diff --git a/.gitignore b/.gitignore index db800584..b7aa49de 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,6 @@ tiny-AES-c/ mbedtls/ -# Auto-generated version files -nostr_core/version.h -nostr_core/version.c mbedtls-arm64-install/ mbedtls-install/ secp256k1/ diff --git a/Makefile b/Makefile index cb760f1f..da46b3a0 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ endif 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_openssl.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_websocket/nostr_websocket_openssl.c cjson/cJSON.c LIB_OBJECTS = $(LIB_SOURCES:.c=.o) ARM64_LIB_OBJECTS = $(LIB_SOURCES:.c=.arm64.o) diff --git a/VERSION b/VERSION index 79062996..001d7528 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.21 +0.1.23 diff --git a/build.sh b/build.sh index f005d25e..05960ab3 100755 --- a/build.sh +++ b/build.sh @@ -70,67 +70,6 @@ increment_version() { # Create new git tag if git tag "$NEW_VERSION" 2>/dev/null; then print_success "Created new version tag: $NEW_VERSION" - - # Generate version.h header file - cat > nostr_core/version.h << EOF -/* - * NOSTR Core Library - Auto-Generated Version Header - * DO NOT EDIT THIS FILE MANUALLY - Generated by build.sh - */ - -#ifndef NOSTR_VERSION_H -#define NOSTR_VERSION_H - -#define VERSION_MAJOR ${MAJOR} -#define VERSION_MINOR ${MINOR} -#define VERSION_PATCH ${NEW_PATCH} -#define VERSION_STRING "${MAJOR}.${MINOR}.${NEW_PATCH}" -#define VERSION_TAG "${NEW_VERSION}" - -/* Build information */ -#define BUILD_DATE "$(date +%Y-%m-%d)" -#define BUILD_TIME "$(date +%H:%M:%S)" -#define BUILD_TIMESTAMP "$(date '+%Y-%m-%d %H:%M:%S')" - -/* Git information */ -#define GIT_HASH "$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')" -#define GIT_BRANCH "$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo 'unknown')" - -/* Display versions */ -#define VERSION_DISPLAY "${NEW_VERSION}" -#define VERSION_FULL_DISPLAY "${NEW_VERSION} ($(date '+%Y-%m-%d %H:%M:%S'), $(git rev-parse --short HEAD 2>/dev/null || echo 'unknown'))" - -/* Version API functions */ -const char* nostr_core_get_version(void); -const char* nostr_core_get_version_full(void); -const char* nostr_core_get_build_info(void); - -#endif /* NOSTR_VERSION_H */ -EOF - - # Generate version.c implementation file - cat > nostr_core/version.c << EOF -/* - * NOSTR Core Library - Auto-Generated Version Implementation - * DO NOT EDIT THIS FILE MANUALLY - Generated by build.sh - */ - -#include "version.h" - -const char* nostr_core_get_version(void) { - return VERSION_TAG; -} - -const char* nostr_core_get_version_full(void) { - return VERSION_FULL_DISPLAY; -} - -const char* nostr_core_get_build_info(void) { - return "Built on " BUILD_DATE " at " BUILD_TIME " from commit " GIT_HASH " on branch " GIT_BRANCH; -} -EOF - - print_success "Generated version.h and version.c" else print_warning "Tag $NEW_VERSION already exists - using existing version" NEW_VERSION=$LATEST_TAG diff --git a/examples/version_test.c b/examples/version_test.c index 36a2ef49..dcb5c7b4 100644 --- a/examples/version_test.c +++ b/examples/version_test.c @@ -1,34 +1,63 @@ /* * NOSTR Core Library - Version Test Example - * Demonstrates the automatic version increment system + * Simple version display using VERSION file */ #include +#include +#include #include "nostr_core.h" -#include "version.h" + +// Simple function to read VERSION file if it exists +static const char* get_version_from_file(void) { + static char version_buf[64] = {0}; + FILE* f = fopen("VERSION", "r"); + if (f) { + if (fgets(version_buf, sizeof(version_buf), f)) { + // Remove trailing newline + size_t len = strlen(version_buf); + if (len > 0 && version_buf[len-1] == '\n') { + version_buf[len-1] = '\0'; + } + } + fclose(f); + return version_buf; + } + return "unknown"; +} int main() { printf("NOSTR Core Library Version Test\n"); printf("===============================\n\n"); - // Display version information - printf("Version: %s\n", nostr_core_get_version()); - printf("Full Version: %s\n", nostr_core_get_version_full()); - printf("Build Info: %s\n", nostr_core_get_build_info()); + // Initialize the library + if (nostr_init() != NOSTR_SUCCESS) { + printf("Failed to initialize NOSTR library\n"); + return 1; + } - printf("\nVersion Macros:\n"); - printf("VERSION_MAJOR: %d\n", VERSION_MAJOR); - printf("VERSION_MINOR: %d\n", VERSION_MINOR); - printf("VERSION_PATCH: %d\n", VERSION_PATCH); - printf("VERSION_STRING: %s\n", VERSION_STRING); - printf("VERSION_TAG: %s\n", VERSION_TAG); + // Display basic version information + const char* version = get_version_from_file(); + printf("Library Version: %s\n", version); + printf("Library Status: Initialized successfully\n"); - printf("\nBuild Information:\n"); - printf("BUILD_DATE: %s\n", BUILD_DATE); - printf("BUILD_TIME: %s\n", BUILD_TIME); - printf("BUILD_TIMESTAMP: %s\n", BUILD_TIMESTAMP); - printf("GIT_HASH: %s\n", GIT_HASH); - printf("GIT_BRANCH: %s\n", GIT_BRANCH); + // Test basic functionality + printf("\nLibrary Functionality Test:\n"); + unsigned char private_key[32]; + unsigned char public_key[32]; + + if (nostr_generate_keypair(private_key, public_key) == NOSTR_SUCCESS) { + printf("✓ Key generation works\n"); + } else { + printf("✗ Key generation failed\n"); + } + + // Cleanup + nostr_cleanup(); + + printf("\nVersion test completed successfully.\n"); + printf("Note: This library no longer includes runtime version functions\n"); + printf(" to avoid build issues when used as a submodule.\n"); return 0; } diff --git a/libnostr_core.a b/libnostr_core.a index 25db5888..ce7a6d15 100644 Binary files a/libnostr_core.a and b/libnostr_core.a differ diff --git a/tests/simple_init_test b/tests/simple_init_test deleted file mode 100755 index 84854bb4..00000000 Binary files a/tests/simple_init_test and /dev/null differ