aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-12-20 19:59:49 +0000
committermerakor <cem@ckyln.com>2020-12-20 19:59:49 +0000
commit96a1f4d2a70e1631564c00fa33e7f11c5e331573 (patch)
treecfcaee4cf5cce66774424e0c439f4f07f47748a1
parent4c902b7873335ec4b48794023ca4f9501c881bac (diff)
downloadcpt-96a1f4d2a70e1631564c00fa33e7f11c5e331573.tar.gz
cpt: update redo build files
FossilOrigin-Name: de567d5766f6af7e5659f2afbef6a566b386c63659f0f8b292f905e38b53c272
-rw-r--r--config.rc51
-rw-r--r--default.do6
-rw-r--r--install.do16
-rw-r--r--src/test.do4
-rw-r--r--uninstall.do9
5 files changed, 62 insertions, 24 deletions
diff --git a/config.rc b/config.rc
index b6dc81e..f09b44c 100644
--- a/config.rc
+++ b/config.rc
@@ -14,6 +14,31 @@ setv() {
esac
}
+setv VERSION = 5.1.1
+
+# Paths
+setv PREFIX = /usr/local
+setv BINDIR = "${PREFIX}/bin"
+setv SHAREDIR = "${PREFIX}/share"
+setv DOCDIR = "${SHAREDIR}/doc"
+setv CPTDOC = "${DOCDIR}/cpt"
+setv MANPREFIX = "${SHAREDIR}/man"
+setv MAN1 = "${MANPREFIX}/man1"
+
+# Flags
+setv CFLAGS = -std=c99 -Wpedantic -Wall -Os
+setv CFLAGS += -D_XOPEN_SOURCE=700
+setv LDFLAGS = -s -static
+setv LIBS = -lc
+
+setv CC = cc
+setv LD = "${CC}"
+
+# Documentation tools
+setv EMACS = emacs
+setv MAKEINFO = makeinfo
+
+# Helper functions
redo_clean() {
# Clean function for various redo implementations
[ -r .do_built ] && {
@@ -38,29 +63,11 @@ PHONY() {
trap 'case " $PHONY " in *" $1 "*) rm -f $3; esac' EXIT INT
}
-setv VERSION = 5.1.1
-
-# Paths
-setv PREFIX = /usr/local
-setv BINDIR = "${PREFIX}/bin"
-setv SHAREDIR = "${PREFIX}/share"
-setv DOCDIR = "${SHAREDIR}/doc"
-setv CPTDOC = "${DOCDIR}/cpt"
-setv MANPREFIX = "${SHAREDIR}/man"
-setv MAN1 = "${MANPREFIX}/man1"
-
-# Flags
-setv CFLAGS = -std=c99 -Wpedantic -Wall -Os
-setv CFLAGS += -D_XOPEN_SOURCE=700
-setv LDFLAGS = -s -static
-setv LIBS = -lc
-
-setv CC = cc
-setv LD = "${CC}"
+getbin() {
+ # Function to get all executables
+ find src contrib bin -name 'cpt-*' ! -name '*.in' ! -name '*.[coh]'
+}
-# Documentation tools
-setv EMACS = emacs
-setv MAKEINFO = makeinfo
# Phony targets
PHONY all dist clean install uninstall test
diff --git a/default.do b/default.do
index d8c1cd9..f0ebcf4 100644
--- a/default.do
+++ b/default.do
@@ -25,9 +25,11 @@ case "$1" in
"cpt-$VERSION.tar.xz")
redo docs/cpt.info
rm -rf -- "cpt-$VERSION"
- find . -type f ! -name '.*' ! -path './.*' |
+ mkdir -p "cpt-$VERSION"
+ { git ls-tree -r HEAD --name-only && echo docs/cpt.info ;} |
while read -r file; do
- mkdir -p "cpt-$VERSION/${file%/*}"
+ [ "${file##*/*}" ] ||
+ mkdir -p "cpt-$VERSION/${file%/*}"
cp "$file" "cpt-$VERSION/$file"
done
tar cf "cpt-$VERSION.tar" "cpt-$VERSION"
diff --git a/install.do b/install.do
new file mode 100644
index 0000000..cc11bd4
--- /dev/null
+++ b/install.do
@@ -0,0 +1,16 @@
+. ./config.rc
+redo all
+
+# Install executables.
+mkdir -p "${DESTDIR}${BINDIR}"
+getbin | while read -r file; do
+ cp "$file" "${DESTDIR}${BINDIR}/${file##*/}"
+ chmod 755 "${DESTDIR}${BINDIR}/${file##*/}"
+done
+
+# Install manual pages.
+mkdir -p "${DESTDIR}${MAN1}"
+for man in man/*.1; do
+ cp "$man" "${DESTDIR}${MAN1}/${man##*/}"
+ chmod 644 "${DESTDIR}${MAN1}/${man##*/}"
+done
diff --git a/src/test.do b/src/test.do
new file mode 100644
index 0000000..9d32aef
--- /dev/null
+++ b/src/test.do
@@ -0,0 +1,4 @@
+. ../config.rc
+redo-ifchange cpt-lib
+shellcheck -x -f gcc ./cpt* ../contrib/*
+PHONY
diff --git a/uninstall.do b/uninstall.do
new file mode 100644
index 0000000..d2f4585
--- /dev/null
+++ b/uninstall.do
@@ -0,0 +1,9 @@
+. ./config.rc
+
+getbin | while read -r file; do
+ rm -f "${DESTDIR}${BINDIR}/${file##*/}"
+done
+
+for man in man/*.1; do
+ rm -f "${DESTDIR}${MAN1}/${man##*/}"
+done