devicepkg-dev: opt-out compiler-gcc.h replacing (!186)

Instead of never overwriting compiler-gcc.h if it exists, overwrite it
by default except if OVERWRITE_GCCH=0 is set in the environment.

Most kernels *do* need this file replaced and won't build without this
patch.
This commit is contained in:
Oliver Smith 2019-01-29 09:35:10 +01:00
parent 7b86ca313d
commit 4328e5fe2f
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 27 additions and 6 deletions

View file

@ -1,5 +1,5 @@
pkgname="devicepkg-dev"
pkgver=0.7
pkgver=0.8
pkgrel=0
pkgdesc="Provides default device package functions"
url="https://postmarketos.org"
@ -59,7 +59,7 @@ package() {
sha512sums="d69930dd790b00fb39760a37d95a10899f0d167e10e2804feb05d9ce04f94185dc32d36edc90214aba2ea2aa09bf18f7dab93f1d2eff23f67beb2cc83be30e7c compiler-gcc.h
55943344e6c6192642f20246566c8468dba33d4ec4223c4e930f723fdb0fa248001c65a9bbaa5f15c18e9a42811c9b9decedfd5586f481aa762b6423b55d55bb devicepkg_build.sh
cc35989539781da2bc847fe68448863174a79db3853f836c61da064030cb729a16681cb6ffa16add558a7dba8563cb7fab495a6db811dcc3a1af5123dc0e6f72 devicepkg_package.sh
786673de073988aff5a4c5a4a3da07131dc693970f5492a99816e8b20caf2cd67365ed9398f74f0f0e9a0a3b5759220b9d5d79d77164357ed823ab44f364c8bc downstreamkernel_prepare.sh
1b038d0bca1e130674497cf7aeb26fac2bcec510ce094fa6f6700fcdcabc778741541c1aa89d3588ed42908f60708a2d9b83ffd5e50e99db619d366458e82256 downstreamkernel_prepare.sh
bedf319a74bff01780192cd11c872c41a451915cc7e7542c467cd84fa1784236401f57e197258c3aae734f478c31a2052129838861ea204c0985630501f152ca devicepkg_subpackage_kernel.sh
9bb7f2a0930f397a713e9f4b6d5b83a426d9a2a3f692dcc42ac30717bf26ead869d8823a38f3ad388af12b2b9a02e8ec4d4418e9c2062389ed06d2b891a49ff3 deviceinfo
136247a16ec91dc0c7241eeddb28c2196ae3b29946a9bc7e9566f848491ef1c53b12d05bf2dbc1cc352986712fd76f25c1510bcc8f301af540a2f01c33b299e1 expected-deviceinfo-downstream

View file

@ -1,4 +1,27 @@
#!/bin/sh
# Replace compiler-gcc.h with one that works with newer GCC versions.
# Set REPLACE_GCCH=0 to avoid replacing an existing compiler-gcc.h file.
install_gcc_h() {
_gcch="$builddir/include/linux/compiler-gcc.h"
if [ -f "$_gcch" ]; then
if [ "$REPLACE_GCCH" = "0" ]; then
echo "NOTE: *not* replacing $_gcch, because of REPLACE_GCCH=0"
return
else
echo "NOTE: replacing $_gcch! If your build breaks with 'Please"
echo "don't include <linux/compiler-gcc.h> directly' or a similar"
echo "compiler-gcc.h related error, then set"
echo " REPLACE_GCCH=0"
echo "in your kernel APKBUILD at the start of the"
echo "downstreamkernel_prepare.sh line."
fi
fi
cp -v "/usr/share/devicepkg-dev/compiler-gcc.h" "$_gcch"
}
# Parse arguments
srcdir=$1
builddir=$2
_config=$3
@ -13,10 +36,8 @@ if [ -z "$srcdir" ] || [ -z "$builddir" ] || [ -z "$_config" ] ||
exit 1
fi
# support newer GCC versions
if [ ! -f "$builddir/include/linux/compiler-gcc.h" ]; then
cp -v "/usr/share/devicepkg-dev/compiler-gcc.h" "$builddir/include/linux/"
fi
# Support newer GCC versions
install_gcc_h
# Remove -Werror from all makefiles
makefiles="$(find "$builddir" -type f -name Makefile)