Version v0.2.104 - Cleaned up build.sh
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -3,7 +3,4 @@ pads/
|
|||||||
Gemini.md
|
Gemini.md
|
||||||
TropicOfCancer-HenryMiller.txt
|
TropicOfCancer-HenryMiller.txt
|
||||||
|
|
||||||
# Auto-generated version files
|
# Auto-generated files (none currently)
|
||||||
src/version.h
|
|
||||||
src/version.c
|
|
||||||
VERSION
|
|
||||||
|
|||||||
@@ -151,10 +151,7 @@ git tag v1.0.0 # Next build: v1.0.1
|
|||||||
- Full version display with metadata
|
- Full version display with metadata
|
||||||
|
|
||||||
### Generated Files
|
### Generated Files
|
||||||
The build system automatically generates:
|
The build system automatically manages Git versioning by incrementing tags.
|
||||||
- `src/version.h` - Version constants and macros
|
|
||||||
- `src/version.c` - Version API functions
|
|
||||||
- `VERSION` - Plain text version number
|
|
||||||
|
|
||||||
These files are excluded from git (.gitignore) and regenerated on each build.
|
These files are excluded from git (.gitignore) and regenerated on each build.
|
||||||
|
|
||||||
@@ -176,9 +173,6 @@ otp/
|
|||||||
├── otp.c # Main source code
|
├── otp.c # Main source code
|
||||||
├── README.md # This file
|
├── README.md # This file
|
||||||
├── .gitignore # Git ignore rules
|
├── .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)
|
├── pads/ # OTP pad storage directory (created at runtime)
|
||||||
└── VERSION # Plain text version (generated)
|
└── VERSION # Plain text version (generated)
|
||||||
```
|
```
|
||||||
|
|||||||
77
build.sh
77
build.sh
@@ -100,13 +100,13 @@ increment_version() {
|
|||||||
print_success "Created new version tag: $NEW_VERSION"
|
print_success "Created new version tag: $NEW_VERSION"
|
||||||
|
|
||||||
# Push changes and tags to remote repository
|
# 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"
|
print_success "Pushed changes to remote repository"
|
||||||
else
|
else
|
||||||
print_warning "Failed to push changes to remote repository"
|
print_warning "Failed to push changes to remote repository"
|
||||||
fi
|
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"
|
print_success "Pushed tags to remote repository"
|
||||||
else
|
else
|
||||||
print_warning "Failed to push tags to remote repository"
|
print_warning "Failed to push tags to remote repository"
|
||||||
@@ -123,71 +123,7 @@ increment_version() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update VERSION file for compatibility
|
print_success "Version updated to ${NEW_VERSION}"
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build functions
|
# Build functions
|
||||||
@@ -222,7 +158,6 @@ build_static() {
|
|||||||
clean_project() {
|
clean_project() {
|
||||||
print_status "Cleaning build artifacts..."
|
print_status "Cleaning build artifacts..."
|
||||||
make clean
|
make clean
|
||||||
rm -f VERSION src/version.h src/version.c
|
|
||||||
print_success "Clean completed"
|
print_success "Clean completed"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +202,7 @@ case "${1:-build}" in
|
|||||||
;;
|
;;
|
||||||
version)
|
version)
|
||||||
increment_version
|
increment_version
|
||||||
print_status "Version information generated"
|
print_status "Version tag updated"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "OTP Cipher Build Script"
|
echo "OTP Cipher Build Script"
|
||||||
@@ -279,10 +214,10 @@ case "${1:-build}" in
|
|||||||
echo "Commands:"
|
echo "Commands:"
|
||||||
echo " build - Build project with automatic version increment (default)"
|
echo " build - Build project with automatic version increment (default)"
|
||||||
echo " static - Build with static linking"
|
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 " install - Install to system (requires build first)"
|
||||||
echo " uninstall - Remove from system"
|
echo " uninstall - Remove from system"
|
||||||
echo " version - Generate version files only"
|
echo " version - Update version tag only"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo " $0 build"
|
echo " $0 build"
|
||||||
|
|||||||
Reference in New Issue
Block a user