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:
parent
e3dc741f67
commit
765bf3aab8
21
Makefile.in
21
Makefile.in
@ -32,6 +32,7 @@ PLIST = org.$(NAME).server.plist
|
||||
HAIKU_SRV = @HAIKUSRV@
|
||||
DEFAULT = @DEFAULT@
|
||||
SYSCONF = @SYSCONF@
|
||||
SYSTEMD = @SYSTEMD@
|
||||
|
||||
CC ?= @CC@
|
||||
HOSTCC ?= @HOSTCC@
|
||||
@ -101,13 +102,15 @@ install-root:
|
||||
$(INSTALL) -m 644 $(MAP).sample $(DESTDIR)$(ROOT)/gophermap
|
||||
|
||||
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
|
||||
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) -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-osx: install-root
|
||||
@ -122,12 +125,12 @@ install-haiku: install-root
|
||||
install-systemd: install-root
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(SYSCONF)
|
||||
$(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) -m 644 -T init/$(NAME).env $(DESTDIR)$(DEFAULT)/$(NAME)
|
||||
$(INSTALL) -m 644 -T init/$(NAME).socket $(DESTDIR)$(DEFAULT)/$(NAME)
|
||||
$(INSTALL) -m 644 init/$(NAME)\@.service $(DESTDIR)$(DEFAULT)/$(NAME)
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(SYSTEMD)
|
||||
$(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@
|
||||
rm -f $(DESTDIR)$(SBINDIR)/$(BINARY)
|
||||
@ -150,8 +153,6 @@ uninstall-haiku:
|
||||
|
||||
uninstall-systemd:
|
||||
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).socket
|
||||
rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME)\@.service
|
||||
rm -f $(DESTDIR)$(SYSTEMD)/$(NAME).socket
|
||||
rm -f $(DESTDIR)$(SYSTEMD)/$(NAME)\@.service
|
||||
|
38
configure
vendored
38
configure
vendored
@ -10,10 +10,11 @@ usage() {
|
||||
printf " --mandir=PREFIX/share/man Prefix for manpages\\n"
|
||||
printf " --man8dir=MANDIR/man8 Prefix for section 8 manpages\\n"
|
||||
printf " --gopherroot=/var/gopher Path to gopher root\\n"
|
||||
printf " --sysconfig=/etc/sysconfig Path to sysconfig directory\\n\\n"
|
||||
printf " --default=/etc/default Path to 'default' configuration directory\\n\\n"
|
||||
printf " --sysconfig=/etc/sysconfig Path to sysconfig directory\\n"
|
||||
printf " --default=/etc/default Path to 'default' configuration directory\\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 " --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"
|
||||
@ -37,7 +38,8 @@ while [ "$#" -gt 0 ] ; do
|
||||
os) OS="${value}"; shift ;;
|
||||
launchd) LAUNCHD="${value}"; shift ;;
|
||||
haikusrv) HAIKUSRV="${value}"; shift ;;
|
||||
listener) LISTENER="${value}"; shift ;;
|
||||
systemd) SYSTEMD="${value}"; shift ;;
|
||||
listener) LISTENERS="${value}"; shift ;;
|
||||
hostname) HOSTNAME="${value}"; shift ;;
|
||||
help) usage; exit 0 ;;
|
||||
*) usage; exit 2 ;;
|
||||
@ -56,6 +58,7 @@ done
|
||||
: ${DEFAULTCONF:=/etc/default}
|
||||
: ${LAUNCHD:=/Library/LaunchDaemons}
|
||||
: ${HAIKUSRV:=/boot/common/settings/network/services}
|
||||
: ${SYSTEMD:=/lib/systemd/system}
|
||||
: ${CC:=cc}
|
||||
: ${HOSTCC:=${CC}}
|
||||
: ${CFLAGS:=-O2}
|
||||
@ -118,7 +121,7 @@ else
|
||||
fi
|
||||
printf "\\n"
|
||||
|
||||
listeners="$(echo ${LISTENER} | tr ',' ' ')"
|
||||
listeners="$(echo ${LISTENERS} | tr ',' ' ')"
|
||||
for listener in ${listeners}; do
|
||||
# Check for listener validity and autodetect if required
|
||||
# Checks that take place:
|
||||
@ -142,33 +145,30 @@ for listener in ${listeners}; do
|
||||
# OS-specific listeners
|
||||
case "${OS}" in
|
||||
mac)
|
||||
LISTENER=mac
|
||||
listener=mac
|
||||
printf "mac\\n"
|
||||
break ;;
|
||||
haiku)
|
||||
LISTENER=haiku
|
||||
listener=haiku
|
||||
printf "haiku\\n"
|
||||
break ;;
|
||||
esac
|
||||
|
||||
if [ -d "/lib/systemd/system" ] ; then
|
||||
LISTENER=systemd
|
||||
listener=systemd
|
||||
printf "systemd\\n"
|
||||
break
|
||||
fi
|
||||
|
||||
printf "checking for inetd... "
|
||||
if command -v update-inetd; then
|
||||
LISTENER=inetd
|
||||
if command -v update-inetd && [ "${listener}" = "autodetect" ]; then
|
||||
listener=inetd
|
||||
printf "inetd\\n"
|
||||
break
|
||||
fi
|
||||
|
||||
printf "checking for xinetd... "
|
||||
if XINETD="$(command -v xinetd)"; then
|
||||
LISTENER=xinetd
|
||||
if XINETD="$(command -v xinetd)" && [ "${listener}" = "autodetect" ]; then
|
||||
listener=xinetd
|
||||
printf "xinetd\\n"
|
||||
break
|
||||
fi
|
||||
|
||||
# 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:@LAUNCHD@:${LAUNCHD}:" Makefile
|
||||
sed -i -e "s:@SYSTEMD@:${SYSTEMD}:" Makefile
|
||||
sed -i -e "s:@INSTALL_ROOT@:${INSTALL_ROOT}:" 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"
|
||||
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
|
||||
rm -f conftest conftest.c
|
||||
|
1
init/.gitignore
vendored
1
init/.gitignore
vendored
@ -3,3 +3,4 @@ org.gophernicus.server.plist
|
||||
gophernicus.xinetd
|
||||
inetlin
|
||||
gophernicus.env
|
||||
gophernicus@.service
|
||||
|
@ -5,7 +5,7 @@ service gopher
|
||||
socket_type = stream
|
||||
wait = no
|
||||
user = nobody
|
||||
server = /usr/sbin/gophernicus
|
||||
server = @BINARY@
|
||||
server_args = -r/var/gopher -h@HOSTNAME@
|
||||
disable = no
|
||||
}
|
||||
|
@ -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
|
10
init/gophernicus@.service.in
Normal file
10
init/gophernicus@.service.in
Normal 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
|
@ -1 +1 @@
|
||||
gopher stream tcp nowait @BINARY_PATH@ @BINARY_NAME@ @OPTIONS@
|
||||
gopher stream tcp nowait nobody @BINARY_PATH@ @OPTIONS@
|
||||
|
Loading…
Reference in New Issue
Block a user