diff --git a/codec-native-quic/pom.xml b/codec-native-quic/pom.xml index 69a318357..4cbb7de60 100644 --- a/codec-native-quic/pom.xml +++ b/codec-native-quic/pom.xml @@ -61,8 +61,8 @@ ${project.build.directory}/generated-sources ${project.build.directory}/template - -std=gnu99 -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused -Wno-unused-value -O3 -I${quicheHomeIncludeDir} -I${boringsslHomeIncludeDir} - -L${quicheHomeBuildDir} -lquiche -L${boringsslHomeBuildDir} -lssl -lcrypto + + @@ -114,17 +114,15 @@ Symbol not found: ___isPlatformVersionAtLeast --> 10.12 - -O3 -fno-omit-frame-pointer - -O3 -fno-omit-frame-pointer -Wa,--noexecstack - ${extraCflags} -DOPENSSL_C11_ATOMIC + ${extraCflags} -O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC - ${extraCflags} -DOPENSSL_C11_ATOMIC -Wno-error=range-loop-analysis + ${extraCxxflags} -O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC -Wno-error=range-loop-analysis libssl.a libcrypto.a libquiche.a - -Wl,-exported_symbol,_JNI_* -Wl,-platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} + -platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget} META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=${os.detected.arch} @@ -136,19 +134,20 @@ osx-aarch_64 osx.aarch_64 11.0 - -O3 -fno-omit-frame-pointer -target arm64-apple-macos11 - -O3 -fno-omit-frame-pointer -target arm64-apple-macos11 + -target arm64-apple-macos11 + -target arm64-apple-macos11 -Wa,--noexecstack -target arm64-apple-macos11 -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64 - ${extraCflags} -DOPENSSL_C11_ATOMIC + ${extraCflags} -O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC - ${extraCflags} -DOPENSSL_C11_ATOMIC -Wno-error=range-loop-analysis + ${extraCxxflags} -O3 -fno-omit-frame-pointer -DOPENSSL_C11_ATOMIC -Wno-error=range-loop-analysis libssl.a libcrypto.a libquiche.a - -arch arm64 -Wl,-exported_symbol,_JNI_* -Wl,-platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} + -arch arm64 -platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} --host=aarch64-apple-darwin + MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget} META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=aarch64 true @@ -788,24 +787,39 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -932,11 +946,10 @@ true v142 ${nativeLibOnlyDir} + true ${extraConfigureArg} ${extraConfigureArg2} - CFLAGS=${cflags} - LDFLAGS=${ldflags} ${extraLdflags} --libdir=${project.build.directory}/native-build/target/lib diff --git a/codec-native-quic/src/main/native-package/m4/custom.m4.template b/codec-native-quic/src/main/native-package/m4/custom.m4.template new file mode 100644 index 000000000..ff0636c62 --- /dev/null +++ b/codec-native-quic/src/main/native-package/m4/custom.m4.template @@ -0,0 +1,39 @@ +dnl --------------------------------------------------------------------------- +dnl Copyright 2022 The Netty Project +dnl +dnl Licensed under the Apache License, Version 2.0 (the "License"); +dnl you may not use this file except in compliance with the License. +dnl You may obtain a copy of the License at +dnl +dnl http://www.apache.org/licenses/LICENSE-2.0 +dnl +dnl Unless required by applicable law or agreed to in writing, software +dnl distributed under the License is distributed on an "AS IS" BASIS, +dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +dnl See the License for the specific language governing permissions and +dnl limitations under the License. +dnl --------------------------------------------------------------------------- + +AC_DEFUN([CUSTOM_M4_SETUP], +[ + dnl Ensure we only expose what we really need + case $host in + *-darwin*) + LDFLAGS="$LDFLAGS -Wl,-exported_symbol,_JNI_*" + ;; + *linux*) + LDFLAGS="$LDFLAGS -Wl,--exclude-libs,ALL" + ;; + *) + ;; + esac + + dnl Update the compiler/linker flags + CFLAGS="$CFLAGS -std=gnu99 -fvisibility=hidden -Werror -fno-omit-frame-pointer -Wunused -Wno-unused-value -O3 -I@BORINGSSL_INCLUDE_DIR@ -I@QUICHE_INCLUDE_DIR@ @EXTRA_CFLAGS@" + CXXFLAGS="$CXXFLAGS" + LDFLAGS="$LDFLAGS -L@BORINGSSL_LIB_DIR@ -lssl -lcrypto -L@QUICHE_LIB_DIR@ -lquiche @EXTRA_LDFLAGS@" + AC_SUBST(CFLAGS) + AC_SUBST(CXXFLAGS) + AC_SUBST(LDFLAGS) +]) +