From 9c6f3432150b4bc9d8408269cafc66f2b5d999fd Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 3 Jan 2017 18:25:35 +0000 Subject: [PATCH] Patch by Thomas Bernard to fix compilation on FreeBSD. Thanks! Fixes #50. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2173 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/Makefile | 11 +++++++++-- src/main.c | 2 +- src/misc.c | 1 + src/mountlist.c | 4 ++-- src/setup.c | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Makefile b/src/Makefile index a7ddc00f..cf63b6ec 100644 --- a/src/Makefile +++ b/src/Makefile @@ -360,8 +360,15 @@ endif # Compiles a regular linux executable for the native platform BIN = ../bin/grafx2 - COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g $(shell sdl-config --cflags) $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM) $(shell pkg-config --cflags libpng) -D_XOPEN_SOURCE=700 - LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT) $(shell pkg-config --libs libpng) $(LUALOPT) -lm + COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g $(shell sdl-config --cflags) $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM) + COPT += $(shell pkg-config --cflags libpng) + ifneq ($(PLATFORM), FreeBSD) + COPT += -D_XOPEN_SOURCE=700 + endif + LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT) + LOPT += $(shell pkg-config --libs libpng) + LOPT += $(LUALOPT) -lm + LOPT += -liconv CC = gcc OBJDIR = ../obj/unix FCLOPT = -lfontconfig diff --git a/src/main.c b/src/main.c index c2bdf926..51beadfd 100644 --- a/src/main.c +++ b/src/main.c @@ -80,7 +80,7 @@ #import #import #elif defined(__FreeBSD__) - #import + #include #endif diff --git a/src/misc.c b/src/misc.c index e61612ba..b36396c0 100644 --- a/src/misc.c +++ b/src/misc.c @@ -727,6 +727,7 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line, #if defined(__OpenBSD__) #include #endif + #include #include #elif defined(__BEOS__) || defined(__HAIKU__) #include diff --git a/src/mountlist.c b/src/mountlist.c index 54a88dcb..9bc405aa 100644 --- a/src/mountlist.c +++ b/src/mountlist.c @@ -25,7 +25,7 @@ // We don't use autoconf and all that in grafx2, so let's do the config here ... #if defined(__macosx__) || defined(__FreeBSD__) || defined(__OpenBSD__) // MacOS X is POSIX compliant #define MOUNTED_GETMNTINFO -#if defined(__macosx__) +#if defined(__macosx__) || defined(__FreeBSD__) #include #endif #if defined(__OpenBSD__) @@ -462,7 +462,7 @@ read_file_system_list (bool need_fs_type) me = malloc (sizeof *me); me->me_devname = strdup (fsp->f_mntfromname); me->me_mountdir = strdup (fsp->f_mntonname); -#if defined(__macosx__) || defined(__OpenBSD__) +#if defined(__macosx__) || defined(__OpenBSD__) || defined(__FreeBSD__) me->me_type = fsp->f_fstypename; #else me->me_type = fsp->fs_typename; diff --git a/src/setup.c b/src/setup.c index 4d145294..0702f22c 100644 --- a/src/setup.c +++ b/src/setup.c @@ -36,7 +36,7 @@ #import #import #elif defined(__FreeBSD__) - #import + #include #elif defined(__MINT__) #include #include