Rev 9 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9 | Rev 11 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | APP_COPYRIGHT="© 2023 Pierre-Marie Baty |
7 | APP_COPYRIGHT="© 2023 Pierre-Marie Baty |
8 | © 2023 Dethrace Labs |
8 | © 2023 Dethrace Labs |
9 | © 1997 Stainless Games" |
9 | © 1997 Stainless Games" |
10 | BUNDLE_ID="com.pmbaty.carmageddon" |
10 | BUNDLE_ID="com.pmbaty.carmageddon" |
11 | ICON_FILE="icon.png" |
11 | ICON_FILE="icon.png" |
- | 12 | CS_IDENTITY="Apple Distribution: Pierre-Marie Baty" |
|
12 | 13 | ||
13 | # compiler and linker flags to use |
14 | # compiler and linker flags to use |
14 | CPPFLAGS="-DDETHRACE_FIX_BUGS=1 -Isrc/harness/include -Isrc/harness -Isrc/smackw32/include -Isrc/BRSRC13/include -Isrc/BRSRC13 -Isrc/S3/include -Isrc/S3 -Isrc/DETHRACE/common -Isrc/DETHRACE/pd -Isrc/DETHRACE -Ilib/glad/include -Ilib/libsmacker -Ilib/miniaudio/include -Ilib/miniaudio/include/miniaudio -Ilib/SDL2 -Ilib" |
15 | CPPFLAGS="-O3 -DDETHRACE_FIX_BUGS=1 -Isrc/harness/include -Isrc/harness -Isrc/smackw32/include -Isrc/BRSRC13/include -Isrc/BRSRC13 -Isrc/S3/include -Isrc/S3 -Isrc/DETHRACE/common -Isrc/DETHRACE/pd -Isrc/DETHRACE -Ilib/glad/include -Ilib/libsmacker -Ilib/miniaudio/include -Ilib/miniaudio/include/miniaudio -Ilib/SDL2/include/SDL2 -Ilib" |
15 | LDFLAGS="" |
16 | LDFLAGS="" |
16 | 17 | ||
17 | cd "${MY_PATH}" || exit 1 |
18 | cd "${MY_PATH}" || exit 1 |
18 | 19 | ||
19 | # cleanup |
20 | # cleanup |
Line 70... | Line 71... | ||
70 | cc -o ".build/${ARCH}/$(basename "${SRCFILE}").o" -c "${SRCFILE}" ${OPTIONAL_ARCH_FLAG} ${CPPFLAGS} || exit 1 |
71 | cc -o ".build/${ARCH}/$(basename "${SRCFILE}").o" -c "${SRCFILE}" ${OPTIONAL_ARCH_FLAG} ${CPPFLAGS} || exit 1 |
71 | done |
72 | done |
72 | 73 | ||
73 | # link them together |
74 | # link them together |
74 | echo "Linking for ${ARCH}..." |
75 | echo "Linking for ${ARCH}..." |
75 | cc -o ".build/${ARCH}/ |
76 | cc -o ".build/${ARCH}/a.out" ".build/${ARCH}/"*".o" ${OPTIONAL_ARCH_FLAG} ${LDFLAGS} || exit 1 |
76 | THIN_OUTPUTS="${THIN_OUTPUTS} .build/${ARCH}/a.out" |
77 | THIN_OUTPUTS="${THIN_OUTPUTS} .build/${ARCH}/a.out" |
77 | done |
78 | done |
78 | 79 | ||
79 | if [ "$(uname)" = "Darwin" ]; then |
80 | if [ "$(uname)" = "Darwin" ]; then |
80 | # create the macOS app layout |
81 | # create the macOS app layout |
Line 87... | Line 88... | ||
87 | 88 | ||
88 | # generate and deploy fat Mach-O executable |
89 | # generate and deploy fat Mach-O executable |
89 | echo "Generating fat executable..." |
90 | echo "Generating fat executable..." |
90 | lipo ${THIN_OUTPUTS} -create -output "${APP_NAME}.app/Contents/MacOS/${APP_NAME}" || exit 1 |
91 | lipo ${THIN_OUTPUTS} -create -output "${APP_NAME}.app/Contents/MacOS/${APP_NAME}" || exit 1 |
91 | 92 | ||
92 | # deploy the SDL2 framework |
93 | # deploy the SDL2 framework without the symlinks and change the LC_LOAD_DYLIB in the main executable |
- | 94 | # (macOS codesign will refuse to sign the executable if a bundled framework contains symlinks) |
|
93 | echo "Deploying SDL2 framework..." |
95 | echo "Deploying SDL2 framework..." |
94 | mkdir "${APP_NAME}.app/Contents/Frameworks/SDL2.framework" |
96 | mkdir "${APP_NAME}.app/Contents/Frameworks/SDL2.framework" || exit 1 |
95 |
|
97 | cp lib/SDL2/macOS/SDL2.framework/SDL2 "${APP_NAME}.app/Contents/Frameworks/SDL2.framework/SDL2" || exit 1 |
96 |
|
98 | install_name_tool -change "@rpath/SDL2.framework/Versions/A/SDL2" "@rpath/SDL2.framework/SDL2" "${APP_NAME}.app/Contents/MacOS/${APP_NAME}" |
97 | cp lib/SDL2/macOS/SDL2.framework/ |
99 | cp -LR lib/SDL2/macOS/SDL2.framework/Resources "${APP_NAME}.app/Contents/Frameworks/SDL2.framework" || exit 1 |
98 |
|
100 | find "${APP_NAME}.app/Contents/Frameworks/SDL2.framework" -name Thumbs.db -exec rm {} \; |
99 |
|
101 | find "${APP_NAME}.app/Contents/Frameworks/SDL2.framework" -name .DS_Store -exec rm {} \; |
100 |
|
102 | find "${APP_NAME}.app/Contents/Frameworks/SDL2.framework" -type f -exec chmod -x {} \; |
101 | 103 | ||
102 | # deploy the game data |
104 | # deploy the game data (excluding the savegames) and drop a notice that the actual game data is instantiated elsewhere |
103 | echo "Deploying game data..." |
105 | echo "Deploying game data..." |
104 | cp -LR DATA "${APP_NAME}.app/Contents/Resources" || exit 1 |
106 | cp -LR DATA "${APP_NAME}.app/Contents/Resources" || exit 1 |
- | 107 | rm "${APP_NAME}.app/Contents/Resources/DATA/SAVEGAME/"* |
|
- | 108 | echo "This game data is READONLY. The actual game data (read/write) is instantiated out of this template in ~/Library/Application Support/Carmageddon/DATA." > "${APP_NAME}.app/Contents/Resources/README.txt" |
|
105 | 109 | ||
106 | # generate and deploy the app icon |
110 | # generate and deploy the app icon |
107 | echo "Generating app icon..." |
111 | echo "Generating app icon..." |
108 | mkdir ".build/${APP_NAME}.iconset" || exit 1 |
112 | mkdir ".build/${APP_NAME}.iconset" || exit 1 |
109 | sips -z 16 16 "${ICON_FILE}" --out ".build/${APP_NAME}.iconset/icon_16x16.png" > /dev/null |
113 | sips -z 16 16 "${ICON_FILE}" --out ".build/${APP_NAME}.iconset/icon_16x16.png" > /dev/null |
Line 148... | Line 152... | ||
148 | echo " <key>CFBundleSignature</key>" |
152 | echo " <key>CFBundleSignature</key>" |
149 | echo " <string>????</string>" |
153 | echo " <string>????</string>" |
150 | echo "</dict>" |
154 | echo "</dict>" |
151 | echo "</plist>" |
155 | echo "</plist>" |
152 | ) > "${APP_NAME}.app/Contents/Info.plist" || exit 1 |
156 | ) > "${APP_NAME}.app/Contents/Info.plist" || exit 1 |
- | 157 | ||
- | 158 | # code signing is mandatory |
|
- | 159 | codesign --force --deep --sign "${CS_IDENTITY}" --timestamp "${APP_NAME}.app" |
|
153 | 160 | ||
154 | echo "Output app bundle: ${APP_NAME}.app" |
161 | echo "Output app bundle: ${APP_NAME}.app" |
- | 162 | ||
- | 163 | # zip on Mac to preserve executable flags |
|
- | 164 | zip -r "${APP_NAME} (Mac).zip" "${APP_NAME}.app" && echo "A Zip file of the app bundle was created for convenience." |
|
155 | else |
165 | else |
156 | # Linux/BSD/whatever: simply retrieve the compiled executable |
166 | # Linux/BSD/whatever: simply retrieve the compiled executable |
157 | cp ".build/${ARCH}/a.out" "${APP_NAME}.$(uname)-$(uname -m)" |
167 | cp ".build/${ARCH}/a.out" "${APP_NAME}.$(uname)-$(uname -m)" |
158 | 168 | ||
159 | echo "Output executable: ${APP_NAME}.$(uname)-$(uname -m)" |
169 | echo "Output executable: ${APP_NAME}.$(uname)-$(uname -m)" |