Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | #!/bin/sh |
2 | |||
3 | # requirements: python, cc, ld |
||
4 | |||
5 | COMMON_SOURCES=" |
||
6 | libphysfs/src/physfs.c |
||
7 | libphysfs/src/physfs_archiver_7z.c |
||
8 | libphysfs/src/physfs_archiver_dir.c |
||
9 | libphysfs/src/physfs_archiver_grp.c |
||
10 | libphysfs/src/physfs_archiver_hog.c |
||
11 | libphysfs/src/physfs_archiver_iso9660.c |
||
12 | libphysfs/src/physfs_archiver_mvl.c |
||
13 | libphysfs/src/physfs_archiver_qpak.c |
||
14 | libphysfs/src/physfs_archiver_slb.c |
||
15 | libphysfs/src/physfs_archiver_unpacked.c |
||
16 | libphysfs/src/physfs_archiver_vdf.c |
||
17 | libphysfs/src/physfs_archiver_wad.c |
||
18 | libphysfs/src/physfs_archiver_zip.c |
||
19 | libphysfs/src/physfs_byteorder.c |
||
20 | libphysfs/src/physfs_platform_posix.c |
||
21 | libphysfs/src/physfs_unicode.c |
||
22 | libphysfs/src/physfs_platform_apple.m |
||
23 | libphysfs/extras/physfsrwops.c |
||
24 | common/2d/2dsline.cpp |
||
25 | common/2d/bitblt.cpp |
||
26 | common/2d/bitmap.cpp |
||
27 | common/2d/box.cpp |
||
28 | common/2d/canvas.cpp |
||
29 | common/2d/circle.cpp |
||
30 | common/2d/disc.cpp |
||
31 | common/2d/gpixel.cpp |
||
32 | common/2d/line.cpp |
||
33 | common/2d/pixel.cpp |
||
34 | common/2d/rect.cpp |
||
35 | common/2d/rle.cpp |
||
36 | common/2d/scalec.cpp |
||
37 | common/3d/draw.cpp |
||
38 | common/3d/globvars.cpp |
||
39 | common/3d/instance.cpp |
||
40 | common/3d/matrix.cpp |
||
41 | common/3d/points.cpp |
||
42 | common/3d/rod.cpp |
||
43 | common/3d/setup.cpp |
||
44 | common/arch/cocoa/messagebox.mm |
||
45 | common/arch/cocoa/SDLMain.m |
||
46 | common/arch/ogl/ogl_extensions.cpp |
||
47 | common/arch/ogl/ogl_sync.cpp |
||
48 | common/arch/sdl/digi_mixer_music.cpp |
||
49 | common/arch/sdl/event.cpp |
||
50 | common/arch/sdl/joy.cpp |
||
51 | common/arch/sdl/key.cpp |
||
52 | common/arch/sdl/mouse.cpp |
||
53 | common/arch/sdl/rbaudio.cpp |
||
54 | common/arch/sdl/timer.cpp |
||
55 | common/arch/sdl/window.cpp |
||
56 | common/editor/func.cpp |
||
57 | common/main/cli.cpp |
||
58 | common/main/cmd.cpp |
||
59 | common/main/cvar.cpp |
||
60 | common/maths/fixc.cpp |
||
61 | common/maths/rand.cpp |
||
62 | common/maths/tables.cpp |
||
63 | common/maths/vecmat.cpp |
||
64 | common/mem/mem.cpp |
||
65 | common/misc/error.cpp |
||
66 | common/misc/hash.cpp |
||
67 | common/misc/hmp.cpp |
||
68 | common/misc/ignorecase.cpp |
||
69 | common/misc/strutil.cpp |
||
70 | common/misc/vgrphys.cpp |
||
71 | common/misc/vgwphys.cpp |
||
72 | common/ui/button.cpp |
||
73 | common/ui/checkbox.cpp |
||
74 | common/ui/dialog.cpp |
||
75 | common/ui/file.cpp |
||
76 | common/ui/gadget.cpp |
||
77 | common/ui/icon.cpp |
||
78 | common/ui/inputbox.cpp |
||
79 | common/ui/keypad.cpp |
||
80 | common/ui/keypress.cpp |
||
81 | common/ui/listbox.cpp |
||
82 | common/ui/menu.cpp |
||
83 | common/ui/menubar.cpp |
||
84 | common/ui/message.cpp |
||
85 | common/ui/radio.cpp |
||
86 | common/ui/scroll.cpp |
||
87 | common/ui/ui.cpp |
||
88 | common/ui/uidraw.cpp |
||
89 | common/ui/userbox.cpp |
||
90 | similar/2d/font.cpp |
||
91 | similar/2d/palette.cpp |
||
92 | similar/2d/pcx.cpp |
||
93 | similar/3d/interp.cpp |
||
94 | similar/arch/ogl/gr.cpp |
||
95 | similar/arch/ogl/ogl.cpp |
||
96 | similar/arch/sdl/digi.cpp |
||
97 | similar/arch/sdl/digi_audio.cpp |
||
98 | similar/arch/sdl/digi_mixer.cpp |
||
99 | similar/arch/sdl/init.cpp |
||
100 | similar/arch/sdl/jukebox.cpp |
||
101 | similar/main/ai.cpp |
||
102 | similar/main/aipath.cpp |
||
103 | similar/main/automap.cpp |
||
104 | similar/main/bm.cpp |
||
105 | similar/main/cntrlcen.cpp |
||
106 | similar/main/collide.cpp |
||
107 | similar/main/config.cpp |
||
108 | similar/main/console.cpp |
||
109 | similar/main/controls.cpp |
||
110 | similar/main/credits.cpp |
||
111 | similar/main/digiobj.cpp |
||
112 | similar/main/dumpmine.cpp |
||
113 | similar/main/effects.cpp |
||
114 | similar/main/endlevel.cpp |
||
115 | similar/main/fireball.cpp |
||
116 | similar/main/fuelcen.cpp |
||
117 | similar/main/fvi.cpp |
||
118 | similar/main/game.cpp |
||
119 | similar/main/gamecntl.cpp |
||
120 | similar/main/gamefont.cpp |
||
121 | similar/main/gamemine.cpp |
||
122 | similar/main/gamerend.cpp |
||
123 | similar/main/gamesave.cpp |
||
124 | similar/main/gameseg.cpp |
||
125 | similar/main/gameseq.cpp |
||
126 | similar/main/gauges.cpp |
||
127 | similar/main/hostage.cpp |
||
128 | similar/main/hud.cpp |
||
129 | similar/main/iff.cpp |
||
130 | similar/main/inferno.cpp |
||
131 | similar/main/kconfig.cpp |
||
132 | similar/main/kmatrix.cpp |
||
133 | similar/main/laser.cpp |
||
134 | similar/main/lighting.cpp |
||
135 | similar/main/menu.cpp |
||
136 | similar/main/mglobal.cpp |
||
137 | similar/main/mission.cpp |
||
138 | similar/main/morph.cpp |
||
139 | similar/main/multi.cpp |
||
140 | similar/main/multibot.cpp |
||
141 | similar/main/net_udp.cpp |
||
142 | similar/main/newdemo.cpp |
||
143 | similar/main/newmenu.cpp |
||
144 | similar/main/object.cpp |
||
145 | similar/main/paging.cpp |
||
146 | similar/main/physics.cpp |
||
147 | similar/main/piggy.cpp |
||
148 | similar/main/player.cpp |
||
149 | similar/main/playsave.cpp |
||
150 | similar/main/polyobj.cpp |
||
151 | similar/main/powerup.cpp |
||
152 | similar/main/render.cpp |
||
153 | similar/main/robot.cpp |
||
154 | similar/main/scores.cpp |
||
155 | similar/main/segment.cpp |
||
156 | similar/main/slew.cpp |
||
157 | similar/main/songs.cpp |
||
158 | similar/main/state.cpp |
||
159 | similar/main/switch.cpp |
||
160 | similar/main/terrain.cpp |
||
161 | similar/main/texmerge.cpp |
||
162 | similar/main/text.cpp |
||
163 | similar/main/titles.cpp |
||
164 | similar/main/vclip.cpp |
||
165 | similar/main/vers_id.cpp |
||
166 | similar/main/wall.cpp |
||
167 | similar/main/weapon.cpp |
||
168 | similar/misc/args.cpp |
||
169 | similar/misc/physfsx.cpp |
||
170 | " |
||
171 | |||
172 | D1_SOURCES="${COMMON_SOURCES} |
||
173 | similar/main/bmread.cpp |
||
174 | d1x-rebirth/main/custom.cpp |
||
175 | d1x-rebirth/main/snddecom.cpp |
||
176 | " |
||
177 | |||
178 | D2_SOURCES="${COMMON_SOURCES} |
||
179 | d2x-rebirth/main/escort.cpp |
||
180 | d2x-rebirth/main/gamepal.cpp |
||
181 | d2x-rebirth/main/movie.cpp |
||
182 | d2x-rebirth/libmve/decoder16.cpp |
||
183 | d2x-rebirth/libmve/decoder8.cpp |
||
184 | d2x-rebirth/libmve/mve_audio.cpp |
||
185 | d2x-rebirth/libmve/mvelib.cpp |
||
186 | d2x-rebirth/libmve/mveplay.cpp |
||
187 | " |
||
188 | |||
189 | SYSTEM_FRAMEWORKS="Foundation AppKit IOKit OpenGL" |
||
190 | CUSTOM_FRAMEWORKS=`ls Frameworks|rev|cut -c 11-|rev` |
||
191 | |||
192 | DEFINES="" |
||
193 | CPPFLAGS="-O0 -g -I. -Icommon/include -Icommon/main -Ilibphysfs/src -Ilibphysfs/extras `for F in ${CUSTOM_FRAMEWORKS}; do echo " -IFrameworks/${F}.framework/Headers"; done` ${DEFINES}" |
||
194 | CFLAGS="" |
||
195 | CXXFLAGS="-std=c++17 -Wno-gnu-string-literal-operator-template" |
||
196 | MFLAGS="-FFrameworks -Wno-objc-protocol-method-implementation" |
||
197 | MXXFLAGS="-std=c++17 -FFrameworks -Wno-objc-protocol-method-implementation" |
||
198 | LDFLAGS="-dead_strip -lc++ -lSystem -lobjc `for F in ${SYSTEM_FRAMEWORKS}; do echo " -framework ${F}"; done` -FFrameworks `for F in ${CUSTOM_FRAMEWORKS}; do echo " -framework ${F}"; done`" |
||
199 | |||
200 | function build() |
||
201 | { |
||
202 | # usage: build "${SOURCES}" "${APPNAME}" "appspecificdir" [all] |
||
203 | echo "Compiling $2..." |
||
204 | echo "$1"|grep -v '^$'|grep -v '^#'|while read SRCFILE; do |
||
205 | OBJFILE="${SRCFILE}.o" |
||
206 | test ! "_$4" = "_all" -a "${OBJFILE}" -nt "${SRCFILE}" && continue |
||
207 | echo "+ ${SRCFILE}" |
||
208 | case "${SRCFILE}" in |
||
209 | similar/main/kconfig.cpp) |
||
210 | cc ${CPPFLAGS} ${DEFINES} -DDXX_KCONFIG_UI_ENUM=DXX_KCONFIG_UI_ENUM -DDXX_KCONFIG_UI_LABEL=DXX_KCONFIG_UI_LABEL -Dkc_item=kc_item ${CFLAGS} -E -c "similar/main/kconfig.ui-table.cpp" -o "similar/main/kconfig.ui-table.i" |
||
211 | similar/main/generate-kconfig-udlr.py "similar/main/kconfig.ui-table.i" > "$3/kconfig.udlr.h" |
||
212 | cc ${CPPFLAGS} ${CXXFLAGS} ${DEFINES} -c "${SRCFILE}" -o "${OBJFILE}";; |
||
213 | *.c) cc ${CPPFLAGS} ${CFLAGS} ${DEFINES} -c "${SRCFILE}" -o "${OBJFILE}";; |
||
214 | *.cpp) cc ${CPPFLAGS} ${CXXFLAGS} ${DEFINES} -c "${SRCFILE}" -o "${OBJFILE}";; |
||
215 | *.cxx) cc ${CPPFLAGS} ${CXXFLAGS} ${DEFINES} -c "${SRCFILE}" -o "${OBJFILE}";; |
||
216 | *.m) cc ${CPPFLAGS} ${MFLAGS} ${DEFINES} -c "${SRCFILE}" -o "${OBJFILE}";; |
||
217 | *.mm) cc ${CPPFLAGS} ${MXXFLAGS} ${DEFINES} -c "${SRCFILE}" -o "${OBJFILE}";; |
||
218 | *.mxx) cc ${CPPFLAGS} ${MXXFLAGS} ${DEFINES} -c "${SRCFILE}" -o "${OBJFILE}";; |
||
219 | esac |
||
220 | test $? -eq 0 || exit 1 |
||
221 | done || exit 1 |
||
222 | echo "Linking $2..." |
||
223 | OBJECTS="`echo "$1"|grep -v '^$'|grep -v '^#'|sed s/$/.o/g`" |
||
224 | ld -o "$2" ${OBJECTS} ${LDFLAGS} || exit 1 |
||
225 | echo "Packaging $2..." |
||
226 | mkdir -p "$2.app/Contents" |
||
227 | echo -n "APPL????" > "$2.app/Contents/PkgInfo" |
||
228 | echo '<?xml version="1.0" encoding="UTF-8"?>' > "$2.app/Contents/Info.plist" |
||
229 | echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> "$2.app/Contents/Info.plist" |
||
230 | echo '<plist version="1.0">' >> "$2.app/Contents/Info.plist" |
||
231 | echo '<dict>' >> "$2.app/Contents/Info.plist" |
||
232 | echo ' <key>CFBundleDevelopmentRegion</key>' >> "$2.app/Contents/Info.plist" |
||
233 | echo ' <string>English</string>' >> "$2.app/Contents/Info.plist" |
||
234 | echo ' <key>CFBundleExecutable</key>' >> "$2.app/Contents/Info.plist" |
||
235 | echo " <string>$2</string>" >> "$2.app/Contents/Info.plist" |
||
236 | echo ' <key>CFBundleIconFile</key>' >> "$2.app/Contents/Info.plist" |
||
237 | echo ' <string>descent</string>' >> "$2.app/Contents/Info.plist" |
||
238 | echo ' <key>CFBundleInfoDictionaryVersion</key>' >> "$2.app/Contents/Info.plist" |
||
239 | echo ' <string>6.0</string>' >> "$2.app/Contents/Info.plist" |
||
240 | echo ' <key>CFBundlePackageType</key>' >> "$2.app/Contents/Info.plist" |
||
241 | echo ' <string>APPL</string>' >> "$2.app/Contents/Info.plist" |
||
242 | echo ' <key>CFBundleSignature</key>' >> "$2.app/Contents/Info.plist" |
||
243 | echo ' <string>????</string>' >> "$2.app/Contents/Info.plist" |
||
244 | echo ' <key>CFBundleVersion</key>' >> "$2.app/Contents/Info.plist" |
||
245 | echo " <string>`cat dxxsconf.h|grep '#define DXX_VERSION_SEQ'|awk '{print $3}'|sed 's/,/./g'`</string>" >> "$2.app/Contents/Info.plist" |
||
246 | echo ' <key>NSMainNibFile</key>' >> "$2.app/Contents/Info.plist" |
||
247 | echo ' <string>MainMenu</string>' >> "$2.app/Contents/Info.plist" |
||
248 | echo ' <key>NSPrincipalClass</key>' >> "$2.app/Contents/Info.plist" |
||
249 | echo ' <string>NSApplication</string>' >> "$2.app/Contents/Info.plist" |
||
250 | echo '</dict>' >> "$2.app/Contents/Info.plist" |
||
251 | echo '</plist>' >> "$2.app/Contents/Info.plist" |
||
252 | mkdir -p "$2.app/Contents/Frameworks" |
||
253 | for FRAMEWORK in ${CUSTOM_FRAMEWORKS}; do |
||
254 | cp -r Frameworks/${FRAMEWORK}.framework "$2.app/Contents/Frameworks" |
||
255 | for HEADERDIR in `find "$2.app/Contents/Frameworks/${FRAMEWORK}.framework" -name Headers`; do |
||
256 | rm -rf "${HEADERDIR}" |
||
257 | done |
||
258 | done |
||
259 | mkdir -p "$2.app/Contents/MacOS" |
||
260 | mv "$2" "$2.app/Contents/MacOS" |
||
261 | mkdir -p "$2.app/Contents/Resources" |
||
262 | cp -r $3/Resources/* "$2.app/Contents/Resources" |
||
263 | echo "+ $2.app" |
||
264 | echo "Done." |
||
265 | } |
||
266 | |||
267 | function clean() |
||
268 | { |
||
269 | # usage: clean "${APPNAME}" |
||
270 | echo "Cleaning up..." |
||
271 | rm -rf "$1.app" |
||
272 | for F in `find . -type f|grep '\.o$'`; do |
||
273 | rm "${F}" |
||
274 | done |
||
275 | echo "+ $1.app" |
||
276 | echo "Done." |
||
277 | } |
||
278 | |||
279 | if [ "_$1" = "_clean" ]; then |
||
280 | clean Descent |
||
281 | clean Descent2 |
||
282 | elif [ "_$1" = "_Descent" ]; then |
||
283 | DEFINES="-DDXX_BUILD_DESCENT_I=1 -DGL_SILENCE_DEPRECATION -Id1x-rebirth/main" |
||
284 | build "${D1_SOURCES}" Descent d1x-rebirth || exit 1 |
||
285 | elif [ "_$1" = "_Descent2" ]; then |
||
286 | DEFINES="-DDXX_BUILD_DESCENT_II=1 -DGL_SILENCE_DEPRECATION -Id1x-rebirth/main" |
||
287 | build "${D2_SOURCES}" Descent2 d2x-rebirth || exit 1 |
||
288 | else |
||
289 | for F in `find . -type f|grep '\.o$'`; do rm "${F}"; done |
||
290 | DEFINES="-DDXX_BUILD_DESCENT_I=1 -DGL_SILENCE_DEPRECATION -Id1x-rebirth/main" |
||
291 | build "${D1_SOURCES}" Descent d1x-rebirth $1 || exit 1 |
||
292 | |||
293 | for F in `find . -type f|grep '\.o$'`; do rm "${F}"; done |
||
294 | DEFINES="-DDXX_BUILD_DESCENT_II=1 -DGL_SILENCE_DEPRECATION -Id2x-rebirth/main" |
||
295 | build "${D2_SOURCES}" Descent2 d2x-rebirth $1 || exit 1 |
||
296 | fi |