1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-10-27 05:20:18 -04:00

Build fixes for NetBSD and TCP wrappers (libwrap)

This commit is contained in:
Kim Holviala 2018-01-29 14:42:12 +02:00
parent 60b391e65e
commit f56ae187ef
6 changed files with 20 additions and 22 deletions

View File

@ -54,14 +54,14 @@ IPCRM = /usr/bin/ipcrm
all: all:
@case `uname` in \ @case `uname` in \
Darwin) $(MAKE) ROOT="$(OSXROOT)" DESTDIR="$(OSXDEST)" $(BINARY); ;; \ Darwin) $(MAKE) ROOT="$(OSXROOT)" DESTDIR="$(OSXDEST)" $(BINARY); ;; \
Haiku) $(MAKE) EXTRA_LDFLAGS="-lnetwork" $(BINARY); ;; \ Haiku) $(MAKE) EXTRA_LIBS="-lnetwork" $(BINARY); ;; \
*) if [ -f "/usr/include/tcpd.h" ]; then $(MAKE) withwrap; else $(MAKE) $(BINARY); fi; ;; \ *) if [ -f "/usr/include/tcpd.h" ]; then $(MAKE) withwrap; else $(MAKE) $(BINARY); fi; ;; \
esac esac
generic: $(BINARY) generic: $(BINARY)
withwrap: withwrap:
$(MAKE) EXTRA_CFLAGS="-DHAVE_LIBWRAP" EXTRA_LDFLAGS="-lwrap" $(BINARY) $(MAKE) EXTRA_CFLAGS="-DHAVE_LIBWRAP" EXTRA_LIBS="-lwrap" $(BINARY)
# #
@ -87,7 +87,7 @@ ChangeLog:
$(NAME).c: $(NAME).h $(HEADERS) $(NAME).c: $(NAME).h $(HEADERS)
$(BINARY): $(OBJECTS) $(BINARY): $(OBJECTS)
$(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(OBJECTS) -o $@ $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(OBJECTS) $(EXTRA_LIBS) -o $@
.c.o: .c.o:
$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DVERSION="\"$(VERSION)\"" -DCODENAME="\"$(CODENAME)\"" -DDEFAULT_ROOT="\"$(ROOT)\"" $< -o $@ $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DVERSION="\"$(VERSION)\"" -DCODENAME="\"$(CODENAME)\"" -DDEFAULT_ROOT="\"$(ROOT)\"" $< -o $@

View File

@ -26,6 +26,15 @@
#include "gophernicus.h" #include "gophernicus.h"
/*
* Libwrap needs these defined
*/
#ifdef HAVE_LIBWRAP
int allow_severity = LOG_DEBUG;
int deny_severity = LOG_ERR;
#endif
/* /*
* Print gopher menu line * Print gopher menu line
*/ */

View File

@ -113,7 +113,6 @@
#include <errno.h> #include <errno.h>
#include <pwd.h> #include <pwd.h>
#include <limits.h> #include <limits.h>
#include <ctype.h>
#ifdef HAVE_SENDFILE #ifdef HAVE_SENDFILE
#include <sys/sendfile.h> #include <sys/sendfile.h>

View File

@ -35,11 +35,13 @@ void platform(state *st)
#if defined(_AIX) || defined(__linux) || defined(__APPLE__) #if defined(_AIX) || defined(__linux) || defined(__APPLE__)
FILE *fp; FILE *fp;
#endif #endif
#if defined(__linux) || defined(__APPLE__)
char buf[BUFSIZE];
#endif
#ifdef __linux #ifdef __linux
struct stat file; struct stat file;
#endif #endif
struct utsname name; struct utsname name;
char buf[BUFSIZE];
char sysname[64]; char sysname[64];
char release[64]; char release[64];
char machine[64]; char machine[64];
@ -154,14 +156,12 @@ void platform(state *st)
/* No DMI? Get possible hypervisor name */ /* No DMI? Get possible hypervisor name */
if (!*st->server_description && (fp = fopen("/sys/hypervisor/type" , "r"))) { if (!*st->server_description && (fp = fopen("/sys/hypervisor/type" , "r"))) {
if (fgets(buf, sizeof(buf), fp) == NULL) strclear(buf); if (fgets(buf, sizeof(buf), fp) != NULL) {
fclose(fp);
chomp(buf); chomp(buf);
ucfirst(buf);
if (*buf) snprintf(st->server_description, sizeof(st->server_description), "%s virtual machine", buf); if (*buf) snprintf(st->server_description, sizeof(st->server_description), "%s virtual machine", buf);
} }
fclose(fp);
}
/* Identify Gentoo */ /* Identify Gentoo */
if (!*sysname && (fp = fopen("/etc/gentoo-release", "r"))) { if (!*sysname && (fp = fopen("/etc/gentoo-release", "r"))) {

View File

@ -26,16 +26,6 @@
#include "gophernicus.h" #include "gophernicus.h"
/*
* Make a string's first character uppercase
*/
void ucfirst(char *str)
{
if (str == NULL || !*str) return;
*str = toupper(*str);
}
/* /*
* Repeat a character num times and zero-terminate * Repeat a character num times and zero-terminate
*/ */

View File

@ -4,7 +4,7 @@
## Generate Gophernicus version/build number ## Generate Gophernicus version/build number
## ##
DEFAULT=99 DEFAULT="PE"
if which git >/dev/null && test -d .git; then if which git >/dev/null && test -d .git; then
git log | grep -c "^commit" git log | grep -c "^commit"