[PATCH] tools: always create $STAGING_DIR/usr/{include,lib}

Jo-Philipp Wich jo at mein.io
Tue Aug 25 03:04:21 EDT 2020


Hi,

> Pretty much all packages stage into staging_dir/target-*/usr - I don't
> think there are any -I/-L flags we can remove.

we're patching the gcc specs [1], [2] to implicitly add $STAGING_DIR/usr/lib
to the link- and $STAGING_DIR/usr/include to the CPP flags. There is no need
to globally pass these as -I and -L flags respectively.

And indeed, I just successfully completed a test build with the following
patch applied:

-- 8< --
diff --git a/rules.mk b/rules.mk
index 45d96d6be4..d3a4073f6d 100644
--- a/rules.mk
+++ b/rules.mk
@@ -174,8 +174,6 @@ TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG),
-g3) $(call qstrip,$(
 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_ASFLAGS_DEFAULT = $(TARGET_CFLAGS)
 TARGET_ASFLAGS = $(TARGET_ASFLAGS_DEFAULT)
-TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include
-TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
 ifneq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
 LIBGCC_S_PATH=$(realpath $(wildcard $(call
qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC))))
 LIBGCC_S=$(if $(LIBGCC_S_PATH),-L$(dir $(LIBGCC_S_PATH)) -lgcc_s)
-- >8 --

~ Jo


[1]
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=toolchain/gcc/final/Makefile#l86
[2]
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=scripts/patch-specs.sh#l37

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20200825/a98bd1c9/attachment.sig>


More information about the openwrt-devel mailing list