Building EDuke32 on macOS: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Distribution intro}}
{{Distribution intro}}


EDuke32 supports OS X 10.5 and newer.
EDuke32 supports macOS.


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


== Getting source files ==
Install the Xcode command line utilities and [http://brew.sh/ Homebrew].
 
:''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.
 
#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.
 
== Prerequisite Libraries ==
 
Install [http://brew.sh/ Homebrew]. (On OS X 10.5, try [https://github.com/mistydemeo/tigerbrew Tigerbrew].)


Run the following in a terminal window:
Run the following in a terminal window:


  brew install --universal sdl sdl_mixer sdl2 sdl2_mixer homebrew/dupes/zlib libpng libogg libvorbis flac libvpx luajit
  brew install make sdl2 flac libvpx
 
You're all set! You can continue to the [[#Building|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 [http://www.macports.org/ 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 <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).
 
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 ==
== Building ==


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.
Type <code>gmake -j4</code> and hope for the best! For debug builds, run <code>gmake RELEASE=0</code>.
 
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 ==
== Game Data ==


[[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:
If you own a digital copy of the game with native support for macOS, EDuke32 will automatically detect its default install location and use any game data it finds! Otherwise, [[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 music packs and mods, can be placed in <code>~/Library/Application Support/EDuke32/</code>.
 
*<code>~/Library/Application Support/EDuke32/</code>
*<code>~/.eduke32/</code>
*<code>EDuke32.app/Contents/Resources/</code>


== Play ==
== Play ==

Latest revision as of 20:09, 21 December 2023

EDuke32 Distribution

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


EDuke32 supports macOS.

Prerequisites

Install the Xcode command line utilities and Homebrew.

Run the following in a terminal window:

brew install make sdl2 flac libvpx

Building

Type gmake -j4 and hope for the best! For debug builds, run gmake RELEASE=0.

Game Data

If you own a digital copy of the game with native support for macOS, EDuke32 will automatically detect its default install location and use any game data it finds! Otherwise, 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 music packs and mods, can be placed in ~/Library/Application Support/EDuke32/.

Play

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