Building EDuke32 on macOS: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
mNo edit summary
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Distribution intro}}
{{Distribution intro}}
EDuke32 supports <s>OS X</s> macOS 10.5 and newer.


You can get help here: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/
You can get help here: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/


== Getting source files ==
== Getting source files ==
* Current version (You need to install the ''subversion'' program) :
<pre>svn co https://eduke32.svn.sourceforge.net/svnroot/eduke32/polymer/eduke32</pre>
* [http://dukeworld.duke4.net/eduke32/synthesis Source tarballs] (Lite subversion snapshots, it does not include metadata, Apple compiled libraries, third-party jaudiolib and Photoshop files).
* [http://dukeworld.duke4.net/eduke32/synthesis/old/ Old] and [http://dukeworld.duke4.net/eduke32/old_versions/source_code/ Older versions].


== Build Setup ==
:''See [[Acquiring the EDuke32 Source Code]].''
 
== Installing Xcode ==


Before you begin, you're going to need a Developer account with Apple. These are free and can be created by heading over to the [https://developer.apple.com/devcenter/mac/index.action Mac Dev Center], clicking the 'Register' link toward the top right hand corner and answering a few questions. If you already have an Apple ID, then you can link your developer account to that. Just enter it when it asks and continue through the registration process.
Before you begin, you're going to need a Developer account with Apple. These are free and can be created by heading over to the [https://developer.apple.com/devcenter/mac/index.action Mac Dev Center], clicking the 'Register' link toward the top right hand corner and answering a few questions. If you already have an Apple ID, then you can link your developer account to that. Just enter it when it asks and continue through the registration process.


=== Compiler ===
#Install the latest version of Xcode that your OS X version supports. Consult the chart on the [[Wikipedia:Xcode#Xcode_3.0_-_Xcode_4.x|Xcode Wikipedia page]].
#:To find a specfic version of Xcode, go to the [https://developer.apple.com/downloads/ Downloads] section of the developer center and run a search for that specific version (e.g.: Xcode 3.1.4) using the search box in the top left corner.
#:Even though you can download Xcode itself through the App Store without a Developer ID, you still need one later to install the mobile device SDKs when you first run Xcode and to install the command line tools.
#Download and install the Xcode command line tools (not needed for versions prior to OS X 10.7/Xcode 4.3.x):
#:Starting with Xcode 4.3, Apple no longer includes the command line build tools within the standard Xcode distribution. In order to install them you have to open Xcode, go into its preferences dialog (Xcode -> Preferences in the menu bar or Command+,) and, in the 'Downloads' tab, click 'Install' next to 'Command Line Tools'. At this point you'll be prompted for your Developer ID.  Just enter it and your password and it should be on its way.


#Install Xcode.
== Prerequisite Libraries ==
#:Versions of Mac OS X distributed on CD or DVD typically include a version of Xcode, but these are possibly quite old and only the latest versions of Xcode for each supported version of OS X have been tested:
#:'''Leopard (Mac OS X 10.5.x):''' 3.1.4
#:'''Snow Leopard (Mac OS X 10.6.x):''' 3.2.6
#::Note: The last few versions of Xcode 3.2 for Snow Leopard also include the iOS SDKs which blow the DMG size out to 3GB and beyond. If you want to avoid that then you ''might'' be able to substitute version 3.2.2 instead, but bear in mind this hasn't been tested.
#:'''Lion (Mac OS X 10.7.x):''' 4.3.1 (Although 4.2.1 and 4.3.0 are also known to work under Lion)
#::Even though you can download Xcode itself through the App Store without a Developer ID, you still need one later to install the mobile device SDKs when you first run Xcode and to install the command line tools.
#:To find the version of Xcode you need go to the [https://developer.apple.com/downloads/ Downloads] section of the developer center and run a search for that specific version (e.g.: Xcode 3.1.4) using the search box in the top left corner.
#Download and install the Xcode command line tools (Xcode 4.3.x under Lion only):
#:Starting with Xcode 4.3, Apple no longer includes the command line build tools within the standard Xcode distribution. In order to install them you have to open Xcode, go into its preferences dialog (Xcode -> Preferences in the menu bar or Command+,) and, in the 'Downloads' tab, click 'Install' next to 'Command Line Tools'. At this point you'll be prompted for your Developer ID.  Just enter it and your password and it should be on its way.


=== MacPorts ===
Install [http://brew.sh/ Homebrew]. (On OS X 10.5, try [https://github.com/mistydemeo/tigerbrew Tigerbrew].)


==== Special notes for 10.5/Leopard users ====
Run the following in a terminal window:


Users on 10.5 should follow the [[#PowerPC Macs|PowerPC]] directions (including on how to set up MacPorts), even if they have an Intel Mac since the script assumes PowerPC support when run under Leopard. If you'd rather not build the PowerPC version then follow the [[#Intel Macs|Intel]] directions, remembering to call the osxbuild.sh script with the noppc parameter to prevent the PowerPC version from being built. If your Mac has a 64-bit capable CPU (Core 2 Duo or later), you may also want to enable the 64-bit build as well using the directions that follow.
brew install --universal sdl sdl2 libogg libvorbis flac libvpx luajit


The 64-bit build is also disabled on Leopard by default. If you wish to enable it and don't care about the PowerPC build then you have to call osxbuild.sh with the <code>--build64=1 --buildppc=0</code> command line parameters and follow the [[#Intel Macs|Intel]] directions below. (64-bit here refers to x86_64, there's no equivalent 64-bit build for PowerPC so even if you have a 64-bit capable PowerPC processor, don't enable this unless you're trying to create a three-way universal binary as defined below)
You're all set! You can continue to the [[#Building|Building]] section.


If, on the other hand, you want to compile a three-way universal binary containing the PowerPC, x86 and x86_64 versions, things get a little more complicated. You not only have to manually enable the 64-bit build as outlined above, but you also have to make sure all but one of the dependency ports are compiled three-way universal as well. The procedure here is much the same as the [[#PowerPC Macs|PowerPC]] directions below, but with a few exceptions: To start with, you need ppc, i386 and x86_64 all in your macports.conf universal_archs line. Use that to install the pkgconfig, libsdl_framework and libsdl_mixer-framework ports, but after you've finished installing those go back into macports.conf and remove ppc from the universal_archs before installing the libvpx port. You can put ppc back afterward if you want, but it's essential to remove it in order to build libvpx.
=== Universal (Fat) Libraries ===


==== Common Setup ====
'''''This section has not been tested for a long time and is not necessary when building for your own personal use!'''''


First, install [http://www.macports.org/ MacPorts]. Make sure you have the correct version for your OS X version.
First, install [http://www.macports.org/ MacPorts]. Make sure you have the correct version for your OS X version.
Line 57: Line 52:
Enter your password again if prompted and then scroll down until you get to the "'''universal_archs'''" line and make sure both i386 and x86_64 are in there if you have an Intel Mac (Core Duo, Core 2 Duo, Core i* or Xeon) and that i386 and ppc are there if you have a PowerPC (G4, G5) Mac.
Enter your password again if prompted and then scroll down until you get to the "'''universal_archs'''" line and make sure both i386 and x86_64 are in there if you have an Intel Mac (Core Duo, Core 2 Duo, Core i* or Xeon) and that i386 and ppc are there if you have a PowerPC (G4, G5) Mac.


All builds have the pkg-config port in common, so start by installing that:
Finally, install the prerequisites themselves:


  sudo port install pkgconfig
  sudo port install pkgconfig libsdl libsdl_mixer libsdl2 libsdl2_mixer zlib libpng libogg libvorbis flac libvpx


Again, entering your password if prompted.
Again, entering your password if prompted. If any of these packages fail to build, remove it from the command and try again to make sure everything that can build has built.


==== PowerPC Macs ====
==== Special notes for 10.5/Leopard users ====


Since there are no PowerPC compatible versions of the latest SDL [[#Frameworks|frameworks]] you need to use MacPorts to compile and install appropriate versions. To do that, type:
osxbuild.sh assumes PowerPC support when run under Leopard. If you'd rather not build the PowerPC version, then call the script with the noppc parameter to prevent the PowerPC version from being built. If your Mac has a 64-bit capable CPU (Core 2 Duo or later), you may also want to enable the 64-bit build as well using the directions that follow.


sudo port install libsdl-framework libsdl_mixer-framework
The 64-bit build is also disabled on Leopard by default. If you wish to enable it and don't care about the PowerPC build then you have to call osxbuild.sh with the <code>--build64=1 --buildppc=0</code> command line parameters and follow the [[#Intel Macs|Intel]] directions below. (64-bit here refers to x86_64, there's no equivalent 64-bit build for PowerPC so even if you have a 64-bit capable PowerPC processor, don't enable this unless you're trying to create a three-way universal binary as defined below).


at your terminal and hit enter. A slight hiccup here is that MacPorts installs them into /opt/local/Library/Frameworks and eDuke32 expects to find them in /Library/Frameworks. Fixing that is a simple matter of typing the following at your terminal:
If, on the other hand, you want to compile a three-way universal binary containing the PowerPC, x86 and x86_64 versions, things get a little more complicated. You not only have to manually enable the 64-bit build as outlined above, but you also have to make sure all but one of the dependency ports are compiled three-way universal as well. The procedure here is much the same as the directions above, but with a few exceptions: To start with, you need ppc, i386 and x86_64 all in your macports.conf universal_archs line. Use that to install everything but libvpx, and after you've finished installing those go back into macports.conf and remove ppc from the universal_archs before installing the libvpx port. You can put ppc back afterward if you want, but it's essential to remove it in order to build libvpx.


sudo ln -s /opt/local/Library/Frameworks/SDL.framework /Library/Frameworks/
== Building ==
sudo ln -s /opt/local/Library/Frameworks/SDL_mixer.framework /Library/Frameworks/


Once that's done you can skip to [[#Final Steps|Final Steps]] below.
Type <code>make</code> and hope for the best! For debug builds, run <code>make RELEASE=0</code>. If you want to use SDL 1.2 instead of SDL 2.0, you can append <code>SDL_TARGET=1</code> to the make invocation.


==== Intel Macs ====
You also have the option of using osxbuild.sh, which is designed to assist in building universal binary packages.


Intel users can download the SDL frameworks from the links [[#Frameworks|below]] and drag them from the DMG files into /Library/Frameworks (you may be prompted for your password as part of this process).
=== osxbuild.sh Documentation ===
 
Intel builds also need the libvpx port. To install that, type:
 
sudo port install libvpx
 
followed by enter.
 
Finally, continue to running osxbuild.sh as outlined in the next [[#Final Steps|section]]
 
=== Final Steps ===
 
#The necessary [[#Frameworks|Frameworks]] should be installed globally.
#Run <code>./osxbuild.sh</code> and hope for the best!
 
== osxbuild.sh Documentation ==


  usage: ./osxbuild.sh [options]
  usage: ./osxbuild.sh [options]
Line 115: Line 94:
**'''disttools''' will build all architectures and both release and debug builds of just the [[Build tools]].
**'''disttools''' will build all architectures and both release and debug builds of just the [[Build tools]].
**'''full''' builds ''everything''.
**'''full''' builds ''everything''.
== Frameworks ==
[[File:macosx_frameworks_missing.png|right|This error will be displayed if EDuke32's required frameworks are not installed. You may click "ignore".]]
EDuke32 requires the following frameworks to function:
*[http://www.libsdl.org/download-1.2.php SDL.framework]
**[http://www.libsdl.org/release/ (old versions)]
*[http://www.libsdl.org/projects/SDL_mixer/ SDL_mixer.framework]
**[http://www.libsdl.org/projects/SDL_mixer/release/ (old versions)]
The error message at the right will be displayed if these frameworks are not properly installed. You may install these at any or all of the following locations:
*Global: <code>/Library/Frameworks</code>
*Per-User: <code>~/Library/Frameworks</code>
*Per-App (Portable): <code><app bundle>/Contents/Frameworks</code>
For more information see [https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/InstallingFrameworks.html#//apple_ref/doc/uid/20002261-BBCCFBJA the relevant article on the Mac OS X Developer Library].


== Game Data ==
== Game Data ==
Line 139: Line 99:
[[Installation and configuration|To play the game]], the files you need are DUKE3D.GRP and DUKE.RTS. They, as well as any other data you have, such as the HRP, music packs, and mods, can be placed in the following locations, depending on the circumstances in which you want them to be used:
[[Installation and configuration|To play the game]], the files you need are DUKE3D.GRP and DUKE.RTS. They, as well as any other data you have, such as the HRP, music packs, and mods, can be placed in the following locations, depending on the circumstances in which you want them to be used:


*<code>/Library/Application Support/EDuke32/</code>
*<code>~/Library/Application Support/EDuke32/</code>
*<code>~/Library/Application Support/EDuke32/</code>
*in the same directory as the .app bundle
*<code>~/.eduke32/</code>
*in the same directory as the binary
*<code>EDuke32.app/Contents/Resources/</code>
 
== Play ==


== External Links ==
Once everything is in place, you should be able to run the .app bundle. Enjoy!
*Deprecated guide: http://www.spam-filter.de/osx/eduke32_on_os_x


[[Category:Distribution documentation]]
[[Category:Distribution documentation]]

Revision as of 14:11, 29 March 2020

EDuke32 Distribution

Download · Source Code · APT repository · Packages
Building from source on: Linux · Windows · macOS


EDuke32 supports OS X macOS 10.5 and newer.

You can get help here: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/

Getting source files

See Acquiring the EDuke32 Source Code.

Installing Xcode

Before you begin, you're going to need a Developer account with Apple. These are free and can be created by heading over to the Mac Dev Center, clicking the 'Register' link toward the top right hand corner and answering a few questions. If you already have an Apple ID, then you can link your developer account to that. Just enter it when it asks and continue through the registration process.

  1. Install the latest version of Xcode that your OS X version supports. Consult the chart on the Xcode Wikipedia page.
    To find a specfic version of Xcode, go to the Downloads section of the developer center and run a search for that specific version (e.g.: Xcode 3.1.4) using the search box in the top left corner.
    Even though you can download Xcode itself through the App Store without a Developer ID, you still need one later to install the mobile device SDKs when you first run Xcode and to install the command line tools.
  2. Download and install the Xcode command line tools (not needed for versions prior to OS X 10.7/Xcode 4.3.x):
    Starting with Xcode 4.3, Apple no longer includes the command line build tools within the standard Xcode distribution. In order to install them you have to open Xcode, go into its preferences dialog (Xcode -> Preferences in the menu bar or Command+,) and, in the 'Downloads' tab, click 'Install' next to 'Command Line Tools'. At this point you'll be prompted for your Developer ID. Just enter it and your password and it should be on its way.

Prerequisite Libraries

Install Homebrew. (On OS X 10.5, try Tigerbrew.)

Run the following in a terminal window:

brew install --universal sdl sdl2 libogg libvorbis flac libvpx luajit

You're all set! You can continue to the Building section.

Universal (Fat) Libraries

This section has not been tested for a long time and is not necessary when building for your own personal use!

First, install MacPorts. Make sure you have the correct version for your OS X version.

You then need to edit a couple of MacPorts' config files to make sure it builds what's needed correctly. At a terminal prompt, type:

sudo nano /opt/local/etc/macports/variants.conf

When prompted, enter your password and hit enter then add the following to the end of the file:

+universal
+no_x11

Then hold down Ctrl and press X to exit nano. You'll be asked if you want to save the file. Press 'Y'.

Now you have to make sure the architecturally relevant versions of things are being built by typing:

sudo nano /opt/local/etc/macports/macports.conf

Enter your password again if prompted and then scroll down until you get to the "universal_archs" line and make sure both i386 and x86_64 are in there if you have an Intel Mac (Core Duo, Core 2 Duo, Core i* or Xeon) and that i386 and ppc are there if you have a PowerPC (G4, G5) Mac.

Finally, install the prerequisites themselves:

sudo port install pkgconfig libsdl libsdl_mixer libsdl2 libsdl2_mixer zlib libpng libogg libvorbis flac libvpx

Again, entering your password if prompted. If any of these packages fail to build, remove it from the command and try again to make sure everything that can build has built.

Special notes for 10.5/Leopard users

osxbuild.sh assumes PowerPC support when run under Leopard. If you'd rather not build the PowerPC version, then call the script with the noppc parameter to prevent the PowerPC version from being built. If your Mac has a 64-bit capable CPU (Core 2 Duo or later), you may also want to enable the 64-bit build as well using the directions that follow.

The 64-bit build is also disabled on Leopard by default. If you wish to enable it and don't care about the PowerPC build then you have to call osxbuild.sh with the --build64=1 --buildppc=0 command line parameters and follow the Intel directions below. (64-bit here refers to x86_64, there's no equivalent 64-bit build for PowerPC so even if you have a 64-bit capable PowerPC processor, don't enable this unless you're trying to create a three-way universal binary as defined below).

If, on the other hand, you want to compile a three-way universal binary containing the PowerPC, x86 and x86_64 versions, things get a little more complicated. You not only have to manually enable the 64-bit build as outlined above, but you also have to make sure all but one of the dependency ports are compiled three-way universal as well. The procedure here is much the same as the directions above, but with a few exceptions: To start with, you need ppc, i386 and x86_64 all in your macports.conf universal_archs line. Use that to install everything but libvpx, and after you've finished installing those go back into macports.conf and remove ppc from the universal_archs before installing the libvpx port. You can put ppc back afterward if you want, but it's essential to remove it in order to build libvpx.

Building

Type make and hope for the best! For debug builds, run make RELEASE=0. If you want to use SDL 1.2 instead of SDL 2.0, you can append SDL_TARGET=1 to the make invocation.

You also have the option of using osxbuild.sh, which is designed to assist in building universal binary packages.

osxbuild.sh Documentation

usage: ./osxbuild.sh [options]
options:
    [--buildppc=<0|1>] [--build86=<0|1>] [--build64=<0|1>]
    [--debug=<0|1>]
    [--main=<0|1>] [--tools=<0|1>]
    [--pack=<0|1>]
presets:
    [onlyzip] [dist] [disttools] [full]
  • The following options take either 0 or 1 as a parameter to disable or enable the option in a binary switch fashion.
    • --buildppc, --build86, and --build64 set the PowerPC, x86, and x86_64 builds respectively.
    • --debug sets additional building of the debugging builds. Currently, it defaults to off.
    • --main controls building of the main executables.
    • --tools controls building and installation of the Build tools.
    • --pack controls creation of a zip file with the results at the conclusion of the process.
  • The following options are mutually exclusive and control preset values for the above switches.
    • onlyzip will skip building any executables and simply package the zip file. Mostly for internal use.
    • dist will build all architectures and both release and debug builds of just the main executables, then pack them.
    • disttools will build all architectures and both release and debug builds of just the Build tools.
    • full builds everything.

Game Data

To play the game, the files you need are DUKE3D.GRP and DUKE.RTS. They, as well as any other data you have, such as the HRP, music packs, and mods, can be placed in the following locations, depending on the circumstances in which you want them to be used:

  • ~/Library/Application Support/EDuke32/
  • ~/.eduke32/
  • EDuke32.app/Contents/Resources/

Play

Once everything is in place, you should be able to run the .app bundle. Enjoy!