build docs + install and static targets

This commit is contained in:
Omar Polo 2021-01-17 12:12:37 +00:00
parent 0170ba023f
commit 771d8f281b
3 changed files with 26 additions and 53 deletions

View File

@ -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'
```

View File

@ -4,7 +4,12 @@ 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
@ -18,6 +23,12 @@ OBJS = gmid.o iri.o utf8.o lex.yy.o y.tab.o ex.o cgi.o sandbox.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

View File

@ -32,23 +32,24 @@ mind: on Linux, FreeBSD and OpenBSD is sandboxed via `seccomp(2)`,
## 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