From 522343e0f8506dead25aa8eb34d35837b747ca23 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Fri, 19 Jan 2018 17:13:06 +1000 Subject: [PATCH] OpenBSD support --- Makefile | 4 ++ src/Makefile.openbsd | 75 ++++++++++++++++++++++++++++ src/Makefile.openbsd.WWW | 81 +++++++++++++++++++++++++++++++ src/chat_system.c | 3 ++ src/www.c | 2 +- utils/fileapprove/Makefile | 5 ++ utils/magichat/main.c | 3 ++ utils/magiftpd/Makefile | 5 ++ utils/magimail/src/Makefile.linux | 2 +- utils/ticproc/Makefile | 5 ++ 10 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 src/Makefile.openbsd create mode 100644 src/Makefile.openbsd.WWW diff --git a/Makefile b/Makefile index b47bff0..a314020 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,10 @@ endif ifeq ($(OS), SunOS) MAKEFILE=Makefile.sunos endif +ifeq ($(OS), OpenBSD) + MAKEFILE=Makefile.openbsd +endif + all: magicka .PHONY: magicka www clean cleanwww diff --git a/src/Makefile.openbsd b/src/Makefile.openbsd new file mode 100644 index 0000000..10119a8 --- /dev/null +++ b/src/Makefile.openbsd @@ -0,0 +1,75 @@ +CC=cc +CFLAGS=-std=gnu99 -I/usr/local/include -I../deps/ +DEPS = bbs.h +JAMLIB = ../deps/jamlib/jamlib.a +ZMODEM = ../deps/Xmodem/libzmodem.a +LUA = ../deps/lua/liblua.a +ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a +JSMN = ../deps/jsmn/libjsmn.a +CDK = ../deps/cdk-5-20161210/libcdk.a + +all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd + +${LUA}: + cd ../deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS= + +${JAMLIB}: + cd ../deps/jamlib && $(MAKE) -f Makefile.linux MAKEFLAGS= + +${ZMODEM}: + cd ../deps/Xmodem && $(MAKE) MAKEFLAGS= + +${ODOORS}: + cd ../deps/odoors/ && $(MAKE) + +$(JSMN): + cd ../deps/jsmn/ && $(MAKE) + +$(CDK): + cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/pkg/include && ./configure --with-ncurses + cd ../deps/cdk-5.0-20161210/ && $(MAKE) + +OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o +%.o: %.c $(DEPS) + $(CC) -c -o $@ $< $(CFLAGS) + +magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} + $(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv + +magiedit: $(ODOORS) + cd ../utils/magiedit && $(MAKE) + +magimail: $(JAMLIB) + cd ../utils/magimail && $(MAKE) freebsd + +ticproc: + cd ../utils/ticproc && $(MAKE) + +mgpost: $(JAMLIB) + cd ../utils/mgpost && $(MAKE) + +magichat: $(JSMN) + cd ../utils/magichat && $(MAKE) + +fileapprove: $(CDK) + cd ../utils/fileapprove && $(MAKE) + +magiftpd: + cd ../utils/magiftpd && $(MAKE) + +.PHONY: clean + +clean: + rm -f $(OBJ) ../magicka + cd ../deps/lua && $(MAKE) clean + cd ../deps/jamlib && $(MAKE) -f Makefile.linux clean + cd ../deps/Xmodem && $(MAKE) clean + cd ../utils/magimail && $(MAKE) cleanfreebsd + cd ../utils/magiedit && $(MAKE) clean + cd ../deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` + cd ../utils/ticproc && $(MAKE) clean + cd ../utils/mgpost && $(MAKE) clean + cd ../utils/magichat && $(MAKE) clean + cd ../deps/cdk-5.0-20161210 && $(MAKE) clean + cd ../utils/fileapprove && $(MAKE) clean + cd ../utils/magiftpd && $(MAKE) clean diff --git a/src/Makefile.openbsd.WWW b/src/Makefile.openbsd.WWW new file mode 100644 index 0000000..abdb526 --- /dev/null +++ b/src/Makefile.openbsd.WWW @@ -0,0 +1,81 @@ +CC=cc +CFLAGS=-std=gnu99 -I/usr/local/include -I../deps/ -I../deps/libb64-1.2/include -DENABLE_WWW=1 +DEPS = bbs.h +JAMLIB = ../deps/jamlib/jamlib.a +ZMODEM = ../deps/Xmodem/libzmodem.a +LUA = ../deps/lua/liblua.a +B64 = ../deps/libb64-1.2/src/libb64.a +MICROHTTPD=-lmicrohttpd +ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a +JSMN = ../deps/jsmn/libjsmn.a +CDK = ../deps/cdk-5-20161210/libcdk.a + +all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd + +${LUA}: + cd ../deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS= + +${JAMLIB}: + cd ../deps/jamlib && $(MAKE) -f Makefile.linux MAKEFLAGS= + +${ZMODEM}: + cd ../deps/Xmodem && $(MAKE) MAKEFLAGS= + +${B64}: + cd ../deps/libb64-1.2 && $(MAKE) MAKEFLAGS= + +${ODOORS}: + cd ../deps/odoors/ && $(MAKE) + +$(JSMN): + cd ../deps/jsmn/ && $(MAKE) + +$(CDK): + cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/pkg/include && ./configure --with-ncurses + cd ../deps/cdk-5.0-20161210/ && $(MAKE) + +OBJ = ../deps/aha/aha.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o hashmap/hashmap.o menus.o +%.o: %.c $(DEPS) + $(CC) -c -o $@ $< $(CFLAGS) + +magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${B64} ${JSMN} + $(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv $(MICROHTTPD) + +magiedit: $(ODOORS) + cd ../utils/magiedit && $(MAKE) + +magimail: $(JAMLIB) + cd ../utils/magimail && $(MAKE) freebsd + +ticproc: + cd ../utils/ticproc && $(MAKE) + +mgpost: $(JAMLIB) + cd ../utils/mgpost && $(MAKE) + +magichat: $(JSMN) + cd ../utils/magichat && $(MAKE) + +fileapprove: $(CDK) + cd ../utils/fileapprove && $(MAKE) + +magiftpd: + cd ../utils/magiftpd && $(MAKE) + +.PHONY: clean + +clean: + rm -f $(OBJ) ../magicka + cd ../deps/lua && $(MAKE) clean + cd ../deps/jamlib && $(MAKE) -f Makefile.linux clean + cd ../deps/Xmodem && $(MAKE) clean + cd ../deps/libb64-1.2 && $(MAKE) clean + cd ../utils/magimail && $(MAKE) cleanfreebsd + cd ../utils/magiedit && $(MAKE) clean + cd ../deps/odoors/ && rm -rf libs-`uname -s` objs-`uname -s` exe-`uname -s` + cd ../utils/ticproc && $(MAKE) clean + cd ../utils/mgpost && $(MAKE) clean + cd ../utils/magichat && $(MAKE) clean + cd ../deps/cdk-5.0-20161210 && $(MAKE) clean + cd ../utils/fileapprove && $(MAKE) clean + cd ../utils/magiftpd && $(MAKE) clean diff --git a/src/chat_system.c b/src/chat_system.c index 7af7840..8fe0aa5 100644 --- a/src/chat_system.c +++ b/src/chat_system.c @@ -7,6 +7,9 @@ #include #include #include +#if defined(__OpenBSD__) +# include +#endif #include "../deps/jsmn/jsmn.h" #include "bbs.h" diff --git a/src/www.c b/src/www.c index c6d750d..bbb1bd2 100644 --- a/src/www.c +++ b/src/www.c @@ -8,7 +8,7 @@ #include #include #include -#if defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) #include #endif #include "bbs.h" diff --git a/utils/fileapprove/Makefile b/utils/fileapprove/Makefile index a4b59b3..475de96 100644 --- a/utils/fileapprove/Makefile +++ b/utils/fileapprove/Makefile @@ -15,6 +15,11 @@ ifeq ($(OS), NetBSD) CFLAGS=-I/usr/pkg/include LDFLAGS=-R/usr/pkg/lib -L/usr/pkg/lib -lsqlite3 -lncurses endif +ifeq ($(OS), OpenBSD) + CC=cc + CFLAGS=-I/usr/local/include + LDFLAGS=-L/usr/local/lib -lsqlite3 -lncurses +endif ifeq ($(OS), Linux) CC=gcc CFLAGS= diff --git a/utils/magichat/main.c b/utils/magichat/main.c index f065a98..c046858 100644 --- a/utils/magichat/main.c +++ b/utils/magichat/main.c @@ -7,6 +7,9 @@ #include #include #include +#if defined(__OpenBSD__) +# include +#endif #include "../../deps/jsmn/jsmn.h" struct chat_msg { diff --git a/utils/magiftpd/Makefile b/utils/magiftpd/Makefile index c08e98b..fd83d04 100644 --- a/utils/magiftpd/Makefile +++ b/utils/magiftpd/Makefile @@ -15,6 +15,11 @@ ifeq ($(OS), NetBSD) CFLAGS=-I/usr/pkg/include LDFLAGS=-R/usr/pkg/lib -L/usr/pkg/lib -lsqlite3 -lcrypto endif +ifeq ($(OS), OpenBSD) + CC=cc + CFLAGS=-I/usr/local/include + LDFLAGS=-L/usr/local/lib -lsqlite3 -lcrypto +endif ifeq ($(OS), Linux) CC=gcc CFLAGS= diff --git a/utils/magimail/src/Makefile.linux b/utils/magimail/src/Makefile.linux index 5605258..1d6bcae 100644 --- a/utils/magimail/src/Makefile.linux +++ b/utils/magimail/src/Makefile.linux @@ -46,7 +46,7 @@ else endif # Commands -ifeq ($(OS), $(filter $(OS), FreeBSD DragonFly)) +ifeq ($(OS), $(filter $(OS), FreeBSD DragonFly OpenBSD)) CC = cc $(CPPFLAGS) $(CFLAGS) $(DEFS) $(LDFLAGS) -L/usr/local/lib -I $(INCDIR) -I ../../../deps/ -I/usr/local/include -Wall else CC = gcc $(CPPFLAGS) $(CFLAGS) $(DEFS) $(LDFLAGS) -I $(INCDIR) -I ../../../deps/ -Wall diff --git a/utils/ticproc/Makefile b/utils/ticproc/Makefile index ec2fb41..c14c66b 100644 --- a/utils/ticproc/Makefile +++ b/utils/ticproc/Makefile @@ -15,6 +15,11 @@ ifeq ($(OS), NetBSD) CFLAGS=-I/usr/pkg/include LDFLAGS=-R/usr/pkg/lib -L/usr/pkg/lib endif +ifeq ($(OS), OpenBSD) + CC=cc + CFLAGS=-I/usr/local/include + LDFLAGS=-L/usr/local/lib +endif ifeq ($(OS), Linux) CC=gcc CFLAGS=