чување c5a5e217e7d90711997647d2d9d1d7ff403e6e0b
родитељ 3222f0ee2867cc0b24234f415bf5453df82107c6
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 29 Sep 2023 20:30:38 +0200
Change build scripts to make .gz optional; OpenBSD build and instructions
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 5, додавања: 50(+), брисања: 14(-)
diff --git a/INSTALL b/INSTALL
@@ -2,7 +2,12 @@ Prerequisites
=============
* C compiler defaults in config.redo
-* gzip
+
+
+Optional
+--------
+
+* gzip (autodetected, for manpage compression)
Install
@@ -27,3 +32,17 @@ Persistent build configuration file
The file config.redo will be sourced when building targets which also accept
configuration through environment variables. For example, CC and PREFIX can be
specified in config.redo.
+
+
+OpenBSD
+-------
+
+Replace gcc in CC with cc and add -D_BSD_SOURCE, eg:
+
+ # CC='cc -g -Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=200809L
+ -D_XOPEN_SOURCE=700 -D_BSD_SOURCE}' \
+ ./do install
+
+and change MANDIR to
+
+ MANDIR=$PREFIX/man/man1
diff --git a/all.do b/all.do
@@ -1 +1,2 @@
-redo-ifchange version.h table table.1.gz
+. ./config.redo
+redo-ifchange table table.1"$MANSUFFIX"
diff --git a/clean.do b/clean.do
@@ -1,2 +1,2 @@
-redo-always
-rm -f table table.1 table.1.gz *.o *~ version date
+. ./config.redo
+rm -f *.o *~ table *.1"$MANSUFFIX" *.1 version.h version date
diff --git a/config.redo b/config.redo
@@ -1,4 +1,21 @@
PREFIX=${PREFIX:-/usr/local}
+
+BINDIR=$PREFIX/bin
+DOCDIR=$PREFIX/share/doc/table
+MANDIR=$PREFIX/share/man/man1
+
+# OpenBSD
+#MANDIR=$PREFIX/man/man1
+
+PROGS="table"
+DOCS="README LICENSE $(find examples -type f -print)"
+MANSUFFIX=${MANSUFFIX-$(command -v gzip >/dev/null && printf ".gz")}
+MANPAGES="table.1${MANSUFFIX}"
+
CC=${CC:-gcc -g -Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=200809L \
-D_XOPEN_SOURCE=700}
STRIP=${STRIP:-:}
+
+# OpenBSD
+#CC=${CC:-cc -g -Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=200809L \
+#-D_XOPEN_SOURCE=700 -D_BSD_SOURCE}
diff --git a/install.do b/install.do
@@ -1,19 +1,18 @@
redo-ifchange all
. ./config.redo
-BINDIR=$PREFIX/bin
-DOCDIR=$PREFIX/share/doc/table
-MANDIR=$PREFIX/share/man/man1
-install -d $DOCDIR
-for executable in table; do
- install -Dm 0755 "${executable}" "${BINDIR}/${executable}"
+install -d "$DOCDIR" "$BINDIR" "$MANDIR"
+for docfile in $DOCS; do
+ install -Dm 0644 "${docfile}" "${DOCDIR}/${docfile}"
+done
+for binfile in $PROGS; do
+ install -Dm 0755 "${binfile}" "${BINDIR}/${binfile}"
done
for synonym in tablep tsvtable; do
ln -sf table "${BINDIR}/${synonym}"
done
-for docfile in README $(find examples -type f); do
- install -Dm 0644 "${docfile}" "${DOCDIR}/${docfile}"
+for manfile in $MANPAGES; do
+ install -Dm 0644 "${manfile}" "${MANDIR}/${manfile}"
done
-install -Dm 0644 table.1.gz "${MANDIR}/table.1.gz"
for synonym in tablep tsvtable; do
- ln -sf table.1.gz "${MANDIR}/${synonym}.1.gz"
+ ln -sf table.1"$MANSUFFIX" "${MANDIR}/${synonym}.1${MANSUFFIX}"
done