Pre-mbedTLS cleanup checkpoint - OpenSSL migration complete, all tests passing
This commit is contained in:
31
Makefile
31
Makefile
@@ -14,10 +14,10 @@ ifneq ($(ENABLE_LOGGING),)
|
||||
endif
|
||||
|
||||
# Include paths
|
||||
INCLUDES = -I. -Inostr_core -Icjson -Isecp256k1/include -Inostr_websocket -Imbedtls/include -Imbedtls/tf-psa-crypto/include -Imbedtls/tf-psa-crypto/drivers/builtin/include
|
||||
INCLUDES = -I. -Inostr_core -Icjson -Isecp256k1/include -Inostr_websocket -I./openssl-install/include
|
||||
|
||||
# Library source files
|
||||
LIB_SOURCES = nostr_core/core.c nostr_core/core_relays.c nostr_core/nostr_crypto.c nostr_core/nostr_secp256k1.c nostr_core/nostr_aes.c nostr_core/nostr_chacha20.c nostr_core/version.c nostr_websocket/nostr_websocket_mbedtls.c cjson/cJSON.c
|
||||
LIB_SOURCES = nostr_core/core.c nostr_core/core_relays.c nostr_core/nostr_crypto.c nostr_core/nostr_secp256k1.c nostr_core/nostr_aes.c nostr_core/nostr_chacha20.c nostr_core/version.c nostr_websocket/nostr_websocket_openssl.c cjson/cJSON.c
|
||||
LIB_OBJECTS = $(LIB_SOURCES:.c=.o)
|
||||
ARM64_LIB_OBJECTS = $(LIB_SOURCES:.c=.arm64.o)
|
||||
|
||||
@@ -43,7 +43,7 @@ default: $(STATIC_LIB) $(ARM64_STATIC_LIB)
|
||||
# Build all targets (static only)
|
||||
all: $(STATIC_LIB) $(ARM64_STATIC_LIB) examples
|
||||
|
||||
# Static library - includes secp256k1 objects for self-contained library
|
||||
# Static library - includes secp256k1 and OpenSSL objects for self-contained library
|
||||
$(STATIC_LIB): $(LIB_OBJECTS) $(SECP256K1_LIB)
|
||||
@echo "Creating self-contained static library: $@"
|
||||
@echo "Extracting secp256k1 objects..."
|
||||
@@ -53,17 +53,21 @@ $(STATIC_LIB): $(LIB_OBJECTS) $(SECP256K1_LIB)
|
||||
echo "Extracting secp256k1_precomputed objects..."; \
|
||||
cd .tmp_secp256k1 && $(AR) x ../$(SECP256K1_PRECOMPUTED_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
|
||||
@echo "Combining all objects into $@..."
|
||||
$(AR) rcs $@ $(LIB_OBJECTS) .tmp_secp256k1/*.o
|
||||
@rm -rf .tmp_secp256k1
|
||||
$(AR) rcs $@ $(LIB_OBJECTS) .tmp_secp256k1/*.o .tmp_openssl/*.o
|
||||
@rm -rf .tmp_secp256k1 .tmp_openssl
|
||||
@echo "Self-contained static library created: $@"
|
||||
|
||||
# ARM64 cross-compilation settings
|
||||
ARM64_CC = aarch64-linux-gnu-gcc
|
||||
ARM64_AR = aarch64-linux-gnu-ar
|
||||
ARM64_INCLUDES = -I. -Inostr_core -Icjson -Isecp256k1/include -Inostr_websocket -Imbedtls/include -Imbedtls/tf-psa-crypto/include -Imbedtls/tf-psa-crypto/drivers/builtin/include
|
||||
ARM64_INCLUDES = -I. -Inostr_core -Icjson -Isecp256k1/include -Inostr_websocket -I./openssl-install/include
|
||||
|
||||
# ARM64 static library - includes secp256k1 objects for self-contained library
|
||||
# ARM64 static library - includes secp256k1 objects for self-contained library (OpenSSL handled separately for cross-compile)
|
||||
$(ARM64_STATIC_LIB): $(ARM64_LIB_OBJECTS) $(SECP256K1_ARM64_LIB)
|
||||
@echo "Creating self-contained ARM64 static library: $@"
|
||||
@echo "Extracting ARM64 secp256k1 objects..."
|
||||
@@ -73,6 +77,7 @@ $(ARM64_STATIC_LIB): $(ARM64_LIB_OBJECTS) $(SECP256K1_ARM64_LIB)
|
||||
echo "Extracting ARM64 secp256k1_precomputed objects..."; \
|
||||
cd .tmp_secp256k1_arm64 && $(ARM64_AR) x ../$(SECP256K1_ARM64_PRECOMPUTED_LIB); \
|
||||
fi
|
||||
@echo "Note: ARM64 users need to link with OpenSSL separately: -lssl -lcrypto"
|
||||
@echo "Combining all ARM64 objects into $@..."
|
||||
$(ARM64_AR) rcs $@ $(ARM64_LIB_OBJECTS) .tmp_secp256k1_arm64/*.o
|
||||
@rm -rf .tmp_secp256k1_arm64
|
||||
@@ -165,7 +170,7 @@ clean:
|
||||
rm -f $(STATIC_LIB) $(ARM64_STATIC_LIB)
|
||||
rm -f $(SECP256K1_ARM64_LIB) $(SECP256K1_ARM64_PRECOMPUTED_LIB)
|
||||
rm -f $(EXAMPLE_TARGETS)
|
||||
rm -rf .tmp_secp256k1 .tmp_secp256k1_arm64
|
||||
rm -rf .tmp_secp256k1 .tmp_secp256k1_arm64 .tmp_openssl
|
||||
rm -rf secp256k1/build_arm64 secp256k1/install_arm64
|
||||
|
||||
# Create distribution package
|
||||
@@ -199,11 +204,11 @@ help:
|
||||
@echo " dist - Create distribution package"
|
||||
@echo " help - Show this help"
|
||||
@echo ""
|
||||
@echo "Library outputs (static only, self-contained with secp256k1):"
|
||||
@echo " $(STATIC_LIB) - x86_64 static library"
|
||||
@echo " $(ARM64_STATIC_LIB) - ARM64 static library"
|
||||
@echo "Library outputs (static only, self-contained):"
|
||||
@echo " $(STATIC_LIB) - x86_64 static library (includes secp256k1 + OpenSSL)"
|
||||
@echo " $(ARM64_STATIC_LIB) - ARM64 static library (includes secp256k1, needs OpenSSL)"
|
||||
@echo ""
|
||||
@echo "Both libraries are self-contained and include secp256k1 objects."
|
||||
@echo "Users only need to link with the library + -lm (no secp256k1 dependency)."
|
||||
@echo "x64 library: Users only need to link with the library + -lm"
|
||||
@echo "ARM64 library: Users need to link with the library + -lssl -lcrypto -lm"
|
||||
|
||||
.PHONY: default all x64 x64-only arm64 arm64-all arm64-only debug examples test test-crypto install uninstall clean dist help
|
||||
|
||||
Reference in New Issue
Block a user