Skip to content

Commit

Permalink
Merge pull request #169 from walkero-gr/add-version-while-compile
Browse files Browse the repository at this point in the history
Add version to the library befor start the compilation
  • Loading branch information
afxgroup committed Mar 17, 2024
2 parents 95f7b1d + 6e479f5 commit 5df86b2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 20 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/makeRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Compile clib4
run: |
cd /opt/code && \
make -j1 -f GNUmakefile.os4 OS=os4 SHARED=no
make -j1 -f GNUmakefile.os4 OS=os4 SHARED=no GITTAG=${{ github.event.release.tag_name }}
- name: Create the LHA release archive
run: |
make -f GNUmakefile.os4 release && \
Expand All @@ -47,18 +47,18 @@ jobs:
asset_name: clib4-${{ github.event.release.tag_name }}_amd64.deb
asset_content_type: application/vnd.debian.binary-pac
- name: Upload DEB release file to the server
uses: kostya-ten/ssh-server-deploy@v4
with:
host: ${{ secrets.DEBSERVER_HOST }}
port: ${{ secrets.DEBSERVER_PORT }}
username: ${{ secrets.DEBSERVER_USERNAME }}
private_key: ${{ secrets.DEBSERVER_PRIVATE_KEY }}
scp_source: clib4-${{ github.event.release.tag_name }}_amd64.deb
scp_target: /opt/amigarepo/ubuntu/pool/main
before_script: |
rm /opt/amigarepo/ubuntu/pool/main/clib4*.deb
after_script: |
/root/regenerate-packages.sh
uses: kostya-ten/ssh-server-deploy@v4
with:
host: ${{ secrets.DEBSERVER_HOST }}
port: ${{ secrets.DEBSERVER_PORT }}
username: ${{ secrets.DEBSERVER_USERNAME }}
private_key: ${{ secrets.DEBSERVER_PRIVATE_KEY }}
scp_source: clib4-${{ github.event.release.tag_name }}_amd64.deb
scp_target: /opt/amigarepo/ubuntu/pool/main
before_script: |
rm /opt/amigarepo/ubuntu/pool/main/clib4*.deb
after_script: |
/root/regenerate-packages.sh
# - name: Prepare OS4Depot release
# run: |
# mkdir os4depot-release
Expand Down
39 changes: 34 additions & 5 deletions GNUmakefile.os4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
##############################################################################

.PHONY : all prepare all-targets all-libs clean \
version compile-tests install release dpkg
gitver version compile-tests install release dpkg

# You may have to change the following sets of macro definitions which will
# be used throughout the build makefile. These definitions cover the paths
Expand Down Expand Up @@ -132,11 +132,30 @@ endif

VERBOSE ?= @

##########################################################################
# Set up version and date properties
##########################################################################

DATEISO = $(shell date --iso=date)
DATESTR = $(shell date "+%d.%m.%Y")

# Parse the repo tag to different defines, that will be used while
# compiling clib4 library
#
# The tags should be like v(MAJOR).(MINOR).(PATCH)
# in example v1.2.3
#
ifneq ($(origin GITTAG),undefined)
MAJOR = $(patsubst v%,%,$(firstword $(subst ., ,$(GITTAG))))
MINOR = $(word 2, $(subst ., ,$(GITTAG)))
PATCH = $(word 3, $(subst ., ,$(GITTAG)))
endif

##############################################################################

# This is the first target: it depends on all the targets

all: prepare all-targets all-libs clib4.library.debug clib4.library
all: gitver prepare all-targets all-libs clib4.library.debug clib4.library

##############################################################################

Expand Down Expand Up @@ -182,12 +201,12 @@ ALL_TARGETS = \
$(OUTPUT_LIB)/crtend.o \
$(OUTPUT_LIB)/shcrtbegin.o \
$(OUTPUT_LIB)/shcrtend.o \
$(OUT_SHARED_LIB)/shared_library/clib4.o \
$(OUT_SHARED_LIB)/shared_library/math.o \
$(OUT_SHARED_LIB)/shared_library/clib4.o \
$(OUT_SHARED_LIB)/shared_library/math.o \
$(MAIN_LIB)

ifdef SPE
ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
endif

all-targets: $(ALL_TARGETS)
Expand All @@ -213,6 +232,16 @@ clean:

##############################################################################

gitver:
$(VERBOSE)sed -i 's/[(]\([0-9]*\.[0-9]*\.[0-9]*\)[)]/($(DATESTR))/g' library/c.lib_rev.h
$(VERBOSE)sed -i 's/"\([0-9]*\.[0-9]*\.[0-9]*\)"/"$(DATESTR)"/g' library/c.lib_rev.h
ifdef GITTAG
$(VERBOSE)sed -i 's/VERSION\t*[[:digit:]]/VERSION\t\t\t$(MAJOR)/g' library/c.lib_rev.h
$(VERBOSE)sed -i 's/REVISION\t*[[:digit:]]/REVISION\t\t$(MINOR)/g' library/c.lib_rev.h
$(VERBOSE)sed -i 's/SUBREVISION\t*[[:digit:]]/SUBREVISION\t\t$(PATCH)/g' library/c.lib_rev.h
$(VERBOSE)sed -i 's/clib4.library [0-9]*\.[0-9]*\.[0-9]*/clib4.library $(MAJOR).$(MINOR).$(PATCH)/g' library/c.lib_rev.h
endif

# Update the version numbers bound to the individual libraries
version:
$(COPY) c.lib_rev.rev amiga/amiga.lib_rev.rev
Expand Down
4 changes: 2 additions & 2 deletions library/c.lib_rev.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#define VERSION 1
#define REVISION 0
#define SUBREVISION 0
#define SUBREVISION 0

#define DATE "27.09.2023"
#define VERS "clib4.library 1.0.0"
#define VSTRING "clib4.library 1.0.0 (27.09.2023)\r\n"
#define VERSTAG "\0$VER: clib4.library 1.0.0 (27.09.2023)"
#define VERSTAG "\0$VER: clib4.library 1.0.0 (27.09.2023)"

0 comments on commit 5df86b2

Please sign in to comment.