Fully statically linked for both x64 and arm64. Updated build.sh to always compile both versions

This commit is contained in:
2025-08-11 06:54:50 -04:00
parent ae4aa7cf80
commit d257ae49f1
12 changed files with 1526 additions and 59 deletions

View File

@@ -16,6 +16,7 @@ RELAY_POOL_TEST_EXEC = relay_pool_test
EVENT_GEN_TEST_EXEC = test_event_generation
POW_LOOP_TEST_EXEC = test_pow_loop
NIP04_TEST_EXEC = nip04_test
STATIC_LINKING_TEST_EXEC = static_linking_only_test
ARM64_CRYPTO_TEST_EXEC = nostr_crypto_test_arm64
ARM64_CORE_TEST_EXEC = nostr_core_test_arm64
ARM64_RELAY_POOL_TEST_EXEC = relay_pool_test_arm64
@@ -54,6 +55,11 @@ $(NIP04_TEST_EXEC): nip04_test.c
@echo "Building NIP-04 encryption test suite (x86_64)..."
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
# Build static linking test executable (x86_64)
$(STATIC_LINKING_TEST_EXEC): static_linking_only_test.c
@echo "Building static linking verification test (x86_64)..."
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
# Build simple initialization test executable (x86_64)
simple_init_test: simple_init_test.c
@echo "Building simple initialization test program (x86_64)..."
@@ -142,8 +148,13 @@ test-nip04: $(NIP04_TEST_EXEC)
@echo "Running NIP-04 encryption tests (x86_64)..."
./$(NIP04_TEST_EXEC)
# Run static linking verification test (x86_64)
test-static-linking: $(STATIC_LINKING_TEST_EXEC)
@echo "Running static linking verification test (x86_64)..."
./$(STATIC_LINKING_TEST_EXEC)
# Run all test suites (x86_64)
test: test-crypto test-core test-relay-pool test-nip04
test: test-crypto test-core test-relay-pool test-nip04 test-static-linking
# Run crypto tests ARM64 (requires qemu-user-static or ARM64 system)
test-crypto-arm64: $(ARM64_CRYPTO_TEST_EXEC)
@@ -190,7 +201,7 @@ test-all: test test-arm64
# Clean
clean:
@echo "Cleaning test artifacts..."
rm -f $(CRYPTO_TEST_EXEC) $(CORE_TEST_EXEC) $(RELAY_POOL_TEST_EXEC) $(EVENT_GEN_TEST_EXEC) $(POW_LOOP_TEST_EXEC) $(NIP04_TEST_EXEC) $(ARM64_CRYPTO_TEST_EXEC) $(ARM64_CORE_TEST_EXEC) $(ARM64_RELAY_POOL_TEST_EXEC) $(ARM64_NIP04_TEST_EXEC)
rm -f $(CRYPTO_TEST_EXEC) $(CORE_TEST_EXEC) $(RELAY_POOL_TEST_EXEC) $(EVENT_GEN_TEST_EXEC) $(POW_LOOP_TEST_EXEC) $(NIP04_TEST_EXEC) $(STATIC_LINKING_TEST_EXEC) $(ARM64_CRYPTO_TEST_EXEC) $(ARM64_CORE_TEST_EXEC) $(ARM64_RELAY_POOL_TEST_EXEC) $(ARM64_NIP04_TEST_EXEC)
# Help
help:
@@ -198,17 +209,18 @@ help:
@echo "================"
@echo ""
@echo "Available targets:"
@echo " all - Build all test executables (x86_64)"
@echo " all-arch - Build test executables for both x86_64 and ARM64"
@echo " test-crypto - Build and run crypto tests (x86_64)"
@echo " test-core - Build and run core tests (x86_64)"
@echo " test-relay-pool - Build and run relay pool tests (x86_64)"
@echo " test-nip04 - Build and run NIP-04 encryption tests (x86_64)"
@echo " test - Build and run all test suites (x86_64)"
@echo " test-arm64 - Build and run all test suites (ARM64)"
@echo " test-all - Run tests on both architectures"
@echo " clean - Remove test artifacts"
@echo " help - Show this help"
@echo " all - Build all test executables (x86_64)"
@echo " all-arch - Build test executables for both x86_64 and ARM64"
@echo " test-crypto - Build and run crypto tests (x86_64)"
@echo " test-core - Build and run core tests (x86_64)"
@echo " test-relay-pool - Build and run relay pool tests (x86_64)"
@echo " test-nip04 - Build and run NIP-04 encryption tests (x86_64)"
@echo " test-static-linking - Build and run static linking verification test (x86_64)"
@echo " test - Build and run all test suites (x86_64)"
@echo " test-arm64 - Build and run all test suites (ARM64)"
@echo " test-all - Run tests on both architectures"
@echo " clean - Remove test artifacts"
@echo " help - Show this help"
@echo ""
@echo "Test Executables:"
@echo " $(CRYPTO_TEST_EXEC) - x86_64 crypto test binary"
@@ -221,9 +233,10 @@ help:
@echo " $(ARM64_NIP04_TEST_EXEC) - ARM64 NIP-04 encryption test binary"
@echo ""
@echo "Test Coverage:"
@echo " Crypto Tests - Low-level cryptographic primitives (SHA-256, HMAC, secp256k1, BIP39, BIP32)"
@echo " Core Tests - High-level NOSTR functionality with nak compatibility validation"
@echo " Relay Pool Tests - Relay pool event processing with real NOSTR relays"
@echo " NIP-04 Tests - NOSTR NIP-04 encryption/decryption with reference test vectors"
@echo " Crypto Tests - Low-level cryptographic primitives (SHA-256, HMAC, secp256k1, BIP39, BIP32)"
@echo " Core Tests - High-level NOSTR functionality with nak compatibility validation"
@echo " Relay Pool Tests - Relay pool event processing with real NOSTR relays"
@echo " NIP-04 Tests - NOSTR NIP-04 encryption/decryption with reference test vectors"
@echo " Static Linking Tests - Verify library has no external crypto dependencies (self-contained)"
.PHONY: all all-arch test-crypto test-core test-relay-pool test test-crypto-arm64 test-core-arm64 test-relay-pool-arm64 test-arm64 test-all clean help
.PHONY: all all-arch test-crypto test-core test-relay-pool test-nip04 test-static-linking test test-crypto-arm64 test-core-arm64 test-relay-pool-arm64 test-arm64 test-all clean help