From 72c39aee65ed88c81343c80bd5cbfbf1f4611218 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Jun 2011 02:57:42 +0300 Subject: More fixes for compilation under MacOS. Add sample make script for fink. Possible broke support for dmg images. --- bmake | 1 + configure.ac | 28 +++++++++++++++++++++++----- fink.sh | 34 ++++++++++++++++++++++++++++++++++ src/client.cpp | 6 +++++- src/utils/gettext.h | 10 +--------- 5 files changed, 64 insertions(+), 15 deletions(-) create mode 100755 fink.sh diff --git a/bmake b/bmake index 7fd348949..55153afbd 100755 --- a/bmake +++ b/bmake @@ -44,6 +44,7 @@ autoreconf -i --enable-tcmalloc=no \ --enable-googleprofiler=no +#--enable-applebuild=yes #--without-librt cd po diff --git a/configure.ac b/configure.ac index d28cd5202..9526cf5b8 100755 --- a/configure.ac +++ b/configure.ac @@ -109,15 +109,31 @@ fi AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h]) +# Enable mac build +AC_ARG_ENABLE(applebuild, +[ --enable-applebuild Turn on apple building], +[case "${enableval}" in + yes) applebuild_enabled=true + ;; + no) applebuild_enabled=false + ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-applebuild) ;; +esac],[applebuild_enabled=false]) + + # Option to enable OpenGL AC_ARG_WITH(opengl,[ --without-opengl don't use OpenGL ] ) if test "x$with_opengl" == "xno"; then with_opengl=no else with_opengl=yes - AC_CHECK_LIB([GL], [glBegin], , - AC_MSG_ERROR([ *** Unable to find OpenGL library])) - AC_DEFINE(USE_OPENGL, 1, [Defines if ManaPlus should have OpenGL support]) + if test "x$applebuild_enabled" == "xfalse"; then + AC_CHECK_LIB([GL], [glBegin], , + AC_MSG_ERROR([ *** Unable to find OpenGL library])) + AC_DEFINE(USE_OPENGL, 1, [Defines if ManaPlus should have OpenGL support]) + else + LDFLAGS="$LDFLAGS -framework OpenGL" + fi fi # Option to enable internal guichan @@ -153,8 +169,10 @@ AC_ARG_WITH(librt,[ --without-librt don't link to librt ] ) if test "x$with_librt" == "xno"; then without_librt=yes else - AC_CHECK_LIB(rt, shm_open, , - AC_MSG_ERROR([ *** Unable to find librt library])) + if test "x$applebuild_enabled" == "xfalse"; then + AC_CHECK_LIB(rt, shm_open, , + AC_MSG_ERROR([ *** Unable to find librt library])) + fi without_librt=no fi diff --git a/fink.sh b/fink.sh new file mode 100755 index 000000000..36c95a836 --- /dev/null +++ b/fink.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +FINKDIR=/sw +GCCVER=4.0 + +. ${FINKDIR}/bin/init.sh +export CC=gcc-${GCCVER} +export CXX=g++-${GCCVER} +export CPP=cpp-${GCCVER} +export CXXCPP=cpp-${GCCVER} +export CPPFLAGS="-I/sw/include" +export LDFLAGS="-framework OpenGL" +#dir=`pwd`/run +dir=${FINKDIR} + +autoreconf -i 2>fink1.log + +# with prefix +#./configure --enable-applebuild=yes \ +#--prefix=${dir} \ +#--datadir=${dir}/share/games \ +#--bindir=${dir}/bin \ +#--mandir=${dir}/share/man 2>fink2.log 1>fink2_ok.log + +# without prefix +./configure --enable-applebuild=yes \ +--datarootdir=${dir}/share/games \ +--bindir=${dir}/bin \ +--sbindir=${dir}/bin \ +--mandir=${dir}/share/man 2>fink2.log 1>fink2_ok.log + +# simple +#./configure --enable-applebuild=yes 2>fink2.log 1>fink2_ok.log +make 2>fink3.log diff --git a/src/client.cpp b/src/client.cpp index 25389f92a..7d8ae90b6 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -336,7 +336,11 @@ Client::Client(const Options &options): //possible crash strncat(path, "/data", PATH_MAX - 1); resman->addToSearchPath(path, false); - mPackageDir = path; +// possible this need for support run client from dmg images. +// mPackageDir = path; + + resman->addToSearchPath(PKG_DATADIR "data", false); + mPackageDir = PKG_DATADIR "data"; #else resman->addToSearchPath(PKG_DATADIR "data", false); mPackageDir = PKG_DATADIR "data"; diff --git a/src/utils/gettext.h b/src/utils/gettext.h index 0a15aa724..67d74aa19 100644 --- a/src/utils/gettext.h +++ b/src/utils/gettext.h @@ -39,15 +39,7 @@ #define gettext(s) (const_cast (s)) #define _(s) (const_cast (s)) #define N_(s) (const_cast (s)) - -char* ngettext(char* msgid, char* msgid_plural, unsigned long int n); - -char* ngettext(char* msgid, char* msgid_plural, unsigned long int n) -{ - if(n > 1) - return msgid_plural; - return msgid; -} +#define ngettext(s1,s2,i1) (const_cast (s1)) #endif -- cgit v1.2.3-60-g2f50