Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] package/netsurf: change how CFLAGS/LDFLAGS are passed
Date: Thu,  9 May 2019 22:28:07 +0200	[thread overview]
Message-ID: <20190509202808.6741-2-thomas.petazzoni@bootlin.com> (raw)
In-Reply-To: <20190509202808.6741-1-thomas.petazzoni@bootlin.com>

In commit 6da049f8ae61b956d135526722ce58fc2f67626a ("package/netsurf:
fix build"), the CC variable passed to netsurf's build system was
extended to pass some special -I and -L options needed for netsurf to
find its own headers/libraries.

Unfortunately, on some systems (including mine), it breaks the build,
due to:

  toolpath_ := $(shell /bin/which $(CC__))

when $(CC__) contains some -I/-L options, they are considered to be
options "to which", which causes the funny:

/usr/bin/make install --directory=libnslog HOST=arm-buildroot-linux-uclibcgnueabi PREFIX=/home/thomas/projets/outputs/shared-netsurf/build/netsurf-3.8/tmpusr Q=@ WARNFLAGS='-Wall -W -Wno-error' DESTDIR=
make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
/bin/which: invalid option -- 'I'
/bin/which: invalid option -- '/'
/bin/which: invalid option -- 'h'
/bin/which: invalid option -- 'o'
/bin/which: invalid option -- 'm'
/bin/which: invalid option -- 'e'
/bin/which: invalid option -- '/'
/bin/which: invalid option -- 't'
/bin/which: invalid option -- 'h'
/bin/which: invalid option -- 'o'
/bin/which: invalid option -- 'm'
/bin/which: invalid option -- 's'
/bin/which: invalid option -- '/'
[...]
/bin/which: invalid option -- 'l'
/bin/which: invalid option -- 'b'
/bin/which: --read-alias, -i: Warning: stdin is a tty.

and the build simply hangs.

We cannot pass CFLAGS/LDFLAGS as make options, as they would override
the CFLAGS definitions in netsurf Makefiles. However, those Makefiles
use the construct:

CFLAGS := $(CFLAGS) -more-flags

so by passing CFLAGS and LDFLAGS through the make environment, which
can achieve our goal.

It is worth mentioning that it remains very fragile, because
CFLAGS/LDFLAGS are used both for building target objects but also some
host tools. The netsurf build system is really not good.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/netsurf/netsurf.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/package/netsurf/netsurf.mk b/package/netsurf/netsurf.mk
index e617707ade..31cf9e62b8 100644
--- a/package/netsurf/netsurf.mk
+++ b/package/netsurf/netsurf.mk
@@ -70,13 +70,18 @@ define NETSURF_CONFIGURE_CMDS
 	$(NETSURF_CURL_CONFIGURE_CMDS)
 endef
 
+NETSURF_MAKE_ENV = \
+	$(TARGET_MAKE_ENV) \
+	CFLAGS="$(TARGET_CFLAGS) -I$(@D)/tmpusr/include" \
+	LDFLAGS="$(TARGET_LDFLAGS) -L$(@D)/tmpusr/lib"
+
 NETSURF_MAKE_OPTS = \
 	TARGET=$(NETSURF_FRONTEND) \
 	BISON="$(HOST_DIR)/bin/bison" \
 	FLEX="$(HOST_DIR)/bin/flex" \
 	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 	BUILD_CC="$(HOSTCC)" \
-	CC="$(TARGET_CC) -I$(@D)/tmpusr/include -L$(@D)/tmpusr/lib" \
+	CC="$(TARGET_CC)" \
 	AR="$(TARGET_AR)" \
 	TMP_PREFIX=$(@D)/tmpusr \
 	NETSURF_CONFIG="$(NETSURF_CONFIG)" \
@@ -84,7 +89,7 @@ NETSURF_MAKE_OPTS = \
 
 define NETSURF_BUILD_CMDS
 	mkdir -p $(@D)/tmpusr
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(NETSURF_MAKE_OPTS) \
+	$(NETSURF_MAKE_ENV) $(MAKE) -C $(@D) $(NETSURF_MAKE_OPTS) \
 		build
 endef
 
-- 
2.21.0

  reply	other threads:[~2019-05-09 20:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 20:28 [Buildroot] [PATCH 0/2] Some more netsurf fixes Thomas Petazzoni
2019-05-09 20:28 ` Thomas Petazzoni [this message]
2019-05-09 20:52   ` [Buildroot] [PATCH 1/2] package/netsurf: change how CFLAGS/LDFLAGS are passed Thomas Petazzoni
2019-05-14 21:12     ` Peter Korsgaard
2019-06-05 21:01   ` Peter Korsgaard
2019-05-09 20:28 ` [Buildroot] [PATCH 2/2] package/netsurf: do not allow on static linking configurations Thomas Petazzoni
2019-05-14 21:13   ` Peter Korsgaard
2019-06-05 21:01   ` Peter Korsgaard
2019-05-26 11:42 ` [Buildroot] [PATCH 0/2] Some more netsurf fixes Arnout Vandecappelle
2019-05-26 21:15   ` Peter Korsgaard

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=20190509202808.6741-2-thomas.petazzoni@bootlin.com \
    --to=thomas.petazzoni@bootlin.com \
    --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