enigma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Enigma-devel] Successful build under MacOS X 10.3.9


From: Sidney Markowitz
Subject: [Enigma-devel] Successful build under MacOS X 10.3.9
Date: Wed, 26 Apr 2006 16:51:29 +1200
User-agent: Thunderbird 1.5.0.2 (Macintosh/20060308)

I was able to build Enigma under MacOS 10.3.9 with only minor changes to
the svn tree.

I have attached two files, the diff from svn trunk revision 133, and a
howto with the list of the libraries I had to upgrade or install and the
steps I took to build.

I didn't have a freshly installed MacOS 10.3.9 to try this on, so there
is some chance that some library or package I've installed for some
other reason earlier was required.

The patches to svn should be proper to install for any version. The
attached howto explains what they are.

This could use someone who is familiar with MacOS X application bundles
to make it into an installable package the way someone has done it for
MacOS X 10.4.

 Sidney Markowitz
 http://www.sidney.com
Index: src/lev/Proxy.cc
===================================================================
--- src/lev/Proxy.cc    (revision 133)
+++ src/lev/Proxy.cc    (working copy)
@@ -286,9 +286,9 @@
                     // handle pure lua
                     // load plain lua file
                     doc = NULL;
-                    lua_State *L = lua::LevelState();
-                    if (lua::Dobuffer(L, levelCode) != 0) {
-                        throw levels::XLevelLoading (lua::LastError(L));
+                    lua_State *L = ::lua::LevelState();
+                    if (::lua::Dobuffer(L, levelCode) != 0) {
+                        throw levels::XLevelLoading (::lua::LastError(L));
                     }
                 }
             }
@@ -335,13 +335,13 @@
     }
 
     void Proxy::loadLuaCode() {
-        lua_State *L = lua::LevelState();
+        lua_State *L = ::lua::LevelState();
         DOMNodeList * luamainList = doc->getElementsByTagNameNS(levelNS, 
Utf8ToXML("luamain").x_str());
         if (luamainList->getLength() == 1) {
             DOMElement *luamain  = dynamic_cast<DOMElement 
*>(luamainList->item(0));
             if (luaL_dostring(L, XMLtoUtf8(luamain->getTextContent()).c_str() 
) != 0) {
              lua_setglobal (L, "_LASTERROR");
-                throw enigma_levels::XLevelLoading(lua::LastError(L));
+                throw enigma_levels::XLevelLoading(::lua::LastError(L));
             }
         } else {
             throw enigma_levels::XLevelLoading("not implemented");
Index: lib-src/zipios++/configure.ac
===================================================================
--- lib-src/zipios++/configure.ac       (revision 133)
+++ lib-src/zipios++/configure.ac       (working copy)
@@ -12,6 +12,24 @@
 dnl   CFLAGS="$CFLAGS -mno-cygwin"
 dnl fi
 
+dnl Check for MacOS X
+AC_MSG_CHECKING(for MacOS X)
+AC_RUN_IFELSE([AC_LANG_PROGRAM( [], [
+#if defined (__APPLE__) && defined (__MACH__)
+    exit(0);
+#else
+   exit(-1);
+#endif
+               ])
+       ],[
+       AC_MSG_RESULT(yes)
+       AC_DEFINE([MACOSX], 1, [Is this a MacOS X system?])
+           MACOSX=yes
+       ],[
+       AC_MSG_RESULT(no)
+       ])
+
+
 dnl to run test progs with CXX: AC_LANG([C++])
 
 dnl Use std compliant iostream library if present?
Index: configure.ac
===================================================================
--- configure.ac        (revision 133)
+++ configure.ac        (working copy)
@@ -110,12 +110,17 @@
   AC_DEFINE(HAVE_SDLTTF, , [Whether SDL_ttf library was found during 
configure])
 else
   AC_MSG_CHECKING([for SDL_ttf >=2.0.6])
-  AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <SDL/SDL_ttf.h>]],
-        [[if (TTF_MAJOR_VERSION < 2)
+  AC_RUN_IFELSE([AC_LANG_SOURCE(
+        [[#include <SDL/SDL_ttf.h>
+         int
+         main(int argc, char *argv[])
+         {
+         if (TTF_MAJOR_VERSION < 2)
             return 1;
           else if (TTF_MAJOR_VERSION == 2 && TTF_MINOR_VERSION == 0 && 
TTF_PATCHLEVEL < 6) 
             return 1;
-          return 0;]])],
+          return 0;
+         }]])],
       [AC_MSG_RESULT([found])],
       [AC_MSG_ERROR([SDL_ttf >= 2.0.6 not found.])])
   AC_CHECK_LIB(SDL_ttf, main,,[AC_MSG_ERROR([SDL_ttf is required to compile 
Enigma])])
Here are steps I used to build Engigma under MacOS 10.3.9 that already
had X-11 insalled (I use OpenOffice, so whatever it needs was there
already), using svn trunk revision 133

I have a attached the output of svn diff with all changes I made to
the svn tree.

1: Very important for building a number of unix projects in 10.3.9 is
to downgrade QuickTime 7.0.4 to version 7.0.1 using
http://www.apple.com/support/downloads/quicktime701reinstallerforquicktime704.html

The QuickTime 7.0.4 upgrade was pushed out as part of a 10.3.9
software update. It installs a version of libstdc++ that was built
with a newer version of gcc than the 3.3 that ships with MacOS 10.3.9,
resulting in various linker errors when trying to build many projects
ported from unix that used to build fine. The downgrade fixes that.

If you continue to get mysterious linker errrors you can also try
reinstalling xcode 1.5. Some people said it restored some files messed
up by a software update. I tried it at one point earlier before I
found out about the QuickTime problem and it didn't by itself help, so
I can't say for sure if it that really is also necessary.

2. I earlier installed, for some other projects, gettext, freetype,
   and libpng, so I can't say for sure if any of the other required
   libraries requires one or more of them. If you see errrors about
   anything like that missing when you try the next steps, download the
   source of whichever you need from its project web site, and use
     ./configure ; make ; sudo make install

3. Downloaded latest versions of autoconf (2.59) and automake
   (1.9.6). Built and installed them from sources using
     ./configure ; make ; sudo make install 

4. Added a configuration test to lib-src/zipios++/configure.ac that
   sets a MACOSX preprocessor macro when building on MacOS X. This is
   required for zipios++ to build properly. Not having 10.4 here, I
   can only guess that it defines MACOSX in its gcc, as that is what
   zipios checks for.
  If you don't want to modify any files in zipios++, you'll have to
   put the test in enigma's configure.ac and figure out what you can
   pass in to zipios++'s configure that will cause it to define MACOSX
   properly in its compile commmand.

5. Changed the test for SDL_ttf version that is in the top level
   configure.ac because it didn't work with the gcc 3.3 that I have on
   MacOS X 10.3.9. The problem is that it generated a test program
   that declares in main(), but the SDL_ttf header declared it as in
   main(int argc, char*argv[]), and gcc saw that as an error. I
   changed the test to declare main properly, which should work with
   any compiler version.

6. Download the source tarballs and installled SDL, SDL_image,
   SDL_ttf, and SDL_mixer. All of them installed fine using
   ./configure ; make ; sudo make install
  The project web sites have binary packages for MacOS X, but I
   assumed that I needed the header files from installing a full build
   from source. However, I didn't try just installing the binary
   packages so I can't say for sure whether that would be enough.

7. Fixed a compile time problem in src/lev/Proxy.cc resulting from
   package name lua conflicting with an enum value lua, confusing the gcc
   3.3 that is in MacOS X 10.3.9, but apparently not a problem with
   the gcc 4.1 on my Fedora Core 5 system. By replacing the five uses of
   lua:: with ::lua:: in Proxy.cc, it would compile ok in all versions
   of gcc.

8. Once all the above was installed and patched, I was able to 

  ./autogen.sh
  ./configure
  make
  sudo make install

9. I successfully installed the resulting build of Enigma by tarring
   up the files that were installed in /usr/local/lib (SDL*, etc.) by
   the various library installs, the files that had been placed in
   /usr/local/share/enigma and /usr/local/share/doc/enigma, and the
   file /usr/local/bin/enigma, and copying it to another MacOS X
   10.3.9 that does not have any development environment or any of the
   required libraries installed. It did have X-11 installed for
   OpenOffice already.

I don't have experience with making apps bundles for MacOSX, and I
didn't try to make a package out of the application. I did succesfully
create a clickable icon for Enigma using the AppleScript editor to
create a script containing
  do shell script '/usr/local/bin/enigma &'
then saving it as a read-only Application type.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]