clean up versioning

This commit is contained in:
2025-08-14 16:26:37 -04:00
parent c109c93382
commit 2637378bf0
7 changed files with 49 additions and 84 deletions

View File

@@ -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