чување 0297300acff8966eb32d8fdc8e50eec336996ce2
родитељ 2b2ee0673ca0ef994f6e61e87c9c35482089b50f
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 29 Sep 2023 20:59:13 +0200
Change build scripts to make .gz optional; OpenBSD build and instructions
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 6, додавања: 53(+), брисања: 16(-)
diff --git a/INSTALL b/INSTALL
@@ -2,7 +2,6 @@ Prerequisites
=============
* C compiler - defaults in config.redo
-* gzip
Optional dependencies
@@ -11,6 +10,7 @@ Optional dependencies
* KaTeX[1] for math mode
* git (for {git-log})
* identify from ImageMagick[2] (for <img width="" height="">)
+* gzip (autodetected, for manpage compression)
[1]: https://katex.org
[2]: https://imagemagick.org
@@ -38,3 +38,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
are 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 slweb slweb.1.gz examples/all
+. ./config.redo
+redo-ifchange slweb slweb.1"$MANSUFFIX" examples/all
diff --git a/clean.do b/clean.do
@@ -1,3 +1,3 @@
-redo-always
-rm -f slweb slweb.1 slweb.1.gz *.o *~ version.h version date *.pdf *.html \
+. ./config.redo
+rm -f *.o *~ slweb $MANPAGES *.1 version.h version date *.pdf *.html \
examples/*/*.html
diff --git a/config.redo b/config.redo
@@ -1,4 +1,21 @@
PREFIX=${PREFIX:-/usr/local}
+
+BINDIR=$PREFIX/bin
+DOCDIR=$PREFIX/share/doc/slweb
+MANDIR=$PREFIX/share/man/man1
+
+# OpenBSD
+#MANDIR=$PREFIX/man/man1
+
+PROGS="slweb"
+DOCS="README LICENSE $(find examples -type f -print)"
+MANSUFFIX=${MANSUFFIX-$(command -v gzip >/dev/null && printf ".gz")}
+MANPAGES="slweb.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 -D_DEFAULT_SOURCE}
diff --git a/install.do b/install.do
@@ -1,12 +1,12 @@
redo-ifchange all
. ./config.redo
-BINDIR=$PREFIX/bin
-DOCDIR=$PREFIX/share/doc/slweb
-MANDIR=$PREFIX/share/man/man1
-install -d $DOCDIR
-for docfile in README $(find examples -type f); do
+install -d "$DOCDIR" "$BINDIR" "$MANDIR"
+for docfile in $DOCS; do
install -Dm 0644 "${docfile}" "${DOCDIR}/${docfile}"
done
-install -d $BINDIR $MANDIR
-install -m 0755 slweb $BINDIR
-install -m 0644 slweb.1.gz $MANDIR
+for binfile in $PROGS; do
+ install -Dm 0755 "${binfile}" "${BINDIR}/${binfile}"
+done
+for manfile in $MANPAGES; do
+ install -Dm 0644 "${manfile}" "${MANDIR}/${manfile}"
+done
diff --git a/uninstall.do b/uninstall.do
@@ -1,6 +1,11 @@
redo-always
. ./config.redo
-BINDIR=$PREFIX/bin
-DOCDIR=$PREFIX/share/doc/slweb
-MANDIR=$PREFIX/share/man/man1
-rm -f $BINDIR/slweb $MANDIR/slweb.1.gz $(find $DOCDIR -type f)
+for docfile in $DOCS; do
+ rm -f "${DOCDIR}/${docfile}"
+done
+for binfile in $PROGS; do
+ rm -f "${BINDIR}/${binfile}"
+done
+for manfile in $MANPAGES; do
+ rm -f "${MANDIR}/${manfile}"
+done