View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0009975 | Dwarf Fortress | Technical -- General | public | 2016-08-23 15:58 | 2023-12-26 19:50 |
Reporter | snoerr | Assigned To | Toady One | ||
Priority | low | Severity | minor | Reproducibility | N/A |
Status | acknowledged | Resolution | open | ||
Platform | Mac | OS | Mac OS X | ||
Product Version | 0.43.05 | ||||
Summary | 0009975: Contribution: script to bundle Mac app | ||||
Description | Contributing this script, which will bundle the files from the distribution into a Mac OS X app bundle. All it's missing is an icon file (icns format). The script has a TODO for that. | ||||
Steps To Reproduce | Steps to use: - stick script into a file, say "build-mac-package.sh" - works with bash on Mac OS X - create your usual distribution folder - run script, substituting the actual version number for "0.43.06" and your distribution folder path: build-mac-package.sh distribution_folder DwarfFotress.app 0.43.06 | ||||
Additional Information | #!/bin/sh if [ $# -ne 3 ]; then echo "Usage: $0 <source folder> <target app name> <version>" echo "Example: $0 DwarfFortress/43.05 bin/DwarfFortress 43.05" echo " will create a DwaarfFortress.app in the bin/ folder under cwd using the contents of DwarfFortress/43.05" exit 1 fi SRC_FOLDER=$1 DEST_APP=$2.app VERSION=$3 if [ -d "${DEST_APP}.bak" ]; then # Delete old backup /bin/rm -rf "${DEST_APP}.bak" fi if [ -d "${DEST_APP}" ]; then # Back up current app /bin/mv "${DEST_APP}" "${DEST_APP}.bak" fi /bin/mkdir -p "${DEST_APP}" /bin/mkdir -p "${DEST_APP}/Contents/MacOS" # Create Info.plist /bin/cat > "${DEST_APP}/Contents/Info.plist" <<EOL <?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>df</string> <key>CFBundleIconFile</key> <string>dwarfort.icns</string> <key>CFBundleIdentifier</key> <string>com.bay12games.dwarfort</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>Dwarf Fortress</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>${VERSION}</string> <key>CFBundleSignature</key> <string>xmmd</string> <key>CFBundleVersion</key> <string>${VERSION}</string> <key>NSAppleScriptEnabled</key> <string>NO</string> </dict> </plist> EOL # Copy the launcher wrapper script cat >"${DEST_APP}/Contents/MacOS/df" <<EOL #!/bin/sh APPNAME=DwarfFortress DIR=\$(cd "\$(dirname "\$0")"; pwd) RESOURCES_DIR=\$(cd "\${DIR}/../Resources"; pwd) #thanks to Iriel for figuring this out OSREV=\`uname -r | cut -d. -f1\` if [ "\$OSREV" -ge 11 ] ; then export DYLD_LIBRARY_PATH=\${DIR}:\${RESOURCES_DIR}/libs:/lib:/usr/lib export DYLD_FRAMEWORK_PATH=\${DIR}:\${RESOURCES_DIR}/libs:lib:/usr/lib else export DYLD_FALLBACK_LIBRARY_PATH=\${DIR}:\${RESOURCES_DIR}/libs:/lib:/usr/lib export DYLD_FALLBACK_FRAMEWORK_PATH=\${DIR}:\${RESOURCES_DIR}/libs:/lib:/usr/lib fi LOG_FILE="\${HOME}/Library/Logs/\${APPNAME}/\${APPNAME}.log" /bin/mkdir -p "\`dirname \"\${LOG_FILE}\"\`" cd "\${RESOURCES_DIR}" if grep -q '\[PRINT_MODE:TEXT\]' data/init/init.txt ; then \${DIR}/dwarfort.exe "\$@" 2>&1 > "\${LOG_FILE}" else \${DIR}/dwarfort.exe "\$@" 2>&1 > "\${LOG_FILE}" & fi EOL # make sure the launcher script is executable /bin/chmod 755 "${DEST_APP}/Contents/MacOS/df" # Copy the exe file into place /bin/cp "${SRC_FOLDER}/dwarfort.exe" "${DEST_APP}/Contents/MacOS/" # Create the Resources folder for all the data files /bin/mkdir -p "${DEST_APP}/Contents/Resources" # Copy the resources into place # TODO: copy the icon file (dwarfort.icns) to the resources folder too for f in "command line.txt" data "file changes.txt" libs raw README.osx readme.txt "release notes.txt" sdl; do /bin/cp -R "${SRC_FOLDER}/${f}" "${DEST_APP}/Contents/Resources/" done pushd "${DEST_APP}/Contents" CONTENT_DIR=`pwd` popd #echo "CONTENT_DIR=${CONTENT_DIR}" /usr/bin/defaults write "${CONTENT_DIR}/Info.plist" CFBundleShortVersionString ${VERSION} /usr/bin/defaults write "${CONTENT_DIR}/Info.plist" CFBundleVersion ${VERSION} ## optional: uncomment to package up a dmg for distribution: ## Copy your app into "publish" (or rename the folder to whatever you like) ## This folder should contain DwarfFortress.app and whatever other resources you want in the DMG (README files etc) #PUBLISH_FOLDER=publish #/usr/bin/hdiutil create -volname DwarfFortress -srcfolder ${PUBLISH_FOLDER}/ -ov -format UDIF -fs HFS+ ./DwarfFortress_${VERSION}.dmg | ||||
Tags | No tags attached. | ||||