Building FS2_Open on OpenSolaris
Written 2010-09-30
Tags:OpenSolaris Lua Unix
Issues
- fs2_open does not have a build script option for OpenSolaris
- Sun make is awful
- dependencies
- Optimized PowerPC code leaks into OpenSolaris x86 builds.
- The word 'sun' is a reserved word on Solaris
- Solaris/X/SDL has a bug if LANG is set, SDL will crash with an XError and a segfault.
- PKG_CHECK_MODULES doesn't work very well on solaris
Dependencies - install with the 'Package Manager'
- SUNWgmake
- gcc-432
- gcc-runtime-432
- SUNWlibtheora
- SUNWogg-vorbis
- SUNWpng
- SUNWjpg
- SUNWlibsdl
- SUNWaconf
- SUNWgnu-automake-110
- SUNWlua
- OpenAL
Lua PKGConfig -here's my /usr/lib/pkgconfig/lua5.1.pc
prefix=/usr
major_version=5.1
version=5.1.4
#prefix=/usr
#major_version=5.1
#version=5.1.0
lib_name=lua${major_version}
libdir=${prefix}/lib
includedir=${prefix}/include
#
# The following are intended to be used via "pkg-config -variable".
# The location of the libtool library. This is used when linking to the Lua
# library via libtool.
libtool_lib=${libdir}/lib${lib_name}.la
# Install paths for Lua modules. For example, if a package wants to install
# Lua source modules to the /usr/local tree, call pkg-config with
# "-define-variable=prefix=/usr/local" and "-variable=INSTALL_LMOD".
INSTALL_LMOD=${prefix}/share/lua/${major_version}
INSTALL_CMOD=${prefix}/lib/lua/${major_version}
Name: Lua
Description: Lua language engine
Version: ${version}
Requires:
Libs: -L${libdir} -l${lib_name}
Libs.private: -lm
Cflags: -I${includedir}/${lib_name}
Patch 1 - code/globalinc/pstypes.h
- remove the section dealing with INTEL_INT, INTEL_FLOAT, stwbrx...
- replace with
#define INTEL_INT( x ) ( x )
#define INTEL_FLOAT( x ) ( *x )
#define INTEL_SHORT( x ) ( x )
Patch 2 - code/fs2netd/tcp_socket.cpp and code/network/chat_api.cpp
- under
#include <sys/ioctl.h>
- add
#include <sys/filio.h>
Patch 3 - code/starfield/starfield.h
- On Solaris, sun is a reserved word.
- replace
int stars_add_sun_entry(starfield_list_entry *sun);
- with
int stars_add_sun_entry(starfield_list_entry *sun_ptr);
- replace
int stars_get_num_entries(bool sun, bool bitmap_count);
- with
int stars_get_num_entries(bool is_a_sun, bool bitmap_count);
- replace
void stars_mark_instance_unused(int index, bool sun);
- with
void stars_mark_instance_unused(int index, bool is_a_sun);
- replace
const char *stars_get_name_from_instance(int index, bool sun);
- with
const char *stars_get_name_from_instance(int index, bool is_a_sun);
- replace
const char *stars_get_name_FRED(int index, bool sun);
- with
const char *stars_get_name_FRED(int index, bool is_a_sun);
- replace
void stars_delete_entry_FRED(int index, bool sun);
- with
void stars_delete_entry_FRED(int index, bool is_a_sun);
- replace
void stars_modify_entry_FRED(int index, const char *name, starfield_list_entry *sbi_new, bool sun);
- with
void stars_modify_entry_FRED(int index, const char *name, starfield_list_entry *sbi_new, bool is_a_sun);
Patch 4 - code/starfield/starfield.cpp
- On Solaris, sun is a reserved word.
- in
int stars_add_sun_entry(starfield_list_entry *sun);
- replace every variable
sun
withsun_ptr
- in the following functions, replace all instances of the variable sun with is_a_sun
int stars_get_num_entries(bool sun, bool bitmap_count);
void stars_mark_instance_unused(int index, bool sun);
const char *stars_get_name_from_instance(int index, bool sun);
const char *stars_get_name_FRED(int index, bool sun);
void stars_delete_entry_FRED(int index, bool sun);
void stars_modify_entry_FRED(int index, const char *name, starfield_list_entry *sbi_new, bool sun);
Patch 5 - code/starfield/supernova.cpp
- On Solaris, sun is a reserved word.
- in
void supernova_get_eye(vec3d *eye_pos, matrix *eye_orient);
- replace every variable
sun
withsun_vec
- optionally replace every
sun_temp
withsun_vec_temp
Patch 6 - configure.ac
- Solaris is an unrecognized platform
- after
fs2_os_osx="no"
, addfs2_os_solaris="no"
- Copy the stanza for
*-*-darwin*)
- and edit to look like:
*-*-solaris*)
# Solaris
echo "Using Solaris 10 defines (for $host_os)"
fs2_os_solaris="yes"
;;
- Also, after the stanza starting with
elif test "$fs2_os_osx" = "yes" ; then
- add:
elif test "$fs2_os_solaris" = "yes" ; then
FS2_CXXFLAGS="$FS2_CXXFLAGS -I/usr/include/SDL"
FS2_LDFLAGS="$FS2_LDFLAGS -lpng -lpng12 -ljpeg -lpthread -logg -lSDL -ltheora -lopenal -lsocket -lvorbisfile -lvorbis -lnsl -lGL -lGLU"
AC_DEFINE([SCP_UNIX])
AC_DEFINE([NO_DIRECT3D])
## don't need the CFLAGS here if recent SDL is used
- Next, replace
AM_CONDITIONAL(FS2_OS_UNIX, test "$fs2_os_unix" = "yes" || test "$fs2_os_osx" = "yes")
withAM_CONDITIONAL(FS2_OS_UNIX, test "$fs2_os_unix" = "yes" || test "$fs2_os_osx" = "yes" || test "$fs2_os_solaris" = "yes")
Building
- run
./autogen.sh
or./autogen.sh -enable-debug
- edit configure and remove all calls+params to
PKG_CHECK_MODULES
, because you already installed all the prereqs...right? - run
./configure
again - run
make
- executable will be in code/fs2_open_r for release and code/fs2_open_d for debug
Launching
- copy binary to game data directory
- run
unset LANG
- This sorta fixes a solaris/SDL/X bug - run
./fs2_open_r
or./fs2_open_d