summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-23 17:43:54 -0400
committerJune McEnroe <june@causal.agency>2020-07-23 17:43:54 -0400
commit86133bdcaae3358bb4af740d8bfd22a045379ac4 (patch)
treee30583ad0b5bd4fa2f1fc164f25572905a4862a5
parentAdd OpenBSD instructions (diff)
downloadscooper-86133bdcaae3358bb4af740d8bfd22a045379ac4.tar.gz
scooper-86133bdcaae3358bb4af740d8bfd22a045379ac4.zip
Rewrite configure script
Diffstat (limited to '')
-rw-r--r--README.79
-rwxr-xr-xconfigure42
-rw-r--r--scooper.pc7
3 files changed, 42 insertions, 16 deletions
diff --git a/README.7 b/README.7
index 6f1ecd0..a37d8be 100644
--- a/README.7
+++ b/README.7
@@ -1,4 +1,4 @@
-.Dd July 21, 2020
+.Dd July 23, 2020
 .Dt README 7
 .Os "Causal Agency"
 .
@@ -26,21 +26,22 @@ and requires
 and SQLite.
 .
 .Bd -literal -offset indent
-\&./configure --static
+\&./configure
 make all
 make install
 .Ed
 .
 .Pp
+By default,
 .Nm
-should be statically linked
+is statically linked
 so it can easily run in
 .Xr chroot 2
 with
 .Xr kfcgi 8 .
 The default install
 .Ev PREFIX
-is set to
+is also set to
 .Pa ~/.local ,
 which is a convenient
 .Xr chroot 2
diff --git a/configure b/configure
index ab23150..c55e71a 100755
--- a/configure
+++ b/configure
@@ -1,9 +1,41 @@
 #!/bin/sh
 set -eu
 
-pkg-config "$@" --print-errors scooper.pc
+cflags() {
+	echo "CFLAGS += $*"
+}
+ldlibs() {
+	echo "LDLIBS ${o:-}= $*"
+	o=+
+}
+config() {
+	pkg-config --print-errors "$@"
+	cflags $(pkg-config --cflags "$@")
+	ldlibs $(pkg-config --libs "$@")
+}
+defstr() {
+	cflags "-D'$1=\"$2\"'"
+}
+defvar() {
+	defstr "$1" "$(pkg-config --variable=$3 $2)${4:-}"
+}
 
-cat >config.mk <<EOF
-CFLAGS += $(pkg-config "$@" --cflags scooper.pc)
-LDLIBS = $(pkg-config "$@" --libs scooper.pc)
-EOF
+exec >config.mk
+
+for opt; do
+	case "${opt}" in
+		(--prefix=*) echo "PREFIX = ${opt#*=}" ;;
+		(--mandir=*) echo "MANDIR = ${opt#*=}" ;;
+		(*) echo "warning: unsupported option ${opt}" >&2 ;;
+	esac
+done
+
+case "$(uname)" in
+	(FreeBSD|OpenBSD)
+		echo 'LDFLAGS += -static'
+		config --static kcgi kcgi-html sqlite3
+		;;
+	(*)
+		config kcgi kcgi-html sqlite3
+		;;
+esac
diff --git a/scooper.pc b/scooper.pc
deleted file mode 100644
index 1784b60..0000000
--- a/scooper.pc
+++ /dev/null
@@ -1,7 +0,0 @@
-Name: scooper
-Version:
-Description:
-URL:
-
-Requires: kcgi kcgi-html sqlite3
-Libs.private: -static
psfed.c?id=041d12fc7f7fca7f28ccc94708b740cbe84dfacb&follow=1'>Add r to psfed for invertJune McEnroe 2018-09-24Add psfed, a PSF2 font editorJune McEnroe 2018-09-21Add scheme -i to swap white and blackJune McEnroe 2018-09-21Map caps lock to escape on Linux consoleJune McEnroe 2018-09-19Fix README mandoc lintsJune McEnroe 2018-09-19Un-NOT trans.alpha values in pngoJune McEnroe 2018-09-18Refactor reads in pngo and clear palette between filesJune McEnroe 2018-09-17Add tRNS support to pngoJune McEnroe 2018-09-11Move gfx man pages to gfx/manJune McEnroe 2018-09-11Move bin man pages to bin/manJune McEnroe 2018-09-11Rewrite gfx.7 and render plaintext READMEJune McEnroe 2018-09-11Remove GAMES from BINSJune McEnroe 2018-09-11Rewrite bin.7 and render to plaintext READMEJune McEnroe 2018-09-11Add "blank" lines to man pagesJune McEnroe 2018-09-10Add mdoc syntax fileJune McEnroe 2018-09-08Fix Nm usage in multi-name man pagesJune McEnroe 2018-09-08Put real dates on man pagesJune McEnroe 2018-09-08Replace gfx README with REAMDE.7June McEnroe 2018-09-08Link gfx man pages in ~/.localJune McEnroe