Documentation of the haskell code for Defect Process, a 2d hack n' slash game on Steam. The full source code is available on GitHub.
[Brief Overview] |
[Cross-platform Notes] |
[Additional Links]
.dll files are copied into the same directory as the .exe.
mt.exe -manifest defect-process.exe.manifest -outputresource:defect-process.exe
ResourceHacker.exe -open defect-process.exe -save defect-process.exe -action addoverwrite -res icon.ico -mask ICONGROUP,MAINICON,
-dynamic to ghc-options.ldd defect-process lists the library files used, which are copied into the local ./lib if not already provided by the Steam Linux Runtime (e.g. SDL2 will be preinstalled).
./lib directory is done by adding the following lines to package.yaml:
ld-options:
- -Wl,-rpath=$ORIGIN/lib
and running patchelf --set-rpath '$$ORIGIN/lib' defect-process.
-dynamic to ghc-options.otool -L defect-process lists the dylib files used, which are copied into the local ./lib if not already provided by the standard macOS environment (e.g. libSystem).
./lib directory is done by running:install_name_tool -add_rpath @executable_path/lib defect-process
lib*.dylib copied into ./lib run otool -L on that file to check for which dylib paths for that dylib itself need updating:
# Updating dylib paths for lib/libSDL2_image-2.0.0.dylib install_name_tool -change /usr/lib/libz.1.dylib @executable_path/lib/libz.1.dylib lib/libSDL2_image-2.0.0.dylib install_name_tool -change /usr/local/opt/jpeg/lib/libjpeg.9.dylib @executable_path/lib/libjpeg.9.dylib lib/libSDL2_image-2.0.0.dylib ...The
otool/install_name_tool steps need to be done recursively for every dependency/dependency of dependency/etc. Depending on the permissions of the .dylib file, install_name_tool may need to be run with sudo.
LC_ID_DYLIB needs to be set for the SDL2 libraries by running:
sudo install_name_tool -id @rpath/libSDL2-2.0.0.dylib lib/libSDL2-2.0.0.dylib sudo install_name_tool -id @rpath/libSDL2_image-2.0.0.dylib lib/libSDL2_image-2.0.0.dylib sudo install_name_tool -id @rpath/libSDL2_ttf-2.0.0.dylib lib/libSDL2_ttf-2.0.0.dylibThe CLI version of cabal-macosx is used to put the binary and assets into an application bundle. Copying
Info.plist into the bundle enables DPI awareness and setting the icon image.