Author Topic: Megaglest on PC-BSD/FreeBSD  (Read 1726 times)

m0ellemeister

  • Guest
Megaglest on PC-BSD/FreeBSD
« on: 15 September 2010, 08:45:09 »
Hi,

for several days i was trying to build Megaglest on my PC-BSD box. PC-BSD is a "Desktop FreeBSD" based on the current production release of FreeBSD (version 8.1 at the moment of writing).

I want to thank GeoVah for is work on the MacOSX port. Without his work i wouldn't be able to compile megaglest successfully on FreeBSD.

I wasn't able to test megaglest test directly after building, anyway i show the output from mg on the terminal:

Code: [Select]
./glest.bin --version
v3.3.7-dev-GNUC: 40201 [64bit]-Sep 15 2010 10:13:41, STREFLOP enabled.

Code: [Select]
./glest.bin --opengl-info
[2010-09-15 10:31:36] In [glest_game/global/config.cpp::getInstance Line: 121]
[2010-09-15 10:31:36] In [glest_game/global/config.cpp::Config Line: 105] attempting to auto-create cfgFile.second = [glestuser.ini]
[2010-09-15 10:31:36] In [glest_game/global/config.cpp::getInstance Line: 125]
[2010-09-15 10:31:36] In [glest_game/global/config.cpp::getInstance Line: 129]
OpenGL Info:
   OpenGL Version: 3.2.0 NVIDIA 195.36.24
   OpenGL Renderer: 3.2.0 NVIDIA 195.36.24
   OpenGL Vendor: NVIDIA Corporation
   OpenGL Max Lights: 8
   OpenGL Max Texture Size: 8192
   OpenGL Max Texture Units: 4
   OpenGL Modelview Stack: 32
   OpenGL Projection Stack: 4

Code: [Select]
/glest.bin --sdl-info
SDL compile-time version 1.2.14
SDL runtime version 1.2.14

i'm going to test megaglest tonight when i'm back home.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Megaglest on PC-BSD/FreeBSD
« Reply #1 on: 15 September 2010, 15:49:08 »
Excellent and great job!

m0ellemeister

  • Guest
Re: Megaglest on PC-BSD/FreeBSD
« Reply #2 on: 17 September 2010, 19:44:59 »
tomreyn, claymore and me had a short game a few minutes ago. Everything worked fine and smoothly. My PCBSD Box was the host. we played 3.3.7 Beta_2.

Now i'm going to create the patch-set for FreeBSD.

Here is a screenshot from a single player game: (3360x1050x32) http://imagebin.ca/view/jWiPHvmu.html

m0ellemeister

  • Guest
Re: Megaglest on PC-BSD/FreeBSD
« Reply #3 on: 17 September 2010, 22:02:31 »
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.

Code: [Select]
--- 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:

Code: [Select]
--- 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:

Code: [Select]
--- 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
Code: [Select]
--- 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:

Code: [Select]
/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:
Code: [Select]
cd /usr/ports ; make search name=glestThe ports collection must be installed ;-)

I hope these patches are good enough to be added to upstream :-)
« Last Edit: 20 September 2010, 23:26:40 by m0ellemeister »

m0ellemeister

  • Guest
Re: Megaglest on PC-BSD/FreeBSD
« Reply #4 on: 18 September 2010, 00:03:30 »
If have to rework my patch for platform_common.cpp. It's unusable i guess.

m0ellemeister

  • Guest
Re: Megaglest on PC-BSD/FreeBSD
« Reply #5 on: 20 September 2010, 23:30:02 »
i've updated the diff files. Now it should be possible to apply the diffs. Please let my know if it works or doesn't. Thx.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Megaglest on PC-BSD/FreeBSD
« Reply #6 on: 24 September 2010, 15:41:50 »
Hello m0ellemeister and thanks for your hard work!

Could you please produce 1 diff file with all changes for me to apply to svn (same as how GeoVah does) as it is more easy to follow the changes and apply the patch.

Thanks

m0ellemeister

  • Guest
Re: Megaglest on PC-BSD/FreeBSD
« Reply #7 on: 24 September 2010, 17:30:47 »
i'll do it, maybe tonight when i'm back home.

m0ellemeister

  • Guest
Re: Megaglest on PC-BSD/FreeBSD
« Reply #8 on: 24 September 2010, 22:59:55 »
Hi softcoder,

here's the diff File: http://nichthelfer.de/FreeBSD.diff

md5sum of this file is: 7dbf40ba215cdc8ff390dd0812a6c184

Hopefully that's what you need.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Megaglest on PC-BSD/FreeBSD
« Reply #9 on: 24 September 2010, 23:29:27 »
Ok this patch is now in svn, thanks!

 

anything