From 6427c251dace5298bfee1420d80808e0250e92f0 Mon Sep 17 00:00:00 2001 From: Benda Xu Date: Mon, 13 Aug 2018 23:19:59 +0900 Subject: dev-util/soong: Combined hack to support gentoo toolchain. Add google llvm-tblgen. Google llvm-tblgen is completely different from upstream. Make toc.sh an executable. Gentoo toolchain defaults with -pie, so replace -Wl,-r with -r. Disable strip, as it is managed by portage. Package-Manager: Portage-2.3.40, Repoman-2.3.9 --- dev-util/soong/Manifest | 9 ++++-- dev-util/soong/files/soong-gentoo-host-bin.patch | 10 +++++-- dev-util/soong/files/soong-gentoo-toolchain.patch | 8 ++++-- dev-util/soong/files/soong-no-strip.patch | 34 +++++++++++++++++++++++ dev-util/soong/files/soong-relative-symlink.patch | 13 +++++++++ dev-util/soong/soong-9999.ebuild | 23 ++++++++++----- 6 files changed, 82 insertions(+), 15 deletions(-) create mode 100644 dev-util/soong/files/soong-no-strip.patch create mode 100644 dev-util/soong/files/soong-relative-symlink.patch diff --git a/dev-util/soong/Manifest b/dev-util/soong/Manifest index 3e6f6d1..f3f098e 100644 --- a/dev-util/soong/Manifest +++ b/dev-util/soong/Manifest @@ -1,14 +1,17 @@ AUX blueprint-test-go-1.10.patch 1533 BLAKE2B 3f764ea5ac68cdce8ecadb0dc40f4e676d8db21095b88cf99d7aa6c950ffd578029782d075d59290fc4898544458cab730471f9f0581dccefccc5a2951aa7234 SHA512 2846a098840b4543ec34466d5e97d0f6f8b05ba8dbb01e23c4a802a2bc3995fbb64020e88fa49ded8d7cac527cbfbb5614447165f7f17b392925f4f02556d480 AUX soong-9999-bootstrap-clean.patch 1539 BLAKE2B 95c06e8242d4d2e7a65d0f5e25b77bfe8079edf71213be318465250c78a1869e0b9ac0a7bb7be8123f586d1150a86951fb30b021230f3e3857ecdbdadab61d63 SHA512 b08a6314e3bee2b6d3ee7fa60afe3678a61d08c4930f9e55a643cf3bbe3373fef08d245b048a03a246d9cb0f9b3974b7e1dcb3f44f614cd9fd7f062d5c096384 AUX soong-bootstrap-clean.patch 1588 BLAKE2B ec20e7fece7c126a19586d1a6db7264f64f2b427c7386a6a9f2df77d5171a024185e119683ae2d5e87f483937bc05d40b6d3ffd4132826ff7e42448348d96e75 SHA512 bb39af5fd5d8ec310506b8a3bb782389e9a3c4a31429d6cf32f4681b5fee64d41c01ecf05f692060bcf15ff53952a31d1d6ffe2ee4de6a6e65ee8f44cca42972 -AUX soong-gentoo-host-bin.patch 1141 BLAKE2B d15738ce12aeb54e63e2f540b992fb6ed1989dfbb53a1b53f8cb0a99b3d30be2ae8ce598fb37f13fd68053e1b2deae0a4e112ab243186bf656662484ae278ca2 SHA512 c6eda77f2f2db1c0fe9b2556966b3015bda409198766a22dfca73dfbca2ed944355e129570e626e1849ee00353a9f229678091f66fed4a61bc5b7e270e33169c -AUX soong-gentoo-toolchain.patch 3277 BLAKE2B a80102f14af1b73768e8efa441bd050ef0ca425c4d0af4ee2c2991b9c41de09446c4cc2b9dc5694e65e84ba12b129790ec56b6286f0ce7a76077cd7a81f66a55 SHA512 b31787d6045ba003be519102a3a2a79c08d4eda1f664f9637f59daada3ea761b0b502642054120b27dd4544f742aafc420ed44ea0a00409030fa72f1092a5437 +AUX soong-gentoo-host-bin.patch 1294 BLAKE2B c9c438dcf66da6663becf5b5919fcf3607d40e2be79d4a7ccea2a4efde7decb099bd12969018f6c65bd9def7eddc26d21cafa2da0c65ac3cad89d232cd409d7d SHA512 eabbab9089cfd637e8904e4bc26b496ac4610d07dae4f71d6fbbe37101945af0620932e90e2c411cdca2982d7796ed09ec4efe145d2377e6fbc0f627265ff5b1 +AUX soong-gentoo-toolchain.patch 3320 BLAKE2B 96ec1e0ccdbd732f1c6b30713702b01e133c71bc6c29bcdaac75e0c39abeeacda1d2b563a26004545cef3f80fe7c0041fe59bf76bb4092844be659602f92628f SHA512 a79fce88eefc422c29866cdd9ab89202a6d24e719ba4d2c8299860b95167fd5bcf9e1e4b4da0c6af2e8636ebae44e46394397f069087f4cd5a1ade244cb27943 AUX soong-no-bootstrap.patch 1519 BLAKE2B 26b70aa67ed07e6ff5166d04f2d11e40b6c9c6a444cb4b8171f3b2d99ea35de194ed3916eb0027d80d2c61b0ae4ece89fa7d61bf48564de11ab40f6faba5d8aa SHA512 f90988259f308a5bc3843965391bad1a2be0f4a64eaa31284a7522d21832bf5e9095c08c3509acbc0ece982888dcb6f90e77116839eadd48be71eb53224e167f AUX soong-no-kernel-header.patch 346 BLAKE2B 9e830f028a47a031b46c5cefbc4ddafc922b1506756ba36266aa97f48e670efd1bae8a438f712add004b17fff3bf3c3f4c059a48039ee6ef619afc39163445d2 SHA512 b0ae8e277050911baf262a54c7324f03d69e5f8dd87505942d0a554451e69c6d6f0668801b83d66ac5c69d7827ea7d613d1d55e376c761c7e1f54c3b1ff286be +AUX soong-no-strip.patch 1355 BLAKE2B d5c4fbeacc48467f463dfd7db6b4af500fbf368f4dac470092c07ecd8ca11eca1d58ab94312f7a89dfb4e3d3bfa6370bfb3e744f1b5a0986c0fd0d59800e2135 SHA512 b5d1799922c04df026e13f0b8f9169d9d73e669977d0a394ebf5f18c8d56a6913dfaa05f63e91023fb390ca4e5f0c0ac20ddc71817a4d15fd72704533c1a4c0b AUX soong-no-sysroot.patch 2875 BLAKE2B 092422fbb204b5413418a36cf6d6bc5504339c082c7261df00140a1fa76f09070e50e5b730a1c3a55d87be9f2327ff3a1010889e6dbd6989b1b47142911f6e49 SHA512 d230fa5bfcc7121615c99db5bf07c0adfa580bd8aa958ba600ee5e027b454f27bf08aa596c93ea7099ab195fb6a94a5a32afdf5d8e16548961bc580c14cafb03 +AUX soong-relative-symlink.patch 466 BLAKE2B c7d682565434e444eaab65bfc516f59ddf909e389e970d5837f8fb7c5b1da73214fddd67659e01312a4462580e27e09c7c167782469402117624cd7fe3fbcae3 SHA512 7a268abcb11e126c29988bcc1e4805fac37badf08112f12efce7a659c54cdf833252d023638ccd9e9531d82dd72062e4bf5dccb96bd93f6e4dc77190af8b6891 DIST blueprint-8.1.0_p41.tar.gz 114222 BLAKE2B cb2335fd766212d1c3279ae4d6ee91df5f3c3a9522230ca70cbc080eed9b387a7d567963ba8ea5ffc4a48b01400958cc1d619b9da897e0f90a29b4446becdf46 SHA512 8ada4f309767567e7e08e6c8e61f0e442eb14a59333323bb6b47bb72c2b923bbb342166cddf6d31ec05a27f70ae60a981c0c8b4a3438820ce20ef47028e9f02b +DIST llvm-8.1.0_p41.tar.gz 26253027 BLAKE2B 50687a47c6a271d0881f6a115d25a698c3fc86d9477cafe361147beaaf4b3c2dd8599391287141f20efa2db8e0be183eed2d44744269b50471c1364a2f6f7687 SHA512 dbc7848cbc7d48c5b4d02fcc855aea57bf1922e8c116cd4f8424826d6aa49569474298f371561360cc2af6050c175b90296eec359443a9a81f65a8cf309fd27b DIST soong-8.1.0_p41.tar.gz 355543 BLAKE2B 0d2b47c30d0515426cffa19c73495f68633dcdbcd5fc33fbbabb8892b712eb85ec68657ea73e07b34573af525055c0f791cd6b54ca58dedd5c14bd4af1a37623 SHA512 50f65ac86f4466adfed6fddf6e8288e16fdc0c1717ba57e59d40395115d4f55ceed3407ce6542ef0173c2076783a7bdc908ff0aac6f19aad7c62a8f63daef6e3 DIST vendor-lineage-15.1.tar.gz 49859452 BLAKE2B c4de3918fa6aff6f24b27fdbde5434b2cfb9d8fb8632e64ce007857de3ad08f3a48d50cc8cee158df3daf29d2330f63ae71b433b0cde888ce3f13d152aab8563 SHA512 6f67ddaa087da4c2d379331367b839025aed75a976c05c1f3562f715d05de387a938969488e2979be8286eed1db4a90652c73eec5e58c728174aa50197229fa7 EBUILD soong-8.1.0_p41.ebuild 1676 BLAKE2B f262faa3e8dbe45414160220975c8ca5c64104f3479f8b4fc2bc2fe50b79ce2af3a732375616906c7db1a13b0295dc21e937a208f670aa37d404badd79d2ed68 SHA512 da536c2b5f000739a70c8a932f921ef2d52e3e73e4062dfa4b4c13b56612a6e95346b5cc425f8bfe79493c04e52a79e759d8abf704ae090caaa1f6a5b0a64aca -EBUILD soong-9999.ebuild 2323 BLAKE2B f5d6668842262a81e81529d7a8095459f4ba4b44d9619865fdfb8a55b3d3cf74ae3d20ce61490139d4c7d8abb4441e14a26b1b8e04fdc88f613ef2c0e38e43ca SHA512 e0f402b41f45302fbacf88da7165f25a2539ef7d306162fae201a263022f9cbaebccd78c3ef77eed4e6577f6aa9b7205975e8c86977b998df2a3cd4cf77ddae3 +EBUILD soong-9999.ebuild 2750 BLAKE2B 932992f39987c9bc1969aa399bc95bc95457f95dd6fe5e80028cf8bebbf3a4a2064d87ffb1ca7d10b0ef9def80b7eaf42a5952c001fcb933614ce65756936e14 SHA512 95dfe51522cafd5fe803399b1e50e2f4e2a117c3301b473d0d2348105c5c0d505e04b3e39ea4b370731427dc2751d679029ddaf8e5a0b3e82a7c6ebb9d2ad786 MISC metadata.xml 242 BLAKE2B 08b4880748ab6d685ce28f65a9f6cc5ad62deff8f85d4e0a55a3dc12aa8bd63cf1de56b28ff89929e054a6831e223d6ef0207e8b19c6887f09ee22621bd76928 SHA512 ae57aaeecc094cffa640d88329a0baa6c2b0703330d84f6406f3f68d8bb9b724d2e19a8478be8708de284db9ac452f95f225a9f79cd1c5d0236aa2f9935b9b21 diff --git a/dev-util/soong/files/soong-gentoo-host-bin.patch b/dev-util/soong/files/soong-gentoo-host-bin.patch index d53a266..6920ad8 100644 --- a/dev-util/soong/files/soong-gentoo-host-bin.patch +++ b/dev-util/soong/files/soong-gentoo-host-bin.patch @@ -2,7 +2,7 @@ Index: soong-9999/build/soong/android/package_ctx.go =================================================================== --- soong-9999.orig/build/soong/android/package_ctx.go +++ soong-9999/build/soong/android/package_ctx.go -@@ -82,11 +82,10 @@ func (p AndroidPackageContext) SourcePat +@@ -82,11 +82,16 @@ func (p AndroidPackageContext) SourcePat func (p AndroidPackageContext) HostBinToolVariable(name, path string) blueprint.Variable { return p.VariableFunc(name, func(config interface{}) (string, error) { ctx := &configErrorWrapper{p, config.(Config), []error{}} @@ -11,7 +11,13 @@ Index: soong-9999/build/soong/android/package_ctx.go return "", ctx.errors[0] } - return p.String(), nil -+ return path, nil ++ ++ if (path == "llvm-tblgen") { ++ p := PathForOutput(ctx, "host", ctx.config.PrebuiltOS(), "bin", path) ++ return p.String(), nil ++ } else { ++ return path, nil ++ } }) } diff --git a/dev-util/soong/files/soong-gentoo-toolchain.patch b/dev-util/soong/files/soong-gentoo-toolchain.patch index 7a7c179..7ad9303 100644 --- a/dev-util/soong/files/soong-gentoo-toolchain.patch +++ b/dev-util/soong/files/soong-gentoo-toolchain.patch @@ -26,11 +26,13 @@ Index: soong-9999/build/soong/cc/builder.go Rspfile: "${out}.rsp", RspfileContent: "${in}", }, -@@ -61,14 +58,12 @@ var ( +@@ -60,15 +57,13 @@ var ( + partialLd = pctx.AndroidStaticRule("partialLd", blueprint.RuleParams{ - Command: "$ldCmd -nostdlib -Wl,-r ${in} -o ${out} ${ldFlags}", +- Command: "$ldCmd -nostdlib -Wl,-r ${in} -o ${out} ${ldFlags}", - CommandDeps: []string{"$ldCmd"}, ++ Command: "$ldCmd -nostdlib -r ${in} -o ${out} ${ldFlags}", }, "ldCmd", "ldFlags") @@ -57,7 +59,7 @@ Index: soong-9999/build/soong/cc/builder.go Deps: blueprint.DepsGCC, - Command: "CROSS_COMPILE=$crossCompile $stripPath ${args} -i ${in} -o ${out} -d ${out}.d", - CommandDeps: []string{"$stripPath"}, -+ Command: "strip ${args} -i ${in} -o ${out} -d ${out}.d", ++ Command: "ln -f ${in} ${out}", }, "args", "crossCompile") diff --git a/dev-util/soong/files/soong-no-strip.patch b/dev-util/soong/files/soong-no-strip.patch new file mode 100644 index 0000000..5647b8a --- /dev/null +++ b/dev-util/soong/files/soong-no-strip.patch @@ -0,0 +1,34 @@ +Index: soong-9999/build/soong/cc/binary.go +=================================================================== +--- soong-9999.orig/build/soong/cc/binary.go ++++ soong-9999/build/soong/cc/binary.go +@@ -297,12 +297,6 @@ func (binary *binaryDecorator) link(ctx + + builderFlags := flagsToBuilderFlags(flags) + +- if binary.stripper.needsStrip(ctx) { +- strippedOutputFile := outputFile +- outputFile = android.PathForModuleOut(ctx, "unstripped", fileName) +- binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags) +- } +- + if binary.Properties.Prefix_symbols != "" { + afterPrefixSymbols := outputFile + outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName) +Index: soong-9999/build/soong/cc/library.go +=================================================================== +--- soong-9999.orig/build/soong/cc/library.go ++++ soong-9999/build/soong/cc/library.go +@@ -545,12 +545,6 @@ func (library *libraryDecorator) linkSha + library.relocationPacker.pack(ctx, outputFile, packedOutputFile, builderFlags) + } + +- if library.stripper.needsStrip(ctx) { +- strippedOutputFile := outputFile +- outputFile = android.PathForModuleOut(ctx, "unstripped", fileName) +- library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags) +- } +- + sharedLibs := deps.SharedLibs + sharedLibs = append(sharedLibs, deps.LateSharedLibs...) + diff --git a/dev-util/soong/files/soong-relative-symlink.patch b/dev-util/soong/files/soong-relative-symlink.patch new file mode 100644 index 0000000..d1ba676 --- /dev/null +++ b/dev-util/soong/files/soong-relative-symlink.patch @@ -0,0 +1,13 @@ +Index: soong-9999/build/soong/android/defs.go +=================================================================== +--- soong-9999.orig/build/soong/android/defs.go ++++ soong-9999/build/soong/android/defs.go +@@ -62,7 +62,7 @@ var ( + // A symlink rule. + Symlink = pctx.AndroidStaticRule("Symlink", + blueprint.RuleParams{ +- Command: "ln -f -s $fromPath $out", ++ Command: "ln -r -f -s $fromPath $out", + Description: "symlink $out", + }, + "fromPath") diff --git a/dev-util/soong/soong-9999.ebuild b/dev-util/soong/soong-9999.ebuild index 5b90d90..f9208df 100644 --- a/dev-util/soong/soong-9999.ebuild +++ b/dev-util/soong/soong-9999.ebuild @@ -7,10 +7,11 @@ inherit ninja-utils git-r3 EGIT_REPO_URI=https://github.com/KireinaHoro/android_build_${PN} EGIT_CHECKOUT_DIR=${WORKDIR}/${P}/build/${PN} -A_URI=http://aosp.airelinux.org/platform/build +A_URI=http://aosp.airelinux.org/platform # blueprint is a source level dependency of soong. MPV=8.1.0_p41 -SRC_URI="${A_URI}/blueprint/+archive/android-${MPV/p/r}.tar.gz -> blueprint-${MPV}.tar.gz +SRC_URI="${A_URI}/build/blueprint/+archive/android-${MPV/p/r}.tar.gz -> blueprint-${MPV}.tar.gz + ${A_URI}/external/llvm/+archive/android-${MPV/p/r}.tar.gz -> llvm-${MPV}.tar.gz https://github.com/LineageOS/android_vendor_lineage/archive/lineage-15.1.tar.gz -> vendor-lineage-15.1.tar.gz" DESCRIPTION="JSON-like build system for Android." HOMEPAGE="${A_URI}/${PN}" @@ -19,7 +20,8 @@ KEYWORDS="~amd64" SLOT=0 DEPEND="dev-lang/go - dev-util/ninja" + dev-util/ninja + dev-libs/libpcre2" RDEPEND="dev-lang/go" PATCHES=( @@ -28,8 +30,10 @@ PATCHES=( "${FILESDIR}"/soong-no-kernel-header.patch "${FILESDIR}"/soong-no-bootstrap.patch "${FILESDIR}"/soong-no-sysroot.patch - "${FILESDIR}"/soong-gentoo-toolchain.patch + "${FILESDIR}"/soong-no-strip.patch + "${FILESDIR}"/soong-gentoo-toolchain.patch # disable strip, as strip is managed by portage. "${FILESDIR}"/soong-gentoo-host-bin.patch + "${FILESDIR}"/soong-relative-symlink.patch ) src_unpack() { @@ -43,6 +47,10 @@ src_unpack() { mkdir -p "${S}"/build/blueprint || die cd "${S}"/build/blueprint || die unpack blueprint-${MPV}.tar.gz + + mkdir -p "${S}"/external/llvm || die + cd "${S}"/external/llvm || die + unpack llvm-${MPV}.tar.gz } src_prepare() { @@ -70,10 +78,11 @@ src_compile() { src_install() { dobin out/.bootstrap/bin/* build/${PN}/cmd/sbox/sbox - sed -n '/\/\/.*host bionic/,$p' < build/soong/Android.bp > "${T}"/Android.bp - sed -e '/build = \[/,+3d' -e '/vendor/d' < build/soong/root.bp > "${T}"/root.bp + pcre2grep -M -v '\swindows: (\{(?>[^{}]|(?1))*\})' < build/soong/Android.bp > "${T}"/Android.bp || die + sed -n '/\/\/.*host bionic/,$p' -i "${T}"/Android.bp || die + sed -e '/build = \[/,+3d' -e '/vendor/d' < build/soong/root.bp > "${T}"/root.bp || die insinto /usr/share/soong doins "${T}"/{Android,root}.bp doins -r build/soong/scripts - fperms +x /usr/share/soong/scripts/copygcclib.sh + fperms +x /usr/share/soong/scripts/{copygcclib,toc}.sh } -- cgit v1.2.3-65-gdbad