2009-05-08 13:33:34 +00:00
|
|
|
PACKAGE := abuild
|
2024-04-17 06:45:34 +00:00
|
|
|
VERSION := 3.13.0
|
2008-10-18 08:09:24 +00:00
|
|
|
|
2009-06-03 11:24:29 +00:00
|
|
|
prefix ?= /usr
|
2012-02-17 13:28:22 +00:00
|
|
|
bindir ?= $(prefix)/bin
|
2009-06-03 11:24:29 +00:00
|
|
|
sysconfdir ?= /etc
|
2019-11-07 11:21:32 +00:00
|
|
|
sharedir ?= $(prefix)/share/$(PACKAGE)
|
2017-11-04 05:48:52 +00:00
|
|
|
mandir ?= $(prefix)/share/man
|
2008-10-18 08:09:24 +00:00
|
|
|
|
2015-06-05 06:47:52 +00:00
|
|
|
SCRIPTS := abuild abuild-keygen abuild-sign newapkbuild \
|
2019-08-04 01:28:00 +00:00
|
|
|
abump apkgrel buildlab apkbuild-cpan apkbuild-pypi checkapk \
|
2014-12-08 15:56:25 +00:00
|
|
|
apkbuild-gem-resolver
|
2017-04-05 13:28:13 +00:00
|
|
|
USR_BIN_FILES := $(SCRIPTS) abuild-tar abuild-gzsplit abuild-sudo abuild-fetch abuild-rmtemp
|
2023-11-19 15:54:06 +00:00
|
|
|
MAN_1_PAGES := newapkbuild.1 abuild.1 abump.1
|
2017-11-04 05:48:52 +00:00
|
|
|
MAN_5_PAGES := APKBUILD.5
|
2009-05-08 13:33:34 +00:00
|
|
|
SAMPLES := sample.APKBUILD sample.initd sample.confd \
|
|
|
|
sample.pre-install sample.post-install
|
2021-07-04 16:04:46 +00:00
|
|
|
MAN_PAGES := $(MAN_1_PAGES) $(MAN_5_PAGES)
|
2016-08-12 11:07:30 +00:00
|
|
|
AUTOTOOLS_TOOLCHAIN_FILES := config.sub config.guess
|
2009-05-08 13:33:34 +00:00
|
|
|
|
|
|
|
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
|
|
|
|
|
|
|
|
GIT_REV := $(shell test -d .git && git describe || echo exported)
|
|
|
|
ifneq ($(GIT_REV), exported)
|
|
|
|
FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
|
|
|
|
FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
|
|
|
|
else
|
|
|
|
FULL_VERSION := $(VERSION)
|
|
|
|
endif
|
|
|
|
|
2009-10-24 20:37:20 +00:00
|
|
|
CHMOD := chmod
|
2009-05-08 13:33:34 +00:00
|
|
|
SED := sed
|
|
|
|
TAR := tar
|
2021-07-04 16:04:46 +00:00
|
|
|
SCDOC := scdoc
|
2012-02-17 13:28:22 +00:00
|
|
|
LINK = $(CC) $(OBJS-$@) -o $@ $(LDFLAGS) $(LDFLAGS-$@) $(LIBS-$@)
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2021-07-24 11:52:34 +00:00
|
|
|
CFLAGS ?= -Wall -Werror -g -pedantic
|
2020-07-06 10:11:46 +00:00
|
|
|
|
2009-05-08 13:33:34 +00:00
|
|
|
SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
|
|
|
|
-e 's:@prefix@:$(prefix):g' \
|
|
|
|
-e 's:@sysconfdir@:$(sysconfdir):g' \
|
2019-11-07 11:21:32 +00:00
|
|
|
-e 's:@sharedir@:$(sharedir):g' \
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2016-01-27 10:38:34 +00:00
|
|
|
SSL_CFLAGS ?= $(shell pkg-config --cflags openssl)
|
|
|
|
SSL_LDFLAGS ?= $(shell pkg-config --cflags openssl)
|
|
|
|
SSL_LIBS ?= $(shell pkg-config --libs openssl)
|
2017-01-10 12:16:16 +00:00
|
|
|
ZLIB_LIBS ?= $(shell pkg-config --libs zlib)
|
2012-02-17 13:28:22 +00:00
|
|
|
|
|
|
|
OBJS-abuild-tar = abuild-tar.o
|
2016-01-27 10:38:34 +00:00
|
|
|
CFLAGS-abuild-tar.o = $(SSL_CFLAGS)
|
|
|
|
LDFLAGS-abuild-tar = $(SSL_LDFLAGS)
|
2012-02-17 13:28:22 +00:00
|
|
|
LIBS-abuild-tar = $(SSL_LIBS)
|
2018-11-27 07:22:53 +00:00
|
|
|
LIBS-abuild-tar.static = $(LIBS-abuild-tar)
|
2012-02-17 13:28:22 +00:00
|
|
|
|
2017-01-10 12:16:16 +00:00
|
|
|
OBJS-abuild-gzsplit = abuild-gzsplit.o
|
|
|
|
LDFLAGS-abuild-gzsplit = $(ZLIB_LIBS)
|
|
|
|
|
2012-02-17 13:28:22 +00:00
|
|
|
OBJS-abuild-sudo = abuild-sudo.o
|
2015-08-26 06:14:36 +00:00
|
|
|
OBJS-abuild-fetch = abuild-fetch.o
|
2009-07-20 14:54:20 +00:00
|
|
|
|
2022-09-13 05:42:09 +00:00
|
|
|
TEST_TIMEOUT = 15
|
|
|
|
|
2023-04-18 11:34:31 +00:00
|
|
|
.SUFFIXES: .conf.in .sh.in .in
|
|
|
|
%.conf: %.conf.in
|
|
|
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
|
|
|
|
2012-02-17 13:28:22 +00:00
|
|
|
%.sh: %.sh.in
|
2009-05-08 13:33:34 +00:00
|
|
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
2009-10-24 20:37:20 +00:00
|
|
|
${CHMOD} +x $@
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2012-02-17 13:28:22 +00:00
|
|
|
%: %.in
|
2009-05-08 13:33:34 +00:00
|
|
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
2009-10-24 20:37:20 +00:00
|
|
|
${CHMOD} +x $@
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2021-07-04 16:04:46 +00:00
|
|
|
%.1: %.1.scd
|
|
|
|
${SCDOC} < $< > $@
|
|
|
|
|
|
|
|
%.5: %.5.scd
|
|
|
|
${SCDOC} < $< > $@
|
|
|
|
|
2009-07-20 14:54:20 +00:00
|
|
|
P=$(PACKAGE)-$(VERSION)
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2023-04-18 11:34:31 +00:00
|
|
|
all: $(USR_BIN_FILES) $(MAN_PAGES) functions.sh abuild.conf
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2009-07-20 14:54:20 +00:00
|
|
|
clean:
|
2023-04-18 13:14:28 +00:00
|
|
|
@rm -f $(USR_BIN_FILES) $(MAN_PAGES) *.o functions.sh abuild.conf Kyuafile \
|
2022-11-29 09:08:14 +00:00
|
|
|
tests/Kyuafile tests/testdata/abuild.key*
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2012-02-17 13:28:22 +00:00
|
|
|
%.o: %.c
|
2013-07-05 14:28:28 +00:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) -o $@ -c $<
|
2010-05-18 12:44:05 +00:00
|
|
|
|
2012-02-17 13:28:22 +00:00
|
|
|
abuild-sudo: abuild-sudo.o
|
|
|
|
$(LINK)
|
|
|
|
|
|
|
|
abuild-tar: abuild-tar.o
|
|
|
|
$(LINK)
|
|
|
|
|
2015-08-26 06:14:36 +00:00
|
|
|
abuild-fetch: abuild-fetch.o
|
|
|
|
$(LINK)
|
|
|
|
|
2017-01-10 12:16:16 +00:00
|
|
|
abuild-gzsplit: abuild-gzsplit.o
|
|
|
|
$(LINK)
|
|
|
|
|
2012-02-17 13:28:22 +00:00
|
|
|
abuild-tar.static: abuild-tar.o
|
2018-11-27 07:22:53 +00:00
|
|
|
$(CC) -static $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) $^ -o $@ $(LIBS-$@)
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2008-10-18 08:09:24 +00:00
|
|
|
help:
|
|
|
|
@echo "$(P) makefile"
|
|
|
|
@echo "usage: make install [ DESTDIR=<path> ]"
|
|
|
|
|
2022-11-29 09:08:14 +00:00
|
|
|
tests/testdata/abuild.key:
|
|
|
|
openssl genrsa -out "$@" 4096
|
|
|
|
|
|
|
|
tests/testdata/abuild.key.pub: tests/testdata/abuild.key
|
|
|
|
openssl rsa -in "$<" -pubout -out "$@"
|
|
|
|
|
2022-06-14 14:39:00 +00:00
|
|
|
tests/Kyuafile: $(wildcard tests/*_test)
|
|
|
|
echo "syntax(2)" > $@
|
|
|
|
echo "test_suite('abuild')" >> $@
|
|
|
|
for i in $(notdir $(wildcard tests/*_test)); do \
|
2022-09-13 05:42:09 +00:00
|
|
|
echo "atf_test_program{name='$$i',timeout=$(TEST_TIMEOUT)}" >> $@ ; \
|
2022-06-14 14:39:00 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
Kyuafile: tests/Kyuafile
|
|
|
|
echo "syntax(2)" > $@
|
|
|
|
echo "test_suite('abuild')" >> $@
|
|
|
|
echo "include('tests/Kyuafile')" >> $@
|
|
|
|
|
2022-11-29 09:08:14 +00:00
|
|
|
check: $(SCRIPTS) $(USR_BIN_FILES) functions.sh tests/Kyuafile Kyuafile tests/testdata/abuild.key.pub
|
2023-10-17 18:43:41 +00:00
|
|
|
kyua --variable parallelism=$(shell nproc) test || (kyua report --verbose && exit 1)
|
2019-11-07 11:01:18 +00:00
|
|
|
|
2023-04-18 11:34:31 +00:00
|
|
|
install: $(USR_BIN_FILES) $(SAMPLES) $(MAN_PAGES) default.conf abuild.conf functions.sh
|
2012-02-17 13:28:22 +00:00
|
|
|
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(sysconfdir) \
|
2019-11-07 11:21:32 +00:00
|
|
|
$(DESTDIR)/$(sharedir) $(DESTDIR)/$(mandir)/man1 \
|
2017-11-04 05:48:52 +00:00
|
|
|
$(DESTDIR)/$(mandir)/man5
|
2009-01-15 15:48:16 +00:00
|
|
|
for i in $(USR_BIN_FILES); do\
|
2012-02-17 13:28:22 +00:00
|
|
|
install -m 755 $$i $(DESTDIR)/$(bindir)/$$i;\
|
|
|
|
done
|
2019-10-11 10:08:24 +00:00
|
|
|
chmod 4555 $(DESTDIR)/$(prefix)/bin/abuild-sudo
|
2012-02-17 13:28:22 +00:00
|
|
|
for i in adduser addgroup apk; do \
|
|
|
|
ln -fs abuild-sudo $(DESTDIR)/$(bindir)/abuild-$$i; \
|
2009-01-15 15:48:16 +00:00
|
|
|
done
|
2017-11-04 05:48:52 +00:00
|
|
|
for i in $(MAN_1_PAGES); do\
|
|
|
|
install -m 644 $$i $(DESTDIR)/$(mandir)/man1/$$i;\
|
|
|
|
done
|
|
|
|
for i in $(MAN_5_PAGES); do\
|
|
|
|
install -m 644 $$i $(DESTDIR)/$(mandir)/man5/$$i;\
|
|
|
|
done
|
2009-01-19 09:19:20 +00:00
|
|
|
if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
|
2023-04-18 11:49:04 +00:00
|
|
|
install -t $(DESTDIR)/$(sysconfdir)/ abuild.conf; \
|
2009-01-07 18:29:19 +00:00
|
|
|
fi
|
2023-04-18 11:34:31 +00:00
|
|
|
|
2023-04-18 11:49:04 +00:00
|
|
|
install -t $(DESTDIR)/$(prefix)/share/abuild/ $(SAMPLES)
|
|
|
|
install -t $(DESTDIR)/$(prefix)/share/abuild/ $(AUTOTOOLS_TOOLCHAIN_FILES)
|
2023-04-18 11:34:31 +00:00
|
|
|
install -t $(DESTDIR)/$(sharedir)/ functions.sh default.conf
|
2008-10-18 08:09:24 +00:00
|
|
|
|
2019-08-23 10:22:26 +00:00
|
|
|
depends depend:
|
2019-11-07 12:02:24 +00:00
|
|
|
sudo apk --no-cache -U --virtual .abuild-depends add openssl-dev zlib-dev
|
2019-08-23 10:22:26 +00:00
|
|
|
|
2010-11-19 10:30:07 +00:00
|
|
|
.gitignore: Makefile
|
|
|
|
echo "*.tar.bz2" > $@
|
|
|
|
for i in $(USR_BIN_FILES); do\
|
|
|
|
echo $$i >>$@;\
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2013-07-05 04:21:17 +00:00
|
|
|
.PHONY: install
|