From 84e2ee5639e76fffd335f42812aef21aee73cdea Mon Sep 17 00:00:00 2001 From: Laan Tungir Date: Sun, 31 Aug 2025 10:43:36 -0400 Subject: [PATCH] Version v0.2.104 - Cleaned up build.sh --- .gitignore | 5 +--- README.md | 8 +----- build.sh | 77 +++++------------------------------------------------- 3 files changed, 8 insertions(+), 82 deletions(-) diff --git a/.gitignore b/.gitignore index 2b900aa..5575209 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,4 @@ pads/ Gemini.md TropicOfCancer-HenryMiller.txt -# Auto-generated version files -src/version.h -src/version.c -VERSION +# Auto-generated files (none currently) diff --git a/README.md b/README.md index 6f57ebc..caa8387 100644 --- a/README.md +++ b/README.md @@ -151,10 +151,7 @@ git tag v1.0.0 # Next build: v1.0.1 - Full version display with metadata ### Generated Files -The build system automatically generates: -- `src/version.h` - Version constants and macros -- `src/version.c` - Version API functions -- `VERSION` - Plain text version number +The build system automatically manages Git versioning by incrementing tags. These files are excluded from git (.gitignore) and regenerated on each build. @@ -176,9 +173,6 @@ otp/ ├── otp.c # Main source code ├── README.md # This file ├── .gitignore # Git ignore rules -├── src/ # Generated version files (auto-created) -│ ├── version.h # Version header (generated) -│ └── version.c # Version implementation (generated) ├── pads/ # OTP pad storage directory (created at runtime) └── VERSION # Plain text version (generated) ``` diff --git a/build.sh b/build.sh index 39b72d6..97ad01b 100755 --- a/build.sh +++ b/build.sh @@ -100,13 +100,13 @@ increment_version() { print_success "Created new version tag: $NEW_VERSION" # Push changes and tags to remote repository - if git push ssh://ubuntu@laantungir.net:/home/ubuntu/git_repos/otp 2>/dev/null; then + if git push 2>/dev/null; then print_success "Pushed changes to remote repository" else print_warning "Failed to push changes to remote repository" fi - if git push ssh://ubuntu@laantungir.net:/home/ubuntu/git_repos/otp --tags 2>/dev/null; then + if git push --tags 2>/dev/null; then print_success "Pushed tags to remote repository" else print_warning "Failed to push tags to remote repository" @@ -123,71 +123,7 @@ increment_version() { fi fi - # Update VERSION file for compatibility - echo "${NEW_VERSION#v}" > VERSION - print_success "Updated VERSION file to ${NEW_VERSION#v}" - - # Generate version.h header file - mkdir -p src - cat > src/version.h << EOF -/* - * Auto-Generated Version Header - * DO NOT EDIT THIS FILE MANUALLY - Generated by build script - */ - -#ifndef VERSION_H -#define 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* get_version(void); -const char* get_version_full(void); -const char* get_build_info(void); - -#endif /* VERSION_H */ -EOF - - # Generate version.c implementation file - cat > src/version.c << EOF -/* - * Auto-Generated Version Implementation - * DO NOT EDIT THIS FILE MANUALLY - Generated by build script - */ - -#include "version.h" - -const char* get_version(void) { - return VERSION_TAG; -} - -const char* get_version_full(void) { - return VERSION_FULL_DISPLAY; -} - -const char* 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 header files" + print_success "Version updated to ${NEW_VERSION}" } # Build functions @@ -222,7 +158,6 @@ build_static() { clean_project() { print_status "Cleaning build artifacts..." make clean - rm -f VERSION src/version.h src/version.c print_success "Clean completed" } @@ -267,7 +202,7 @@ case "${1:-build}" in ;; version) increment_version - print_status "Version information generated" + print_status "Version tag updated" ;; *) echo "OTP Cipher Build Script" @@ -279,10 +214,10 @@ case "${1:-build}" in echo "Commands:" echo " build - Build project with automatic version increment (default)" echo " static - Build with static linking" - echo " clean - Clean build artifacts and generated files" + echo " clean - Clean build artifacts" echo " install - Install to system (requires build first)" echo " uninstall - Remove from system" - echo " version - Generate version files only" + echo " version - Update version tag only" echo "" echo "Examples:" echo " $0 build"