aportgen linux: make compatible with GCC8

* create symlinks to the GCC8 patches (introduced in pmaports!35)
* link to the new vendorkernel reference wiki page
* use SPDX license in the license= field
* add comment above the compiler section of the APKBUILD
* remove empty line at the end of the APKBUILD
This commit is contained in:
Oliver Smith 2018-10-05 09:07:57 +02:00
parent 46d7891a22
commit f54f96069e
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 15 additions and 16 deletions

View File

@ -22,7 +22,7 @@ import pmb.parse.apkindex
import pmb.parse.arch import pmb.parse.arch
def generate_apkbuild(args, pkgname, deviceinfo): def generate_apkbuild(args, pkgname, deviceinfo, patches):
device = "-".join(pkgname.split("-")[1:]) device = "-".join(pkgname.split("-")[1:])
carch = pmb.parse.arch.alpine_to_kernel(deviceinfo["arch"]) carch = pmb.parse.arch.alpine_to_kernel(deviceinfo["arch"])
@ -65,6 +65,7 @@ def generate_apkbuild(args, pkgname, deviceinfo):
"$pkgdir/boot/dt.img\"""" "$pkgdir/boot/dt.img\""""
content = """\ content = """\
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/""" + carch + """/configs/(CHANGEME!) # Kernel config based on: arch/""" + carch + """/configs/(CHANGEME!)
pkgname=\"""" + pkgname + """\" pkgname=\"""" + pkgname + """\"
@ -75,9 +76,11 @@ def generate_apkbuild(args, pkgname, deviceinfo):
_carch=\"""" + carch + """\" _carch=\"""" + carch + """\"
_flavor=\"""" + device + """\" _flavor=\"""" + device + """\"
url="https://kernel.org" url="https://kernel.org"
license="GPL2" license="GPL-2.0-only"
options="!strip !check !tracedeps" options="!strip !check !tracedeps"
makedepends=\"""" + makedepends + """\" makedepends=\"""" + makedepends + """\"
# Compiler: latest GCC from Alpine
HOSTCC="${CC:-gcc}" HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}" HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
@ -87,10 +90,7 @@ def generate_apkbuild(args, pkgname, deviceinfo):
_config="config-${_flavor}.${arch}" _config="config-${_flavor}.${arch}"
source=" source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/${_repository}/archive/${_commit}.tar.gz $pkgname-$_commit.tar.gz::https://github.com/LineageOS/${_repository}/archive/${_commit}.tar.gz
$_config $_config""" + ("\n" + " " * 12).join([""] + patches) + """
compiler-gcc6.h
01_msm-fix-perf_trace_counters.patch
02_gpu-msm-fix-gcc5-compile.patch
" "
builddir="$srcdir/${_repository}-${_commit}" builddir="$srcdir/${_repository}-${_commit}"
@ -105,8 +105,7 @@ def generate_apkbuild(args, pkgname, deviceinfo):
package() {""" + package + """ package() {""" + package + """
} }
sha512sums="(run 'pmbootstrap checksum """ + pkgname + """' to fill)" sha512sums="(run 'pmbootstrap checksum """ + pkgname + """' to fill)\""""
"""
# Write the file # Write the file
with open(args.work + "/aportgen/APKBUILD", "w", encoding="utf-8") as handle: with open(args.work + "/aportgen/APKBUILD", "w", encoding="utf-8") as handle:
@ -118,13 +117,13 @@ def generate(args, pkgname):
device = "-".join(pkgname.split("-")[1:]) device = "-".join(pkgname.split("-")[1:])
deviceinfo = pmb.parse.deviceinfo(args, device) deviceinfo = pmb.parse.deviceinfo(args, device)
# Copy gcc6 support header and the patches from lg-mako for now # Symlink commonly used patches
# (automatically finding the right patches is planned in #688)
pmb.helpers.run.user(args, ["mkdir", "-p", args.work + "/aportgen"]) pmb.helpers.run.user(args, ["mkdir", "-p", args.work + "/aportgen"])
for file in ["compiler-gcc6.h", "01_msm-fix-perf_trace_counters.patch", patches = ["gcc7-give-up-on-ilog2-const-optimizations.patch",
"02_gpu-msm-fix-gcc5-compile.patch"]: "gcc8-fix-put-user.patch"]
pmb.helpers.run.user(args, ["cp", args.aports + for patch in patches:
"/device/linux-lg-mako/" + file, pmb.helpers.run.user(args, ["ln", "-s",
args.work + "/aportgen/"]) "../../.shared-patches/linux/" + patch,
args.work + "/aportgen/" + patch])
generate_apkbuild(args, pkgname, deviceinfo) generate_apkbuild(args, pkgname, deviceinfo, patches)