Here's the patch for platform_common.cpp:
EDIT: made some changes. That way will be (hopefully) proper checked if OS is APPLE or FreeBSD. The first diff i made wasn't usable at all i guess. This one should works.
--- trunk/source/shared_lib/sources/platform/common/platform_common.cpp 2010-09-21 00:57:43.000000000 +0200
+++ trunk/source/shared_lib/sources/platform/common_FreeBSD/platform_common.cpp 2010-09-21 01:02:44.000000000 +0200
@@ -419,7 +419,7 @@
globfree(&globbuf);
// Look recursively for sub-folders
-#ifdef __APPLE__ //APPLE does'nt have the GLOB_ONLYDIR definition..
+#if defined(__APPLE__) || defined(__FreeBSD__)
res = glob(mypath.c_str(), 0, 0, &globbuf);
#else
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
@@ -431,7 +431,7 @@
}
for(int i = 0; i < globbuf.gl_pathc; ++i) {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__)
struct stat statStruct;
// only process if dir..
int actStat = lstat( globbuf.gl_pathv[i], &statStruct);
@@ -567,7 +567,7 @@
globfree(&globbuf);
// Look recursively for sub-folders
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__)
res = glob(mypath.c_str(), 0, 0, &globbuf);
#else //APPLE doesn't have the GLOB_ONLYDIR definition..
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
@@ -579,7 +579,7 @@
}
for(int i = 0; i < globbuf.gl_pathc; ++i) {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__)
struct stat statStruct;
// only get if dir..
int actStat = lstat( globbuf.gl_pathv[ i], &statStruct);
Patch for ogg.m4:
--- trunk/mk/linux/mk/autoconf/ogg.m4 2010-09-21 01:18:46.000000000 +0200
+++ trunk/mk/linux/mk/autoconf_FreeBSD/ogg.m4_FreeBSD 2010-09-15 14:22:55.000000000 +0200
@@ -41,6 +41,7 @@
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $OGG_CFLAGS"
+ CPPFLAGS="$CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Ogg is sufficiently new.
patch for vorbis.m4:
--- trunk/mk/linux/mk/autoconf/vorbis.m4 2010-09-21 01:18:45.000000000 +0200
+++ trunk/mk/linux/mk/autoconf_FreeBSD/vorbis.m4_FreeBSD 2010-09-15 14:19:41.000000000 +0200
@@ -46,6 +46,7 @@
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
+ CPPFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Vorbis is sufficiently new.
Patch for check_lua.m4
--- trunk/mk/linux/mk/autoconf/check_lua.m4 2010-09-21 01:18:47.000000000 +0200
+++ trunk/mk/linux/mk/autoconf_FreeBSD/check_lua.m4_FreeBSD 2010-09-15 14:18:04.000000000 +0200
@@ -62,6 +62,26 @@
else
AC_MSG_RESULT([no])
fi
+# another test for finding lua on FreeBSD
+ AC_MSG_CHECKING([for lua.hpp in ${p}/include/lua51])
+ if test -f ${p}/include/lua51/lua.hpp; then
+ AC_MSG_RESULT([yes])
+ save_CFLAGS=$CFLAGS
+ save_LDFLAGS=$LDFLAGS
+ CFLAGS="$CFLAGS"
+ LDFLAGS="-L${p}/lib/lua51 $LDFLAGS $lib_m"
+ AC_CHECK_LIB(lua, luaL_newstate,
+ [
+ LUA_AVAILABLE=yes
+ LUA_LIBS="-L${p}/lib/lua51 -llua"
+ LUA_CFLAGS="-I${p}/include/lua51"
+ ])
+ CFLAGS=$save_CFLAGS
+ LDFLAGS=$save_LDFLAGS
+ break
+ else
+ AC_MSG_RESULT([no])
+ fi
AC_MSG_CHECKING([for lua.hpp in ${p}/include])
if test -f ${p}/include/lua.hpp; then
AC_MSG_RESULT([yes])
Despite these patches it's needed to pass some optione to the configure script on FreeBSD. I call the configure script like this:
/configure --with-wx-config=/usr/local/bin/wxgtk2u-2.8-config --with-wx-prefix=/usr/local --with-ogg=/usr/local --with-vorbis-includes=/usr/local/include --with-vorbis=/usr/local --with-libLibX11=/usr/local --with-libLibCurl=/usr/local --with-libLibPng=/usr/local --with-libLibJPEG=/usr/local --with-libOpenAL=/usr/local --with-libxerces=/usr/local --prefix=/usr/games
The software dependencies are quit the same like for glest, which is allready ported to FreeBSD. Before you try to build megaglest on FreeBSD it's necessary to install the Buid-Deps. The dependencies can be viewed with the following commands:
cd /usr/ports ; make search name=glest
The ports collection must be installed ;-)
I hope these patches are good enough to be added to upstream :-)