Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH next 1/2] package/apr-util: fix build with per-package folders
Date: Thu, 15 Nov 2018 21:13:55 +0100	[thread overview]
Message-ID: <20181115201355.GN10271@scaer> (raw)
In-Reply-To: <20181115152107.5834-2-thomas.petazzoni@bootlin.com>

Thomas, All,

On 2018-11-15 16:21 +0100, Thomas Petazzoni spake thusly:
> With per-package folder support enable, the build of apr-util fails,
> for two reasons:
> 
>  - The rules.mk file is generated by the 'apr' package, and then
>    copied into the 'apr-util' source directory. This is done by the
>    'apr-util' build process. Unfortunately, this rules.mk file has a
>    number of hardcoded paths: to the compiler and to the libtool
>    script.
> 
>    Due to this, the compiler from the 'apr' per-package folder gets
>    used. But this compiler uses the 'apr' package sysroot, which does
>    not have all the dependencies of the 'apr-util' package, causing
>    the build to fail because <expat.h> is not found.
> 
>  - Similarly, the libtool script itself has some hardcoded paths,
>    which make it use the compiler/linker from the 'apr' per-package
>    folder, so it does not find the expat library.
> 
> We fix both issues by doing the necessary replacement in both rules.mk
> and libtool. For rules.mk, since it's in the source directoryt, we can
> do the replacement in-place. For libtool, since it's hard-linked
> between the 'apr' copy and the 'apr-util' copy, we need to make a
> temporary copy to break the hard link and do the replacement.

I don't know what sed version you are using, but mine breaks the
hardlink when doing in-place replacement:

    $ echo OK >foo
    $ ln foo bar
    $ sed -i -e 's/OK/in-bar/' bar
    $ cat foo
    OK
    $ cat bar
    in-bar

Regards,
Yann E. MORIN.

> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  package/apr-util/apr-util.mk | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/package/apr-util/apr-util.mk b/package/apr-util/apr-util.mk
> index b006964ccb..e685f76838 100644
> --- a/package/apr-util/apr-util.mk
> +++ b/package/apr-util/apr-util.mk
> @@ -15,6 +15,15 @@ APR_UTIL_CONF_OPTS = \
>  	--with-apr=$(STAGING_DIR)/usr/bin/apr-1-config
>  APR_UTIL_CONFIG_SCRIPTS = apu-1-config
>  
> +define APR_UTIL_FIX_RULES_MK_LIBTOOL
> +	$(SED) 's,$(PER_PACKAGE_DIR)/apr/,$(PER_PACKAGE_DIR)/apr-util/,g' $(@D)/build/rules.mk
> +	cp $(STAGING_DIR)/usr/build-1/libtool $(STAGING_DIR)/usr/build-1/libtool.fixed
> +	$(SED) 's,$(PER_PACKAGE_DIR)/apr/,$(PER_PACKAGE_DIR)/apr-util/,g' \
> +		$(STAGING_DIR)/usr/build-1/libtool.fixed
> +	mv $(STAGING_DIR)/usr/build-1/libtool.fixed $(STAGING_DIR)/usr/build-1/libtool
> +endef
> +APR_UTIL_POST_CONFIGURE_HOOKS += APR_UTIL_FIX_RULES_MK_LIBTOOL
> +
>  # When iconv is available, then use it to provide charset conversion
>  # features.
>  APR_UTIL_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv)
> -- 
> 2.19.1
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2018-11-15 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-15 15:21 [Buildroot] [PATCH next 0/2] Per-package folder fixes Thomas Petazzoni
2018-11-15 15:21 ` [Buildroot] [PATCH next 1/2] package/apr-util: fix build with per-package folders Thomas Petazzoni
2018-11-15 20:13   ` Yann E. MORIN [this message]
2018-11-20 15:56     ` Thomas Petazzoni
2018-11-15 15:21 ` [Buildroot] [PATCH next 2/2] package/apache: add patch to fix per-package folder build Thomas Petazzoni
2018-11-15 20:45   ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181115201355.GN10271@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox