-
-
Save matschaffer/87220798c79a5d0ace1eaa9afb729d28 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
set -euxo pipefail | |
rm -rf Floating-Sandbox | |
rm -rf DevIL | |
rm -rf SFML | |
# rm -rf wxWidgets | |
rm -rf fs_libs | |
rm -rf git | |
rm -rf dist |
#!/usr/bin/env bash | |
set -euxo pipefail | |
WORKSPACE="$(pwd)" | |
FS_LIBS="$(pwd)/fs_libs" | |
DIST="$(pwd)/dist" | |
mkdir -p "${FS_LIBS}" | |
# Should come with xcode CLI tools during homebrew install | |
gcc --version | |
g++ --version | |
brew install cmake | |
cmake --version | |
git clone https://github.com/GabrieleGiuseppini/Floating-Sandbox.git | |
echo "Building Floating-Sandbox rev: " $(cd Floating-Sandbox && git rev-parse HEAD) | |
git clone https://github.com/DentonW/DevIL | |
( | |
cd DevIL | |
git checkout v1.8.0 | |
git apply ../Floating-Sandbox/devil-issue-95.patch | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release -DIL_NO_TIF=1 -DIL_NO_JP2=1 -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="${FS_LIBS}/DevIL" ../DevIL | |
make install | |
) | |
# Hack to install SFML dependencies | |
brew install sfml; brew uninstall sfml | |
git clone https://github.com/SFML/SFML.git | |
( | |
cd SFML | |
git checkout 2.5.1 | |
mkdir build | |
cd build | |
# Got a vorbis resolution warning here, but was able to just ignore it. | |
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=FALSE -DSFML_BUILD_WINDOW=FALSE -DSFML_BUILD_GRAPHICS=FALSE -DSFML_BUILD_DOC=FALSE -DSFML_BUILD_EXAMPLES=FALSE -DCMAKE_INSTALL_PREFIX="${FS_LIBS}/SFML" -DSFML_DEPENDENCIES_INSTALL_PREFIX="${FS_LIBS}/SFML" .. | |
make install | |
) | |
brew install wxwidgets | |
# brew install gtk+3 | |
# git clone --recurse-submodules https://github.com/wxWidgets/wxWidgets.git | |
# ( | |
# cd wxWidgets | |
# git checkout v3.1.4 | |
# mkdir my_wx_build | |
# cd my_wx_build | |
# ../configure --disable-shared --with-gtk=3 --with-libpng --with-libxpm --with-libjpeg --without-libtiff --without-expat --disable-pnm --disable-gif --disable-pcx --disable-iff --with-opengl --prefix=${HOME}/fs_libs/wxWidgets --exec_prefix="${FS_LIBS}/wxWidgets" --disable-tests --disable-rpath | |
# make install | |
# ) | |
mkdir git | |
( | |
cd git | |
git clone https://github.com/kazuho/picojson.git | |
cd picojson | |
git checkout v1.3.0 | |
) | |
( | |
cd git | |
git clone https://github.com/google/googletest.git | |
cd googletest | |
git checkout release-1.12.1 | |
) | |
( | |
cd Floating-Sandbox | |
cp UserSettings.example-linux.cmake UserSettings.cmake | |
sed -i '' "s|/home/gg|${WORKSPACE}|g" UserSettings.cmake | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release -DFS_BUILD_BENCHMARKS=OFF -DFS_USE_STATIC_LIBS=ON -DwxWidgets_USE_DEBUG=OFF -DwxWidgets_USE_UNICODE=ON -DwxWidgets_USE_STATIC=ON -DFS_INSTALL_DIRECTORY="${DIST}" .. | |
make install | |
) | |
cd "${DIST}" | |
xattr -r -d com.apple.quarantine ./FloatingSandbox | |
echo "To start the game run: cd ${DIST}; ./FloatingSandbox" |
No worries :) Got your ping. I'm mostly moved onto some new laptops (old personal i7 and new work M1), so I'll retry the build process from the latest master and let you know if it works out.
Gist has been updated after a build from master on a new mac. I'd be happy to post the binary somewhere, but I'm not entirely sure if it'll run without the build steps or not. Could be some dynamic linking afoot still.
Maybe a good next step would be to PR a page like https://github.com/GabrieleGiuseppini/Floating-Sandbox/blob/master/BUILD-Ubuntu.md that has this script broken down piece by piece so others can build and maybe contribute as well.
Indeed, that's exactly one of the two things that I'd like to achieve - a new document with build instructions for Mac. So let me get this straight: these two shell scripts successfully build a Floating Sandbox from current master
? 'cause if that's the case I can try to write the build instructions myself.
As for the binary, any chance you could try ldd
and see which dynamic libs it needs?
I'll try to get ahold of you on Discord now that we're connected. I only get online there once a week ;-)
Thanks so much Matt, by the way, for sharing your progress so far!!!
So let me get this straight: these two shell scripts successfully build a Floating Sandbox from current master?
That's what macos.sh
does. Assuming you have at least homebrew installed. clean.sh
just removes all the assets so I can re-run build fresh.
As for the binary, any chance you could try ldd and see which dynamic libs it needs?
It seems like maybe ldd
isn't available on mac. I found https://stackoverflow.com/a/67818942 which recommends otool, so I tried that:
❯ otool -L FloatingSandbox
FloatingSandbox:
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 165.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1000.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
/usr/local/opt/wxwidgets/lib/libwx_baseu-3.2.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/local/opt/wxwidgets/lib/libwx_osx_cocoau_core-3.2.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/local/opt/wxwidgets/lib/libwx_osx_cocoau_gl-3.2.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/local/opt/wxwidgets/lib/libwx_osx_cocoau_html-3.2.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/local/opt/wxwidgets/lib/libwx_osx_cocoau_propgrid-3.2.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/local/opt/wxwidgets/lib/libwx_osx_cocoau_ribbon-3.2.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/local/opt/jpeg-turbo/lib/libjpeg.8.dylib (compatibility version 8.0.0, current version 8.2.2)
/usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 55.0.0, current version 55.0.0)
/System/Library/Frameworks/OpenAL.framework/Versions/A/OpenAL (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/libvorbis/lib/libvorbisfile.3.dylib (compatibility version 7.0.0, current version 7.8.0)
/usr/local/opt/libvorbis/lib/libvorbisenc.2.dylib (compatibility version 3.0.0, current version 3.12.0)
/usr/local/opt/libvorbis/lib/libvorbis.0.dylib (compatibility version 5.0.0, current version 5.9.0)
/usr/local/opt/libogg/lib/libogg.0.dylib (compatibility version 9.0.0, current version 9.5.0)
/usr/local/opt/flac/lib/libFLAC.12.dylib (compatibility version 13.0.0, current version 13.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
Most of it looks like system-provided stuff, but these are homebrew assets flac, jpeg-turbo, libogg, libpng, libvorbis, wxwidgets
so I suspect this binary will only work on another mac which has them installed.
Thank you Matt. Darn, I wasn't expecting wxWidgets there, that's a setback. The other dynamic libraries are quite general and one could easily say they are requirements, but wxWidgets is not, and the Ubuntu instructions were geared towards building wxWidgets as static libs, and linking them statically in Floating Sandbox.
I see your shell script install wxWidgets instead of building it (statically) - the build step is commented out. Were you having problems with building them?
Yeah, I could give it another shot though.
If I recall correctly it was a similar case to SFML where getting all the dependencies was tricky. Maybe the same hack of install/uninstall would do the trick there as well.
Hey Matt, sorry it took me forever - I've sent you a friend request on Discord. Let's see if we can catch up there!