v0.0.10 - Fix ARM64 static release build via buildx/QEMU and arch-aware nostr_core linking
This commit is contained in:
@@ -46,7 +46,10 @@ RUN cd /tmp && \
|
|||||||
|
|
||||||
# Copy and build nostr_core_lib from project resources
|
# Copy and build nostr_core_lib from project resources
|
||||||
COPY resources/nostr_core_lib /build/nostr_core_lib/
|
COPY resources/nostr_core_lib /build/nostr_core_lib/
|
||||||
RUN cd /build/nostr_core_lib && \
|
RUN if [ "$(uname -m)" = "aarch64" ] && ! command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then \
|
||||||
|
ln -s "$(command -v gcc)" /usr/local/bin/aarch64-linux-gnu-gcc; \
|
||||||
|
fi && \
|
||||||
|
cd /build/nostr_core_lib && \
|
||||||
chmod +x ./build.sh && \
|
chmod +x ./build.sh && \
|
||||||
./build.sh --nips=1,4,6,19,44
|
./build.sh --nips=1,4,6,19,44
|
||||||
|
|
||||||
@@ -54,26 +57,33 @@ RUN cd /build/nostr_core_lib && \
|
|||||||
COPY src/ /build/src/
|
COPY src/ /build/src/
|
||||||
|
|
||||||
# Build nsigner as a fully static binary
|
# Build nsigner as a fully static binary
|
||||||
RUN gcc -static -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -s -Wall -Wextra -std=c99 \
|
RUN ARCH="$(uname -m)"; \
|
||||||
-I/build/nostr_core_lib \
|
case "$ARCH" in \
|
||||||
-I/build/nostr_core_lib/nostr_core \
|
aarch64|arm64) NOSTR_LIB="/build/nostr_core_lib/libnostr_core_arm64.a" ;; \
|
||||||
-I/build/nostr_core_lib/cjson \
|
x86_64|amd64) NOSTR_LIB="/build/nostr_core_lib/libnostr_core_x64.a" ;; \
|
||||||
/build/src/main.c \
|
*) echo "Unsupported build arch: $ARCH"; exit 1 ;; \
|
||||||
/build/src/secure_mem.c \
|
esac; \
|
||||||
/build/src/mnemonic.c \
|
[ -f "$NOSTR_LIB" ] || { echo "Missing nostr core lib: $NOSTR_LIB"; ls -la /build/nostr_core_lib; exit 1; }; \
|
||||||
/build/src/role_table.c \
|
gcc -static -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -s -Wall -Wextra -std=c99 \
|
||||||
/build/src/selector.c \
|
-I/build/nostr_core_lib \
|
||||||
/build/src/enforcement.c \
|
-I/build/nostr_core_lib/nostr_core \
|
||||||
/build/src/dispatcher.c \
|
-I/build/nostr_core_lib/cjson \
|
||||||
/build/src/policy.c \
|
/build/src/main.c \
|
||||||
/build/src/server.c \
|
/build/src/secure_mem.c \
|
||||||
/build/src/transport_frame.c \
|
/build/src/mnemonic.c \
|
||||||
/build/src/key_store.c \
|
/build/src/role_table.c \
|
||||||
/build/src/socket_name.c \
|
/build/src/selector.c \
|
||||||
/build/nostr_core_lib/libnostr_core_x64.a \
|
/build/src/enforcement.c \
|
||||||
-o /build/nsigner_static \
|
/build/src/dispatcher.c \
|
||||||
$(pkg-config --static --libs libcurl openssl) \
|
/build/src/policy.c \
|
||||||
-lsecp256k1 -lsqlite3 -lz -lpthread -lm
|
/build/src/server.c \
|
||||||
|
/build/src/transport_frame.c \
|
||||||
|
/build/src/key_store.c \
|
||||||
|
/build/src/socket_name.c \
|
||||||
|
"$NOSTR_LIB" \
|
||||||
|
-o /build/nsigner_static \
|
||||||
|
$(pkg-config --static --libs libcurl openssl) \
|
||||||
|
-lsecp256k1 -lsqlite3 -lz -lpthread -lm
|
||||||
|
|
||||||
RUN strip /build/nsigner_static || true
|
RUN strip /build/nsigner_static || true
|
||||||
RUN file /build/nsigner_static && \
|
RUN file /build/nsigner_static && \
|
||||||
|
|||||||
@@ -105,12 +105,29 @@ echo "Platform: $PLATFORM"
|
|||||||
echo "Output: $BUILD_DIR/$OUTPUT_NAME"
|
echo "Output: $BUILD_DIR/$OUTPUT_NAME"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
if [ "$ARCH" != "$HOST_ARCH" ]; then
|
||||||
|
echo "[0/3] Preparing buildx + QEMU for cross-architecture build"
|
||||||
|
if ! docker buildx inspect >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: docker buildx is not available"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
docker run --privileged --rm tonistiigi/binfmt --install all >/dev/null
|
||||||
|
|
||||||
|
if ! docker buildx inspect nsigner-builder >/dev/null 2>&1; then
|
||||||
|
docker buildx create --name nsigner-builder --driver docker-container --use >/dev/null
|
||||||
|
else
|
||||||
|
docker buildx use nsigner-builder >/dev/null
|
||||||
|
fi
|
||||||
|
docker buildx inspect --bootstrap >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[1/3] Building builder stage from project root context"
|
echo "[1/3] Building builder stage from project root context"
|
||||||
docker build \
|
docker buildx build \
|
||||||
--platform "$PLATFORM" \
|
--platform "$PLATFORM" \
|
||||||
--target builder \
|
--target builder \
|
||||||
-f "$DOCKERFILE" \
|
-f "$DOCKERFILE" \
|
||||||
-t "$IMAGE_TAG" \
|
-t "$IMAGE_TAG" \
|
||||||
|
--load \
|
||||||
"$SCRIPT_DIR"
|
"$SCRIPT_DIR"
|
||||||
|
|
||||||
echo "[2/3] Extracting static binary"
|
echo "[2/3] Extracting static binary"
|
||||||
|
|||||||
@@ -451,8 +451,8 @@ int socket_name_random(char *out, size_t out_len);
|
|||||||
/* Version information (auto-updated by build/version tooling) */
|
/* Version information (auto-updated by build/version tooling) */
|
||||||
#define NSIGNER_VERSION_MAJOR 0
|
#define NSIGNER_VERSION_MAJOR 0
|
||||||
#define NSIGNER_VERSION_MINOR 0
|
#define NSIGNER_VERSION_MINOR 0
|
||||||
#define NSIGNER_VERSION_PATCH 9
|
#define NSIGNER_VERSION_PATCH 10
|
||||||
#define NSIGNER_VERSION "v0.0.9"
|
#define NSIGNER_VERSION "v0.0.10"
|
||||||
|
|
||||||
|
|
||||||
/* NSIGNER_HEADERLESS_DECLS_END */
|
/* NSIGNER_HEADERLESS_DECLS_END */
|
||||||
|
|||||||
Reference in New Issue
Block a user