| #!/bin/bash -ex |
| # |
| # Copyright 2019 Google Inc. All rights reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| # Regenerate host configuration files for the current host |
| |
| cd `dirname ${BASH_SOURCE[0]}` |
| |
| ANDROID_BUILD_TOP=$(cd ../..; pwd) |
| |
| UNAME=$(uname | tr 'A-Z' 'a-z') |
| DIR=$UNAME-lib |
| mkdir -p $DIR |
| cd $DIR |
| |
| if [ $DIR == "linux-lib" ]; then |
| export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-r370808/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 |
| |
| rm -rf tmp |
| mkdir tmp |
| cd tmp |
| ../../configure \ |
| --disable-nls \ |
| --enable-relocatable \ |
| --prefix=/nonexistent \ |
| --exec-prefix=/nonexistent/$UNAME-x86 \ |
| --datarootdir=/nonexistent/common |
| |
| echo 'gensrcs: $(BUILT_SOURCES)' >>Makefile |
| make -fMakefile gensrcs |
| make -fMakefile src/bison |
| mv lib/*.h ../ |
| |
| GENBP=../Android.bp |
| rm -f $GENBP |
| cat >$GENBP <<END |
| // Autogenerated by android_regen.sh |
| |
| cc_defaults { |
| name: "libbison_${UNAME}_defaults", |
| target: { |
| $UNAME: { |
| srcs: [ |
| $(find lib -name '*.o' | sed "s/libbison_a-//" | sed -E "s/(.*)\.o/\"\1\.c\",/" | LC_ALL=C sort) |
| ], |
| }, |
| }, |
| } |
| |
| cc_defaults { |
| name: "bison_${UNAME}_defaults", |
| target: { |
| $UNAME: { |
| srcs: [ |
| $(find src -name '*.o' | sed "s/bison-//" | sed -E "s/(.*)\.o/\"\1\.c\",/" | LC_ALL=C sort) |
| ], |
| }, |
| }, |
| } |
| END |
| ${ANDROID_BUILD_TOP}/prebuilts/build-tools/$UNAME-x86/bin/bpfmt -w $GENBP |
| |
| cd ../ |
| rm -rf tmp |