MacOS SpringRTS OSX Build - Page 3

MacOS SpringRTS OSX Build

Discuss everything related to compiling and running Spring on Mac OS X.

Moderator: Moderators

User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: MacOS SpringRTS OSX 10.10 Build

Post by jamerlan »

Hi man!
Please build spring 100 for mac! It was just released!
Thanks a lot!
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX 10.10 Build

Post by darklord42 »

Yay! On it's way!

@abama

Absolutely! Should I include any documentation with the 7z or just leave it with just the app? Why not have the .dmg with such documentation for the website link, and the 7z for springlobby? Regarding implementing my script for the build process, it's very much rigged for my computer and my own purposes (e.g. my own learning of bash), but it is pretty straight forward.. I'm sure some of it is useful to you.

Code: Select all

#! /bin/bash

#setup macports
#sudo port install gcc49 cmake libdevil p7zip libvorbis libsdl2 freetype glew xorg-libXcursor dylibbundler
#
#download the latest boost source and build against gcc49, but don't install. set using gcc : : g++-mp-4.9 ; in project-config.jam and replace darwin with gcc
#
#in cmake list file add
#set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib)

ROOT=~/Spring
BUILD=~/Spring/build
BUNDLE=0
ERRORBUILD=0
BOOST=~/Documents/SpringDevStuff/boost_1_58_0
MYDIR=~/Documents/SpringDevStuff/Spring # Directory where the script is and will build the app/bundle
MACPORTS=`which port | sed s/[/]bin[/]port//`

# Clean old builds
if [ -d $MYDIR/*.app ]; then 
	rm -r $MYDIR/*.app
fi
if [ -e $MYDIR/*.dmg ]; then
	rm $MYDIR/*.dmg
fi
if [ -e $MYDIR/log.txt ]; then
	rm $MYDIR/log.txt
fi

while [ "$BUNDLE" != "n" ] && [ "$BUNDLE" != "y" ]; do
	read -p "Do you want to bundle the app? : y/n " BUNDLE
done

cd ~/spring

mkdir $BUILD
cd $BUILD

REV=$(git describe --tags)
VERSION=`echo "${REV}" | tr '<>:\"/\\|?*' -`

echo "....Compiling Spring-${VERSION}"

cmake .. -DCMAKE_CXX_COMPILER=$MACPORTS/bin/g++-mp-4.9 -DCMAKE_C_COMPILER=$MACPORTS/bin/gcc-mp-4.9 -DGLEW_INCLUDE_DIR=$MACPORTS/include/GL -DBOOST_ROOT=$BOOST -DBoost_USE_STATIC_LIBS=YES -DGLEW_LIBRARIES=$MACPORTS/lib/libGLEW.a >>$MYDIR/log.txt 2>&1
make spring -j8 >>$MYDIR/log.txt 2>&1
make pr-downloader -j8 >>$MYDIR/log.txt 2>&1

echo "....Making Spring-${VERSION}.app"

#Generate the spring data folder (share) by installing into a temp directory
make install-spring DESTDIR=./temp >>$MYDIR/log.txt 2>&1

mkdir $BUILD/Spring.app
mkdir $BUILD/Spring.app/Contents
mkdir $BUILD/Spring.app/Contents/MacOS
mkdir $BUILD/Spring.app/Contents/Resources
mkdir $BUILD/Spring.app/Contents/lib
cp $BUILD/spring $BUILD/Spring.app/Contents/MacOS/spring
cp ~/Spring/installer/Mac/spring.icns $BUILD/Spring.app/Contents/Resources/spring.icns
cp -R $BUILD/temp/usr/local/share $BUILD/Spring.app/Contents/share

cat ~/Spring/installer/Mac/Info.plist | sed s/###VERSION###/${VERSION}/ > $BUILD/Spring.app/Contents/Info.plist
cp $BUILD/tools/pr-downloader/src/pr-downloader $BUILD/Spring.app/Contents/MacOS

dylibbundler -cd -b -x $BUILD/libunitsync.dylib -d $BUILD/Spring.app/Contents/MacOS -p @loader_path/../MacOS >>$MYDIR/log.txt 2>&1

dylibbundler -of -cd -b -x $BUILD/Spring.app/Contents/MacOS/spring -d $BUILD/Spring.app/Contents/lib -p @executable_path/../lib >>$MYDIR/log.txt 2>&1

install_name_tool -change $MACPORTS/lib/libX11.6.dylib @executable_path/../lib/libX11.6.dylib $BUILD/Spring.app/Contents/lib/libXcursor.1.dylib >>$MYDIR/log.txt 2>&1

dylibbundler -of -cd -b -x $BUILD/Spring.app/Contents/MacOS/pr-downloader -d $BUILD/Spring.app/Contents/lib -p @executable_path/../lib >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Interfaces/C/0.1/libAIInterface.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Interfaces/C/0.1 -p @loader_path/../0.1 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Interfaces/Java/0.1/libAIInterface.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Interfaces/Java/0.1 -p @loader_path/../0.1 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/AAI/0.9/libSkirmishAI.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/AAI/0.9 -p @loader_path/../0.9 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/CppTestAI/0.1/libSkirmishAI.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/CppTestAI/0.1 -p @loader_path/../0.1 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/E323AI/3.25.0/libSkirmishAI.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/E323AI/3.25.0 -p @loader_path/../3.25.0 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/KAIK/0.13/libSkirmishAI.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/KAIK/0.13 -p @loader_path/../0.13 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/NullAI/0.1/libSkirmishAI.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/NullAI/0.1 -p @loader_path/../0.1 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/RAI/0.601/libSkirmishAI.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/RAI/0.601 -p @loader_path/../0.601 >>$MYDIR/log.txt 2>&1

dylibbundler -cd -b -x $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/Shard/dev/libSkirmishAI.dylib -d $BUILD/Spring.app/Contents/share/games/spring/AI/Skirmish/Shard/dev -p @loader_path/../dev >>$MYDIR/log.txt 2>&1

if [ ! -e $BUILD/Spring.app/Contents/MacOS/spring ];then
    echo "Error: App did not build correctly. Check log for details"
    ERRORBUILD=1
fi

mv $BUILD/Spring.app $MYDIR/Spring_${VERSION}.app
rm -R $BUILD

if [ "$BUNDLE" = "y" ] && [ "$ERRORBUILD" = "0" ]; then
    echo "REQUESTED....Bundling Spring-${VERSION}.app"
    cd $MYDIR
    mkdir ./Spring_${VERSION}-OSX-10.10
    mkdir ./Spring_${VERSION}-OSX-10.10/Docs
    mv ./Spring_${VERSION}.app ./Spring_${VERSION}-OSX-10.10/Spring_${VERSION}.app
    cp $ROOT/AUTHORS $ROOT/COPYING $ROOT/FAQ $ROOT/gpl-2.0.html $ROOT/gpl-2.0.txt $ROOT/gpl-3.0.html $ROOT/gpl-3.0.txt $ROOT/LICENSE $ROOT/LICENSE.html $ROOT/README.markdown $ROOT/THANKS $ROOT/doc/changelog.txt ./Spring_${VERSION}-OSX-10.10/Docs
    hdiutil create -volname Spring_${VERSION}-OSX-10.10 -srcfolder ./Spring_${VERSION}-OSX-10.10 -ov -format UDZO Spring_${VERSION}-OSX-10.10.dmg >>$MYDIR/log.txt 2>&1
    rm -R ./Spring_${VERSION}-OSX-10.10
fi

if [ "$ERRORBUILD" = "1" ]; then
	rm -R $MYDIR/*.app
else
	rm $MYDIR/log.txt
fi

echo "Done!"
exit 0
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX 10.10 Build

Post by darklord42 »

Ok I updated the first post with the Spring-100.0 dmg. Here is a 7z of just the app for SpringLobby

https://dl.dropboxusercontent.com/u/504 ... X-10.10.7z (It will have to be moved elsewhere, my dropbox account isn't the best place)
abma
Spring Developer
Posts: 3704
Joined: 01 Jun 2009, 00:08

Re: MacOS SpringRTS OSX 10.10 Build

Post by abma »

uploaded to this server:

https://springrts.com/dl/buildbot/defau ... osemite.7z

(adjusted the filename to the naming schema)

is this ok? if so i'll upload to sourceforge, too.
abma
Spring Developer
Posts: 3704
Joined: 01 Jun 2009, 00:08

Re: MacOS SpringRTS OSX 10.10 Build

Post by abma »

darklord42 wrote:Yay! On it's way!

@abama

Absolutely! Should I include any documentation with the 7z or just leave it with just the app? Why not have the .dmg with such documentation for the website link, and the 7z for springlobby? Regarding implementing my script for the build process, it's very much rigged for my computer and my own purposes (e.g. my own learning of bash), but it is pretty straight forward.. I'm sure some of it is useful to you.
imo no documentation is needed, would be better to place instructions to the download page imo. also idk if currently springlobby can automaticly pick up the file.

wrt the script: a lot of this is hardcoded in the "old" script, too:

https://github.com/spring/spring/blob/d ... _bundle.sh

i only miss that compile / upload works fully automated, atm its a lot of work/time to just put it on the server.

but thanks to apple, its very difficult / expensive to get a buildslave to just compile sth. (i.e. no virtualization allowed on non-mac machines)

maybe crosscompiling could be tried, not sure: https://github.com/tpoechtrager/osxcross
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX 10.10 Build

Post by darklord42 »

Yeah I borrowed a lot from that script, including finding out that there must be code to find the resources in the app bundle, and how the resources should be installed into the app. The only problem with the build script is the portion that relinks the libraries, although very cleaver, doesn't seem to work. And being a novice in bash, I have no idea how to fix it. The program dylibbundler does it just fine. But as you point out, you need a mac to virtualize a mac
....I completely forgot that that was the case. I have heard of attempts to cross compile osx apps in linux. You may need an OSX SDK. I have a 10.7 sdk if you would like to play with it. (10.6 too, but sdl2 needs 10.7)

https://dl.dropboxusercontent.com/u/504 ... 0.7.sdk.7z

One of these days I'll try to remake my setup to build for 10.7. I imagine boost is going to be trouble for me.
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX 10.10 Build

Post by darklord42 »

I somehow missed your first post. I suppose it's ok. Personally speaking, I prefer .dmg. It lets the user know that yes this is a mac download. And there is something nice about a disk image as oppose to a normal compressed archive. I can even put an alias in there of the Application folder to help people install it. In a drag and drop sort of way.

However practically speaking, I find creating the dmg image fixes permissions of the compiled app. (I get some strange permissions otherwise...) But i suppose it's alright to compress as dmg, copy the app out, and then compress to 7zip. I like 7zip, the compression size is better. But I would have thought you would want to include the license and changelog in a docs folder for the website download. A 7zip archive for springlobby to download and install automatically is one thing. The user never sees what was in the archive. But it's your call.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: MacOS SpringRTS OSX 10.10 Build

Post by jamerlan »

darklord42, for some reason springlobby 0.225 is crashing when you join battleroom (confirmed for 2 people)
could you please make build with latest dev version? I would like to test it
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Re: MacOS SpringRTS OSX 10.10 Build

Post by Belmakor »

Works for me usually… crashes if I try to join a server with a map I don't have. Or the server changes to a map I don't have.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: MacOS SpringRTS OSX 10.10 Build

Post by jamerlan »

we need to check this issue in the latest build. So we can report it to the lobby devs and probably they will be able to fix it before the release
abma
Spring Developer
Posts: 3704
Joined: 01 Jun 2009, 00:08

Re: MacOS SpringRTS OSX 10.10 Build

Post by abma »

jamerlan wrote:we need to check this issue in the latest build.
hurry please! :)
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX 10.10 Build

Post by darklord42 »

Sorry I didn't see you guys' posts earlier. Anyway .226 is out so I updated springlobby

To be honest I never had that issue even with .225 but certainly not during development. Hopefully it's been fixed whatever it was.
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: MacOS SpringRTS OSX 10.10 Build

Post by jamerlan »

thanks darklord42!
Just tested - still crashing :-) reported here: https://github.com/springlobby/springlobby/issues/553
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX 10.10 Build

Post by darklord42 »

User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: MacOS SpringRTS OSX 10.10 Build

Post by jamerlan »

Works! Thank you so much! for fixes and builds!
camlac
Posts: 3
Joined: 18 Apr 2015, 15:26

Re: MacOS SpringRTS OSX 10.10 Build

Post by camlac »

Wait, how do i get to Edit??
camlac
Posts: 3
Joined: 18 Apr 2015, 15:26

Re: MacOS SpringRTS OSX 10.10 Build

Post by camlac »

It wont let me open the spring lobby without crashing
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX 10.10 Build

Post by darklord42 »

Well I just updated springlobby, I doubt that's the problem. My question is edit what?
User avatar
Anarchid
Posts: 1383
Joined: 30 Nov 2008, 04:31

Re: MacOS SpringRTS OSX Build

Post by Anarchid »

I have tried to run a Java AI with this Spring:

Code: Select all

[f=0000000] Error: Initializing AI Interface library from file "/Users/user/.spring/engine/100.0/Spring_100.0.app/Contents//share/games/spring/AI/Interfaces/Java/0.1/libAIInterface.dylib". The call to initStatic() returned unsuccessfuly.
It seems the java interface is broken. I wonder if someone can spot any obvious errors or methods of fixing this?
darklord42
Posts: 96
Joined: 26 Jul 2014, 07:11

Re: MacOS SpringRTS OSX Build

Post by darklord42 »

I knew a lot of the engines didn't work. Never found out why.. Hmm when I linked the library it added an erronius "/" before "share" I can probably get the build script to fix that. Only i don't see in my build script how it got there...

EDIT
I did a grep of the whole app (grep scans binaries as well) couldn't find it. I'm not even sure that's the issue.. If it didn't find the library it would be a different error correct? It's possible the java interface wasn't intended for the app setup. I just made use of the existing code and made my own buildscript following the existing one that made the app. I bet the code for finding resources in the app is quite old.
Post Reply

Return to “Mac OS X”