From 1fb43df9f191688a043758e6af44b9c188a40f12 Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Sun, 6 Aug 2017 23:40:50 +0000 Subject: [PATCH] build binutils with TOOLS_DIR and SYSROOT_DIR The binutils build only needs one stage, so we can write the binaries directly to the new output path. We disable the feature to poison system paths because we expect our sysroot to be rooted at /usr when installing these tools through OS packages. Signed-off-by: Ben Cressey --- package/binutils/binutils.mk | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk index 1ef7ee57d2..5fbaef88bb 100644 --- a/package/binutils/binutils.mk +++ b/package/binutils/binutils.mk @@ -65,9 +65,10 @@ endif BINUTILS_CONF_ENV += MAKEINFO=true BINUTILS_MAKE_OPTS += MAKEINFO=true BINUTILS_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) MAKEINFO=true install +BINUTILS_INSTALL_TOOLS_OPTS = DESTDIR=$(TOOLS_DIR) MAKEINFO=true install HOST_BINUTILS_CONF_ENV += MAKEINFO=true HOST_BINUTILS_MAKE_OPTS += MAKEINFO=true -HOST_BINUTILS_INSTALL_OPTS += MAKEINFO=true install +HOST_BINUTILS_INSTALL_OPTS += DESTDIR=$(HOST_DIR) MAKEINFO=true install # Workaround a build issue with -Os for ARM Cortex-M cpus. # (Binutils 2.25.1 and 2.26.1) @@ -84,8 +85,7 @@ HOST_BINUTILS_CONF_OPTS = \ --target=$(GNU_TARGET_NAME) \ --disable-shared \ --enable-static \ - --with-sysroot=$(STAGING_DIR) \ - --enable-poison-system-directories \ + --with-sysroot=$(SYSROOT_DIR) \ --without-debuginfod \ --enable-plugins \ --enable-lto \ @@ -99,6 +99,11 @@ else HOST_BINUTILS_CONF_OPTS += --disable-gprofng endif +HOST_BINUTILS_CONF_OPTS += \ + --prefix="/usr" \ + --sysconfdir="/etc" \ + --localstatedir="/var" + # binutils run configure script of subdirs at make time, so ensure # our TARGET_CONFIGURE_ARGS are taken into consideration for those BINUTILS_MAKE_ENV = $(TARGET_CONFIGURE_ARGS) @@ -143,5 +148,17 @@ define HOST_BINUTILS_FIXUP_HARDLINKS endef HOST_BINUTILS_POST_INSTALL_HOOKS += HOST_BINUTILS_FIXUP_HARDLINKS +define HOST_BINUTILS_TOOLS_DIR_INSTALL + $(TARGET_MAKE_ENV) $(MAKE) $(BINUTILS_INSTALL_TOOLS_OPTS) -C $(@D) +endef +HOST_BINUTILS_POST_INSTALL_HOOKS += HOST_BINUTILS_TOOLS_DIR_INSTALL + +define HOST_BINUTILS_TOOLS_DIR_CLEANUP + $(RM) -rf $(TOOLS_DIR)/usr/lib/ldscripts + $(RM) -rf $(TOOLS_DIR)/usr/share + find $(TOOLS_DIR) -name '*.la' -delete +endef +HOST_BINUTILS_POST_INSTALL_HOOKS += HOST_BINUTILS_TOOLS_DIR_CLEANUP + $(eval $(autotools-package)) $(eval $(host-autotools-package)) -- 2.37.2