Re: [PATCH] configure: detect version by compiler for build

2020-07-28 Thread Đoàn Trần Công Danh
On 2020-07-28 08:25:00-0300, David Bremner  wrote:
> Đoàn Trần Công Danh  writes:
> 
> >
> > Other compile and try run linked with libraries in (autotools') host
> > architecture.
> >
> > Linking with build's libraries doesn't make sense, hence I ignored it.
> > And patched downstream.
> >
> > I don't mind dropping this change and carry it downstream.
> >
> 
> I'm afraid I don't understand the reference to autotools here. Are you
> embedding the build of notmuch in some packaging system that thinks
> everything is autotools?

Yes, this patch was inspired by patching for a packaging system that
have all autotools' required variable exported.

> I agree with Tomi that changing this one
> relatively minor use of CC in isolation does not make sense.  I'm not
> opposed to upstreaming packaging inspired changes, but generally I would
> like to see how they help more than just one packager.

Nowaday, most distro only cross-compiles some base system then build
other packages native-like with qemu-user-static. Except very limited
set of distro and some distro for embedded system, but notmuch is
unlikely shipped notmuch, so this could help only single packager.

So, I think this patch should be dropped.


-- 
Danh
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: detect version by compiler for build

2020-07-28 Thread David Bremner
Đoàn Trần Công Danh  writes:

>
> Other compile and try run linked with libraries in (autotools') host
> architecture.
>
> Linking with build's libraries doesn't make sense, hence I ignored it.
> And patched downstream.
>
> I don't mind dropping this change and carry it downstream.
>

I'm afraid I don't understand the reference to autotools here. Are you
embedding the build of notmuch in some packaging system that thinks
everything is autotools?  I agree with Tomi that changing this one
relatively minor use of CC in isolation does not make sense.  I'm not
opposed to upstreaming packaging inspired changes, but generally I would
like to see how they help more than just one packager.


___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: detect version by compiler for build

2020-07-27 Thread Đoàn Trần Công Danh
On 2020-07-27 20:31:59+0300, Tomi Ollila  wrote:
> On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:
> 
> > We'll need to run the compiled binary to report our current version.
> >
> > With the same code base, we should have the same version information
> > regardless of compiler and architecture.
> >
> > Let's use the compiler for building architecture to build the reporting
> > binary. Which is usually reported under variable CC_FOR_BUILD,
> > a convention established by GNU Autotools, and fall back to CC if it's
> > not defined.
> 
> We'd probably need to change quite a few other compiled and run binaries
> in configure... otherwise this would be incomplete change (and thus just
> adds confusion ?)

Other compile and try run linked with libraries in (autotools') host
architecture.

Linking with build's libraries doesn't make sense, hence I ignored it.
And patched downstream.

I don't mind dropping this change and carry it downstream.

> 
> >
> > Signed-off-by: Đoàn Trần Công Danh 
> > ---
> >  configure | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 98f5f1ea..db3538b3 100755
> > --- a/configure
> > +++ b/configure
> > @@ -85,8 +85,10 @@ fi
> >  BASHCMD=${BASHCMD:-bash}
> >  PERL=${PERL:-perl}
> >  CC=${CC:-cc}
> > +CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
> >  CXX=${CXX:-c++}
> >  CFLAGS=${CFLAGS:--g -O2}
> > +CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
> >  CPPFLAGS=${CPPFLAGS:-}
> >  CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
> >  CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
> > @@ -410,7 +412,7 @@ int main(void) {
> >  return 0;
> >  }
> >  EOF
> > -if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 
> > 2>&1 \
> > +if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o 
> > _libversion > /dev/null 2>&1 \
> > && ./_libversion > _libversion.sh && . ./_libversion.sh
> >  then
> >  printf "OK.\n"
> > -- 
> > 2.28.0.rc2.21.g5c06d60fc5
> > ___
> > notmuch mailing list -- notmuch@notmuchmail.org
> > To unsubscribe send an email to notmuch-le...@notmuchmail.org

-- 
Danh
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] configure: detect version by compiler for build

2020-07-27 Thread Tomi Ollila
On Mon, Jul 27 2020, Đoàn Trần Công Danh wrote:

> We'll need to run the compiled binary to report our current version.
>
> With the same code base, we should have the same version information
> regardless of compiler and architecture.
>
> Let's use the compiler for building architecture to build the reporting
> binary. Which is usually reported under variable CC_FOR_BUILD,
> a convention established by GNU Autotools, and fall back to CC if it's
> not defined.

We'd probably need to change quite a few other compiled and run binaries
in configure... otherwise this would be incomplete change (and thus just
adds confusion ?)

>
> Signed-off-by: Đoàn Trần Công Danh 
> ---
>  configure | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 98f5f1ea..db3538b3 100755
> --- a/configure
> +++ b/configure
> @@ -85,8 +85,10 @@ fi
>  BASHCMD=${BASHCMD:-bash}
>  PERL=${PERL:-perl}
>  CC=${CC:-cc}
> +CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
>  CXX=${CXX:-c++}
>  CFLAGS=${CFLAGS:--g -O2}
> +CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
>  CPPFLAGS=${CPPFLAGS:-}
>  CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
>  CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
> @@ -410,7 +412,7 @@ int main(void) {
>  return 0;
>  }
>  EOF
> -if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 
> \
> +if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o 
> _libversion > /dev/null 2>&1 \
> && ./_libversion > _libversion.sh && . ./_libversion.sh
>  then
>  printf "OK.\n"
> -- 
> 2.28.0.rc2.21.g5c06d60fc5
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org