From 3cd98c8822879eb9c2c030add433363931be5e5a Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Wed, 9 Jun 2021 19:01:23 +0700 Subject: [PATCH] Try wrapped clang with some warning suppressed Clang works well on compiling OpenJDK 17, however suppressing warnings doesn't work even with `--with-extra-c(xx)flags` so I had to try this. --- android-wrapped-clang | 1 + android-wrapped-clang++ | 1 + buildjdk.sh | 2 ++ setdevkitpath.sh | 9 ++++++--- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 android-wrapped-clang create mode 100755 android-wrapped-clang++ diff --git a/android-wrapped-clang b/android-wrapped-clang new file mode 100755 index 0000000..14dcf5d --- /dev/null +++ b/android-wrapped-clang @@ -0,0 +1 @@ +exec $thecc "$@" -Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused diff --git a/android-wrapped-clang++ b/android-wrapped-clang++ new file mode 100755 index 0000000..f22917d --- /dev/null +++ b/android-wrapped-clang++ @@ -0,0 +1 @@ +exec $thecxx "$@" -Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused \ No newline at end of file diff --git a/buildjdk.sh b/buildjdk.sh index 3bb40a2..1b38cd3 100755 --- a/buildjdk.sh +++ b/buildjdk.sh @@ -27,6 +27,8 @@ export CFLAGS+=" -DLE_STANDALONE -DANDROID" # -I$FREETYPE_DIR -I$CUPS_DI # cp -R /usr/include/fontconfig $ANDROID_INCLUDE/ if [ "$BUILD_IOS" != "1" ]; then + chmod +x android-wrapped-clang + chmod +x android-wrapped-clang++ ln -s -f /usr/include/X11 $ANDROID_INCLUDE/ ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/ AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11" diff --git a/setdevkitpath.sh b/setdevkitpath.sh index c10c1f4..1e5b3d4 100755 --- a/setdevkitpath.sh +++ b/setdevkitpath.sh @@ -55,7 +55,7 @@ else export JVM_PLATFORM=linux # Set NDK export API=21 -export NDK=`pwd`/android-ndk-$NDK_VERSION +export NDK=$PWD/android-ndk-$NDK_VERSION export TOOLCHAIN=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain # export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64 @@ -64,11 +64,14 @@ export ANDROID_INCLUDE=$TOOLCHAIN/sysroot/usr/include export CPPFLAGS="-I$ANDROID_INCLUDE -I$ANDROID_INCLUDE/$TARGET" # -I/usr/include -I/usr/lib export LDFLAGS="-L$NDK/platforms/android-$API/arch-$TARGET_SHORT/usr/lib" +export thecc=$TOOLCHAIN/bin/$TARGET-clang +export thecxx=$TOOLCHAIN/bin/$TARGET-clang++ + # Configure and build. export AR=$TOOLCHAIN/bin/$TARGET-ar export AS=$TOOLCHAIN/bin/$TARGET-as -export CC=$TOOLCHAIN/bin/$TARGET-gcc -export CXX=$TOOLCHAIN/bin/$TARGET-g++ +export CC=$PWD/android-wrapped-clang +export CXX=$PWD/android-wrapped-clang++ export LD=$TOOLCHAIN/bin/$TARGET-ld export OBJCOPY=$TOOLCHAIN/bin/$TARGET-objcopy export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib