Skip to content

Commit 5a0c93e

Browse files
committed
build: Better Git version info hack, don't --unify
The --unify flag still doesn't quite work because libgc.so can't be found.
1 parent 660bac8 commit 5a0c93e

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

.github/workflows/test.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@ jobs:
2828
- name: make install
2929
env:
3030
DYLAN: dylan-root
31-
run: make install
31+
run: |
32+
deft update
33+
make install
3234
3335
- name: Run http-server --help
34-
env:
35-
DYLAN: dylan-root
36-
LD_LIBRARY_PATH: _od/opendylan-2024.1/lib
3736
run: |
38-
ls -l dylan-root/bin/
39-
find . -name '*unwind*'
4037
dylan-root/bin/http-server --help

Makefile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,31 @@
33
# "http-server". The expectation is that during development people will use `deft build`
44
# or `deft test`.
55

6-
# TODO: use the .gitattributes filtering that Deft uses instead of this version hack.
7-
86
DYLAN ?= $${HOME}/dylan
97

108
.PHONY: build clean install
119

12-
build:
10+
git_version := $(shell git describe --tags --always --match 'v*')
11+
12+
# We assume `deft update` is invoked manually before running make.
13+
14+
build: common/*.dylan common/*.lid server/*/*.dylan server/*/*.lid
1315
file="server/core/server.dylan"; \
14-
backup=$$(mktemp); \
15-
temp=$$(mktemp); \
16-
cp -p $${file} $${backup}; \
17-
cat $${file} | sed "s,/.__./.*/.__./,/*__*/ \"$$(git describe --always --tags)\" /*__*/,g" > $${temp}; \
18-
mv $${temp} $${file}; \
19-
dylan update; \
20-
dylan build --unify http-server-app; \
21-
cp -p $${backup} $${file}
16+
orig=$$(mktemp); \
17+
temp=$$(mktemp); \
18+
cp -p $${file} $${orig}; \
19+
cat $${file} | sed "s|_NO_VERSION_SET_|${git_version} built on $$(date -Iseconds)|g" > $${temp}; \
20+
mv $${temp} $${file}; \
21+
deft build http-server-app; \
22+
cp -p $${orig} $${file}
2223

2324
install: build
2425
mkdir -p $(DYLAN)/bin
25-
cp _build/sbin/http-server-app $(DYLAN)/bin/http-server
26+
mkdir -p $(DYLAN)/install/http/bin
27+
mkdir -p $(DYLAN)/install/http/lib
28+
cp _build/bin/http-server-app $(DYLAN)/install/http/bin/http-server
29+
cp -r _build/lib/lib* $(DYLAN)/install/http/lib/
30+
ln -s -f $$(realpath $(DYLAN)/install/http/bin/http-server) $(DYLAN)/bin/http-server
2631

2732
clean:
28-
rm -rf _build registry
33+
rm -rf _build _packages registry

server/core/server.dylan

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ Copyright: See LICENSE in this distribution for details.
88
// sort of connotes slowness (?) so I stopped using it.
99
define constant $server-name = "Dylan HTTP Server";
1010

11-
// The Makefile replaces EVERYTHING BETWEEN THE /*__*/ MARKERS with the actual
12-
// tagged version before building, so don't move them. Using the comment
13-
// markers enables recovery if someone commits a string other than "HEAD" by
14-
// accident. git's `ident` attribute doesn't use tag names and `filter` looks
15-
// more complex than it's worth.
16-
define constant $server-version :: <string> = /*__*/ "HEAD" /*__*/;
11+
// The Makefile replaces this string with Git version info before building.
12+
define constant $server-version :: <string> = "_NO_VERSION_SET_";
1713

1814
// This is needed to handle sockets shutdown.
1915
define variable *exiting-application* = #f;

0 commit comments

Comments
 (0)