.
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -9,6 +9,10 @@ node_modules/
|
|||||||
nostr-tools/
|
nostr-tools/
|
||||||
tiny-AES-c/
|
tiny-AES-c/
|
||||||
mbedtls/
|
mbedtls/
|
||||||
|
|
||||||
|
# Auto-generated version files
|
||||||
|
nostr_core/version.h
|
||||||
|
nostr_core/version.c
|
||||||
mbedtls-arm64-install/
|
mbedtls-arm64-install/
|
||||||
mbedtls-install/
|
mbedtls-install/
|
||||||
secp256k1/
|
secp256k1/
|
||||||
@@ -22,4 +26,4 @@ node_modules/
|
|||||||
*.dll
|
*.dll
|
||||||
build/
|
build/
|
||||||
mbedtls-install/
|
mbedtls-install/
|
||||||
mbedtls-arm64-install/
|
mbedtls-arm64-install/
|
||||||
|
|||||||
223
AUTOMATIC_VERSIONING.md
Normal file
223
AUTOMATIC_VERSIONING.md
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
# NOSTR Core Library - Automatic Versioning System
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The NOSTR Core Library now features an automatic version increment system that automatically increments the patch version (e.g., v0.2.0 → v0.2.1) with each build. This ensures consistent versioning and traceability across builds.
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
### Version Format
|
||||||
|
The library uses semantic versioning with the format: `vMAJOR.MINOR.PATCH`
|
||||||
|
|
||||||
|
- **MAJOR**: Incremented for breaking changes (manual)
|
||||||
|
- **MINOR**: Incremented for new features (manual)
|
||||||
|
- **PATCH**: Incremented automatically with each build
|
||||||
|
|
||||||
|
### Automatic Increment Process
|
||||||
|
|
||||||
|
1. **Version Detection**: The build system scans all git tags matching `v*.*.*` pattern
|
||||||
|
2. **Highest Version**: Uses `sort -V` to find the numerically highest version (not chronologically latest)
|
||||||
|
3. **Patch Increment**: Increments the patch number by 1
|
||||||
|
4. **Git Tag Creation**: Creates a new git tag for the incremented version
|
||||||
|
5. **File Generation**: Generates `nostr_core/version.h` and `nostr_core/version.c` with build metadata
|
||||||
|
|
||||||
|
### Generated Files
|
||||||
|
|
||||||
|
The system automatically generates two files during each build:
|
||||||
|
|
||||||
|
#### `nostr_core/version.h`
|
||||||
|
```c
|
||||||
|
#define VERSION_MAJOR 0
|
||||||
|
#define VERSION_MINOR 2
|
||||||
|
#define VERSION_PATCH 1
|
||||||
|
#define VERSION_STRING "0.2.1"
|
||||||
|
#define VERSION_TAG "v0.2.1"
|
||||||
|
|
||||||
|
#define BUILD_DATE "2025-08-09"
|
||||||
|
#define BUILD_TIME "10:42:45"
|
||||||
|
#define BUILD_TIMESTAMP "2025-08-09 10:42:45"
|
||||||
|
|
||||||
|
#define GIT_HASH "ca6b475"
|
||||||
|
#define GIT_BRANCH "master"
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `nostr_core/version.c`
|
||||||
|
Contains the implementation of the version API functions.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Building with Auto-Versioning
|
||||||
|
|
||||||
|
All major build targets automatically increment the version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build static library (increments version)
|
||||||
|
./build.sh lib
|
||||||
|
|
||||||
|
# Build shared library (increments version)
|
||||||
|
./build.sh shared
|
||||||
|
|
||||||
|
# Build all libraries (increments version)
|
||||||
|
./build.sh all
|
||||||
|
|
||||||
|
# Build examples (increments version)
|
||||||
|
./build.sh examples
|
||||||
|
|
||||||
|
# Install to system (increments version)
|
||||||
|
./build.sh install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Non-Versioned Builds
|
||||||
|
|
||||||
|
Some targets do not increment versions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clean build artifacts (no version increment)
|
||||||
|
./build.sh clean
|
||||||
|
|
||||||
|
# Run tests (no version increment)
|
||||||
|
./build.sh test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using Version Information in Code
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
// Get version string
|
||||||
|
printf("Version: %s\n", nostr_core_get_version());
|
||||||
|
|
||||||
|
// Get full version with timestamp and commit
|
||||||
|
printf("Full: %s\n", nostr_core_get_version_full());
|
||||||
|
|
||||||
|
// Get detailed build information
|
||||||
|
printf("Build: %s\n", nostr_core_get_build_info());
|
||||||
|
|
||||||
|
// Use version macros
|
||||||
|
#if VERSION_MAJOR >= 1
|
||||||
|
// Use new API
|
||||||
|
#else
|
||||||
|
// Use legacy API
|
||||||
|
#endif
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing Version System
|
||||||
|
|
||||||
|
A version test example is provided:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build and run version test
|
||||||
|
gcc -I. -Inostr_core examples/version_test.c -o examples/version_test ./libnostr_core.a ./secp256k1/.libs/libsecp256k1.a -lm
|
||||||
|
./examples/version_test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version History Tracking
|
||||||
|
|
||||||
|
### View All Versions
|
||||||
|
```bash
|
||||||
|
# List all version tags
|
||||||
|
git tag --list
|
||||||
|
|
||||||
|
# View version history
|
||||||
|
git log --oneline --decorate --graph
|
||||||
|
```
|
||||||
|
|
||||||
|
### Current Version
|
||||||
|
```bash
|
||||||
|
# Check current version
|
||||||
|
cat VERSION
|
||||||
|
|
||||||
|
# Or check the latest git tag
|
||||||
|
git describe --tags --abbrev=0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Manual Version Management
|
||||||
|
|
||||||
|
### Major/Minor Version Bumps
|
||||||
|
|
||||||
|
For major or minor version changes, manually create the appropriate tag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# For a minor version bump (new features)
|
||||||
|
git tag v0.3.0
|
||||||
|
|
||||||
|
# For a major version bump (breaking changes)
|
||||||
|
git tag v1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
The next build will automatically increment from the new base version.
|
||||||
|
|
||||||
|
### Resetting Version
|
||||||
|
|
||||||
|
To reset or fix version numbering:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Delete incorrect tags (if needed)
|
||||||
|
git tag -d v0.2.1
|
||||||
|
git push origin --delete v0.2.1
|
||||||
|
|
||||||
|
# Create correct base version
|
||||||
|
git tag v0.2.0
|
||||||
|
|
||||||
|
# Next build will create v0.2.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integration Notes
|
||||||
|
|
||||||
|
### Makefile Integration
|
||||||
|
- The `version.c` file is automatically included in `LIB_SOURCES`
|
||||||
|
- Version files are compiled and linked with the library
|
||||||
|
- Clean targets remove generated version object files
|
||||||
|
|
||||||
|
### Git Integration
|
||||||
|
- Version files (`version.h`, `version.c`) are excluded from git via `.gitignore`
|
||||||
|
- Only version tags and the `VERSION` file are tracked
|
||||||
|
- Build system works in any git repository with version tags
|
||||||
|
|
||||||
|
### Build System Integration
|
||||||
|
- Version increment is integrated directly into `build.sh`
|
||||||
|
- No separate scripts or external dependencies required
|
||||||
|
- Self-contained and portable across systems
|
||||||
|
|
||||||
|
## Example Output
|
||||||
|
|
||||||
|
When building, you'll see output like:
|
||||||
|
|
||||||
|
```
|
||||||
|
[INFO] Incrementing version...
|
||||||
|
[INFO] Current version: v0.2.0
|
||||||
|
[INFO] New version: v0.2.1
|
||||||
|
[SUCCESS] Created new version tag: v0.2.1
|
||||||
|
[SUCCESS] Generated version.h and version.c
|
||||||
|
[SUCCESS] Updated VERSION file to 0.2.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Version Not Incrementing
|
||||||
|
- Ensure you're in a git repository
|
||||||
|
- Check that git tags exist with `git tag --list`
|
||||||
|
- Verify tag format matches `v*.*.*` pattern
|
||||||
|
|
||||||
|
### Tag Already Exists
|
||||||
|
If a tag already exists, the build will continue with the existing version:
|
||||||
|
|
||||||
|
```
|
||||||
|
[WARNING] Tag v0.2.1 already exists - using existing version
|
||||||
|
```
|
||||||
|
|
||||||
|
### Missing Git Information
|
||||||
|
If git is not available, version files will show "unknown" for git hash and branch.
|
||||||
|
|
||||||
|
## Benefits
|
||||||
|
|
||||||
|
1. **Automatic Traceability**: Every build has a unique version
|
||||||
|
2. **Build Metadata**: Includes timestamp, git commit, and branch information
|
||||||
|
3. **API Integration**: Version information accessible via C API
|
||||||
|
4. **Zero Maintenance**: No manual version file editing required
|
||||||
|
5. **Git Integration**: Automatic git tag creation for version history
|
||||||
2
Makefile
2
Makefile
@@ -17,7 +17,7 @@ endif
|
|||||||
INCLUDES = -I. -Inostr_core -Icjson -Isecp256k1/include
|
INCLUDES = -I. -Inostr_core -Icjson -Isecp256k1/include
|
||||||
|
|
||||||
# Library source files
|
# 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 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 cjson/cJSON.c
|
||||||
LIB_OBJECTS = $(LIB_SOURCES:.c=.o)
|
LIB_OBJECTS = $(LIB_SOURCES:.c=.o)
|
||||||
ARM64_LIB_OBJECTS = $(LIB_SOURCES:.c=.arm64.o)
|
ARM64_LIB_OBJECTS = $(LIB_SOURCES:.c=.arm64.o)
|
||||||
|
|
||||||
|
|||||||
122
VERSIONING.md
122
VERSIONING.md
@@ -1,122 +0,0 @@
|
|||||||
# Version Management System
|
|
||||||
|
|
||||||
This project implements an automated version management system for C applications with auto-incrementing build numbers.
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The version management system consists of:
|
|
||||||
- **Semantic versioning** (Major.Minor.Patch) in `VERSION` file
|
|
||||||
- **Auto-incrementing build numbers** in `.build_number` file
|
|
||||||
- **Generated version header** (`version.h`) with all version info
|
|
||||||
- **Build-time integration** via `scripts/generate_version.sh`
|
|
||||||
|
|
||||||
## Files
|
|
||||||
|
|
||||||
### Core Files
|
|
||||||
- `VERSION` - Contains semantic version (e.g., "1.0.0")
|
|
||||||
- `.build_number` - Contains current build number (auto-incremented)
|
|
||||||
- `scripts/generate_version.sh` - Version generation script
|
|
||||||
- `version.h` - Generated header (auto-created, do not edit)
|
|
||||||
|
|
||||||
### Integration Files
|
|
||||||
- `build.sh` - Modified to call version generation
|
|
||||||
- `.gitignore` - Excludes generated `version.h`
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Building
|
|
||||||
Every time you run `./build.sh`, the build number automatically increments:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./build.sh # Build #1
|
|
||||||
./build.sh # Build #2
|
|
||||||
./build.sh # Build #3
|
|
||||||
```
|
|
||||||
|
|
||||||
### Version Display
|
|
||||||
The application shows version information in multiple ways:
|
|
||||||
|
|
||||||
**Command Line:**
|
|
||||||
```bash
|
|
||||||
./build/c_nostr --version
|
|
||||||
./build/c_nostr -v
|
|
||||||
```
|
|
||||||
|
|
||||||
**Interactive Mode:**
|
|
||||||
- ASCII art title with version
|
|
||||||
- Header shows: `NOSTR TERMINAL v1.0.0 (Build #3, 2025-07-21)`
|
|
||||||
|
|
||||||
### Updating Semantic Version
|
|
||||||
To update the major/minor/patch version:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
echo "1.1.0" > VERSION
|
|
||||||
```
|
|
||||||
|
|
||||||
The next build will be `v1.1.0 (Build #4)`.
|
|
||||||
|
|
||||||
## Generated Macros
|
|
||||||
|
|
||||||
The `version.h` file contains these macros:
|
|
||||||
|
|
||||||
```c
|
|
||||||
#define VERSION_MAJOR 1
|
|
||||||
#define VERSION_MINOR 0
|
|
||||||
#define VERSION_PATCH 0
|
|
||||||
#define VERSION_BUILD 3
|
|
||||||
#define VERSION_STRING "1.0.0"
|
|
||||||
#define VERSION_FULL "1.0.0.3"
|
|
||||||
#define BUILD_NUMBER 3
|
|
||||||
#define BUILD_DATE "2025-07-21"
|
|
||||||
#define BUILD_TIME "14:53:32"
|
|
||||||
#define BUILD_TIMESTAMP "2025-07-21 14:53:32"
|
|
||||||
#define GIT_HASH ""
|
|
||||||
#define GIT_BRANCH ""
|
|
||||||
#define VERSION_DISPLAY "v1.0.0 (Build #3)"
|
|
||||||
#define VERSION_FULL_DISPLAY "v1.0.0 (Build #3, 2025-07-21)"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Integration in Code
|
|
||||||
|
|
||||||
Include the version header:
|
|
||||||
```c
|
|
||||||
#include "version.h"
|
|
||||||
```
|
|
||||||
|
|
||||||
Use version macros:
|
|
||||||
```c
|
|
||||||
printf("NOSTR TERMINAL %s\n", VERSION_FULL_DISPLAY);
|
|
||||||
printf("Built: %s\n", BUILD_TIMESTAMP);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
1. **Never edit `version.h`** - it's auto-generated
|
|
||||||
2. **Commit `.build_number`** - tracks build history
|
|
||||||
3. **Update `VERSION` manually** - for semantic version changes
|
|
||||||
4. **Build increments automatically** - no manual intervention needed
|
|
||||||
|
|
||||||
## Version History
|
|
||||||
|
|
||||||
Build numbers are persistent and increment across sessions:
|
|
||||||
- Build #1: Initial implementation
|
|
||||||
- Build #2: First rebuild test
|
|
||||||
- Build #3: Added --version flag
|
|
||||||
- Build #4: Next build...
|
|
||||||
|
|
||||||
## ASCII Art Integration
|
|
||||||
|
|
||||||
The version system integrates with the ASCII art title display:
|
|
||||||
|
|
||||||
```
|
|
||||||
███ ██ ██████ ███████ ████████ ███████ ██████
|
|
||||||
████ ██ ██ ██ ██ ██ ██ ██ ██
|
|
||||||
██ ██ ██ ██ ██ ███████ ██ █████ ██████
|
|
||||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
||||||
██ ████ ███████ ██████ ███████ ███████ ██ ███████ ██ ██
|
|
||||||
|
|
||||||
NOSTR TERMINAL v1.0.0 (Build #3, 2025-07-21) - user_abc123
|
|
||||||
================================================================
|
|
||||||
```
|
|
||||||
|
|
||||||
This provides a professional, branded experience with clear version identification.
|
|
||||||
117
build.sh
117
build.sh
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# NOSTR Core Library Build Script
|
# NOSTR Core Library Build Script
|
||||||
# Provides convenient build targets for the standalone library
|
# Provides convenient build targets for the standalone library
|
||||||
|
# Automatically increments patch version with each build
|
||||||
|
|
||||||
set -e # Exit on any error
|
set -e # Exit on any error
|
||||||
|
|
||||||
@@ -29,6 +30,117 @@ print_error() {
|
|||||||
echo -e "${RED}[ERROR]${NC} $1"
|
echo -e "${RED}[ERROR]${NC} $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to automatically increment version
|
||||||
|
increment_version() {
|
||||||
|
print_status "Incrementing version..."
|
||||||
|
|
||||||
|
# Check if we're in a git repository
|
||||||
|
if ! git rev-parse --git-dir > /dev/null 2>&1; then
|
||||||
|
print_warning "Not in a git repository - skipping version increment"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the highest version tag (not necessarily the most recent chronologically)
|
||||||
|
LATEST_TAG=$(git tag -l 'v*.*.*' | sort -V | tail -n 1 || echo "v0.1.0")
|
||||||
|
if [[ -z "$LATEST_TAG" ]]; then
|
||||||
|
LATEST_TAG="v0.1.0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract version components (remove 'v' prefix if present)
|
||||||
|
VERSION=${LATEST_TAG#v}
|
||||||
|
|
||||||
|
# Parse major.minor.patch
|
||||||
|
if [[ $VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||||
|
MAJOR=${BASH_REMATCH[1]}
|
||||||
|
MINOR=${BASH_REMATCH[2]}
|
||||||
|
PATCH=${BASH_REMATCH[3]}
|
||||||
|
else
|
||||||
|
print_error "Invalid version format in tag: $LATEST_TAG"
|
||||||
|
print_error "Expected format: v0.1.0"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increment patch version
|
||||||
|
NEW_PATCH=$((PATCH + 1))
|
||||||
|
NEW_VERSION="v${MAJOR}.${MINOR}.${NEW_PATCH}"
|
||||||
|
|
||||||
|
print_status "Current version: $LATEST_TAG"
|
||||||
|
print_status "New version: $NEW_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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update VERSION file for compatibility
|
||||||
|
echo "${NEW_VERSION#v}" > VERSION
|
||||||
|
print_success "Updated VERSION file to ${NEW_VERSION#v}"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show usage
|
# Function to show usage
|
||||||
show_usage() {
|
show_usage() {
|
||||||
echo "NOSTR Core Library Build Script"
|
echo "NOSTR Core Library Build Script"
|
||||||
@@ -64,6 +176,7 @@ case "$TARGET" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
lib|library)
|
lib|library)
|
||||||
|
increment_version
|
||||||
print_status "Building static library..."
|
print_status "Building static library..."
|
||||||
make clean
|
make clean
|
||||||
make
|
make
|
||||||
@@ -78,6 +191,7 @@ case "$TARGET" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
shared)
|
shared)
|
||||||
|
increment_version
|
||||||
print_status "Building shared library..."
|
print_status "Building shared library..."
|
||||||
make clean
|
make clean
|
||||||
make libnostr_core.so
|
make libnostr_core.so
|
||||||
@@ -92,6 +206,7 @@ case "$TARGET" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
all)
|
all)
|
||||||
|
increment_version
|
||||||
print_status "Building all libraries..."
|
print_status "Building all libraries..."
|
||||||
make clean
|
make clean
|
||||||
make all
|
make all
|
||||||
@@ -100,6 +215,7 @@ case "$TARGET" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
examples)
|
examples)
|
||||||
|
increment_version
|
||||||
print_status "Building examples..."
|
print_status "Building examples..."
|
||||||
make clean
|
make clean
|
||||||
make
|
make
|
||||||
@@ -135,6 +251,7 @@ case "$TARGET" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
install)
|
install)
|
||||||
|
increment_version
|
||||||
print_status "Installing library to system..."
|
print_status "Installing library to system..."
|
||||||
make clean
|
make clean
|
||||||
make all
|
make all
|
||||||
|
|||||||
Binary file not shown.
34
examples/version_test.c
Normal file
34
examples/version_test.c
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* NOSTR Core Library - Version Test Example
|
||||||
|
* Demonstrates the automatic version increment system
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "nostr_core.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
libnostr_core.a
BIN
libnostr_core.a
Binary file not shown.
@@ -346,9 +346,11 @@ int nostr_add_proof_of_work(cJSON* event, const unsigned char* private_key,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =============================================================================
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// RELAY COMMUNICATION
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// =============================================================================
|
// RELAYS - SYNCHRONOUS MULTI-RELAY QUERIES AND PUBLISHING
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query a relay for a specific event
|
* Query a relay for a specific event
|
||||||
@@ -361,10 +363,6 @@ int nostr_add_proof_of_work(cJSON* event, const unsigned char* private_key,
|
|||||||
cJSON* nostr_query_relay_for_event(const char* relay_url, const char* pubkey_hex, int kind);
|
cJSON* nostr_query_relay_for_event(const char* relay_url, const char* pubkey_hex, int kind);
|
||||||
|
|
||||||
|
|
||||||
// =============================================================================
|
|
||||||
// SYNCHRONOUS MULTI-RELAY QUERIES AND PUBLISHING
|
|
||||||
// =============================================================================
|
|
||||||
|
|
||||||
// Query mode enum
|
// Query mode enum
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RELAY_QUERY_FIRST_RESULT, // Return as soon as first event is found
|
RELAY_QUERY_FIRST_RESULT, // Return as soon as first event is found
|
||||||
@@ -448,9 +446,15 @@ publish_result_t* synchronous_publish_event_with_progress(
|
|||||||
void* user_data
|
void* user_data
|
||||||
);
|
);
|
||||||
|
|
||||||
// =============================================================================
|
|
||||||
// RELAY POOL MANAGEMENT
|
|
||||||
// =============================================================================
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// RELAYS - ASYNCHRONOUS RELAY POOLS
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Forward declarations for relay pool types
|
// Forward declarations for relay pool types
|
||||||
typedef struct nostr_relay_pool nostr_relay_pool_t;
|
typedef struct nostr_relay_pool nostr_relay_pool_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user