feat: add arch packaging

This commit is contained in:
2024-08-06 20:35:00 +02:00
parent 5469fdcf92
commit ccd07141f5
11 changed files with 301 additions and 63 deletions

View File

@ -2,9 +2,13 @@
# See LICENSE file for copyright and license details.
# Note: If you're confused by the makefile, I do emplore you to read the info-page: $ info make
.POSIX:
NAME=sci
DESCRIPTION=$(NAME) is a simple contiuous integration system.
VERSION = 0.1.0
VERSION = 1.0.0
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
CC = gcc
OUTDIR := out/
OBJDIR := out/obj
@ -14,11 +18,11 @@ CFLAGS += -DSCI_NAME="\"$(NAME)\""
CFLAGS += -DSCI_DESCRIPTION="\"$(DESCRIPTION)\""
CFLAGS += -D_POSIX_C_SOURCE=2
CFLAGS += -D_GNU_SOURCE
CFLAGS += -Wall -Werror -std=c23 -g
CFLAGS += -Wall -Werror -std=c11 -g
CFLAGS += -Iinclude
CFLAGS += -lpthread -luuid
.PHONY: all clean
.PHONY: all clean dist install
all: out/bin/sci
@ -38,6 +42,7 @@ out/bin/sci: $(OBJ) | $(BINDIR)
clean:
rm -rf $(OUTDIR)
rm -rf $(NAME)-$(VERSION)
$(OUTDIR):
mkdir -p $@
@ -48,20 +53,34 @@ $(OBJDIR): $(OUTDIR)
$(BINDIR): $(OUTDIR)
mkdir -p $@
# dist: clean
# mkdir -p st-$(VERSION)
# cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
# config.def.h st.info st.1 arg.h st.h win.h $(SRC)\
# st-$(VERSION)
# tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
# rm -rf st-$(VERSION)
#
# install: st
# mkdir -p $(DESTDIR)$(PREFIX)/bin
# cp -f st $(DESTDIR)$(PREFIX)/bin
# chmod 755 $(DESTDIR)$(PREFIX)/bin/st
# mkdir -p $(DESTDIR)$(MANPREFIX)/man1
# sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
# chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
# tic -sx st.info
# @echo Please see the README file regarding the terminfo entry of st.
dist:
mkdir -p $(NAME)-$(VERSION)
cp -R \
TODO.md README.md\
Makefile src include\
$(NAME)-$(VERSION)
tar -cf - $(NAME)-$(VERSION) | gzip > $(NAME)-$(VERSION).tar.gz
rm -rf $(NAME)-$(VERSION)
# NOTE: DESTDIR is meant for making packaging easier.
# If you want to install in a different directory than the default, please
# use: # make install PREFIX=/custom/path
install: out/bin/sci
mkdir -p $(DESTDIR)$(PREFIX)/bin
# install binaries
cp -f out/bin/sci $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/sci
# install libraries
# install services (only if system is using systemd though)
# install manpages
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < src/sci.1 > $(DESTDIR)$(MANPREFIX)/man1/sci.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sci.1
uninstall:
# uninstall binaries
rm -f $(DESTDIR)$(PREFIX)/bin/sci
# uninstall libraries
# uninstall services (only if system is using systemd though)
# uninstall manpages
rm -f $(DESTDIR)$(MANPREFIX)/man1/sci.1