Jump to content


Photo

Compiling Instructions For Macosx


  • Please log in to reply
4 replies to this topic

#1 armin

armin

    Squaddie

  • Forum Members
  • PipPip
  • 5 posts

Posted 10 March 2007 - 02:05 PM

Dear all,

I've managed to compile the latest beta 0.7.1071 on MacOsX 10.4 (PowerPC).
The complete instructions are quite lengthy...

Attached you find a diff for the INSTALL file.
$ cd ufo2000
$ patch -p0 < INSTALL.diff

Can anybody confirm this instructions?

Patch content
--- INSTALL	2007-03-10 20:31:40.000000000 +0100
+++ ../ufo2000-1071/INSTALL	2007-03-10 19:43:49.000000000 +0100
@@ -98,6 +98,148 @@
 to '/usr/share/games/ufo2000/TFTD' respectively. This will allow you to play on maps 
 with various terrain types and use more different units.
 
+--- MacOsX ---
+
+Build ufo2000 from scratch on MacOs X 10.4.x
+
+# mkdir /Applications/UFO2000.app
+# mkdir /Applications/UFO2000.app/Contents
+# mkdir /Applications/UFO2000.app/Contents/Resources
+
+1) Allegro library version 4.2.x
+	 can be found at http://alleg.sourceforge.net
+	 
+   $ ./fix.sh macosx
+   $ vi makefile.osx
+   
+   Modify the INSTALLDIR from
+   INSTALLDIR = $(DESTDIR)/usr/local
+   to
+   INSTALLDIR = /Applications/UFO2000.app/Contents/Resources
+   
+   $ export STATICLINK=1
+   $ make STATICLINK=1
+   # make install STATICLINK=1
+
+2) Lua programming language 5.0.x
+	 can be found at http://www.lua.org
+
+   $ vi config
+   
+   Modify the INSTALL_ROOT from
+   INSTALL_ROOT= /usr/local
+   to
+   INSTALL_ROOT= /Applications/UFO2000.app/Contents/Resources
+
+   $ make
+   $ make test
+   # make install
+   
+3) Expat XML parser library 1.95.x
+	 can be found at http://expat.sourceforge.net
+
+   $ ./configure --prefix=/Applications/UFO2000.app/Contents/Resources --enable-static=yes --enable-shared=no
+   $ make
+   $ make check
+   # make install
+   
+4) HawkNL library 1.68
+	 can be found at http://www.hawksoft.com/hawknl/ 
+	 
+   $ cd src
+   $ vi makefile.osx
+
+   Modify the FLAGS to avoid linking errors such as /crt1.o definitions.. from
+   LIBFLAGS = -dylib -r -lpthread -Wl,-x
+   to
+   LIBFLAGS = -dynamiclib -r -lpthread -Wl,-x
+
+   $ vi sock.c
+   
+   Comment out the socklen_t definition to avoid compiling errors
+   as MacOsX 10.4 (other than 10.3) already defines socklen_t.
+   
+   #if defined __sgi || defined MACOSX
+   //typedef int socklen_t;
+   #endif
+
+   $ vi makefile.osx
+   
+   Modify LIBDIR and INCDIR from
+   LIBDIR = /usr/lib
+   INCDIR = /usr/include   
+   to 
+   LIBDIR = /Applications/UFO2000.app/Contents/Resources/lib
+   INCDIR = /Applications/UFO2000.app/Contents/Resources/include
+   
+   $ make -f makefile.osx
+   # make -f makefile.osx install
+   
+   Now we remove the unneeded shared libraries
+   # rm -f /Applications/UFO2000.app/Contents/Resources/lib/libNL*.dylib
+   and update the archive for further usage
+   # ranlib /Applications/UFO2000.app/Contents/Resources/lib/libNL.a
+
+5) PNG library 1.2.x
+	 can be found at http://www.libpng.org/pub/png/
+	
+   $ ./configure --prefix=/Applications/UFO2000.app/Contents/Resources --enable-static=yes --enable-shared=no
+   $ make 
+   $ make check
+   # make install
+	
+6) Download the latest sources of ufo2000
+	 can be found at http://ufo2000.sourceforge.net
+
+   $ vi makefile
+   
+   Add an additional include directory
+   CFLAGS = -funsigned-char -Wall -Wno-deprecated-declarations -I src/lua -I src/luasqlite3 -DDEBUGMODE
+   to
+   CFLAGS = -funsigned-char -Wall -Wno-deprecated-declarations -I src/lua -I src/luasqlite3 -I /Applications/UFO2000.app/Contents/Resources/include -DDEBUGMODE
+
+   Add an additional library directory
+   ifdef static
+		LIBS := -static $(LIBS) -lNL ${shell allegro-config --libs}
+		SERVER_LIBS += -static -lNL -pthread
+   else
+		LIBS += -lNL -pthread ${shell allegro-config --libs}
+		SERVER_LIBS += -lNL -pthread
+   endif
+   to
+   ifdef static	
+		LIBS := -static $(LIBS) -L/Applications/UFO2000.app/Contents/Resources/lib -lNL  ${shell allegro-config --libs}
+		SERVER_LIBS += -static -L/Applications/UFO2000.app/Contents/Resources/lib -lNL
+   else
+		LIBS += -L/Applications/UFO2000.app/Contents/Resources/lib -lNL ${shell allegro-config --libs}
+		SERVER_LIBS += -L/Applications/UFO2000.app/Contents/Resources/lib -lNL ${shell allegro-config --libs}   
+   endif
+   
+   For building without music support (and without the need to install DUMB library):
+   
+   $ UFO=/Applications/UFO2000.app/Contents/Resources
+   $ PATH=$UFO/bin:$PATH
+
+   $ make all no_dumbogg=1 no_ttf=1 DATA_DIR=/Applications/UFO2000.app/Contents/MacOS
+   $ make server no_dumpogg=1 no_ttf=1
+
+   Copy all nessecary files
+   # cp -R . /Applications/UFO2000.app/Contents/MacOS
+
+   And some last MacOsX fixups
+   $ /Applications/UFO2000.app/Contents/Resources/bin/fixbundle ufo2000 -o UFO2000.app
+   # cp UFO2000.app/Contents/Info.plist /Applications/UFO2000.app/Contents
+   # cp UFO2000.app/Contents/PkgInfo /Applications/UFO2000.app/Contents   
+
+7) If you have a full version of X-COM, you can copy all the files from 
+   the directory where you have X-COM: UFO Defense installed into 
+   'XCOM' subdirectory of ufo2000 (it is initially empty).
+   /Applications/UFO2000.app/Contents/MacOS/XCOM
+
+8) X-COM: Terror From the Deep data files are installed in a similar 
+   way to 'TFTD' subdirectory
+   /Applications/UFO2000.app/Contents/MacOS/TFTD
+
 ------------------------------------------------------------------------------
 -- 3. Getting the latest unstable sources snapshot (for developers only)
 ------------------------------------------------------------------------------

Edited by armin, 10 March 2007 - 02:06 PM.


#2 Ole2

Ole2

    Squaddie

  • New Forum Members
  • PipPip
  • 1 posts

Posted 12 March 2007 - 03:24 AM

yes, instruction works fine, except LUA:

+ 2) Lua programming language 5.1.x
+ can be found at http://www.lua.org
+
+ $ vi config
+
+ Modify the INSTALL_ROOT from
+ INSTALL_ROOT= /usr/local
+ to
+ INSTALL_ROOT= /Applications/UFO2000.app/Contents/Resources
+
+ $ make macosx
+ $ make test
+ # make install

in overal, game is buildable and executable (I used iBook G4 PPC based)

#3 armin

armin

    Squaddie

  • Forum Members
  • PipPip
  • 5 posts

Posted 15 March 2007 - 05:40 AM

Thanks for the verification.

yes, instruction works fine, except LUA:

+ 2) Lua programming language 5.1.x
+ can be found at http://www.lua.org


Oops. Seems that I've missed the latest version. I will update the
instruction and my build.

I will also try to add the Ogg support.

#4 Serge

Serge

    Project Leader: UFO 2000

  • Xenocide Programming Department
  • 785 posts

Posted 15 March 2007 - 01:09 PM

Thanks for starting to prepare Macosx related information. It would really help for the coming 0.8.x release.

External lua is not needed by the way, lua interpreter sources are included into ufo2000 source tree :)

I have a hope to also remove HawkNL dependency (before the release) as it causes so much troubles for everyone and replace network code with BSD sockets, it will need to be tested on Macosx too

By the way, everyone is encouraged to use a stable branch instead of SVN trunk, as it contains the code that will be used for the coming release:
svn co https://ufo2000.svn.sourceforge.net/svnroot/ufo2000/branches/0.8 ufo2000-0.8

ufo2000 development team
http://ufo2000.sourceforge.net

#5 armin

armin

    Squaddie

  • Forum Members
  • PipPip
  • 5 posts

Posted 17 March 2007 - 08:42 AM

External lua is not needed by the way, lua interpreter sources are included into ufo2000 source tree :)


Thanks for the LUA tip. I've updated my description and the testbuild.

--- MacOsX ---

Build ufo2000 from scratch on MacOs X 10.4.x for PowerPC

# mkdir /Applications/UFO2000.app
# mkdir /Applications/UFO2000.app/Contents
# mkdir /Applications/UFO2000.app/Contents/Resources

1) Allegro library version 4.2.x
	 can be found at http://alleg.sourceforge.net
	 
   $ ./fix.sh macosx
   $ vi makefile.osx
   
   Modify the INSTALLDIR from
   INSTALLDIR = $(DESTDIR)/usr/local
   to
   INSTALLDIR = /Applications/UFO2000.app/Contents/Resources
   
   $ export STATICLINK=1
   $ make STATICLINK=1
   # make install STATICLINK=1

2) Expat XML parser library 1.95.x
	 can be found at http://expat.sourceforge.net

   $ ./configure --prefix=/Applications/UFO2000.app/Contents/Resources --enable-static=yes --enable-shared=no
   $ make
   $ make check
   # make install
   
3) HawkNL library 1.68
	 can be found at http://www.hawksoft.com/hawknl/ 
	 
   $ cd src
   $ vi makefile.osx

   Modify the FLAGS to avoid linking errors such as /crt1.o definitions.. from
   LIBFLAGS = -dylib -r -lpthread -Wl,-x
   to
   LIBFLAGS = -dynamiclib -r -lpthread -Wl,-x

   $ vi sock.c
   
   Comment out the socklen_t definition to avoid compiling errors
   as MacOsX 10.4 (other than 10.3) already defines socklen_t.
   
   #if defined __sgi || defined MACOSX
   //typedef int socklen_t;
   #endif

   $ vi makefile.osx
   
   Modify LIBDIR and INCDIR from
   LIBDIR = /usr/lib
   INCDIR = /usr/include   
   to 
   LIBDIR = /Applications/UFO2000.app/Contents/Resources/lib
   INCDIR = /Applications/UFO2000.app/Contents/Resources/include
   
   $ make -f makefile.osx
   # make -f makefile.osx install
   
   Now we remove the unneeded shared libraries
   # rm -f /Applications/UFO2000.app/Contents/Resources/lib/libNL*.dylib
   and update the archive for further usage
   # ranlib /Applications/UFO2000.app/Contents/Resources/lib/libNL.a

4) PNG library 1.2.x
	 can be found at http://www.libpng.org/pub/png/
	
   $ ./configure --prefix=/Applications/UFO2000.app/Contents/Resources --enable-static=yes --enable-shared=no
   $ make 
   $ make check
   # make install
	
5) Download the latest sources of ufo2000
	 can be found at http://ufo2000.sourceforge.net

   $ vi makefile
   
   Add an additional include directory
   CFLAGS = -funsigned-char -Wall -Wno-deprecated-declarations -I src/lua -I src/luasqlite3 -DDEBUGMODE
   to
   CFLAGS = -funsigned-char -Wall -Wno-deprecated-declarations -I src/lua -I src/luasqlite3 -I /Applications/UFO2000.app/Contents/Resources/include -DDEBUGMODE

   Add an additional library directory
   ifdef static
		LIBS := -static $(LIBS) -lNL ${shell allegro-config --libs}
		SERVER_LIBS += -static -lNL -pthread
   else
		LIBS += -lNL -pthread ${shell allegro-config --libs}
		SERVER_LIBS += -lNL -pthread
   endif
   to
   ifdef static	
		LIBS := -static $(LIBS) -L/Applications/UFO2000.app/Contents/Resources/lib -lNL  ${shell allegro-config --libs}
		SERVER_LIBS += -static -L/Applications/UFO2000.app/Contents/Resources/lib -lNL
   else
		LIBS += -L/Applications/UFO2000.app/Contents/Resources/lib -lNL ${shell allegro-config --libs}
		SERVER_LIBS += -L/Applications/UFO2000.app/Contents/Resources/lib -lNL ${shell allegro-config --libs}   
   endif
   
   For building without music support (and without the need to install DUMB library):
   
   $ UFO=/Applications/UFO2000.app/Contents/Resources
   $ PATH=$UFO/bin:$PATH

   $ make all no_dumbogg=1 no_ttf=1 DATA_DIR=/Applications/UFO2000.app/Contents/MacOS
   $ make server no_dumpogg=1 no_ttf=1

   Copy all nessecary files
   # cp -R . /Applications/UFO2000.app/Contents/MacOS

   And some last MacOsX fixups
   $ /Applications/UFO2000.app/Contents/Resources/bin/fixbundle ufo2000 -o UFO2000.app
   # cp UFO2000.app/Contents/Info.plist /Applications/UFO2000.app/Contents
   # cp UFO2000.app/Contents/PkgInfo /Applications/UFO2000.app/Contents   

6) If you have a full version of X-COM, you can copy all the files from 
   the directory where you have X-COM: UFO Defense installed into 
   'XCOM' subdirectory of ufo2000 (it is initially empty).
   /Applications/UFO2000.app/Contents/MacOS/XCOM

7) X-COM: Terror From the Deep data files are installed in a similar 
   way to 'TFTD' subdirectory
   /Applications/UFO2000.app/Contents/MacOS/TFTD

Ok, I will use the CVS source to see if I can find something about the mouse-stuck problem.