Version v0.2.104 - Cleaned up build.sh

This commit is contained in:
2025-08-31 10:43:36 -04:00
parent 0f3af174b0
commit 84e2ee5639
3 changed files with 8 additions and 82 deletions

View File

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