Commit Diff


commit - 0170ba023f9c85bde2c4ae410b0af741383b7317
commit + 771d8f281baa6f15913d705365e00c3128feac8b
blob - c822e3e39fa5493b253e2c92798bc9ba04efbccc (mode 644)
blob + /dev/null
--- INSTALL.gmi
+++ /dev/null
@@ -1,43 +0,0 @@
-# Installing gmid
-
-## Dependencies
-
-gmid depends on libtls and a C compiler.  It's reported to compile with gcc 4.2, so it should work pretty everywhere now.
-
-The compilation is as easy as
-
-```
-make
-```
-
-Note that there isn't an install target yet.
-
-If you're a packager, don't forget to install also the manpage gmid.1
-
-### etags
-
-during the build process, etags(1) is invoked to generate a TAGS file.  This is done to aid the development.  Anyway, etags(1) is NOT NEEDED as dependency.  So, if you get something like
-
-```
-$ make
-...
-etags gmid.c
-make: exec(etags) failed (No such file or directory)
-*** Error code 1 (ignored)
-```
-
-you don't need to worry, it is OK.
-
-## Notes for specific OSes
-
-### OpenBSD
-
-Everything you need is in base, just run make.
-
-### FreeBSD
-
-You need to install security/libressl and then
-
-```
-make CFLAGS=-I/usr/local/include LDFLAGS='-L/usr/local/lib -ltls'
-```
blob - cf06deff85751c2096253f66008f343cb9f529f0
blob + 4d6ae12143b2610a5d740e9e462e7c21dd25279f
--- Makefile
+++ Makefile
@@ -4,8 +4,13 @@ LDFLAGS =	-ltls
 LEX =		lex
 YACC =		yacc
 
-.PHONY: all clean test
+PREFIX =	/usr/local
 
+# /usr/local/lib on FreeBSD
+LIBDIR =	/usr/lib/
+
+.PHONY: all static clean test install
+
 all: gmid TAGS README.md
 
 lex.yy.c: lex.l y.tab.c
@@ -18,6 +23,12 @@ OBJS = gmid.o iri.o utf8.o lex.yy.o y.tab.o ex.o cgi.o
 gmid: ${OBJS}
 	${CC} ${OBJS} -o gmid ${LDFLAGS}
 
+static: ${OBJS}
+	${CC} -static ${OBJS} \
+		${LIBDIR}/libcrypto.a ${LIBDIR}/libtls.a ${LIBDIR}/libssl.a \
+		-o gmid
+	strip gmid
+
 TAGS: gmid.c iri.c utf8.c ex.c cgi.c sandbox.c
 	-etags gmid.c iri.c utf8.c ex.c cgi.c sandbox.c || true
 
@@ -35,3 +46,7 @@ test: gmid iri_test
 	@echo "server tests"
 	@echo "=============================="
 	cd test && ./test.sh
+
+install: gmid
+	install -o root -g wheel -m 0755 gmid   ${PREFIX}/bin/
+	install -o root -g wheel -m 0644 gmid.1 ${PREFIX}/man/man1
blob - 7bbc2ed8f0d685235073578bec997bf20e18865e
blob + 0bcaa14069299c99e5dfc319e0b22324ec777310
--- README.md
+++ README.md
@@ -32,24 +32,25 @@ mind: on Linux, FreeBSD and OpenBSD is sandboxed via `
 
 ## Building
 
-gmid depends a POSIX libc and libtls.  It can probably be linked
-against libretls, but I've never tried.
+gmid depends on a POSIX libc and libtls (part of LibreSSL).  It can
+probably be linked against libretls, but I've never tried.  At build
+time, flex and yacc (or GNU bison) are also needed.
 
-See [INSTALL.gmi](INSTALL.gmi) for more info, but the build is as
-simple as
+The build is as simple as
 
     make
 
-The Makefile isn't able to produce a statically linked executable
-(yet), so for that you have to execute by hand
+or
 
-    make
-    cc -static *.o /usr/lib/lib{crypto,tls,ssl}.a -o gmid
-    strip gmid
+    make static
 
 to enjoy your ~2.3M statically-linked gmid.
 
+To install execute:
 
+    make install
+
+
 ## Architecture/Security considerations
 
 gmid is composed by two processes: a listener and an executor.  The