With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: Tequila, sparcdr, torhu

Building for Mac OS X

Postby sparcdr » Thu Oct 15, 2009 1:59 pm

Using 10.4 or 10.5 is preferred due to build bugs introduced with x86_64 on 32-bit kernel support (reverse thunking) in 10.6. I suggest building native binaries on their respective hardware if possible instead of cross-compiling.

Latest revision as of post is r339 on SourceForge.

1.) Install XCode 2.5/3.1+
2.) Install MacPorts 1.7+
3.) Open /Applications/Utilities/Terminal.app
4.)
Code: Select all
sudo port install libsdl-devel
svn co https://smokinguns.svn.sourceforge.net/svnroot/smokinguns/branches/1.1/ sg11-engine
export CC="gcc -m32"
export CFLAGS="-m32 -march i386 -pipe"
export CXXFLAGS=$CFLAGS
export LDFLAGS=$CFLAGS
make


6.)
Code: Select all
#!/bin/bash
APPBUNDLE="Smokin' Guns.app"
BINARY=smokinguns.i386
DEDBIN=smokinguns_dedicated.i386
PKGINFO=APPLSG
ICNS=misc/smokinguns.icns
DESTDIR=build/release-darwin-i386
BASEDIR=smokinguns

cd `dirname $0`
if [ ! -f Makefile ]; then
   echo "This script must be run from the smokinguns build directory"
   exit 1
fi

SG_VERSION=`grep '^VERSION=' Makefile | sed -e 's/.*=\(.*\)/\1/'`

if [ ! -d $DESTDIR ]; then
   mkdir -p $DESTDIR
fi

echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
if [ ! -d "$DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR" ]; then
   mkdir -p "$DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR" || exit 1;
fi
if [ ! -d "$DESTDIR/$APPBUNDLE/Contents/Resources" ]; then
   mkdir -p "$DESTDIR/$APPBUNDLE/Contents/Resources"
fi
cp $ICNS "$DESTDIR/$APPBUNDLE/Contents/Resources/smokinguns.icns" || exit 1;
echo $PKGINFO > "$DESTDIR/$APPBUNDLE/Contents/PkgInfo"
echo "
   <?xml version=\"1.0\" encoding=\"UTF-8\"?>
   <!DOCTYPE plist
      PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
      \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
   <plist version=\"1.0\">
   <dict>
      <key>CFBundleDevelopmentRegion</key>
      <string>English</string>
      <key>CFBundleExecutable</key>
      <string>$BINARY</string>
      <key>CFBundleGetInfoString</key>
      <string>Smokin' Guns $SG_VERSION</string>
      <key>CFBundleIconFile</key>
      <string>smokinguns.icns</string>
      <key>CFBundleIdentifier</key>
      <string>net.smokin-guns.www</string>
      <key>CFBundleInfoDictionaryVersion</key>
      <string>6.0</string>
      <key>CFBundleName</key>
      <string>smokinguns</string>
      <key>CFBundlePackageType</key>
      <string>APPL</string>
      <key>CFBundleShortVersionString</key>
      <string>$SG_VERSION</string>
      <key>CFBundleSignature</key>
      <string>$PKGINFO</string>
      <key>CFBundleVersion</key>
      <string>$SG_VERSION</string>
      <key>NSExtensions</key>
      <dict/>
      <key>NSPrincipalClass</key>
      <string>NSApplication</string>
   </dict>
   </plist>
   " > "$DESTDIR/$APPBUNDLE/Contents/Info.plist"

cp code/libs/macosx/*.dylib "$DESTDIR/$APPBUNDLE/Contents/MacOS/"
cp $DESTDIR/$BINARY "$DESTDIR/$APPBUNDLE/Contents/MacOS/"
cp $DESTDIR/$DEDBIN "$DESTDIR/$APPBUNDLE/Contents/MacOS/"

7.) Locate your sg pak0.pk3 and *.cfg files from sg-generic-1.0 and place inside Smokin' Guns.app bundle in Contents/MacOS/smokinguns

8.) Pray Clint Eastwood isn't waiting around the corner and that it launched.

Notes:
[4] make-macosx-ub.sh is now only used for creating the bundle. LCC build process will probably fail on Snow Leopard (10.6) hosts but since we already had the VM files built, oh well. We'll track ioq3 to see if it's fixed there yet.

[6] This is a replacement for make-macosx-ub.sh which can be ran from terminal by simply copying and pasting the whole block.

Other:
You may encounter mouse acceleration issues due to the "acceleration curve" of Mac OS X versus UNIX/Windows. It was fixed a while ago, though it seems to have stopped working again in 100 revisions.

You can edit the default.cfg file inside the Smokin' Guns.app bundle (Contents/MacOS/smokinguns) and append:

seta cl_mouseAccel "0" (Change from 0 to 1 to see if there's a difference)

If you've previously ran Smokin' Guns, remove the ~/Library/Application Support/SmokinGuns folder before launching again. All persistent settings will not be applied to local profiles. Something like changing mouse sensitivity would generally be a system-wide setting, so you're free to modify the above file. Also, the q3config.cfg inside "smokinguns" folder is redundant and can be removed if you want.
sparcdr
SG Team
 
Posts: 334
Joined: Wed Jun 13, 2007 3:41 pm



Re: Building for Mac OS X

Postby dansh » Sun Sep 02, 2012 9:59 am

I tried to compile binaries for OS X. Who has a Mac, please check the files on the performance. The archive contains universal binary(*.ub) files. That is, should work on PowerPC or Intel-manufactured IA-32 or Intel 64-based Macintosh computers.
SmokinGuns_1.1.app_osx.zip
Last edited by dansh on Sun Sep 02, 2012 4:42 pm, edited 2 times in total.
User avatar
dansh
Shootist
 
Posts: 93
Joined: Mon Jan 23, 2012 2:49 pm
Location: RF



Re: Building for Mac OS X

Postby Tequila » Sun Sep 02, 2012 2:53 pm

Nice shot dansh ! Thank you.

It seems you kept the built object files in the archive. I tried to clean it and put it under our MAC binaries repo.

If MAC users can report their feedback this could really help to enhance MAC support, thank you in advance.
:twisted:

Join Smokin'Guns community on Image
User avatar
Tequila
SG Team
 
Posts: 1087
Joined: Thu Nov 15, 2007 11:33 pm
Location: Montpellier, France



Re: Building for Mac OS X

Postby dansh » Sun Sep 02, 2012 4:24 pm

I just packed all the files from the build folder. Now I repacked,only the necessary universal binary(*.ub) files.
User avatar
dansh
Shootist
 
Posts: 93
Joined: Mon Jan 23, 2012 2:49 pm
Location: RF



Re: Building for Mac OS X

Postby Jack_Wade » Sat Sep 15, 2012 2:19 pm

It does not work when I try to open it on mac 10.5.8 : I receive an error message saying : Couldn't load default.cfg

Anyone knows what I should do to make it work?
Jack_Wade
Drifter
 
Posts: 8
Joined: Sat Jan 28, 2012 1:17 pm



Re: Building for Mac OS X

Postby /dev/random » Sat Sep 15, 2012 3:28 pm

When you launch it from a terminal, does it pick up the correct path to your existing Smokin' Guns installation?

Should look similar to
----- FS_Startup -----
Current search path:
/home/rnd/.smokinguns/smokinguns
/home/rnd/.smokinguns/smokinguns/somefile.pk3 (42 files)
[..]
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Re: Building for Mac OS X

Postby Jack_Wade » Sun Sep 16, 2012 4:11 pm

Here is what I get in the crash log :

Smokin' Guns 1.1 macosx-i386 Sep 2 2012
----- FS_Startup -----
Current search path:
/Users/truc/Library/Application Support/SmokinGuns/smokinguns
/Users/truc/Desktop/Smokin' Guns.app/Contents/MacOS/smokinguns
/Users/truc/Desktop/smokinguns
/Users/truc/Library/Application Support/SmokinGuns/baseq3
/Users/truc/Desktop/baseq3

----------------------
0 files in pk3 files
Couldn't load default.cfg


Am I missing .pk3 files? If so, should I just try to download them and insert them manually?
Jack_Wade
Drifter
 
Posts: 8
Joined: Sat Jan 28, 2012 1:17 pm



Re: Building for Mac OS X

Postby TheDoctor » Sun Sep 16, 2012 5:25 pm

If it is really just the default.cfg, you could try to create an empty file here:
Code: Select all
/Users/truc/Library/Application Support/SmokinGuns/smokinguns/default.cfg


Alternatively, you could ensure that /Users/truc/Desktop/smokinguns exists and it contains the file sg_pak0.pk3. If it does not, you should move the Smokin' Guns executable you were using in the Smokin' Guns program directory (the directory, where the Windows smokinguns.exe and smokinguns_dedicated.exe resides that you don't need). If you cannot find this directory, you may have forgotten to install Smokin'Guns. You cannot just use the binaries provided in this topic, you also need the content files.
Image
User avatar
TheDoctor
Smokin' Amigo!
 
Posts: 753
Joined: Sun Jun 06, 2010 3:31 am



Re: Building for Mac OS X

Postby /dev/random » Sun Sep 16, 2012 6:02 pm

Jack_Wade wrote:
0 files in pk3 files
Couldn't load default.cfg

Am I missing .pk3 files? If so, should I just try to download them and insert them manually?

The game does not find any pk3 files, so it can not load at all.

You should download the full game ("OS Independent archive") and extract the files so that you have the following structure
Code: Select all
/Users/truc/Desktop/
    smokinguns/
        included_fanpak0.pk3
        sg_pak0.pk3
        default.cfg
    baseq3/
        pak0.pk3
    Smokin' Guns.app/
      ..


BTW; what are the *.qvm files doing in Smokin' Guns.app/Contents/MacOS/smokinguns/? They should not be part of the Zip or they should be in a vm/ subfolder.
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Re: Building for Mac OS X

Postby dansh » Mon Sep 17, 2012 8:36 pm

/dev/random wrote:BTW; what are the *.qvm files doing in Smokin' Guns.app/Contents/MacOS/smokinguns/? They should not be part of the Zip or they should be in a vm/ subfolder.

Oops... Yes, it is wrong to distributed files :oops: .It's my fault. Of course *.qvm-files must be in the folder Smokin' Guns.app/Contents/MacOS/smokinguns/vm, or vm-folder should be packed in *.pk3. But those will work without these files, because .../smokinguns/sg_pak0.pk3 already contains *.qvm-files.
EDITED =>
User avatar
dansh
Shootist
 
Posts: 93
Joined: Mon Jan 23, 2012 2:49 pm
Location: RF



Re: Building for Mac OS X

Postby TheDoctor » Sat Oct 05, 2013 4:39 pm

Bumping this post to notify you of a new Smokin' Guns .DMG file for installation on MAC OS X. If you never got SG working or are interested to test this file, give it a try and give us feedback in the above post.
Image
User avatar
TheDoctor
Smokin' Amigo!
 
Posts: 753
Joined: Sun Jun 06, 2010 3:31 am




Return to Code

Show Sidebar
Show Sidebar

User Control Panel