.
This commit is contained in:
45
Makefile
45
Makefile
@@ -29,6 +29,13 @@ SECP256K1_PRECOMPUTED_LIB = ./secp256k1/.libs/libsecp256k1_precomputed.a
|
||||
SECP256K1_ARM64_LIB = ./secp256k1/.libs/libsecp256k1_arm64.a
|
||||
SECP256K1_ARM64_PRECOMPUTED_LIB = ./secp256k1/.libs/libsecp256k1_precomputed_arm64.a
|
||||
|
||||
# OpenSSL library paths
|
||||
OPENSSL_LIB_SSL = ./openssl-install/lib64/libssl.a
|
||||
OPENSSL_LIB_CRYPTO = ./openssl-install/lib64/libcrypto.a
|
||||
|
||||
# curl library paths
|
||||
CURL_LIB = ./curl-install/lib/libcurl.a
|
||||
|
||||
# Library outputs (static only)
|
||||
STATIC_LIB = libnostr_core.a
|
||||
ARM64_STATIC_LIB = libnostr_core_arm64.a
|
||||
@@ -58,8 +65,40 @@ $(SECP256K1_LIB): secp256k1/configure
|
||||
fi
|
||||
@echo "x86_64 secp256k1 library built successfully"
|
||||
|
||||
# Build OpenSSL for x86_64
|
||||
$(OPENSSL_LIB_SSL) $(OPENSSL_LIB_CRYPTO): openssl-3.4.2/Configure
|
||||
@echo "Building OpenSSL for x86_64..."
|
||||
@cd openssl-3.4.2 && \
|
||||
if [ ! -f ../openssl-install/lib64/libssl.a ] || [ ! -f ../openssl-install/lib64/libcrypto.a ]; then \
|
||||
echo "Configuring OpenSSL..."; \
|
||||
make distclean >/dev/null 2>&1 || true; \
|
||||
./Configure linux-x86_64 --prefix=$(PWD)/openssl-install --openssldir=$(PWD)/openssl-install/ssl no-shared no-dso; \
|
||||
echo "Building OpenSSL libraries..."; \
|
||||
make -j$(shell nproc 2>/dev/null || echo 4); \
|
||||
make install_sw >/dev/null 2>&1; \
|
||||
else \
|
||||
echo "OpenSSL libraries already exist, skipping build"; \
|
||||
fi
|
||||
@echo "x86_64 OpenSSL libraries built successfully"
|
||||
|
||||
# Build curl for x86_64
|
||||
$(CURL_LIB): curl-8.15.0/curl-8.15.0/configure $(OPENSSL_LIB_SSL)
|
||||
@echo "Building curl for x86_64..."
|
||||
@cd curl-8.15.0/curl-8.15.0 && \
|
||||
if [ ! -f ../../curl-install/lib/libcurl.a ]; then \
|
||||
echo "Configuring curl..."; \
|
||||
make distclean >/dev/null 2>&1 || true; \
|
||||
./configure --prefix=$(PWD)/curl-install --with-openssl=$(PWD)/openssl-install --disable-shared --enable-static --without-libpsl --without-nghttp2 --without-brotli --without-zstd; \
|
||||
echo "Building curl library..."; \
|
||||
make -j$(shell nproc 2>/dev/null || echo 4); \
|
||||
make install >/dev/null 2>&1; \
|
||||
else \
|
||||
echo "curl library already exists, skipping build"; \
|
||||
fi
|
||||
@echo "x86_64 curl library built successfully"
|
||||
|
||||
# Static library - includes secp256k1 and OpenSSL objects for self-contained library
|
||||
$(STATIC_LIB): $(LIB_OBJECTS) $(SECP256K1_LIB)
|
||||
$(STATIC_LIB): $(LIB_OBJECTS) $(SECP256K1_LIB) $(OPENSSL_LIB_SSL) $(OPENSSL_LIB_CRYPTO)
|
||||
@echo "Creating self-contained static library: $@"
|
||||
@echo "Extracting secp256k1 objects..."
|
||||
@mkdir -p .tmp_secp256k1
|
||||
@@ -70,8 +109,8 @@ $(STATIC_LIB): $(LIB_OBJECTS) $(SECP256K1_LIB)
|
||||
fi
|
||||
@echo "Extracting OpenSSL objects..."
|
||||
@mkdir -p .tmp_openssl
|
||||
@cd .tmp_openssl && $(AR) x ../openssl-install/lib64/libssl.a
|
||||
@cd .tmp_openssl && $(AR) x ../openssl-install/lib64/libcrypto.a
|
||||
@cd .tmp_openssl && $(AR) x ../$(OPENSSL_LIB_SSL)
|
||||
@cd .tmp_openssl && $(AR) x ../$(OPENSSL_LIB_CRYPTO)
|
||||
@echo "Combining all objects into $@..."
|
||||
$(AR) rcs $@ $(LIB_OBJECTS) .tmp_secp256k1/*.o .tmp_openssl/*.o
|
||||
@rm -rf .tmp_secp256k1 .tmp_openssl
|
||||
|
||||
Reference in New Issue
Block a user