1 # XScreenSaver for MacOS X, Copyright (c) 2006-2014 by Jamie Zawinski.
3 # We have to use Xcode 5.0.2 in order to build savers that will run on
4 # MacOS 10.6 and 10.7, because that's the latest version of Xcode that
5 # ships with a version of clang that implements "-fobjc-gc".
7 XCODE_APP = /Applications/Xcode-5.0.2.app
10 ARCH = -arch i386 -arch x86_64
11 CERT = 'Jamie Zawinski'
12 CERT = 'iPhone Developer: Jamie Zawinski (Y5M82TL69N)'
13 PKGID = org.jwz.xscreensaver
14 THUMBDIR = $(HOME)/www/xscreensaver/screenshots/
15 XCODEBUILD = $(XCODE_APP)/Contents/Developer/usr/bin/xcodebuild
16 SETFILE = $(XCODE_APP)/Contents/Developer/Tools/SetFile
17 SETICON = /usr/local/bin/seticon
18 # seticon is from osxutils1.7.pkg
25 # $(XCODEBUILD) -target "$(TARGETS)" clean
28 -rm -f config.status config.cache config.log \
29 *.bak *.rej TAGS *~ "#"*
30 -rm -rf autom4te*.cache
31 -rm -rf build Sparkle.framework
33 distdepend:: Sparkle.framework
34 distdepend:: update_plist_version
37 $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Debug build
40 $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Release build
42 release:: check_versions
43 release:: update_thumbs
47 unzip ../archive/Sparkle.framework-2013-12-04.zip
50 @for f in build/Release/*.app/Contents/*/*.saver \
51 build/Release/*.{saver,app} ; do \
52 codesign --deep -vfs $(CERT) $$f ; \
57 SRC=../utils/version.h ; \
58 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
61 for S in $$DIR/*.{saver,app} ; do \
62 for P in $$S/Contents/Info.plist ; do \
63 V2=`plutil -convert xml1 -o - "$$P" | \
65 'm@<key>CFBundleVersion</key>\s*<string>(.*?)</string>@si \
67 if [ "$$V2" != "$$V" ] ; then \
68 echo "Wrong version: $$S ($$V2)" ; \
73 if [ "$$RESULT" = 0 ]; then echo "Versions match ($$V2)" ; fi ; \
79 DIR="build/Release" ; \
81 for S in "$$DIR/"*.saver ; do \
82 SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/.saver$$//'` ; \
83 D="$$S/Contents/MacOS/$$SS" ; \
84 V=`otool -s __DATA __objc_imageinfo "$$D" \
85 | grep ' 00 02 00 '` ; \
86 if [ -z "$$V" ]; then \
87 echo "$$S does not have GC enabled" ; \
92 for D in "$$DIR"/webcollage-helper \
93 "$$DIR"/*.saver/Contents/*/webcollage-helper \
94 "$$DIR"/*.app/Contents/*/XScreenSaverUpdater \
96 V=`otool -s __DATA __objc_imageinfo "$$D" \
97 | grep ' 00 02 00 '` ; \
98 if [ ! -z "$$V" ]; then \
99 echo "$$D has GC enabled" ; \
104 if [ "$$RESULT" = 0 ]; then echo "GC enabled" ; fi ; \
110 DIR="build/Release" ; \
112 for S in "$$DIR/"*.{saver,app} ; do \
113 SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/[.][a-z]*$$//'` ; \
114 D="$$S/Contents/MacOS/$$SS" ; \
116 | fgrep '/CoreText.framework/' \
117 | sed -n 's/^ *name \([^ ]*\).*$$/\1/p'` ; \
118 if [ -z "$$FF" ] ; then \
119 echo "$$S not linked with CoreText" >/dev/null ; \
121 OK=`echo "$$FF" | fgrep -v '/ApplicationServices.framework/'` ; \
122 if [ ! -z "$$OK" ]; then \
123 echo "$$S is linked with the wrong CoreText: $$FF" ; \
126 echo "$$S linked right: $$FF" >/dev/null ; \
130 if [ "$$RESULT" = 0 ]; then echo "CoreText linked correctly" ; fi ; \
135 ./update-thumbnail.pl $(THUMBDIR) build/Release/*.saver
139 ios-function-table.m::
140 @./build-fntable.pl build/Debug-iphonesimulator/XScreenSaver.app $@
145 \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \
146 -o -name 'jwz.*' -o -name 'Screen Savers' \
147 -o -name xscreensaver.xcodeproj \) \
149 -o \( -type f -o -type l \) -print ; \
150 echo xscreensaver.xcodeproj/project.pbxproj ) \
154 update_plist_version:
156 SRC=../utils/version.h ; \
157 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
159 for S in *.plist ; do \
160 /bin/echo -n "Updating version number in $$S to \"$$V\"... " ; \
161 KEYS="CFBundleVersion|CFBundleShortVersionString|CFBundleLongVersionString|CFBundleGetInfoString|NSHumanReadableCopyright" ; \
163 "s@(<key>($$KEYS)</key>\s*<string>)[^<>]+(</string>)@\$${1}$$V\$${3}@g" \
165 if cmp -s $$S $$T ; then \
166 echo "unchanged." ; \
176 ./updates.pl xscreensaver ../README ../archive ~/www/xscreensaver
181 U=../utils/version.h ; \
182 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ;]*\).*/\1/p' < $$U` ; \
183 BASE="xscreensaver-$$V" ; \
184 OUTDIR="../archive" ; \
185 DMG="$$OUTDIR/$$BASE.dmg" ; \
186 SIG=`sed -n 's/^.*dsaSignature="\(.*\)".*/\1/p' updates.xml` ; \
187 PUB="sparkle_dsa_pub.pem" ; \
189 SIGB=/tmp/$$NN.sig ; \
190 HASH=/tmp/$$NN.hash ; \
191 rm -f "$$SIGB" "$$HASH" ; \
192 echo "$$SIG " | base64 -D > "$$SIGB" ; \
194 for OPENSSL in /usr/bin/openssl /opt/local/bin/openssl ; do \
195 $$OPENSSL dgst -sha1 -binary < "$$DMG" > "$$HASH" ; \
196 /bin/echo -n "$$OPENSSL `$$OPENSSL version`: " ; \
197 $$OPENSSL dgst -dss1 -verify "$$PUB" -signature "$$SIGB" "$$HASH" ; \
199 rm -f "$$SIGB" "$$HASH" ; \
202 build/Release/installer.pkg: installer.rtf installer.xml installer.sh installer.png ../utils/version.h
205 SRC=../utils/version.h ; \
206 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
208 DIST="installer.xml" ; \
209 STAGE="build/Release/pkg_stage" ; \
211 PKG2="$$STAGE/contents.pkg" ; \
212 SCRIPTS="$$STAGE/scripts" ; \
213 RES="$$STAGE/resources" ; \
217 mkdir -p "$$SCRIPTS" "$$RES" ; \
219 cp -p installer.sh "$$SCRIPTS/preinstall" ; \
220 cp -p installer.png "$$RES/background.png" ; \
221 cp -p installer.rtf "$$RES/welcome.rtf" ; \
223 pkgbuild --identifier "$(PKGID)" --version "$$V" \
224 --scripts "$$SCRIPTS" --nopayload "$$PKG2" ; \
225 codesign -vfs $(CERT) "$$PKG2" ; \
226 codesign -vd "$$PKG2" ; \
228 productbuild --distribution "$$DIST" --resources "$$RES" \
229 --package-path "$$STAGE" --version "$$V" "$$PKG1" ; \
230 codesign -vfs $(CERT) "$$PKG1" ; \
231 codesign -vd "$$PKG1" ; \
236 # -format UDBZ saves 4% (~1.2 MB) over UDZO.
238 dmg:: check_versions check_gc check_coretext
239 dmg:: build/Release/installer.pkg
243 SRC=../utils/version.h ; \
244 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
246 SRC="build/Release" ; \
247 EXTRAS=../../xdaliclock/OSX/build/Release/*.saver ; \
248 BASE="xscreensaver-$$V" ; \
249 OUTDIR="../archive" ; \
250 DMG="$$OUTDIR/$$BASE.dmg" ; \
251 TMPDMG="$$TMPDIR/tmp.dmg" ; \
252 VOLNAME="XScreenSaver $$V" ; \
253 STAGE="$$TMPDIR/dmg_stage" ; \
254 DST="$$STAGE/Screen Savers" ; \
255 PKG="$$STAGE/Install Everything.pkg" ; \
258 echo + mkdir -p "$$DST" ; \
261 retired=`perl -0 -ne \
262 's/\\\\\\n//g; m/^RETIRED_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
263 ../hacks/Makefile.in ; \
265 's/\\\\\\n//g; m/^RETIRED_GL_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
266 ../hacks/glx/Makefile.in ; \
267 echo xscreensaver ; \
268 echo savertester` ; \
270 for f in $$SRC/*.{saver,app} $$EXTRAS ; do \
271 f2=`basename "$$f"` ; \
273 ff=`echo $$f | perl -e '$$_=<>; s@^.*/(.*)\..*$$@\L$$1@; print'`; \
274 for r in $$retired ; do \
275 if [ "$$ff" = "$$r" ]; then ok=no ; fi ; \
277 if [ "$$ff" = testx11 ]; then ok=no ; fi ; \
278 if [ "$$f2" = "XScreenSaverUpdater.app" ]; then \
279 DST_HACK="XScreenSaver.updater" ; \
280 echo + tar ... "$$DST/$$DST_HACK" ; \
281 ( cd $$SRC ; tar -czf - "$$f2" ) > "$$DST/$$DST_HACK" ; \
282 elif [ "$$ok" = yes ]; then \
283 echo + cp -pR "$$f" "$$DST/" ; \
284 cp -pR "$$f" "$$DST/" ; \
286 echo skipping "$$f" ; \
291 cp -p bindist.rtf "$$STAGE/Read Me.rtf" ; \
292 cp -p build/Release/installer.pkg "$$PKG" ; \
293 cp -p bindist-DS_Store "$$STAGE/.DS_Store" ; \
294 cp -p bindist.webloc "$$STAGE/Get the iPhone:iPad Version.webloc" ; \
295 cp -p XScreenSaverDMG.icns "$$STAGE/.VolumeIcon.icns" ; \
296 ${SETFILE} -a C "$$STAGE" ; \
297 ${SETFILE} -a E "$$STAGE"/*.{rtf,pkg,webloc} ; \
298 $(SETICON) -d ../../xdaliclock/OSX/daliclockSaver.icns \
299 "$$DST/DaliClock.saver" ; \
300 $(SETICON) -d XScreenSaverFolder.icns "$$DST" ; \
301 $(SETICON) -d XScreenSaverWebloc.icns "$$STAGE"/*.webloc ; \
302 $(SETICON) -d XScreenSaverPkg.icns "$$STAGE"/*.pkg ; \
303 hdiutil makehybrid -quiet -ov -hfs -hfs-volume-name "$$VOLNAME" \
304 -hfs-openfolder "$$STAGE" "$$STAGE" -o "$$TMPDMG" ; \
306 hdiutil convert -quiet -ov -format UDBZ -imagekey zlib-level=9 \
307 "$$TMPDMG" -o "$$DMG" ; \
308 xattr -w com.apple.quarantine "0000;00000000;;" "$$DMG" ; \
313 # When debugging, sometimes I have to reset the preferences for all
314 # the savers. Also I like FPS to be turned on, and them all to be
315 # pointed at the same image directory.
319 for f in *.saver ; do \
320 f=`echo "$$f" | sed 's/\..*//'` ; \
321 echo "########################## $$f" ; \
322 defaults -currentHost read org.jwz.xscreensaver."$$f" 2>&- ; \
324 for f in Apple2 Phosphor updater ; do \
325 echo "########################## $$f" ; \
326 defaults read org.jwz.xscreensaver."$$f" 2>&- ; \
332 W2="$$W1 -currentHost write" ; \
333 img='~/Pictures/Screensaver' ; \
334 for f in *.saver ; do \
335 name=`echo "$$f" | sed 's/\..*//'` ; \
336 echo "########################## $$name" ; \
337 domain="org.jwz.xscreensaver" ; \
338 dd="$$domain.$$name" ; \
339 $$W1 -currentHost delete "$$dd" 2>&- ; \
340 $$W2 "$$dd" doFPS -bool true ; \
341 if [ -f $$f/Contents/Resources/xscreensaver-text ] ; then \
342 $$W2 "$$dd" textMode url ; \
344 if [ -f $$f/Contents/Resources/xscreensaver-getimage-file ] ; then \
345 $$W2 "$$dd" chooseRandomImages -bool true ; \
346 $$W2 "$$dd" grabDesktopImages -bool false ; \
347 $$W2 "$$dd" imageDirectory "$$img" ; \
349 if ( strings "$$f/Contents/MacOS/$$name" | \
350 grep NSOpenGLContext >/dev/null ) ; then \
351 $$W2 "$$dd" multiSample -bool true ; \
355 $$W1 delete "$$domain.Apple2" 2>&- ; \
356 $$W1 delete "$$domain.Phosphor" 2>&- ; \
357 $$W1 delete "$$domain.updater" 2>&- ; \
358 $$W1 write "$$domain.updater" SUScheduledCheckIntervalKey 86400; \
360 $$W2 "$$domain.BoxFit" grab -bool true ; \
361 $$W2 "$$domain.FlipFlop" textured -bool true ; \
362 $$W2 "$$domain.GLSlideshow" titles -bool true ; \
363 $$W2 "$$domain.Photopile" titles -bool true ; \
364 $$W2 "$$domain.SkyTentacles" mode cel ; \
365 $$W2 "$$domain.Sonar" ping \
366 '/etc/hosts,$$HOME/.ssh/known_hosts,$$HOME/.ssh/known_hosts2' ; \
367 $$W2 "$$domain.XMatrix" matrixFont small ; \
368 $$W2 "$$domain.XMatrix" textMode literal ; \
369 $$W2 "$$domain.XMatrix" textLiteral "MONKEY BUTTER" ; \
371 # defaults -currentHost write org.jwz.xscreensaver.FontGlide debugMetrics -bool true
372 # defaults -currentHost write org.jwz.xscreensaver.StarWars debug -bool true
373 # defaults -currentHost write org.jwz.xscreensaver.StarWars textMode file
374 # defaults -currentHost write org.jwz.xscreensaver.StarWars textFile ~/src/xscreensaver/hacks/glx/zalgo.txt