Skip to content

Commit

Permalink
fixed the build on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsiomb committed Oct 2, 2020
1 parent abe50ae commit 28573a9
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export PREFIX
export CFLAGS_cfg
export LDFLAGS_cfg
name = xlivebg

src = $(wildcard src/*.c)
Expand Down
10 changes: 9 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
prefix=/usr/local
opt=true
dbg=true
plugins=$(cd plugins && find . -mindepth 1 -maxdepth 1 -type d -printf '%f ')
plugins=$(cd plugins && find . -mindepth 1 -maxdepth 1 -type d | sed 's/\.\///' | xargs echo -n)

disable_plugin()
{
Expand Down Expand Up @@ -91,6 +91,14 @@ cat Makefile.in >>Makefile

echo 'Generating plugins/Makefile ...'
echo '# Generated by configure, do not edit.' >plugins/Makefile
if [ -n "$CFLAGS" ]; then
echo "CFLAGS_cfg = $CFLAGS" >>plugins/Makefile
echo 'export CFLAGS_cfg' >>plugins/Makefile
fi
if [ -n "$LDFLAGS" ]; then
echo "LDFLAGS_cfg = $LDFLAGS" >>plugins/Makefile
echo 'export LDFLAGS_cfg' >>plugins/Makefile
fi
echo '.PHONY: all clean install uninstall' >>plugins/Makefile
echo "all: $plugins" >>plugins/Makefile
echo "clean: $(echo $plugins | sed 's/\(^\| \)/ clean-/g')" >>plugins/Makefile
Expand Down
4 changes: 2 additions & 2 deletions gui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ warn = -Wall -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
def = -DMINIGLUT_USE_LIBC
inc = -I../libs/treestore/src

CFLAGS = $(warn) -g -MMD $(def) $(inc)
LDFLAGS = ../libs/treestore/libtreestore.a -lXm -lXt -lX11 -lGL -lm
CFLAGS = $(warn) -g -MMD $(def) $(inc) $(CFLAGS_cfg)
LDFLAGS = $(LDFLAGS_cfg) ../libs/treestore/libtreestore.a -lXm -lXt -lX11 -lGL -lm

$(bin): $(obj)
$(CC) -o $@ $(obj) $(LDFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion libs/imago/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ src = $(wildcard src/*.c)
obj = $(src:.c=.o)
lib = libimago.a

CFLAGS = -Wall -g -O3
CFLAGS = -Wall -g -O3 $(CFLAGS_cfg)

$(lib): $(obj)
$(AR) rcs $@ $(obj)
Expand Down
2 changes: 2 additions & 0 deletions libs/imago/src/file_lbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if defined(__WATCOMC__) || defined(WIN32)
#include <malloc.h>
#else
#ifndef __FreeBSD__
#include <alloca.h>
#endif
#endif
#include "imago2.h"
#include "ftype_module.h"
#include "byteord.h"
Expand Down
2 changes: 2 additions & 0 deletions libs/treestore/src/treestore.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#ifdef WIN32
#include <malloc.h>
#else
#ifndef __FreeBSD__
#include <alloca.h>
#endif
#endif

struct ts_node *ts_text_load(struct ts_io *io);
int ts_text_save(struct ts_node *tree, struct ts_io *io);
Expand Down
2 changes: 2 additions & 0 deletions plugins/colcycle/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined(WIN32)
#include <malloc.h>
#else
#ifndef __FreeBSD__
#include <alloca.h>
#endif
#endif
#include "image.h"
#include "imagelbm.h"

Expand Down
2 changes: 2 additions & 0 deletions plugins/colcycle/imagelbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if defined(__WATCOMC__) || defined(_MSC_VER)
#include <malloc.h>
#else
#ifndef __FreeBSD__
#include <alloca.h>
#endif
#endif
#include "imagelbm.h"

#ifdef __GNUC__
Expand Down
5 changes: 3 additions & 2 deletions plugins/plugin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ so = $(name).so

proj_root = ../..

CFLAGS = -pedantic -Wall -g -O3 -ffast-math -fPIC -I$(proj_root)/include $(plugin_cflags)
LDFLAGS = $(plugin_ldflags)
CFLAGS = -pedantic -Wall -g -O3 -ffast-math -fPIC -I$(proj_root)/include \
$(CFLAGS_cfg) $(plugin_cflags)
LDFLAGS = $(LDFLAGS_cfg) $(plugin_ldflags)

$(so): $(obj)
$(CC) -o $@ -shared $(obj) $(LDFLAGS)
Expand Down
2 changes: 2 additions & 0 deletions src/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <string.h>
#include <ctype.h>
#include <errno.h>
#ifndef __FreeBSD__
#include <alloca.h>
#endif
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
Expand Down
2 changes: 2 additions & 0 deletions src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifndef __FreeBSD__
#include <alloca.h>
#endif
#include <unistd.h>
#include <dirent.h>
#include <dlfcn.h>
Expand Down

0 comments on commit 28573a9

Please sign in to comment.