Difference between revisions of "Compiling ScummVM/Mac OS X Crosscompiling"

Jump to navigation Jump to search
→‎PPC build: Remove refs to MPEG2
(→‎PPC build: Remove refs to MPEG2)
 
(11 intermediate revisions by 5 users not shown)
Line 12: Line 12:
== PPC build ==
== PPC build ==


For our PPC build to work on all PPC versions of Mac OS X above 10.2, there's a few requirements:
For our PPC build to work on all PPC versions of Mac OS X from 10.2 and above, there's a few requirements:
* We need to use GCC 3.3
* We need to use GCC 3.3
* We need to compile against the 10.2 SDK
* We need to compile against the 10.2 SDK
Line 39: Line 39:
Now, first we'll have to download and build the dependency libs we're needing for our build. SDL is the only required one, plus whatever optional libs you want, like libMAD, Ogg Vorbis, etc, etc. If you include zlib, there's some special instructions below.
Now, first we'll have to download and build the dependency libs we're needing for our build. SDL is the only required one, plus whatever optional libs you want, like libMAD, Ogg Vorbis, etc, etc. If you include zlib, there's some special instructions below.


The twist here, is that you should install these libs to a seperate location from the regular system libraries. Since we're compiling PPC 10.2 specific versions, we don't want to overwrite our regular libraries. I went with /opt/1028libs/. Just set this with the --prefix option to the ./configure script, for all the libraries you're including. Do this, and make sure you've defined the above environmental libraries both when you do ./configure and when you do make, and you should be set.
The twist here, is that you should install these libs to a separate location from the regular system libraries. Since we're compiling PPC 10.2 specific versions, we don't want to overwrite our regular libraries. I went with /opt/1028libs/. Just set this with the --prefix option to the ./configure script, for all the libraries you're including. Do this, and make sure you've defined the above environmental libraries both when you do ./configure and when you do make, and you should be set. For some of the libraries you might also need to use the --host=powerpc-apple-darwin option when running the ./configure script.
 
To compile the SDL library (and maybe some of the other libraries) you will also need to set CPPFLAGS to a slightly different value than what is written above:
export CPPFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc -I$SDK/usr/include/gcc/darwin/3.3 -isystem $SDK/usr/include -arch ppc -F$SDK/System/Library/Frameworks"


Once you've set up all the dependency libraries, you're ready to build ScummVM itself.
Once you've set up all the dependency libraries, you're ready to build ScummVM itself.


First, there's a couple of minor changes we have to do to the ScummVM Makefile.
First, there a minor change we have to do to the ScummVM <code>config.mk</code> file.


Find the line that says:
Find the line that says:
  OSXOPT=/sw
  STATICLIBPATH=/sw


Change this to whatever root you used to install the dependency libraries. In my case, I've changed it to:
Change this to whatever root you used to install the dependency libraries. In my case, I've changed it to:
  OSXOPT=/opt/1028libs
  STATICLIBPATH=/opt/1028libs


Now, find the line that says:
Next we also have to modify the <code>ports.mk</code> file.
OSX_STATIC_LIBS := `sdl-config --static-libs`


Add whatever prefix you used when you built SDL, to the sdl-config path. Like this, for example:
Find the section that starts with:
OSX_STATIC_LIBS := `/opt/1028libs/bin/sdl-config --static-libs`
 
Next, find the section that starts with:
  scummvm-static: $(OBJS)
  scummvm-static: $(OBJS)
This is the part of the makefile that compiles our static binary (so we can distribute it to others without them having to have all the libraries installed)
This is the part of <code>ports.mk</code> that compiles our static binary (so we can distribute it to others without them having to have all the libraries installed)
In this section, find and remove this line:
In this section, find and remove this line:
  -lSystemStubs \
  -lSystemStubs \
Line 68: Line 67:
  $(OSXOPT)/lib/libz.a
  $(OSXOPT)/lib/libz.a


This will ensure we build zlib in statically instead of dynamically, which avoids some obscure problems we've had on 10.2.x.
This will ensure we link zlib in statically instead of dynamically, which avoids some obscure problems we've had on 10.2.x.
 
At this point, we also need to make sure that the configure script finds the correct version of sdl-config (In other words, the one we compiled ourselves and put, for example, in /opt/1028libs.


We do this thusly:
export PATH="/opt/1028libs/bin:$PATH"
When you've done the above, it's time to run ./configure. For each library you want to include, you have to tell ScummVM where it can find it.
When you've done the above, it's time to run ./configure. For each library you want to include, you have to tell ScummVM where it can find it.
So, for me, that would be:
So, for me, that would be:
  ./configure \
  ./configure \
  --with-sdl-prefix=/opt/1028libs/bin \
  --with-sdl-prefix=/opt/1028libs/bin \
--with-mpeg2-prefix=/opt/1028libs --with-mad-prefix=/opt/1028libs \
--with-mad-prefix=/opt/1028libs \
  --with-ogg-prefix=/opt/1028libs --with-vorbis-prefix=/opt/1028libs \
  --with-ogg-prefix=/opt/1028libs \
--with-vorbis-prefix=/opt/1028libs \
  --with-flac-prefix=/opt/1028libs
  --with-flac-prefix=/opt/1028libs


Line 113: Line 117:
* Copy 'scummvm-static' from the PPC build directory, to a file called 'scummvm-static-ppc' in whatever build directory you chose.
* Copy 'scummvm-static' from the PPC build directory, to a file called 'scummvm-static-ppc' in whatever build directory you chose.
* Copy 'scummvm-static' from the Intel build directory, to 'scummvm-static-x86' in the same directory.
* Copy 'scummvm-static' from the Intel build directory, to 'scummvm-static-x86' in the same directory.
* Run 'strip' on both of the above files to remove debugging info (otherwise the files will be tens of megabytes large).
* Run 'lipo -create scummvm-static-x86 scummvm-static-ppc -output scummvm-static'
* Run 'lipo -create scummvm-static-x86 scummvm-static-ppc -output scummvm-static'
* Run 'make osxsnap'
* Run 'make osxsnap'


Tada! The resulting ScummVM-snapshot.dmg is a package of ScummVM that should work on MacOS X 10.2, 10.3, 10.4, 10.5, both Intel and PPC builds.
Tada! The resulting ScummVM-snapshot.dmg is a package of ScummVM that should work on Mac OS X 10.2, 10.3, 10.4, 10.5, both Intel and PPC builds.
1,079

edits

Navigation menu