From bef98b7c10a9969bc3f8b977dd9e0bdafba684a3 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Fri, 15 Jul 2011 00:24:07 +0200 Subject: toolchain/crosstool-NG: use the package infrastructure Move crosstool-NG to package/ and make it an autotarget package. This requires a new patch (now upstream). Now, the crosstool-NG toolchain backend only contains enough to build the toolchain, there's no more reference to building crosstool-NG as a package. Signed-off-by: "Yann E. MORIN" Signed-off-by: Peter Korsgaard --- package/crosstool-ng/crosstool-ng-001-no-cvs.patch | 15 +++++ ...-break-on-existing-symlinks-and-build.log.patch | 76 ++++++++++++++++++++++ .../crosstool-ng-003-autostuf-compat.patch | 10 +++ package/crosstool-ng/crosstool-ng.mk | 9 +++ toolchain/toolchain-crosstool-ng/001-no-cvs.patch | 15 ----- ...-break-on-existing-symlinks-and-build.log.patch | 76 ---------------------- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 57 ++++------------ 7 files changed, 121 insertions(+), 137 deletions(-) create mode 100644 package/crosstool-ng/crosstool-ng-001-no-cvs.patch create mode 100644 package/crosstool-ng/crosstool-ng-002-dont-break-on-existing-symlinks-and-build.log.patch create mode 100644 package/crosstool-ng/crosstool-ng-003-autostuf-compat.patch create mode 100644 package/crosstool-ng/crosstool-ng.mk delete mode 100644 toolchain/toolchain-crosstool-ng/001-no-cvs.patch delete mode 100644 toolchain/toolchain-crosstool-ng/002-dont-break-on-existing-symlinks-and-build.log.patch diff --git a/package/crosstool-ng/crosstool-ng-001-no-cvs.patch b/package/crosstool-ng/crosstool-ng-001-no-cvs.patch new file mode 100644 index 000000000..c82d35941 --- /dev/null +++ b/package/crosstool-ng/crosstool-ng-001-no-cvs.patch @@ -0,0 +1,15 @@ +Remove dependency on cvs. + +cvs is used to retrieve newlib, which is not supported +under Buildroot, so cvs is not required. + +--- crosstool-ng-1.8.0/configure.orig 2010-11-27 15:43:52.000000000 +0000 ++++ crosstool-ng-1.8.0/configure 2010-11-27 15:44:10.000000000 +0000 +@@ -359,7 +359,6 @@ + err="'libtool' 1.5.26 or above was not found" + has_or_abort prog=stat + has_or_abort prog="curl wget" +-has_or_abort prog=cvs + has_or_abort prog=patch + has_or_abort prog=tar + has_or_abort prog=gzip diff --git a/package/crosstool-ng/crosstool-ng-002-dont-break-on-existing-symlinks-and-build.log.patch b/package/crosstool-ng/crosstool-ng-002-dont-break-on-existing-symlinks-and-build.log.patch new file mode 100644 index 000000000..2bb613ffb --- /dev/null +++ b/package/crosstool-ng/crosstool-ng-002-dont-break-on-existing-symlinks-and-build.log.patch @@ -0,0 +1,76 @@ + +# HG changeset patch +# User "Yann E. MORIN" +# Date 1310507544 -7200 +# Node ID 1ebc2248cc60230cd53ff94ae8f8f1e3261461a3 +# Parent f1c730da41f3b22ca1a1e1b14592da4b7c078797 +scripts, cc/gcc: do not fail on existing symlinks or build.log + +If the user builds a toolchain over an existing one, so, without removing +CT_PREFIX_DIR, the build fails as the symlinks already exist, as does the +build.log. + +This can also happen (for build.log) if the user first ran in download- +or extract-only. + +Patch (with no SoB) originally from: + Phil Wilshire + +Modified by me as it did not apply cleanly. + +Signed-off-by: "Yann E. MORIN" + +diff -r f1c730da41f3 -r 1ebc2248cc60 scripts/build/cc/gcc.sh +--- a/scripts/build/cc/gcc.sh Tue Jul 12 23:21:27 2011 +0200 ++++ b/scripts/build/cc/gcc.sh Tue Jul 12 23:52:24 2011 +0200 +@@ -386,7 +386,7 @@ + # check whether compiler has an extension + file="$( ls -1 "${core_prefix_dir}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" + [ -z "${file}" ] || ext=".${file##*.}" +- CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}" ++ CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}" + + CT_EndStep + } +@@ -630,7 +630,7 @@ + # check whether compiler has an extension + file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" + [ -z "${file}" ] || ext=".${file##*.}" +- CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}" ++ CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}" + + CT_EndStep + } +diff -r f1c730da41f3 -r 1ebc2248cc60 scripts/build/internals.sh +--- a/scripts/build/internals.sh Tue Jul 12 23:21:27 2011 +0200 ++++ b/scripts/build/internals.sh Tue Jul 12 23:52:24 2011 +0200 +@@ -86,14 +86,14 @@ + for t in "${CT_TARGET}-"*; do + if [ -n "${CT_TARGET_ALIAS}" ]; then + _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;') +- CT_DoExecLog ALL ln -sv "${t}" "${_t}" ++ CT_DoExecLog ALL ln -sfv "${t}" "${_t}" + fi + if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then + _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}") + if [ "${_t}" = "${t}" ]; then + CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'" + else +- CT_DoExecLog ALL ln -sv "${t}" "${_t}" ++ CT_DoExecLog ALL ln -sfv "${t}" "${_t}" + fi + fi + done +diff -r f1c730da41f3 -r 1ebc2248cc60 scripts/crosstool-NG.sh.in +--- a/scripts/crosstool-NG.sh.in Tue Jul 12 23:21:27 2011 +0200 ++++ b/scripts/crosstool-NG.sh.in Tue Jul 12 23:52:24 2011 +0200 +@@ -604,7 +604,7 @@ + # moment... Consign all ouptut to oblivion... + CT_DoLog INFO "Finishing installation (may take a few seconds)..." + exec >/dev/null 2>&1 +- ++rm -f ${CT_PREFIX_DIR}/build.log.bz2 + if [ "${CT_LOG_TO_FILE}" = "y" ]; then + cp "${tmp_log_file}" "${CT_PREFIX_DIR}/build.log" + if [ "${CT_LOG_FILE_COMPRESS}" = y ]; then + diff --git a/package/crosstool-ng/crosstool-ng-003-autostuf-compat.patch b/package/crosstool-ng/crosstool-ng-003-autostuf-compat.patch new file mode 100644 index 000000000..d79e62bac --- /dev/null +++ b/package/crosstool-ng/crosstool-ng-003-autostuf-compat.patch @@ -0,0 +1,10 @@ +--- crosstool-ng-1.11.3/configure 2011-05-21 01:10:10.000000000 +0200 ++++ host-crosstool-ng-1.11.3/configure 2011-07-14 17:35:25.830403914 +0200 +@@ -260,6 +260,7 @@ + # Skip, auto-stuff compatibility + --build=*|--host=*|--infodir=*|--datadir=*|--sysconfdir=*|--localstatedir=*) shift;; + --build|--host|--infodir|--datadir|--sysconfdir|--localstatedir) shift 2;; ++ --enable-shared|--disable-shared|--enable-static|--disable-static) shift;; + *) printf "Unrecognised option: '${1}'\n"; do_help; exit 1;; + esac + done diff --git a/package/crosstool-ng/crosstool-ng.mk b/package/crosstool-ng/crosstool-ng.mk new file mode 100644 index 000000000..b40cf353b --- /dev/null +++ b/package/crosstool-ng/crosstool-ng.mk @@ -0,0 +1,9 @@ +CROSSTOOL_NG_VERSION = 1.11.3 +CROSSTOOL_NG_SOURCE = crosstool-ng-$(CROSSTOOL_NG_VERSION).tar.bz2 +CROSSTOOL_NG_SITE = http://crosstool-ng.org/download/crosstool-ng/ +CROSSTOOL_NG_INSTALL_STAGING = NO +CROSSTOOL_NG_INSTALL_TARGET = NO +CROSSTOOL_NG_MAKE = $(MAKE1) +HOST_CROSSTOOL_NG_DEPENDENCIES = host-gawk host-automake $(if $(BR2_CCACHE),host-ccache) + +$(eval $(call AUTOTARGETS,package,crosstool-ng,host)) diff --git a/toolchain/toolchain-crosstool-ng/001-no-cvs.patch b/toolchain/toolchain-crosstool-ng/001-no-cvs.patch deleted file mode 100644 index c82d35941..000000000 --- a/toolchain/toolchain-crosstool-ng/001-no-cvs.patch +++ /dev/null @@ -1,15 +0,0 @@ -Remove dependency on cvs. - -cvs is used to retrieve newlib, which is not supported -under Buildroot, so cvs is not required. - ---- crosstool-ng-1.8.0/configure.orig 2010-11-27 15:43:52.000000000 +0000 -+++ crosstool-ng-1.8.0/configure 2010-11-27 15:44:10.000000000 +0000 -@@ -359,7 +359,6 @@ - err="'libtool' 1.5.26 or above was not found" - has_or_abort prog=stat - has_or_abort prog="curl wget" --has_or_abort prog=cvs - has_or_abort prog=patch - has_or_abort prog=tar - has_or_abort prog=gzip diff --git a/toolchain/toolchain-crosstool-ng/002-dont-break-on-existing-symlinks-and-build.log.patch b/toolchain/toolchain-crosstool-ng/002-dont-break-on-existing-symlinks-and-build.log.patch deleted file mode 100644 index 2bb613ffb..000000000 --- a/toolchain/toolchain-crosstool-ng/002-dont-break-on-existing-symlinks-and-build.log.patch +++ /dev/null @@ -1,76 +0,0 @@ - -# HG changeset patch -# User "Yann E. MORIN" -# Date 1310507544 -7200 -# Node ID 1ebc2248cc60230cd53ff94ae8f8f1e3261461a3 -# Parent f1c730da41f3b22ca1a1e1b14592da4b7c078797 -scripts, cc/gcc: do not fail on existing symlinks or build.log - -If the user builds a toolchain over an existing one, so, without removing -CT_PREFIX_DIR, the build fails as the symlinks already exist, as does the -build.log. - -This can also happen (for build.log) if the user first ran in download- -or extract-only. - -Patch (with no SoB) originally from: - Phil Wilshire - -Modified by me as it did not apply cleanly. - -Signed-off-by: "Yann E. MORIN" - -diff -r f1c730da41f3 -r 1ebc2248cc60 scripts/build/cc/gcc.sh ---- a/scripts/build/cc/gcc.sh Tue Jul 12 23:21:27 2011 +0200 -+++ b/scripts/build/cc/gcc.sh Tue Jul 12 23:52:24 2011 +0200 -@@ -386,7 +386,7 @@ - # check whether compiler has an extension - file="$( ls -1 "${core_prefix_dir}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" - [ -z "${file}" ] || ext=".${file##*.}" -- CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}" -+ CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}" - - CT_EndStep - } -@@ -630,7 +630,7 @@ - # check whether compiler has an extension - file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" - [ -z "${file}" ] || ext=".${file##*.}" -- CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}" -+ CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}" - - CT_EndStep - } -diff -r f1c730da41f3 -r 1ebc2248cc60 scripts/build/internals.sh ---- a/scripts/build/internals.sh Tue Jul 12 23:21:27 2011 +0200 -+++ b/scripts/build/internals.sh Tue Jul 12 23:52:24 2011 +0200 -@@ -86,14 +86,14 @@ - for t in "${CT_TARGET}-"*; do - if [ -n "${CT_TARGET_ALIAS}" ]; then - _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;') -- CT_DoExecLog ALL ln -sv "${t}" "${_t}" -+ CT_DoExecLog ALL ln -sfv "${t}" "${_t}" - fi - if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then - _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}") - if [ "${_t}" = "${t}" ]; then - CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'" - else -- CT_DoExecLog ALL ln -sv "${t}" "${_t}" -+ CT_DoExecLog ALL ln -sfv "${t}" "${_t}" - fi - fi - done -diff -r f1c730da41f3 -r 1ebc2248cc60 scripts/crosstool-NG.sh.in ---- a/scripts/crosstool-NG.sh.in Tue Jul 12 23:21:27 2011 +0200 -+++ b/scripts/crosstool-NG.sh.in Tue Jul 12 23:52:24 2011 +0200 -@@ -604,7 +604,7 @@ - # moment... Consign all ouptut to oblivion... - CT_DoLog INFO "Finishing installation (may take a few seconds)..." - exec >/dev/null 2>&1 -- -+rm -f ${CT_PREFIX_DIR}/build.log.bz2 - if [ "${CT_LOG_TO_FILE}" = "y" ]; then - cp "${tmp_log_file}" "${CT_PREFIX_DIR}/build.log" - if [ "${CT_LOG_FILE_COMPRESS}" = y ]; then - diff --git a/toolchain/toolchain-crosstool-ng/crosstool-ng.mk b/toolchain/toolchain-crosstool-ng/crosstool-ng.mk index d3fcc65ff..ec6e1889b 100644 --- a/toolchain/toolchain-crosstool-ng/crosstool-ng.mk +++ b/toolchain/toolchain-crosstool-ng/crosstool-ng.mk @@ -8,15 +8,9 @@ #----------------------------------------------------------------------------- # Internal variables -# Crostool-NG hard-coded configuration options -CTNG_VERSION:=1.11.3 -CTNG_SITE:=http://crosstool-ng.org/download/crosstool-ng/ -CTNG_SOURCE:=crosstool-ng-$(CTNG_VERSION).tar.bz2 -CTNG_DIR:=$(BUILD_DIR)/crosstool-ng-$(CTNG_VERSION) -CTNG_CAT:=bzcat -CTNG_PATCH_DIR:=toolchain/toolchain-crosstool-ng -CTNG_UCLIBC_CONFIG_FILE := $(TOPDIR)/toolchain/toolchain-crosstool-ng/uClibc.config +CTNG_DIR := $(BUILD_DIR)/build-toolchain +CTNG_UCLIBC_CONFIG_FILE := $(TOPDIR)/toolchain/toolchain-crosstool-ng/uClibc.config CTNG_CONFIG_FILE:=$(call qstrip,$(BR2_TOOLCHAIN_CTNG_CONFIG)) # Hack! ct-ng is in fact a Makefile script. As such, it accepts all @@ -24,7 +18,7 @@ CTNG_CONFIG_FILE:=$(call qstrip,$(BR2_TOOLCHAIN_CTNG_CONFIG)) # to calling ct-ng. # $1: the set of arguments to pass to ct-ng define ctng -PATH=$(HOST_PATH) $(CTNG_DIR)/ct-ng -C $(CTNG_DIR) --no-print-directory $(1) +PATH=$(HOST_PATH) ct-ng -C $(CTNG_DIR) --no-print-directory $(1) endef #----------------------------------------------------------------------------- @@ -366,6 +360,11 @@ define ctng-oldconfig $(call ctng-fix-dot-config,$(1),$(CTNG_FIX_DOT_CONFIG_PATHS_SED)) endef +# We need the host crosstool-NG before we can even begin working +# on the toolchain. Using order-only dependency, as we do not want +# to rebuild the toolchain for every run... +$(CTNG_DIR)/.config: | host-crosstool-ng + # Default configuration # Depends on top-level .config because it has options we have to shoe-horn # into crosstool-NG's .config @@ -375,8 +374,10 @@ endef # are correctly set ( eg. if an option is new, then the initial sed # can't do anything about it ) Ideally, this should go in oldconfig # itself, but it's much easier to handle here. -$(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE) $(CTNG_DIR)/ct-ng $(CONFIG_DIR)/.config + +$(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE) $(CONFIG_DIR)/.config $(Q)if [ ! -f $@ ]; then \ + mkdir -p "$(CTNG_DIR)"; \ libc="$$(awk -F '"' '$$1=="CT_LIBC=" { print $$2; }' "$<")"; \ if [ "$${libc}" != "$(BR2_TOOLCHAIN_CTNG_LIBC)" ]; then \ echo "* Inconsistency in crosstool-NG config file '$<'"; \ @@ -403,39 +404,3 @@ ctng-menuconfig: $(CTNG_DIR)/.config $(call ctng-oldconfig,$<) $(call ctng-check-config-changed,$<,$<.timestamp) $(Q)rm -f $<.timestamp - -#----------------------------------------------------------------------------- -# Retrieving, configuring and building crosstool-NG (as a package) - -$(DL_DIR)/$(CTNG_SOURCE): - $(Q)$(call DOWNLOAD,$(CTNG_SITE),$(CTNG_SOURCE)) - -$(CTNG_DIR)/.unpacked: $(DL_DIR)/$(CTNG_SOURCE) - $(Q)rm -rf $(CTNG_DIR) - $(Q)mkdir -p $(BUILD_DIR) - $(Q)$(CTNG_CAT) $(DL_DIR)/$(CTNG_SOURCE) |tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - $(Q)touch $@ - -$(CTNG_DIR)/.patched: $(CTNG_DIR)/.unpacked - $(Q)toolchain/patch-kernel.sh $(CTNG_DIR) \ - $(CTNG_PATCH_DIR) \ - \*.patch \ - \*.patch.$(ARCH) - $(Q)touch $@ - -# Use order-only dependencies on host-* as they -# are virtual targets with no rules, and so are -# considered always remade. But we do not want -# to reconfigure and rebuild ct-ng every time -# we need to run it... -$(CTNG_DIR)/.configured: | $(if $(BR2_CCACHE),host-ccache) \ - host-gawk \ - host-automake - -$(CTNG_DIR)/.configured: $(CTNG_DIR)/.patched - $(Q)cd $(CTNG_DIR) && PATH=$(HOST_PATH) ./configure --local - $(Q)touch $@ - -$(CTNG_DIR)/ct-ng: $(CTNG_DIR)/.configured - $(Q)$(MAKE) -C $(CTNG_DIR) --no-print-directory - $(Q)touch $@ -- cgit v1.2.3