From 42649e03563542bf905d15b9b34ce09cd5942ce0 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 8 Sep 2021 13:22:10 +0200 Subject: [PATCH 1/2] Add support for mac m1 Motivation: As more and more people switch to a mac m1 we should support it Modifications: - Add profiles for cross-compile for mac m1 - Adjust script to finish release Result: Mac m1 is supported --- all/pom.xml | 30 +++++++- bom/pom.xml | 19 ++++- resolver-dns-native-macos/pom.xml | 105 +++++++++++++++++++++++++++ scripts/finish_release.sh | 1 + transport-native-kqueue/pom.xml | 105 +++++++++++++++++++++++++++ transport-native-unix-common/pom.xml | 69 ++++++++++++++++++ 6 files changed, 327 insertions(+), 2 deletions(-) diff --git a/all/pom.xml b/all/pom.xml index f8c6d9cf352..a9838e53904 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -82,6 +82,13 @@ compile true + + ${project.groupId} + netty-transport-native-kqueue + osx-aarch_64 + compile + true + ${project.groupId} netty-resolver-dns-native-macos @@ -89,6 +96,13 @@ compile true + + ${project.groupId} + netty-resolver-dns-native-macos + osx-aarch_64 + compile + true + @@ -118,6 +132,13 @@ compile true + + ${project.groupId} + netty-transport-native-kqueue + osx-aarch_64 + compile + true + ${project.groupId} netty-resolver-dns-native-macos @@ -125,10 +146,17 @@ compile true + + ${project.groupId} + netty-resolver-dns-native-macos + osx-aarch_64 + compile + true + - diff --git a/bom/pom.xml b/bom/pom.xml index e05844a8d51..11b484b1f63 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -202,6 +202,12 @@ 4.1.68.Final-SNAPSHOT osx-x86_64 + + io.netty + netty-resolver-dns-native-macos + 4.1.68.Final-SNAPSHOT + osx-aarch_64 + io.netty netty-transport-native-unix-common @@ -225,6 +231,12 @@ 4.1.68.Final-SNAPSHOT osx-x86_64 + + io.netty + netty-transport-native-unix-common + 4.1.68.Final-SNAPSHOT + osx-aarch_64 + io.netty netty-transport-native-epoll @@ -253,7 +265,12 @@ 4.1.68.Final-SNAPSHOT osx-x86_64 - + + io.netty + netty-transport-native-kqueue + 4.1.68.Final-SNAPSHOT + osx-aarch_64 + io.netty diff --git a/resolver-dns-native-macos/pom.xml b/resolver-dns-native-macos/pom.xml index ab05437fc30..97a5589cdfc 100644 --- a/resolver-dns-native-macos/pom.xml +++ b/resolver-dns-native-macos/pom.xml @@ -132,6 +132,111 @@ + + mac-m1-cross-compile + + LDFLAGS=-arch arm64 -Wl,-weak_library,${unix.common.lib.unpacked.dir}/lib${unix.common.lib.name}.a + CFLAGS=-target arm64-apple-macos11 -O3 -Werror -fno-omit-frame-pointer -Wunused-variable -fvisibility=hidden -I${unix.common.include.unpacked.dir} + + + ${os.detected.name}-aarch_64 + true + + + + + maven-dependency-plugin + + + + unpack + generate-sources + + unpack-dependencies + + + ${project.groupId} + netty-transport-native-unix-common + ${jni.classifier} + ${unix.common.lib.dir} + META-INF/native/** + false + true + + + + + + + org.fusesource.hawtjni + maven-hawtjni-plugin + + + build-native-lib + + netty_resolver_dns_native_macos_${os.detected.arch} + ${project.basedir}/src/main/c + ${project.build.outputDirectory} + + . + + ${jni.compiler.args.ldflags} + ${jni.compiler.args.cflags} + --host=aarch64-apple-darwin + + + + generate + build + + + + + + + maven-jar-plugin + + + + native-jar + + jar + + + + + true + + + META-INF/native/libnetty_resolver_dns_native_macos_aarch_64.jnilib; osname=MacOSX; processor=aarch_64 + ${javaModuleName} + + true + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + ${jni.classifier} + + + + + + + + + io.netty + netty-transport-native-unix-common + ${project.version} + ${jni.classifier} + + true + + + diff --git a/scripts/finish_release.sh b/scripts/finish_release.sh index 22f1b67f573..193904cae28 100755 --- a/scripts/finish_release.sh +++ b/scripts/finish_release.sh @@ -41,6 +41,7 @@ git checkout "$2" export JAVA_HOME="$JAVA8_HOME" ./mvnw -Psonatype-oss-release -am -pl resolver-dns-native-macos,transport-native-unix-common,transport-native-kqueue clean package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DstagingRepositoryId="$1" -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DskipTests=true +./mvnw -Psonatype-oss-release,mac-m1-cross-compile -am -pl resolver-dns-native-macos,transport-native-unix-common,transport-native-kqueue clean package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DstagingRepositoryId="$1" -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DskipTests=true ./mvnw -Psonatype-oss-release,full,uber-staging -pl all clean package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DstagingRepositoryId="$1" -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DskipTests=true diff --git a/transport-native-kqueue/pom.xml b/transport-native-kqueue/pom.xml index 0baed095ef7..60c44d5e22b 100644 --- a/transport-native-kqueue/pom.xml +++ b/transport-native-kqueue/pom.xml @@ -137,6 +137,111 @@ + + mac-m1-cross-compile + + + ${os.detected.name}-aarch_64 + CFLAGS=-target arm64-apple-macos11 -O3 -Werror -fno-omit-frame-pointer -Wunused-variable -fvisibility=hidden -I${unix.common.include.unpacked.dir} + LDFLAGS=-arch arm64 -Wl,-weak_library,${unix.common.lib.unpacked.dir}/lib${unix.common.lib.name}.a + true + + + + + maven-dependency-plugin + + + + unpack + generate-sources + + unpack-dependencies + + + ${project.groupId} + netty-transport-native-unix-common + ${jni.classifier} + ${unix.common.lib.dir} + META-INF/native/** + false + true + + + + + + + org.fusesource.hawtjni + maven-hawtjni-plugin + + + build-native-lib + + netty_transport_native_kqueue_aarch_64 + ${nativeSourceDirectory} + ${project.build.outputDirectory} + + . + + ${jni.compiler.args.ldflags} + ${jni.compiler.args.cflags} + --host=aarch64-apple-darwin + --libdir=${project.build.directory}/native-build/target/lib + + + + generate + build + + + + + + + maven-jar-plugin + + + + native-jar + + jar + + + + + true + + + META-INF/native/libnetty_transport_native_kqueue_aarch_64.jnilib; osname=MacOSX; processor=aarch_64 + ${javaModuleName} + + true + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + ${jni.classifier} + + + + + + + + + io.netty + netty-transport-native-unix-common + ${project.version} + ${jni.classifier} + + true + + + openbsd diff --git a/transport-native-unix-common/pom.xml b/transport-native-unix-common/pom.xml index 83b2e2a3990..59b483b1436 100644 --- a/transport-native-unix-common/pom.xml +++ b/transport-native-unix-common/pom.xml @@ -169,6 +169,75 @@ + + mac-m1-cross-compile + + clang + darwin + + ${os.detected.name}-aarch_64 + + + + + maven-antrun-plugin + + + + native-jar + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + build-native-lib + generate-sources + + run + + + + + + + + + + + + + + + + + + + + + linux From 1c9248ba3eda0668092072e0eef25ffc2b3e9afc Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 8 Sep 2021 14:33:42 +0200 Subject: [PATCH 2/2] Fix --- resolver-dns-native-macos/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resolver-dns-native-macos/pom.xml b/resolver-dns-native-macos/pom.xml index 97a5589cdfc..7a6c93b227b 100644 --- a/resolver-dns-native-macos/pom.xml +++ b/resolver-dns-native-macos/pom.xml @@ -174,7 +174,7 @@ build-native-lib - netty_resolver_dns_native_macos_${os.detected.arch} + netty_resolver_dns_native_macos_aarch_64 ${project.basedir}/src/main/c ${project.build.outputDirectory}