diff mbox series

package/asterisk: fix host build

Message ID 20170924163301.10853-1-yann.morin.1998@free.fr
State Accepted
Headers show
Series package/asterisk: fix host build | expand

Commit Message

Yann E. MORIN Sept. 24, 2017, 4:33 p.m. UTC
The host menuselect tool is linked to our host libxml2 library, but it
is missing an RPATH to the host directory.

This is because menuselect does not use automake, so does not inherit
the LDFLAGS from the configure run.

We fix that by simply passing $(HOST_CONFIGURE_OPTS) in the make
environment.

At the same time, we also install the tool in the host directory, even
if not used from there, so that the sanity checks we run are properly
passed.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
 package/asterisk/asterisk.mk | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Arnout Vandecappelle Sept. 24, 2017, 4:51 p.m. UTC | #1
On 24-09-17 18:33, Yann E. MORIN wrote:
> The host menuselect tool is linked to our host libxml2 library, but it
> is missing an RPATH to the host directory.
> 
> This is because menuselect does not use automake, so does not inherit
> the LDFLAGS from the configure run.
> 
> We fix that by simply passing $(HOST_CONFIGURE_OPTS) in the make
> environment.
> 
> At the same time, we also install the tool in the host directory, even
> if not used from there, so that the sanity checks we run are properly
> passed.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> ---
>  package/asterisk/asterisk.mk | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/package/asterisk/asterisk.mk b/package/asterisk/asterisk.mk
> index a6801a006d..50512c0b3a 100644
> --- a/package/asterisk/asterisk.mk
> +++ b/package/asterisk/asterisk.mk
> @@ -294,12 +294,23 @@ HOST_ASTERISK_CONF_OPTS = \
>  	--without-curses \
>  	--with-ncurses=$(HOST_DIR)/usr
>  
> -# Even though menuselect is an autotools package, it is *not* installed,
> -# as asterisk does expect it to be in a sub-directory of its source tree,
> -# which do by copying the full menuselect build tree as a pre-configure
> -# hook in the target variant.
> +# Not an automake package, so does not inherit LDFLAGS et al. from
> +# the configure run.
> +HOST_ASTERISK_MAKE_ENV = $(HOST_CONFIGURE_OPTS)
> +
> +# Even though menuselect is an autotools package, it is not an automake
> +# package and does not have an 'install' rule, as asterisk does expect
> +# it to be in a sub-directory of its source tree. We do so by copying
> +# the full menuselect build tree as a pre-configure hook in the target
> +# variant.
> +# However, the sanity checks on host packages are not run on menuselect.
> +# But we still want to catch that menuselect has the proper rpath set,
> +# for example, as it uses host libraries that we do build, like
> +# host-libxml2.
> +# So we do manually install the menuselect tool.
>  define HOST_ASTERISK_INSTALL_CMDS
> -	@:
> +	$(INSTALL) -D -m 0755 $(@D)/menuselect/menuselect \
> +		$(HOST_DIR)/bin/asterisk-menuselect

 So then could you symlink to this instead of copying the entire tree?

 Regards,
 Arnout

>  endef
>  
>  $(eval $(host-autotools-package))
>
Yann E. MORIN Sept. 24, 2017, 5:04 p.m. UTC | #2
On 2017-09-24 18:51 +0200, Arnout Vandecappelle spake thusly:
> 
> 
> On 24-09-17 18:33, Yann E. MORIN wrote:
> > The host menuselect tool is linked to our host libxml2 library, but it
> > is missing an RPATH to the host directory.
> > 
> > This is because menuselect does not use automake, so does not inherit
> > the LDFLAGS from the configure run.
> > 
> > We fix that by simply passing $(HOST_CONFIGURE_OPTS) in the make
> > environment.
> > 
> > At the same time, we also install the tool in the host directory, even
> > if not used from there, so that the sanity checks we run are properly
> > passed.
> > 
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Arnout Vandecappelle <arnout@mind.be>
> > ---
> >  package/asterisk/asterisk.mk | 21 ++++++++++++++++-----
> >  1 file changed, 16 insertions(+), 5 deletions(-)
> > 
> > diff --git a/package/asterisk/asterisk.mk b/package/asterisk/asterisk.mk
> > index a6801a006d..50512c0b3a 100644
> > --- a/package/asterisk/asterisk.mk
> > +++ b/package/asterisk/asterisk.mk
> > @@ -294,12 +294,23 @@ HOST_ASTERISK_CONF_OPTS = \
> >  	--without-curses \
> >  	--with-ncurses=$(HOST_DIR)/usr
> >  
> > -# Even though menuselect is an autotools package, it is *not* installed,
> > -# as asterisk does expect it to be in a sub-directory of its source tree,
> > -# which do by copying the full menuselect build tree as a pre-configure
> > -# hook in the target variant.
> > +# Not an automake package, so does not inherit LDFLAGS et al. from
> > +# the configure run.
> > +HOST_ASTERISK_MAKE_ENV = $(HOST_CONFIGURE_OPTS)
> > +
> > +# Even though menuselect is an autotools package, it is not an automake
> > +# package and does not have an 'install' rule, as asterisk does expect
> > +# it to be in a sub-directory of its source tree. We do so by copying
> > +# the full menuselect build tree as a pre-configure hook in the target
> > +# variant.
> > +# However, the sanity checks on host packages are not run on menuselect.
> > +# But we still want to catch that menuselect has the proper rpath set,
> > +# for example, as it uses host libraries that we do build, like
> > +# host-libxml2.
> > +# So we do manually install the menuselect tool.
> >  define HOST_ASTERISK_INSTALL_CMDS
> > -	@:
> > +	$(INSTALL) -D -m 0755 $(@D)/menuselect/menuselect \
> > +		$(HOST_DIR)/bin/asterisk-menuselect
> 
>  So then could you symlink to this instead of copying the entire tree?

Nope, because all the intermediate object files would missing, so the
Makefile would try to build them, and would then rebuild menuseclect as
well, and all those efforts would have been in vain...

And anyway, this would have been a topic different from this patch.

Regards,
Yann E. MORIN.
Yann E. MORIN Sept. 24, 2017, 5:08 p.m. UTC | #3
Arnout, All,

On 2017-09-24 19:04 +0200, Yann E. MORIN spake thusly:
> On 2017-09-24 18:51 +0200, Arnout Vandecappelle spake thusly:
> > On 24-09-17 18:33, Yann E. MORIN wrote:
[--SNIP--]
> > > +# Even though menuselect is an autotools package, it is not an automake
> > > +# package and does not have an 'install' rule, as asterisk does expect
> > > +# it to be in a sub-directory of its source tree. We do so by copying
> > > +# the full menuselect build tree as a pre-configure hook in the target
> > > +# variant.
> > > +# However, the sanity checks on host packages are not run on menuselect.
> > > +# But we still want to catch that menuselect has the proper rpath set,
> > > +# for example, as it uses host libraries that we do build, like
> > > +# host-libxml2.
> > > +# So we do manually install the menuselect tool.
> > >  define HOST_ASTERISK_INSTALL_CMDS
> > > -	@:
> > > +	$(INSTALL) -D -m 0755 $(@D)/menuselect/menuselect \
> > > +		$(HOST_DIR)/bin/asterisk-menuselect
> > 
> >  So then could you symlink to this instead of copying the entire tree?
> 
> Nope, because all the intermediate object files would missing, so the
> Makefile would try to build them, and would then rebuild menuseclect as
> well, and all those efforts would have been in vain...

Oh, and I forgot: it needs a file, makeopts, generated by configure, but
running menuselect's configure in the target variant is the things we
want to avoid in the first place.

And to be sure, I tried what you suggest, and it does not work (build
failure).

Regards,
Yann E. MORIN.
Arnout Vandecappelle Sept. 26, 2017, 10:41 p.m. UTC | #4
On 24-09-17 18:33, Yann E. MORIN wrote:
> The host menuselect tool is linked to our host libxml2 library, but it
> is missing an RPATH to the host directory.
> 
> This is because menuselect does not use automake, so does not inherit
> the LDFLAGS from the configure run.
> 
> We fix that by simply passing $(HOST_CONFIGURE_OPTS) in the make
> environment.
> 
> At the same time, we also install the tool in the host directory, even
> if not used from there, so that the sanity checks we run are properly
> passed.

 I think this is a bit over the top, but oh well.

> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>

 Applied to master, thanks.

 Regards,
 Arnout
diff mbox series

Patch

diff --git a/package/asterisk/asterisk.mk b/package/asterisk/asterisk.mk
index a6801a006d..50512c0b3a 100644
--- a/package/asterisk/asterisk.mk
+++ b/package/asterisk/asterisk.mk
@@ -294,12 +294,23 @@  HOST_ASTERISK_CONF_OPTS = \
 	--without-curses \
 	--with-ncurses=$(HOST_DIR)/usr
 
-# Even though menuselect is an autotools package, it is *not* installed,
-# as asterisk does expect it to be in a sub-directory of its source tree,
-# which do by copying the full menuselect build tree as a pre-configure
-# hook in the target variant.
+# Not an automake package, so does not inherit LDFLAGS et al. from
+# the configure run.
+HOST_ASTERISK_MAKE_ENV = $(HOST_CONFIGURE_OPTS)
+
+# Even though menuselect is an autotools package, it is not an automake
+# package and does not have an 'install' rule, as asterisk does expect
+# it to be in a sub-directory of its source tree. We do so by copying
+# the full menuselect build tree as a pre-configure hook in the target
+# variant.
+# However, the sanity checks on host packages are not run on menuselect.
+# But we still want to catch that menuselect has the proper rpath set,
+# for example, as it uses host libraries that we do build, like
+# host-libxml2.
+# So we do manually install the menuselect tool.
 define HOST_ASTERISK_INSTALL_CMDS
-	@:
+	$(INSTALL) -D -m 0755 $(@D)/menuselect/menuselect \
+		$(HOST_DIR)/bin/asterisk-menuselect
 endef
 
 $(eval $(host-autotools-package))