From patchwork Fri Jul 12 02:28:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: djerome X-Patchwork-Id: 258681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B2F032C033B for ; Fri, 12 Jul 2013 12:31:41 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:reply-to:mime-version:to :cc:subject:content-type:content-transfer-encoding; q=dns; s= default; b=sAIa0trkSpUr06Xfqnuw/VVbqpJd08FakJAXv4CrExZpFTJy1A0Is Rw9K+xdy6zPJaJbctkN/0Q/Ub4uj7Qako1rsEyYYSJu6kR3mpIpJMwF24rlUi7CH YNnjd/YyD8EfOwJN3XQLjSdrD0zHjE43z4TxDmuGn/PsuHOhqv5W7k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:reply-to:mime-version:to :cc:subject:content-type:content-transfer-encoding; s=default; bh=yvoCZ2LjZAH5Y6R9qzXMsj0OwzU=; b=GksuSKuK7SsH5mGpH0kM0eXKh7E7 jVc+HgLulBLvKF7sA71yyGNWgkOdW8XWxUIklKxIk0dTEfde1/+VtIA+w7CcxiZW SjHwIUdLGB2+TRYQEtXFtrMFeCAht9d19uBvp5UvPBrGwc0wNqH3RuCUottBuHnn vcnSLYkwBB+oj4k= Received: (qmail 3581 invoked by alias); 12 Jul 2013 02:31:33 -0000 Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Delivered-To: mailing list crossgcc@sourceware.org Received: (qmail 3557 invoked by uid 89); 12 Jul 2013 02:31:29 -0000 X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 Received: from fed1rmfepo203.cox.net (HELO fed1rmfepo203.cox.net) (68.230.241.148) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 12 Jul 2013 02:31:26 +0000 Received: from fed1rmimpo305 ([68.230.241.173]) by fed1rmfepo203.cox.net (InterMail vM.8.01.05.09 201-2260-151-124-20120717) with ESMTP id <20130712023124.WYIM3846.fed1rmfepo203.cox.net@fed1rmimpo305> for ; Thu, 11 Jul 2013 22:31:24 -0400 Received: from [192.168.0.6] ([68.2.20.108]) by fed1rmimpo305 with cox id zEXK1l00K2Kugjo01EXQ3J; Thu, 11 Jul 2013 22:31:24 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=R/Dd76tX c=1 sm=1 a=q/rGc7sagMFOFQHJWFfz+Q==:17 a=eV-di8Q2jpsA:10 a=uL3wHWWPlzAA:10 a=wnSmf5K7uG0A:10 a=Pp1QvlQp6FQA:10 a=8nJEP1OIZ-IA:10 a=CoWrFW8XAAAA:8 a=23axc7jmaV0A:10 a=VwQbUJbxAAAA:8 a=mDV3o1hIAAAA:8 a=FP58Ms26AAAA:8 a=SB9WkFiGM5i-y4MGzRMA:9 a=wPNLvfGTeEIA:10 a=kXDXxuL-L2wA:10 a=q/rGc7sagMFOFQHJWFfz+Q==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=drj1138@cox.net Message-ID: <51DF69E1.1060606@crosslinux.org> Date: Thu, 11 Jul 2013 19:28:49 -0700 From: djerome Reply-To: djerome@crosslinux.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: "Yann E. MORIN" CC: crossgcc@sourceware.org Subject: [PATCH] scripts: export source and patches This patch gives crosstool-NG the ability to export source code packages of the target system C library and Linux kernel, and all patches applied to them. This helps automate getting source; very useful for GPL compliance when delivering systems that have the cross-tool chain glibc. Thu Jul 11 19:12:18 MST 2013 scripts: Add the ability to export target source and patches. Signed-off-by: Douglas Jerome CT_DoListTarballExt() { @@ -596,6 +637,7 @@ # Do we already have it in *our* tarballs dir? if ext="$( CT_GetFileExtension "${basename}" ${first_ext} )"; then CT_DoLog DEBUG "Already have '${basename}'" + CT_DoMakeTargetManifestEntry "${CT_TARBALLS_DIR}/${basename}${ext}" return 0 fi @@ -609,6 +651,7 @@ "${CT_FORCE_DOWNLOAD}" != "y" ]; then CT_DoLog DEBUG "Got '${basename}' from local storage" CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}${ext}" "${CT_TARBALLS_DIR}/${basename}${ext}" + CT_DoMakeTargetManifestEntry "${CT_TARBALLS_DIR}/${basename}${ext}" return 0 fi done @@ -693,6 +736,7 @@ # If not allowed to download from the Internet, don't if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then CT_DoLog DEBUG "Not allowed to download from the Internet, aborting ${file} download" + CT_DoDisableTargetManifestEntry return 1 fi @@ -722,10 +766,12 @@ if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then CT_DoLog DEBUG "Got '${file}' from the Internet" CT_SaveLocal "${CT_TARBALLS_DIR}/${file}${ext}" + CT_DoMakeTargetManifestEntry "${CT_TARBALLS_DIR}/${file}${ext}" return 0 fi done done + CT_DoDisableTargetManifestEntry # Just return error, someone may want to catch and handle the error # (eg. glibc/eglibc add-ons can be missing). @@ -1056,6 +1102,7 @@ for p in "${d}"/*.patch; do if [ -f "${p}" ]; then CT_DoExecLog ALL patch --no-backup-if-mismatch -g0 -F1 -p1 -f -i "${p}" + CT_DoMakeTargetManifestEntry "${p}" persist fi done if [ "${CT_PATCH_SINGLE}" = "y" ]; then @@ -1063,6 +1110,7 @@ fi fi done + CT_DoDisableTargetManifestEntry if [ "${CT_OVERIDE_CONFIG_GUESS_SUB}" = "y" ]; then CT_DoLog ALL "Overiding config.guess and config.sub" --- For unsubscribe information see http://sourceware.org/lists.html#faq diff -Naur a/config/global/manifest.in b/config/global/manifest.in --- a/config/global/manifest.in 1969-12-31 17:00:00.000000000 -0700 +++ b/config/global/manifest.in 2013-06-28 19:28:51.121832505 -0700 @@ -0,0 +1,15 @@ +# Options specific to extracting packages + +comment "Target Manifest" + +config TARGET_MANIFEST + bool + prompt "Create a manifest of target components" + default n + help + Copy the source target components to a taget manifest directory in the + target toolchain directory. This is only for the target components that + end up in the tool-chain sysroot. + + This is intended to make it easy to get the toolchain target sysroot + source components and their patches. diff -Naur a/config/global.in b/config/global.in --- a/config/global.in 2013-01-31 13:07:52.000000000 -0700 +++ b/config/global.in 2013-06-28 19:43:55.705523652 -0700 @@ -13,5 +13,6 @@ source "config/global/extract.in" source "config/global/build-behave.in" source "config/global/logging.in" +source "config/global/manifest.in" endmenu diff -Naur a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh --- a/scripts/build/kernel/linux.sh 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/build/kernel/linux.sh 2013-06-28 15:14:04.233944903 -0700 @@ -49,6 +49,7 @@ 2.6.*) rel_dir=v2.6;; 3.*) rel_dir=v3.x;; esac + CT_DoEnableTargetManifestEntry "linux" "${CT_MANIFEST_DIR}" korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}" CT_GetFile "linux-${CT_KERNEL_VERSION}" \ "${korg_base}" \ @@ -78,6 +79,7 @@ if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then return 0 fi + CT_DoEnableTargetManifestEntry "linux-patch" "${CT_MANIFEST_DIR}/linux-patch" CT_Patch "linux" "${CT_KERNEL_VERSION}" } diff -Naur a/scripts/build/libc/eglibc.sh b/scripts/build/libc/eglibc.sh --- a/scripts/build/libc/eglibc.sh 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/build/libc/eglibc.sh 2013-06-28 15:16:07.185407798 -0700 @@ -103,6 +103,7 @@ # Extract the files required for the libc locales do_libc_locales_extract() { CT_Extract "eglibc-localedef-${CT_LIBC_VERSION}" + CT_DoEnableTargetManifestEntry "eglibc-patch" "${CT_MANIFEST_DIR}/eglibc-patch" CT_Patch "eglibc" "localedef-${CT_LIBC_VERSION}" } diff -Naur a/scripts/build/libc/glibc-eglibc.sh-common b/scripts/build/libc/glibc-eglibc.sh-common --- a/scripts/build/libc/glibc-eglibc.sh-common 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/build/libc/glibc-eglibc.sh-common 2013-06-28 15:17:40.712238552 -0700 @@ -7,6 +7,7 @@ # Extract the main tarball CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}" CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}" + CT_DoEnableTargetManifestEntry "glibc-patch" "${CT_MANIFEST_DIR}/glibc-patch" CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}" # Extract the add-opns @@ -34,6 +35,7 @@ CT_DoExecLog FILE ln -s "${addon}" "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" + CT_DoEnableTargetManifestEntry "glibc-patch-addon" "${CT_MANIFEST_DIR}/glibc-patch-addon" CT_Patch nochdir "${CT_LIBC}" "${addon}-${CT_LIBC_VERSION}" # Remove the long name since it can confuse configure scripts to run diff -Naur a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh --- a/scripts/build/libc/glibc.sh 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/build/libc/glibc.sh 2013-06-28 15:35:39.595750652 -0700 @@ -19,6 +19,7 @@ addons_list=($(do_libc_add_ons_list " ")) # Main source + CT_DoEnableTargetManifestEntry "glibc" "${CT_MANIFEST_DIR}" CT_GetFile "glibc-${CT_LIBC_VERSION}" \ {ftp,http}://ftp.gnu.org/gnu/glibc \ ftp://gcc.gnu.org/pub/glibc/releases \ @@ -32,6 +33,7 @@ nptl) continue;; esac + CT_DoEnableTargetManifestEntry "glibc_${addon}" "${CT_MANIFEST_DIR}" if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \ {ftp,http}://ftp.gnu.org/gnu/glibc \ ftp://gcc.gnu.org/pub/glibc/releases \ diff -Naur a/scripts/build/libc/mingw.sh b/scripts/build/libc/mingw.sh --- a/scripts/build/libc/mingw.sh 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/build/libc/mingw.sh 2013-06-28 15:36:43.848947376 -0700 @@ -2,6 +2,7 @@ # Licensed under the GPL v2. See COPYING in the root of this package do_libc_get() { + CT_DoEnableTargetManifestEntry "mingw-w64" "${CT_MANIFEST_DIR}" CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \ http://downloads.sourceforge.net/sourceforge/mingw-w64 } @@ -9,6 +10,7 @@ do_libc_extract() { CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}" CT_Pushd "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/" + CT_DoEnableTargetManifestEntry "mingw-w64-patch" "${CT_MANIFEST_DIR}/mingw-w64-patch" CT_Patch nochdir mingw-w64 "${CT_WINAPI_VERSION}" CT_Popd } diff -Naur a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh --- a/scripts/build/libc/newlib.sh 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/build/libc/newlib.sh 2013-06-28 15:38:16.008795219 -0700 @@ -16,10 +16,12 @@ CT_GetCustom "newlib" "${CT_LIBC_VERSION}" \ "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}" else # ! custom location + CT_DoEnableTargetManifestEntry "newlib" "${CT_MANIFEST_DIR}" CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} fi # ! custom location if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then + CT_DoEnableTargetManifestEntry "avr32headers" "${CT_MANIFEST_DIR}/" CT_GetFile "avr32headers" ${avr32headers_src} fi } @@ -32,6 +34,7 @@ fi CT_Extract "newlib-${CT_LIBC_VERSION}" + CT_DoEnableTargetManifestEntry "newlib-patch" "${CT_MANIFEST_DIR}/newlib-patch" CT_Patch "newlib" "${CT_LIBC_VERSION}" if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then diff -Naur a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh --- a/scripts/build/libc/uClibc.sh 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/build/libc/uClibc.sh 2013-06-28 15:39:48.210642538 -0700 @@ -15,10 +15,12 @@ CT_GetCustom "uClibc" "${CT_LIBC_VERSION}" \ "${CT_LIBC_UCLIBC_CUSTOM_LOCATION}" else + CT_DoEnableTargetManifestEntry "uclibc" "${CT_MANIFEST_DIR}" CT_GetFile "uClibc-${CT_LIBC_VERSION}" ${libc_src} fi # uClibc locales if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" ]; then + CT_DoEnableTargetManifestEntry "uclibc-locales" "${CT_MANIFEST_DIR}" CT_GetFile "${uclibc_local_tarball}" ${libc_src} fi @@ -35,6 +37,7 @@ if ! [ "${CT_LIBC_UCLIBC_CUSTOM}" = "y" \ -a -d "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}" ]; then CT_Extract "uClibc-${CT_LIBC_VERSION}" + CT_DoEnableTargetManifestEntry "uclibc-patch" "${CT_MANIFEST_DIR}/uclibc-patch" CT_Patch "uClibc" "${CT_LIBC_VERSION}" fi diff -Naur a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in --- a/scripts/crosstool-NG.sh.in 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/crosstool-NG.sh.in 2013-06-28 18:15:35.033791168 -0700 @@ -185,6 +185,12 @@ ;; esac +# Compute target manifest directory +if [ "${CT_TARGET_MANIFEST:-}" = "y" ]; then + CT_MANIFEST_DIR="${CT_INSTALL_DIR}/_target-source" + CT_MANIFEST_FILE="${CT_MANIFEST_DIR}/manifest.txt" +fi + # Compute test suite install directory CT_TEST_SUITE_DIR=${CT_INSTALL_DIR}/test-suite @@ -260,6 +266,10 @@ CT_DoExecLog ALL mkdir -p "${CT_INSTALL_DIR}" CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}" CT_DoExecLog ALL mkdir -p "${CT_HOST_COMPLIBS_DIR}" +if [ "${CT_TARGET_MANIFEST:-}" = "y" ]; then + CT_DoExecLog ALL mkdir -p "${CT_MANIFEST_DIR}" + CT_DoExecLog ALL touch "${CT_MANIFEST_DIR}/manifest.txt" +fi # Only create the state dir if asked for a restartable build [ -n "${CT_DEBUG_CT_SAVE_STEPS}" ] && CT_DoExecLog ALL mkdir -p "${CT_STATE_DIR}" diff -Naur a/scripts/functions b/scripts/functions --- a/scripts/functions 2013-01-31 13:07:53.000000000 -0700 +++ b/scripts/functions 2013-06-28 20:06:53.243302060 -0700 @@ -510,6 +510,47 @@ export LD_LIBRARY_PATH } +# Enable making one entry in the target manifest. +# Usage: CT_DoEnableTargetManifestEntry +CT_DoEnableTargetManifestEntry() { + if [ "${CT_TARGET_MANIFEST:-}" != "y" ]; then + return 0 + fi + CT_MANIFEST_ENTRY="$1" + CT_MANIFEST_ENTRY_DIR="$2" + if [ ! -d "${CT_MANIFEST_ENTRY_DIR}" ]; then + CT_DoExecLog FILE mkdir -p "${CT_MANIFEST_ENTRY_DIR}" + fi +} + +CT_DoDisableTargetManifestEntry() { + if [ "${CT_TARGET_MANIFEST:-}" != "y" ]; then + return 0 + fi + CT_MANIFEST_ENTRY="" +} + +# Make one target manifest entry; disable making more until enabled again. +# Usage: CT_DoMakeTargetManifestEntry [persist] +CT_DoMakeTargetManifestEntry() { + if [ "${CT_TARGET_MANIFEST:-}" != "y" ]; then + return 0 + fi + local file="$1" + if [ -n "${CT_MANIFEST_ENTRY:-}" -a -d "${CT_MANIFEST_ENTRY_DIR}" ]; then + if [ ! -f "${CT_MANIFEST_FILE}" ]; then + CT_DoExecLog FILE touch "${CT_MANIFEST_FILE}" + fi + echo "${CT_MANIFEST_ENTRY} ${file}" >>"${CT_MANIFEST_FILE}" + CT_DoExecLog FILE cp "${file}" "${CT_MANIFEST_ENTRY_DIR}" + fi + if [ x"${2:-}" == x"persist" ]; then + : + else + CT_MANIFEST_ENTRY="" + fi +} + # Build up the list of allowed tarball extensions # Add them in the prefered order; most preferred comes first