From cfb021f33628ba2b958c819cac8c1260087bf0c0 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 31 Oct 2024 11:46:22 +0100 Subject: [PATCH] Only add extra ldflags on linux (#901) Motivation: We need to ensure we only add the extra ldflags on linux as otherwise compilation will fail on macOS Modifications: Add the ldflags on linux only Result: Be able to compile on macOS again --- boringssl-static/pom.xml | 31 +++++++++++++++++-- .../netty/internal/tcnative/NativeTest.java | 3 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/boringssl-static/pom.xml b/boringssl-static/pom.xml index e69b47d4..401b9f9a 100644 --- a/boringssl-static/pom.xml +++ b/boringssl-static/pom.xml @@ -93,7 +93,7 @@ ssl.lib;crypto.lib -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused -Wno-unused-value -O3 -DHAVE_OPENSSL -I${boringsslSourceDir}/include - -L${boringsslHome}/ssl -L${boringsslHome}/crypto -lssl -lcrypto -static-libstdc++ -l:libstdc++.a + -L${boringsslHome}/ssl -L${boringsslHome}/crypto -lssl -lcrypto true ${javaDefaultModuleName} @@ -563,6 +563,33 @@ + + ldflags-setup + compile + + run + + + true + + + + + + + + + + + + + + + + + + + native-jar @@ -658,7 +685,7 @@ ${macOsxDeploymentTarget} CFLAGS=${cflags} CPPFLAGS=${cppflags} - LDFLAGS=${ldflags} + LDFLAGS=${hawtjniLdflags} diff --git a/boringssl-static/src/test/java/io/netty/internal/tcnative/NativeTest.java b/boringssl-static/src/test/java/io/netty/internal/tcnative/NativeTest.java index 14fe262a..2acb57a4 100644 --- a/boringssl-static/src/test/java/io/netty/internal/tcnative/NativeTest.java +++ b/boringssl-static/src/test/java/io/netty/internal/tcnative/NativeTest.java @@ -25,10 +25,11 @@ public class NativeTest { @Test public void loadNativeLib() throws Exception { String testClassesRoot = NativeTest.class.getProtectionDomain().getCodeSource().getLocation().getFile(); + File f = new File(testClassesRoot + File.separator + "META-INF" + File.separator + "native"); File[] directories = new File(testClassesRoot + File.separator + "META-INF" + File.separator + "native") .listFiles(); if (directories == null || directories.length != 1) { - throw new IllegalStateException("Could not find platform specific native directory"); + throw new IllegalStateException("Could not find platform specific native directory: " + f); } String libName = System.mapLibraryName("netty_tcnative") // Fix the filename (this is needed for macOS).