Skip to content

Commit 5df86b2

Browse files
authored
Merge pull request #169 from walkero-gr/add-version-while-compile
Add version to the library befor start the compilation
2 parents 95f7b1d + 6e479f5 commit 5df86b2

File tree

3 files changed

+49
-20
lines changed

3 files changed

+49
-20
lines changed

.github/workflows/makeRelease.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Compile clib4
2121
run: |
2222
cd /opt/code && \
23-
make -j1 -f GNUmakefile.os4 OS=os4 SHARED=no
23+
make -j1 -f GNUmakefile.os4 OS=os4 SHARED=no GITTAG=${{ github.event.release.tag_name }}
2424
- name: Create the LHA release archive
2525
run: |
2626
make -f GNUmakefile.os4 release && \
@@ -47,18 +47,18 @@ jobs:
4747
asset_name: clib4-${{ github.event.release.tag_name }}_amd64.deb
4848
asset_content_type: application/vnd.debian.binary-pac
4949
- name: Upload DEB release file to the server
50-
uses: kostya-ten/ssh-server-deploy@v4
51-
with:
52-
host: ${{ secrets.DEBSERVER_HOST }}
53-
port: ${{ secrets.DEBSERVER_PORT }}
54-
username: ${{ secrets.DEBSERVER_USERNAME }}
55-
private_key: ${{ secrets.DEBSERVER_PRIVATE_KEY }}
56-
scp_source: clib4-${{ github.event.release.tag_name }}_amd64.deb
57-
scp_target: /opt/amigarepo/ubuntu/pool/main
58-
before_script: |
59-
rm /opt/amigarepo/ubuntu/pool/main/clib4*.deb
60-
after_script: |
61-
/root/regenerate-packages.sh
50+
uses: kostya-ten/ssh-server-deploy@v4
51+
with:
52+
host: ${{ secrets.DEBSERVER_HOST }}
53+
port: ${{ secrets.DEBSERVER_PORT }}
54+
username: ${{ secrets.DEBSERVER_USERNAME }}
55+
private_key: ${{ secrets.DEBSERVER_PRIVATE_KEY }}
56+
scp_source: clib4-${{ github.event.release.tag_name }}_amd64.deb
57+
scp_target: /opt/amigarepo/ubuntu/pool/main
58+
before_script: |
59+
rm /opt/amigarepo/ubuntu/pool/main/clib4*.deb
60+
after_script: |
61+
/root/regenerate-packages.sh
6262
# - name: Prepare OS4Depot release
6363
# run: |
6464
# mkdir os4depot-release

GNUmakefile.os4

+34-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
##############################################################################
99

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

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

133133
VERBOSE ?= @
134134

135+
##########################################################################
136+
# Set up version and date properties
137+
##########################################################################
138+
139+
DATEISO = $(shell date --iso=date)
140+
DATESTR = $(shell date "+%d.%m.%Y")
141+
142+
# Parse the repo tag to different defines, that will be used while
143+
# compiling clib4 library
144+
#
145+
# The tags should be like v(MAJOR).(MINOR).(PATCH)
146+
# in example v1.2.3
147+
#
148+
ifneq ($(origin GITTAG),undefined)
149+
MAJOR = $(patsubst v%,%,$(firstword $(subst ., ,$(GITTAG))))
150+
MINOR = $(word 2, $(subst ., ,$(GITTAG)))
151+
PATCH = $(word 3, $(subst ., ,$(GITTAG)))
152+
endif
153+
135154
##############################################################################
136155

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

139-
all: prepare all-targets all-libs clib4.library.debug clib4.library
158+
all: gitver prepare all-targets all-libs clib4.library.debug clib4.library
140159

141160
##############################################################################
142161

@@ -182,12 +201,12 @@ ALL_TARGETS = \
182201
$(OUTPUT_LIB)/crtend.o \
183202
$(OUTPUT_LIB)/shcrtbegin.o \
184203
$(OUTPUT_LIB)/shcrtend.o \
185-
$(OUT_SHARED_LIB)/shared_library/clib4.o \
186-
$(OUT_SHARED_LIB)/shared_library/math.o \
204+
$(OUT_SHARED_LIB)/shared_library/clib4.o \
205+
$(OUT_SHARED_LIB)/shared_library/math.o \
187206
$(MAIN_LIB)
188207

189208
ifdef SPE
190-
ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
209+
ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
191210
endif
192211

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

214233
##############################################################################
215234

235+
gitver:
236+
$(VERBOSE)sed -i 's/[(]\([0-9]*\.[0-9]*\.[0-9]*\)[)]/($(DATESTR))/g' library/c.lib_rev.h
237+
$(VERBOSE)sed -i 's/"\([0-9]*\.[0-9]*\.[0-9]*\)"/"$(DATESTR)"/g' library/c.lib_rev.h
238+
ifdef GITTAG
239+
$(VERBOSE)sed -i 's/VERSION\t*[[:digit:]]/VERSION\t\t\t$(MAJOR)/g' library/c.lib_rev.h
240+
$(VERBOSE)sed -i 's/REVISION\t*[[:digit:]]/REVISION\t\t$(MINOR)/g' library/c.lib_rev.h
241+
$(VERBOSE)sed -i 's/SUBREVISION\t*[[:digit:]]/SUBREVISION\t\t$(PATCH)/g' library/c.lib_rev.h
242+
$(VERBOSE)sed -i 's/clib4.library [0-9]*\.[0-9]*\.[0-9]*/clib4.library $(MAJOR).$(MINOR).$(PATCH)/g' library/c.lib_rev.h
243+
endif
244+
216245
# Update the version numbers bound to the individual libraries
217246
version:
218247
$(COPY) c.lib_rev.rev amiga/amiga.lib_rev.rev

library/c.lib_rev.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#define VERSION 1
22
#define REVISION 0
3-
#define SUBREVISION 0
3+
#define SUBREVISION 0
44

55
#define DATE "27.09.2023"
66
#define VERS "clib4.library 1.0.0"
77
#define VSTRING "clib4.library 1.0.0 (27.09.2023)\r\n"
8-
#define VERSTAG "\0$VER: clib4.library 1.0.0 (27.09.2023)"
8+
#define VERSTAG "\0$VER: clib4.library 1.0.0 (27.09.2023)"

0 commit comments

Comments
 (0)