~strahinja/lav-sdl

db0bb3faaf8744b9b68d0c300dcf22a80ed3a6af — Страхиња Радић 5 months ago 118c344
Change build scripts synchronized from sled; OpenBSD build and instructions

Signed-off-by: Страхиња Радић <contact@strahinja.org>
7 files changed, 49 insertions(+), 18 deletions(-)

M INSTALL
M all.do
M clean.do
M config.redo
M install.do
M lav-sdl.do
M uninstall.do
M INSTALL => INSTALL +14 -1
@@ 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

M all.do => all.do +1 -1
@@ 1,1 1,1 @@
redo lav-sdl
redo-ifchange lav-sdl

M clean.do => clean.do +1 -1
@@ 1,1 1,1 @@
rm -f *.o lav-sdl local.h
rm -f *.o *~ lav-sdl local.h

M config.redo => config.redo +13 -0
@@ 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}

M install.do => install.do +9 -8
@@ 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

M lav-sdl.do => lav-sdl.do +2 -2
@@ 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

M uninstall.do => uninstall.do +9 -5
@@ 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