forked from java-native-access/jna
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cross-compiling on macos and also ensure CFLAGS / LDFLAGS are cor…
…rectly set (java-native-access#406) Motivation: Our cross-compilation on mac did not work correctly and produced a non working lib. Modifications: Fix cross compilation by using a custom m4 template Result: cross compile works as expected
- Loading branch information
1 parent
9f635c8
commit 8f1ec1b
Showing
2 changed files
with
78 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
codec-native-quic/src/main/native-package/m4/custom.m4.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
]) | ||
|