-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild-native.sh
More file actions
executable file
·69 lines (53 loc) · 1.88 KB
/
Copy pathbuild-native.sh
File metadata and controls
executable file
·69 lines (53 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -euo pipefail
#
# Builds netty-tcnative openssl-dynamic against the system's OpenSSL.
# Outputs the platform-classified JAR to a specified directory.
#
# Usage: build-native.sh <repo-url> <tag> <output-dir>
#
# The output JAR will be named: netty-tcnative-<arch>.jar
# where <arch> is detected from the build (e.g., linux-x86_64, linux-aarch_64)
#
REPO_URL="$1"
TAG="$2"
OUTPUT_DIR="$3"
CLONE_DIR="$(mktemp -d)/netty-tcnative"
mkdir -p "${OUTPUT_DIR}"
echo "=== System info ==="
echo "OpenSSL: $(openssl version)"
echo "Arch: $(uname -m)"
echo "OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2)"
echo ""
echo "=== Cloning netty-tcnative at tag ${TAG} ==="
git clone --depth 1 --branch "${TAG}" "${REPO_URL}" "${CLONE_DIR}"
echo "=== Building openssl-dynamic ==="
mvn -f "${CLONE_DIR}" install \
-pl openssl-dynamic \
-am \
-DskipTests \
-Dmaven.javadoc.skip=true
echo "=== Collecting build output ==="
# Find the platform-classified JAR (e.g., netty-tcnative-2.0.76.Final-linux-x86_64.jar)
NATIVE_JAR=$(find "${CLONE_DIR}/openssl-dynamic/target" \
-name "netty-tcnative-*-linux-*.jar" \
! -name "*-sources.jar" \
! -name "*-javadoc.jar" \
| head -1)
if [ -z "${NATIVE_JAR}" ]; then
echo "ERROR: Could not find built native JAR"
exit 1
fi
# Extract the classifier from the filename (e.g., linux-x86_64 or linux-x86_64-fedora)
CLASSIFIER=$(basename "${NATIVE_JAR}" | sed -E "s/netty-tcnative-[^-]+-//; s/\.jar//")
echo "Native JAR: ${NATIVE_JAR}"
echo "Classifier: ${CLASSIFIER}"
cp "${NATIVE_JAR}" "${OUTPUT_DIR}/netty-tcnative-${CLASSIFIER}.jar"
# Also copy the sources JAR (same for all platforms)
SOURCES_JAR=$(find "${CLONE_DIR}/openssl-dynamic/target" -name "*-sources.jar" | head -1)
if [ -n "${SOURCES_JAR}" ]; then
cp "${SOURCES_JAR}" "${OUTPUT_DIR}/sources.jar"
fi
echo ""
echo "=== Done ==="
echo "Output: ${OUTPUT_DIR}/netty-tcnative-${CLASSIFIER}.jar"