summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-01 19:20:23 -0500
committerJune McEnroe <june@causal.agency>2020-03-01 21:14:52 -0500
commitc876c88c2ac74255fa402c441343e8314d1fff8f (patch)
treee6420b0a64c4e8ef9709d129b3ce2a11b484602a
parentAdvertise STS policy (diff)
downloadpounce-c876c88c2ac74255fa402c441343e8314d1fff8f.tar.gz
pounce-c876c88c2ac74255fa402c441343e8314d1fff8f.zip
Replace .mk files with configure script
Copied and expanded from catgirl.
Diffstat (limited to '')
-rw-r--r--Darwin.mk2
-rw-r--r--Linux.mk6
-rw-r--r--Makefile7
-rw-r--r--README.751
-rw-r--r--bounce.c4
-rw-r--r--bounce.h4
-rwxr-xr-xconfigure43
7 files changed, 80 insertions, 37 deletions
diff --git a/Darwin.mk b/Darwin.mk
deleted file mode 100644
index 42ba483..0000000
--- a/Darwin.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-LIBRESSL_PREFIX = /usr/local/opt/libressl
-LDLIBS := ${LDLIBS:-lcrypt=}
diff --git a/Linux.mk b/Linux.mk
deleted file mode 100644
index fff0c8a..0000000
--- a/Linux.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-CFLAGS += -D_GNU_SOURCE -D'CERTBOT_PATH="/etc/letsencrypt"'
-LDLIBS_calico = -lcrypto
-
-MANDIR = ${PREFIX}/share/man
-RCS =
-DIRS =
diff --git a/Makefile b/Makefile
index de08e06..597534e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,8 @@
 PREFIX = /usr/local
-MANDIR = ${PREFIX}/man
+MANDIR = ${PREFIX}/share/man
 ETCDIR = ${PREFIX}/etc
-LIBRESSL_PREFIX = /usr/local
-LIBRESSL_BIN_PREFIX = ${LIBRESSL_PREFIX:%=%/bin}
 
 CFLAGS += -std=c11 -Wall -Wextra -Wpedantic
-CFLAGS += ${LIBRESSL_PREFIX:%=-I%/include}
-CFLAGS += ${LIBRESSL_BIN_PREFIX:%=-D'LIBRESSL_BIN_PREFIX="%/"'}
-LDFLAGS += ${LIBRESSL_PREFIX:%=-L%/lib}
 LDLIBS = -lcrypt -lcrypto -ltls
 
 BINS = calico pounce
diff --git a/README.7 b/README.7
index 1508628..225a7a7 100644
--- a/README.7
+++ b/README.7
@@ -1,4 +1,4 @@
-.Dd January 17, 2020
+.Dd March  1, 2020
 .Dt README 7
 .Os "Causal Agency"
 .
@@ -15,24 +15,6 @@ and the IRCv3.2
 .Sy server-time
 extension to communicate with clients.
 .
-.Pp
-.Nm
-requires LibreSSL
-.Pq Fl ltls
-and targets
-.Fx .
-It can also be built
-on Darwin or GNU/Linux
-by copying the appropriate file to
-.Pa config.mk
-and modifying as needed.
-On
-.Fx ,
-processes are sandboxed with
-.Xr capsicum 4 .
-On other systems,
-who knows what might happen?
-.
 .Sh RATIONALE
 As a former
 .Xr znc 1
@@ -58,6 +40,37 @@ extension,
 all events can be accurately replayed,
 rather than being limited to messages.
 .
+.Sh INSTALLING
+.Nm
+requires LibreSSL
+.Pq Fl ltls
+and primarily targets
+.Fx ,
+as well as macOS and Linux.
+On
+.Fx ,
+processes are sandboxed with
+.Xr capsicum 4 .
+On other systems,
+who knows what might happen?
+.
+.Bd -literal -offset indent
+\&./configure
+make all
+sudo make install PREFIX=/usr/local
+.Ed
+.
+.Pp
+If your system installs LibreSSL
+in a non-standard path, set
+.Ev PKG_CONFIG_PATH
+for
+.Nm ./configure .
+For example,
+.Bd -literal -offset indent
+PKG_CONFIG_PATH=/opt/libressl/lib/pkgconfig ./configure
+.Ed
+.
 .Sh FILES
 .Bl -tag -width "dispatch.c" -compact
 .It Pa bounce.h
diff --git a/bounce.c b/bounce.c
index efcc59d..604830a 100644
--- a/bounce.c
+++ b/bounce.c
@@ -58,7 +58,7 @@ static void genKey(const char *path) {
 	char subj[256];
 	snprintf(subj, sizeof(subj), "/CN=%.*s", (int)strcspn(name, "."), name);
 	execlp(
-		LIBRESSL_BIN_PREFIX "openssl", "openssl", "req",
+		OPENSSL_BIN, "openssl", "req",
 		"-x509", "-new", "-newkey", "rsa:4096", "-sha256", "-days", "3650",
 		"-nodes", "-subj", subj, "-keyout", path,
 		NULL
@@ -97,7 +97,7 @@ static void genCert(const char *path, const char *ca) {
 	close(rw[1]);
 	redir(STDIN_FILENO, rw[0]);
 	execlp(
-		LIBRESSL_BIN_PREFIX "openssl", "openssl", "x509",
+		OPENSSL_BIN, "openssl", "x509",
 		"-CA", ca, "-CAcreateserial", "-days", "3650",
 		NULL
 	);
diff --git a/bounce.h b/bounce.h
index ffbd24b..a5dc836 100644
--- a/bounce.h
+++ b/bounce.h
@@ -27,8 +27,8 @@
 #define CERTBOT_PATH "/usr/local/etc/letsencrypt"
 #endif
 
-#ifndef LIBRESSL_BIN_PREFIX
-#define LIBRESSL_BIN_PREFIX
+#ifndef OPENSSL_BIN
+#define OPENSSL_BIN "openssl"
 #endif
 
 #define SOURCE_URL "https://git.causal.agency/pounce"
diff --git a/configure b/configure
new file mode 100755
index 0000000..7d1e424
--- /dev/null
+++ b/configure
@@ -0,0 +1,43 @@
+#!/bin/sh
+set -eu
+
+case "$(uname)" in
+	(FreeBSD)
+		if ! pkg info -e libressl; then
+			echo 'LibreSSL required'
+			exit 1
+		fi
+		prefix=$(pkg query '%p' libressl)
+		cat >config.mk <<-EOF
+		MANDIR = \${PREFIX}/man
+		CFLAGS += -I${prefix}/include
+		CFLAGS += -D'OPENSSL_BIN="${prefix}/bin/openssl"'
+		LDFLAGS += -L${prefix}/lib
+		EOF
+		exit
+		;;
+esac
+
+libs='libcrypto libtls'
+pkg-config --print-errors $libs
+
+cat >config.mk <<EOF
+CFLAGS += $(pkg-config --cflags $libs)
+CFLAGS += -D'OPENSSL_BIN="$(pkg-config --variable=prefix openssl)/bin/openssl"'
+LDFLAGS += $(pkg-config --libs-only-L $libs)
+LDLIBS = -lcrypt $(pkg-config --libs-only-l $libs)
+EOF
+
+case "$(uname)" in
+	(Darwin)
+		echo 'LDLIBS := ${LDLIBS:-lcrypt=}' >>config.mk
+		;;
+	(Linux)
+		cat >>config.mk <<-EOF
+		CFLAGS += -D_GNU_SOURCE -D'CERTBOT_PATH="/etc/letsencrypt"'
+		LDLIBS_calico = $(pkg-config --libs-only-l libcrypto)
+		RCS =
+		DIRS =
+		EOF
+		;;
+esac
9-07-31ui-snapshot: use cgit_{open|close}_filter() to execute compressorsLars Hjemli This simplifies the code in ui-snapshot.c and makes the test-suite verify the new filter-functions. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-31Add generic filter/plugin infrastructureLars Hjemli The functions cgit_open_filter() and cgit_close_filter() can be used to execute filters on the output stream from cgit. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25Add support for mime type registration and lookupLars Hjemli This patch makes it possible to register mappings from filename extension to mime type in cgitrc and use this mapping when returning blob content in `plain` view. The reason for adding this mapping to cgitrc (as opposed to parsing something like /etc/mime.types) is to allow quick lookup of a limited number of filename extensions (/etc/mime-types on my machine currently contains over 700 entries). NB: A nice addition to this patch would be to parse /etc/mime.types when `plain` view is requested for a file with an extension for which there is no mapping registered in cgitrc. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25cgit.h: keep config flags sortedLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25cgitrc.5.txt: document 'embedded' and 'noheader'Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25Add support for 'noheader' optionLars Hjemli This option can be used to disable the standard cgit page header, which might be useful in combination with the 'embedded' option. Suggested-by: Mark Constable <markc@renta.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25cgitrc.5.txt: document 'head-include'Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25ui-blob: return 'application/octet-stream' for binary blobsLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25ui-plain: Return 'application/octet-stream' for binary files.Remko Tronçon Signed-off-by: Remko Tronçon <git@el-tramo.be> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-06-11use cgit_httpscheme() for atom feedDiego Ongaro 2009-06-11add cgit_httpscheme() -> http:// or https://Diego Ongaro 2009-06-07Return http statuscode 404 on unknown branchLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-06-07Add head-include configuration option.Mark Lodato This patch adds an option to the configuration file, "head-include", which works just like "header" or "footer", except the content is put into the HTML's <head> tag. 2009-03-15CGIT 0.8.2.1Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15Fix doc-related glitches in Makefile and .gitignoreLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15ui-snapshot: avoid segfault when no filename is specifiedLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15fix segfault when displaying empty blobsEric Wong When size is zero, subtracting one from it turns it into ULONG_MAX which causes an out-of-bounds access on buf. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-19Add support for HEAD requestsLars Hjemli This is a quick 'n dirty hack which makes cgit honor HEAD requests. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-19Add support for ETag in 'plain' viewLars Hjemli When downloading a blob identified by its path, the client might want to know if the blob has been modified since a previous download of the same path. To this end, an ETag containing the blob SHA1 seems to be ideal. Todo: add support for HEAD requests... Suggested-by: Owen Taylor <otaylor@redhat.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-12ui-tree: escape ascii-text properly in hexdump viewLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-12Makefile: add doc-related targetsLars Hjemli