чување db0bb3faaf8744b9b68d0c300dcf22a80ed3a6af
родитељ 118c344443d3572d7f106d8b9949c13ce2f1bab7
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 29 Sep 2023 21:45:23 +0200
Change build scripts synchronized from sled; OpenBSD build and instructions
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 7, додавања: 49(+), брисања: 18(-)
diff --git a/INSTALL b/INSTALL
@@ -2,7 +2,6 @@ Prerequisites
=============
* C compiler - defaults in config.redo
-* gzip
* libSDL (SDL2, SDL2_image)
@@ -28,3 +27,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 @@
-redo lav-sdl
+redo-ifchange lav-sdl
diff --git a/clean.do b/clean.do
@@ -1 +1 @@
-rm -f *.o lav-sdl local.h
+rm -f *.o *~ lav-sdl local.h
diff --git a/config.redo b/config.redo
@@ -1,4 +1,17 @@
PREFIX=${PREFIX:-/usr/local}
+
+BINDIR=$PREFIX/bin
+DATADIR=$PREFIX/share/lav-sdl
+DOCDIR=$PREFIX/share/doc/lav-sdl
+
+PROGS="lav-sdl"
+DATAFILES=$(find \( -name '*.dat' -o -name '*.png' \) -print)
+DOCS="README LICENSE"
+
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,11 +1,12 @@
redo-ifchange all
. ./config.redo
-BINDIR=$PREFIX/bin
-if [ -z "$DATADIR" ]; then
- DATADIR=$PREFIX/share/lav-sdl
-fi
-install -d $BINDIR $DATADIR
-install -m 0755 lav-sdl $BINDIR
-for datafile in *.dat *.png; do
- install -m 0644 $datafile $DATADIR/$datafile
+install -d "$DOCDIR" "$BINDIR" "$DATADIR"
+for docfile in $DOCS; do
+ install -Dm 0644 "${docfile}" "${DOCDIR}/${docfile}"
+done
+for datafile in $DATAFILES; do
+ install -m 0644 "${datafile}" "${DATADIR}/${datafile}"
+done
+for binfile in $PROGS; do
+ install -Dm 0755 "${binfile}" "${BINDIR}/${binfile}"
done
diff --git a/lav-sdl.do b/lav-sdl.do
@@ -9,5 +9,5 @@ done | xargs redo-ifchange
LIBS=$(pkg-config --libs sdl2)
LIBS="$LIBS $(pkg-config --libs SDL2_image)"
LIBS="$LIBS -lm"
-$CC -o $3 lav-sdl.o $LIBS
-$STRIP $3
+${CC} -o $3 lav-sdl.o ${LIBS}
+${STRIP} $3
diff --git a/uninstall.do b/uninstall.do
@@ -1,6 +1,10 @@
. ./config.redo
-BINDIR=$PREFIX/bin
-if [ -z "$DATADIR" ]; then
- DATADIR=$PREFIX/share/lav-sdl
-fi
-rm -f $BINDIR/lav-sdl $(find $DATADIR -type f)
+for docfile in $DOCS; do
+ rm -f "${DOCDIR}/${docfile}"
+done
+for datafile in $DATAFILES; do
+ rm -f "${MANDIR}/${manfile}"
+done
+for binfile in $PROGS; do
+ rm -f "${BINDIR}/${binfile}"
+done