summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-25 08:05:22 -0300
committerEuAndreh <eu@euandre.org>2024-03-28 10:31:43 -0300
commit606d38bd5701794ea1d9f7b9be88b25a33db94e0 (patch)
treea91753729310adbd57cba4812e3d61f5be694f04
parentNode.js -> Go (diff)
downloadpapod-606d38bd5701794ea1d9f7b9be88b25a33db94e0.tar.gz
papod-606d38bd5701794ea1d9f7b9be88b25a33db94e0.tar.xz
Adapt build and installation
-rw-r--r--Makefile47
-rw-r--r--deps.mk15
-rwxr-xr-xmkdeps.sh7
3 files changed, 24 insertions, 45 deletions
diff --git a/Makefile b/Makefile
index 78b1ca7..65787e4 100644
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,7 @@ LANGUAGES =
## Installation prefix. Defaults to "/usr".
PREFIX = /usr
BINDIR = $(PREFIX)/bin
-LIBDIR = $(PREFIX)/lib
-JSLIBDIR = $(LIBDIR)/node/$(NAME)
+LIBDDIR = $(PREFIX)/lib/$(NAME)
SRCDIR = $(PREFIX)/src/$(NAME)
SHAREDIR = $(PREFIX)/share
LOCALEDIR = $(SHAREDIR)/locale
@@ -22,7 +21,7 @@ DESTDIR =
.SUFFIXES:
-.SUFFIXES: .in .go .bin .bin-check
+.SUFFIXES: .in
.in:
sed \
@@ -34,33 +33,24 @@ DESTDIR =
< $< > $@
if [ -x $< ]; then chmod +x $@; fi
-.go.bin:
- CGO_ENABLED=0 go test -c -o $@ -v \
- -ldflags='-s -w -extldflags "-static"' $<
-
all:
include deps.mk
-tests.bin = $(tests.go:.go=.bin)
-
manpages = $(manpages.in:.in=)
sources = \
- $(sources.mjs) \
-
-installable = \
+ $(sources.static) \
$(sources.sql) \
- $(sources.mjs) \
- src/sqlite.cjs \
- src/package.json \
+ src/papo.go \
+ src/cmd/papo.go \
derived-assets = \
$(manpages) \
main.bin \
- $(tests.bin) \
+ tests/papo_test.bin \
side-assets = \
ircd.pipe \
@@ -75,26 +65,25 @@ side-assets = \
all: $(derived-assets)
-main.bin: ALWAYS
+main.bin: src/papo.go src/cmd/papo.go
CGO_ENABLED=0 go build -o $@ -v \
-ldflags='-s -w -extldflags "-static"' src/cmd/papo.go
-
-$(tests.bin): ALWAYS
+tests/papo_test.bin: src/papo.go tests/papo_test.go
+ CGO_ENABLED=0 go test -c -o $@ -v \
+ -ldflags='-s -w -extldflags "-static"' tests/papo_test.go
-tests.bin-check = $(tests.go:.go=.bin-check)
-$(tests.bin-check):
- ./$*.bin
-check-unit: $(tests.bin-check)
+check-unit: tests/papo_test.bin
+ ./tests/papo_test.bin
integration-tests = \
tests/cli-opts.sh \
$(integration-tests): ALWAYS
- sh $@ $(EXEC)src/bin.mjs
+ sh $@
check-integration: $(integration-tests)
@@ -115,11 +104,10 @@ clean:
## ensures that all installable artifacts are crafted beforehand.
install: all
mkdir -p \
- '$(DESTDIR)$(BINDIR)' \
- '$(DESTDIR)$(JSLIBDIR)'
- ln -fs '$(DESTDIR)$(JSLIBDIR)'/bin.mjs '$(DESTDIR)$(BINDIR)'/$(NAME)
- for f in $(installable); do \
- dir='$(DESTDIR)$(JSLIBDIR)'/"`dirname "$${f#src/}"`"; \
+ '$(DESTDIR)$(BINDIR)'
+ cp main.bin '$(DESTDIR)$(BINDIR)'/$(NAME)
+ for f in $(sources.sql) $(sources.static); do \
+ dir='$(DESTDIR)$(LIBDDIR)'/"`dirname "$${f#src/}"`"; \
mkdir -p "$$dir"; \
cp -P "$$f" "$$dir"; \
done
@@ -136,7 +124,6 @@ install: all
uninstall:
rm -rf \
'$(DESTDIR)$(BINDIR)'/$(NAME) \
- '$(DESTDIR)$(JSLIBDIR)' \
'$(DESTDIR)$(SRCDIR)'
doctool -up '$(DESTDIR)$(MANDIR)' $(manpages)
diff --git a/deps.mk b/deps.mk
index 7cf1f0e..e75165b 100644
--- a/deps.mk
+++ b/deps.mk
@@ -1,12 +1,12 @@
-sources.go = \
- src/papo.go \
-
-tests.go = \
- tests/papo_test.go \
-
sources.sql = \
src/sql/migrations/2023-11-16T15:46:27-03:00-init-auth-data.sql \
+sources.static = \
+ src/static/client.js \
+ src/static/favicon.svg \
+ src/static/index.html \
+ src/static/styles.css \
+
manpages.en.in = \
doc/papo.en.1.in \
doc/papo.en.3go.in \
@@ -15,6 +15,3 @@ manpages.en.in = \
doc/papo.why.en.7.in \
manpages.in = $(manpages.en.in)
-
-
-tests/papo_test.bin-check: tests/papo_test.bin
diff --git a/mkdeps.sh b/mkdeps.sh
index f174689..1ebbfec 100755
--- a/mkdeps.sh
+++ b/mkdeps.sh
@@ -8,13 +8,8 @@ varlist() {
}
export LANG=POSIX.UTF-8
-find src/*.go | sort | varlist 'sources.go'
-find tests/*_test.go | sort | varlist 'tests.go'
find src/sql/migrations/*.sql | sort | varlist 'sources.sql'
+find src/static/ -type f | sort | varlist 'sources.static'
find doc/*.en.*.in | sort | varlist 'manpages.en.in'
echo 'manpages.in = $(manpages.en.in)'
-printf '\n\n'
-
-
-find tests/*_test.go | sort | sed 's|^\(.*\)\.go$|\1.bin-check:\t\1.bin|'