1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-11-03 04:27:17 -05:00

Fix various build system issues

This commit is contained in:
fosslinux 2021-01-03 12:09:34 +11:00
parent e3dc741f67
commit 765bf3aab8
7 changed files with 47 additions and 37 deletions

View File

@ -32,6 +32,7 @@ PLIST = org.$(NAME).server.plist
HAIKU_SRV = @HAIKUSRV@ HAIKU_SRV = @HAIKUSRV@
DEFAULT = @DEFAULT@ DEFAULT = @DEFAULT@
SYSCONF = @SYSCONF@ SYSCONF = @SYSCONF@
SYSTEMD = @SYSTEMD@
CC ?= @CC@ CC ?= @CC@
HOSTCC ?= @HOSTCC@ HOSTCC ?= @HOSTCC@
@ -101,13 +102,15 @@ install-root:
$(INSTALL) -m 644 $(MAP).sample $(DESTDIR)$(ROOT)/gophermap $(INSTALL) -m 644 $(MAP).sample $(DESTDIR)$(ROOT)/gophermap
install-inetd-update: install-root install-inetd-update: install-root
update-inetd --add $$(sed -e "s/@BINARY_PATH@/$(DESTDIR)$(SBINDIR)$(BINARY)/g" -e "s/@BINARY_NAME@/$(BINARY)/g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in) update-inetd --add "$$(sed -e "s:@BINARY_PATH@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in)"
update-inetd --enable gopher
install-inetd-manual: install-root install-inetd-manual: install-root
sed -e "s:@BINARY_PATH@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" -e "s/@BINARY_NAME@/$(BINARY)/g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in >> $(DESTDIR)$(INETD) sed -e "s:@BINARY_PATH@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in >> $(DESTDIR)$(INETD)
install-xinetd: install-root install-xinetd: install-root
$(INSTALL) -d -m 755 $(DESTDIR)/etc/xinetd.d $(INSTALL) -d -m 755 $(DESTDIR)/etc/xinetd.d
sed -i -e "s:@BINARY@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" init/$(NAME).xinetd
$(INSTALL) -m 644 -T init/$(NAME).xinetd $(DESTDIR)$(XINETD) $(INSTALL) -m 644 -T init/$(NAME).xinetd $(DESTDIR)$(XINETD)
install-osx: install-root install-osx: install-root
@ -122,12 +125,12 @@ install-haiku: install-root
install-systemd: install-root install-systemd: install-root
$(INSTALL) -d -m 755 $(DESTDIR)$(SYSCONF) $(INSTALL) -d -m 755 $(DESTDIR)$(SYSCONF)
$(INSTALL) -m 644 -T init/$(NAME).env $(DESTDIR)$(SYSCONF)/$(NAME) $(INSTALL) -m 644 -T init/$(NAME).env $(DESTDIR)$(SYSCONF)/$(NAME)
$(INSTALL) -m 644 -T init/$(NAME).socket $(DESTDIR)$(SYSCONF)/$(NAME)
$(INSTALL) -m 644 -T init/$(NAME)\@.service $(DESTDIR)$(SYSCONF)/$(NAME)
$(INSTALL) -d -m 755 $(DESTDIR)$(DEFAULT) $(INSTALL) -d -m 755 $(DESTDIR)$(DEFAULT)
$(INSTALL) -m 644 -T init/$(NAME).env $(DESTDIR)$(DEFAULT)/$(NAME) $(INSTALL) -m 644 -T init/$(NAME).env $(DESTDIR)$(DEFAULT)/$(NAME)
$(INSTALL) -m 644 -T init/$(NAME).socket $(DESTDIR)$(DEFAULT)/$(NAME) $(INSTALL) -d -m 755 $(DESTDIR)$(SYSTEMD)
$(INSTALL) -m 644 init/$(NAME)\@.service $(DESTDIR)$(DEFAULT)/$(NAME) $(INSTALL) -m 644 -t $(DESTDIR)$(SYSTEMD) init/$(NAME).socket
sed -i -e "s:@BINARY@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" init/$(NAME)\@.service
$(INSTALL) -m 644 -t $(DESTDIR)$(SYSTEMD) init/$(NAME)\@.service
uninstall: @UNINSTALL_INETD_UPDATE@ @UNINSTALL_INETD_MANUAL@ @UNINSTALL_XINETD@ @UNINSTALL_OSX@ @UNINSTALL_SYSTEMD@ uninstall: @UNINSTALL_INETD_UPDATE@ @UNINSTALL_INETD_MANUAL@ @UNINSTALL_XINETD@ @UNINSTALL_OSX@ @UNINSTALL_SYSTEMD@
rm -f $(DESTDIR)$(SBINDIR)/$(BINARY) rm -f $(DESTDIR)$(SBINDIR)/$(BINARY)
@ -150,8 +153,6 @@ uninstall-haiku:
uninstall-systemd: uninstall-systemd:
rm -f $(DESTDIR)$(SYSCONF)/$(NAME)/$(NAME).env rm -f $(DESTDIR)$(SYSCONF)/$(NAME)/$(NAME).env
rm -f $(DESTDIR)$(SYSCONF)/$(NAME)/$(NAME).socket
rm -f $(DESTDIR)$(SYSCONF)/$(NAME)/$(NAME)\@.service
rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME).env rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME).env
rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME).socket rm -f $(DESTDIR)$(SYSTEMD)/$(NAME).socket
rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME)\@.service rm -f $(DESTDIR)$(SYSTEMD)/$(NAME)\@.service

38
configure vendored
View File

@ -10,10 +10,11 @@ usage() {
printf " --mandir=PREFIX/share/man Prefix for manpages\\n" printf " --mandir=PREFIX/share/man Prefix for manpages\\n"
printf " --man8dir=MANDIR/man8 Prefix for section 8 manpages\\n" printf " --man8dir=MANDIR/man8 Prefix for section 8 manpages\\n"
printf " --gopherroot=/var/gopher Path to gopher root\\n" printf " --gopherroot=/var/gopher Path to gopher root\\n"
printf " --sysconfig=/etc/sysconfig Path to sysconfig directory\\n\\n" printf " --sysconfig=/etc/sysconfig Path to sysconfig directory\\n"
printf " --default=/etc/default Path to 'default' configuration directory\\n\\n" printf " --default=/etc/default Path to 'default' configuration directory\\n"
printf " --launchd=/Library/LaunchDaemons Path to launchd for MacOS\\n" printf " --launchd=/Library/LaunchDaemons Path to launchd for MacOS\\n"
printf " --haikusrv=/boot/common/settings/network/services Path to services directory in Haiku\\n\\n" printf " --haikusrv=/boot/common/settings/network/services Path to services directory in Haiku\\n"
printf " --systemd=/lib/systemd/system Path to systemd directory when using systemd listener\\n"
printf " --os=autodetected Your target OS, one of linux, mac, haiku, netbsd, openbsd or freebsd\\n" printf " --os=autodetected Your target OS, one of linux, mac, haiku, netbsd, openbsd or freebsd\\n"
printf " --listener=somelistener Program to recieve and pass network requests; one or more of systemd, inetd, xinetd, comma-seperated, or autodetect, mac or haiku (parameter required, mac/haiku required on respective OSes)\\n" printf " --listener=somelistener Program to recieve and pass network requests; one or more of systemd, inetd, xinetd, comma-seperated, or autodetect, mac or haiku (parameter required, mac/haiku required on respective OSes)\\n"
printf " --hostname=autodetected Desired hostname for gophernicus to identify as\\n" printf " --hostname=autodetected Desired hostname for gophernicus to identify as\\n"
@ -37,7 +38,8 @@ while [ "$#" -gt 0 ] ; do
os) OS="${value}"; shift ;; os) OS="${value}"; shift ;;
launchd) LAUNCHD="${value}"; shift ;; launchd) LAUNCHD="${value}"; shift ;;
haikusrv) HAIKUSRV="${value}"; shift ;; haikusrv) HAIKUSRV="${value}"; shift ;;
listener) LISTENER="${value}"; shift ;; systemd) SYSTEMD="${value}"; shift ;;
listener) LISTENERS="${value}"; shift ;;
hostname) HOSTNAME="${value}"; shift ;; hostname) HOSTNAME="${value}"; shift ;;
help) usage; exit 0 ;; help) usage; exit 0 ;;
*) usage; exit 2 ;; *) usage; exit 2 ;;
@ -56,6 +58,7 @@ done
: ${DEFAULTCONF:=/etc/default} : ${DEFAULTCONF:=/etc/default}
: ${LAUNCHD:=/Library/LaunchDaemons} : ${LAUNCHD:=/Library/LaunchDaemons}
: ${HAIKUSRV:=/boot/common/settings/network/services} : ${HAIKUSRV:=/boot/common/settings/network/services}
: ${SYSTEMD:=/lib/systemd/system}
: ${CC:=cc} : ${CC:=cc}
: ${HOSTCC:=${CC}} : ${HOSTCC:=${CC}}
: ${CFLAGS:=-O2} : ${CFLAGS:=-O2}
@ -118,7 +121,7 @@ else
fi fi
printf "\\n" printf "\\n"
listeners="$(echo ${LISTENER} | tr ',' ' ')" listeners="$(echo ${LISTENERS} | tr ',' ' ')"
for listener in ${listeners}; do for listener in ${listeners}; do
# Check for listener validity and autodetect if required # Check for listener validity and autodetect if required
# Checks that take place: # Checks that take place:
@ -142,33 +145,30 @@ for listener in ${listeners}; do
# OS-specific listeners # OS-specific listeners
case "${OS}" in case "${OS}" in
mac) mac)
LISTENER=mac listener=mac
printf "mac\\n" printf "mac\\n"
break ;; break ;;
haiku) haiku)
LISTENER=haiku listener=haiku
printf "haiku\\n" printf "haiku\\n"
break ;; break ;;
esac esac
if [ -d "/lib/systemd/system" ] ; then if [ -d "/lib/systemd/system" ] ; then
LISTENER=systemd listener=systemd
printf "systemd\\n" printf "systemd\\n"
break
fi fi
printf "checking for inetd... " printf "checking for inetd... "
if command -v update-inetd; then if command -v update-inetd && [ "${listener}" = "autodetect" ]; then
LISTENER=inetd listener=inetd
printf "inetd\\n" printf "inetd\\n"
break
fi fi
printf "checking for xinetd... " printf "checking for xinetd... "
if XINETD="$(command -v xinetd)"; then if XINETD="$(command -v xinetd)" && [ "${listener}" = "autodetect" ]; then
LISTENER=xinetd listener=xinetd
printf "xinetd\\n" printf "xinetd\\n"
break
fi fi
# Ensure we detected something # Ensure we detected something
@ -299,6 +299,7 @@ sed -i -e "s:@ROOT@:${GOPHERROOT}:" Makefile
sed -i -e "s:@HAIKUSRV@:${HAIKUSRV}:" Makefile sed -i -e "s:@HAIKUSRV@:${HAIKUSRV}:" Makefile
sed -i -e "s:@LAUNCHD@:${LAUNCHD}:" Makefile sed -i -e "s:@LAUNCHD@:${LAUNCHD}:" Makefile
sed -i -e "s:@SYSTEMD@:${SYSTEMD}:" Makefile
sed -i -e "s:@INSTALL_ROOT@:${INSTALL_ROOT}:" Makefile sed -i -e "s:@INSTALL_ROOT@:${INSTALL_ROOT}:" Makefile
sed -i -e "s:@INSTALL_OSX@:${INSTALL_OSX}:" Makefile sed -i -e "s:@INSTALL_OSX@:${INSTALL_OSX}:" Makefile
@ -328,5 +329,12 @@ for f in gophernicus.env haiku_snippet org.gophernicus.server.plist \
printf "done\\n" printf "done\\n"
done done
# And generate gophernicus@.service
printf "creating init/gophernicus@.service... "
sed -e "s:@DEFAULT@:${DEFAULTCONF}:" \
-e "s:@SYSCONFIG@:${SYSCONFIG}:" \
'init/gophernicus@.service.in' > 'init/gophernicus@.service'
printf "done\\n"
# Cleanup # Cleanup
rm -f conftest conftest.c rm -f conftest conftest.c

1
init/.gitignore vendored
View File

@ -3,3 +3,4 @@ org.gophernicus.server.plist
gophernicus.xinetd gophernicus.xinetd
inetlin inetlin
gophernicus.env gophernicus.env
gophernicus@.service

View File

@ -5,7 +5,7 @@ service gopher
socket_type = stream socket_type = stream
wait = no wait = no
user = nobody user = nobody
server = /usr/sbin/gophernicus server = @BINARY@
server_args = -r/var/gopher -h@HOSTNAME@ server_args = -r/var/gopher -h@HOSTNAME@
disable = no disable = no
} }

View File

@ -1,10 +0,0 @@
[Unit]
Description=Gophernicus gopher server
[Service]
EnvironmentFile=-/etc/default/gophernicus
EnvironmentFile=-/etc/sysconfig/gophernicus
ExecStart=/usr/sbin/gophernicus -h %H $OPTIONS
SuccessExitStatus=1
StandardInput=socket
User=nobody

View File

@ -0,0 +1,10 @@
[Unit]
Description=Gophernicus gopher server
[Service]
EnvironmentFile=-@DEFAULT@/gophernicus
EnvironmentFile=-@SYSCONFIG@/gophernicus
ExecStart=@BINARY@ $OPTIONS
SuccessExitStatus=1
StandardInput=socket
User=nobody

View File

@ -1 +1 @@
gopher stream tcp nowait @BINARY_PATH@ @BINARY_NAME@ @OPTIONS@ gopher stream tcp nowait nobody @BINARY_PATH@ @OPTIONS@