Commit Diff


commit - 4cc61ea32e287e330ce1c4c965bdafefe43695dc
commit + c64c0d1524ca88914520c823d244c150e24926dc
blob - a4cad08b7c0233a3854f9a357ba4bdef6fd89bab
blob + 0ff9d239322213830cc3a7373ca540f20982027a
--- Makefile
+++ Makefile
@@ -1,13 +1,14 @@
 CC ?= cc
 CFLAGS += -Wall -Wextra -pedantic -std=c23 -Werror -I/usr/local/include
-LDFLAGS += -L/usr/local/lib -lsqlite3
+LDFLAGS += -L/usr/local/lib -lsqlite3 -lpthread -lm
+LDFLAGS_STATIC ?= -static
 
 SRCS = deskd.c cgi.c db.c natural.c about.c dateform.c bookings.c \
        bookingform.c book.c cancel.c
 OBJS = ${SRCS:.c=.o}
 
 deskd: ${OBJS}
-	${CC} -o $@ ${OBJS} ${LDFLAGS}
+	${CC} ${LDFLAGS_STATIC} -o $@ ${OBJS} ${LDFLAGS}
 
 .c.o:
 	${CC} ${CFLAGS} -c $<
blob - 57d7c37120a287b78aff1386085f435b1d1f9be6
blob + f4454c6a1ab5c1c83b582245dc30311184f86d73
--- README.md
+++ README.md
@@ -20,11 +20,14 @@ make
 The build uses `cc` with `-std=c23` and links against `-lsqlite3`.
 All other dependencies are satisfied by the C libraries available in OpenBSD base.
 
-On macOS (for development and testing), install sqlite3 via MacPorts and build
-with the appropriate include and library paths:
+The binary is statically linked by default so it can run inside an OpenBSD
+httpd chroot without access to shared libraries.
+
+On macOS (for development and testing), static linking is not supported.
+Install sqlite3 via MacPorts and build with static linking disabled:
 ```
 port install sqlite3
-make CFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib -lsqlite3"
+make LDFLAGS_STATIC= CFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib -lsqlite3"
 ```
 
 A `compat.h` header provides shims for OpenBSD-specific functions (`reallocarray`,