diff options
author | Dan Willemsen <dwillemsen@google.com> | 2022-01-28 15:00:54 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2022-03-24 01:50:15 -0700 |
commit | 59a4732461c3a5191498ad202a7168d582723af2 (patch) | |
tree | 6dde88aec21efaff13b0f69015d2b483c5efa55f | |
parent | 3c11d492c628c550156ff095a8e1ef9795bf8ee4 (diff) | |
download | bison-59a4732461c3a5191498ad202a7168d582723af2.tar.gz |
android_regen and Android.bp updates for 3.8.2
* Work around flaky Makefile regeneration that would wipe out our
modification by touching some files and running `make Makefile` before
making our changes.
* Support the generated lib/malloc/*.h headers
* Ignore the unused-parameter warning
* Move to C17, as upstream uses the compiler default.
* Switch musl regen to using the prebuilt sysroot
* Disable iconv and vfork on Mac
Change-Id: I5294bb3ae66a3ccd830503a802a5a536ba50d72f
-rw-r--r-- | Android.bp | 7 | ||||
-rwxr-xr-x | android_regen.sh | 30 |
2 files changed, 31 insertions, 6 deletions
@@ -15,9 +15,11 @@ cc_defaults { name: "bison_defaults", + c_std: "c17", cflags: [ "-Wall", "-Werror", + "-Wno-unused-parameter", "-DEXEEXT=\"\"", ], @@ -40,7 +42,10 @@ cc_defaults { "linux_musl-lib", "lib", ], - cflags: ["-DMUSL"], + cflags: [ + "-Wno-error=unused-const-variable", + "-DMUSL_LIBC", + ], }, }, } diff --git a/android_regen.sh b/android_regen.sh index 6cad17f8..e41a7492 100755 --- a/android_regen.sh +++ b/android_regen.sh @@ -23,21 +23,27 @@ ANDROID_BUILD_TOP=$(cd ../..; pwd) UNAME=$(uname | tr 'A-Z' 'a-z') NAME=linux_glibc TARGET=glibc +config_opts=() if [ $UNAME == "darwin" ]; then NAME=darwin TARGET=darwin + # vfork is deprecated on Mac, so always fallback to fork + config_opts+=("ac_cv_func_vfork=no") + # we'd need to link to libiconv + config_opts+=("am_cv_func_iconv=no") +else + export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/$(cd $ANDROID_BUILD_TOP; build/soong/scripts/get_clang_version.py)/bin/clang" fi -if [ "$1" = "--musl_sysroot" ]; then +if [ "$1" = "--musl" ]; then NAME=linux_musl TARGET=musl - sysroot=$2 - export CC="${sysroot}/bin/musl-clang" + sysroot="${ANDROID_BUILD_TOP}/prebuilts/build-tools/sysroots/x86_64-linux-musl" + export CFLAGS="--sysroot=${sysroot} -target x86_64-linux-musl -fuse-ld=lld" export LDFLAGS="--rtlib=compiler-rt" fi if [ $NAME == "linux_glibc" ]; then - export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/$(cd $ANDROID_BUILD_TOP; build/soong/scripts/get_clang_version.py)/bin/clang" export CFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot" export LDFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -B$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64" fi @@ -55,12 +61,26 @@ cd tmp --enable-relocatable \ --prefix=/nonexistent \ --exec-prefix=/nonexistent/$NAME-x86 \ - --datarootdir=/nonexistent/common + --datarootdir=/nonexistent/common \ + "${config_opts[@]}" + +# Don't try to use aclocal/automake/etc +touch ../../aclocal.m4 +touch ../../configure +touch ../../Makefile.in +# Don't attempt to update source timestamps +touch ../../doc/stamp-vti + +make -fMakefile Makefile echo 'gensrcs: $(BUILT_SOURCES)' >>Makefile make -fMakefile gensrcs make -fMakefile src/bison + +mkdir -p ../malloc +rm -rf ../*.h ../malloc/*.h mv lib/*.h ../ +mv lib/malloc/*.h ../malloc/ GENBP=../Android.bp rm -f $GENBP |