1 # XScreenSaver for MacOS X, Copyright (c) 2006-2015 by Jamie Zawinski.
3 XCODE_APP = /Applications/Xcode.app
5 # To build savers that will run on MacOS 10.6 and 10.7, Xcode 5.0.2 must
6 # be used (as that's the latest version of Xcode that ships with a version
7 # of clang that implements "-fobjc-gc"). However, Xcode 5.0.2 will not
8 # launch on MacOS 10.11 or later.
10 # XCODE_APP = /Applications/Xcode-5.0.2.app
13 ARCH = -arch i386 -arch x86_64 ONLY_ACTIVE_ARCH=NO
14 CERT = 'Developer ID Installer: Jamie Zawinski (4627ATJELP)'
15 PKGID = org.jwz.xscreensaver
16 THUMBDIR = build/screenshots
17 XCODEBUILD = $(XCODE_APP)/Contents/Developer/usr/bin/xcodebuild
18 SETFILE = $(XCODE_APP)/Contents/Developer/Tools/SetFile
19 SETICON = ./seticon.pl
26 # $(XCODEBUILD) -target "$(TARGETS)" clean
29 -rm -f config.status config.cache config.log \
30 *.bak *.rej TAGS *~ "#"*
31 -rm -rf autom4te*.cache
32 -rm -rf build Sparkle.framework
34 distdepend:: Sparkle.framework
35 distdepend:: update_plist_version
38 $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Debug build
41 $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Release build
43 release:: check_versions
46 unzip ../archive/Sparkle.framework-2013-12-04.zip
48 # Download and resize images from jwz.org.
49 # This saves us having to include 4MB of images in the tar file
50 # that will only be used by a vast minority of people building
52 # update-info-plist.pl runs this as needed.
53 # Might be better to do this with curl, since that is installed by default.
55 BASE = xscreensaver/screenshots/
56 URL = https://www.jwz.org/$(BASE)
57 WGET = wget -q -U xscreensaver-build-osx
58 CVT = -thumbnail '200x150^' -gravity center -extent 200x150 \
59 \( +clone -alpha extract \
60 -draw 'fill black polygon 0,0 0,6 6,0 fill white circle 6,6 6,0' \
61 \( +clone -flip \) -compose Multiply -composite \
62 \( +clone -flop \) -compose Multiply -composite \
63 \) -alpha off -compose CopyOpacity -composite \
71 FILE1=`echo "$@" | sed 's!^.*/\([^/]*\)\.png$$!\1.jpg!'` ; \
74 URL="$(URL)$$FILE1" ; \
75 URL2="$(URL)retired/$$FILE1" ; \
76 if [ ! -d $(THUMBDIR) ]; then mkdir -p $(THUMBDIR) ; fi ; \
77 rm -f "$$FILE2" "$$TMP" ; \
79 if [ -f "$$HOME/www/$(BASE)/$$FILE1" ]; then \
80 cp -p "$$HOME/www/$(BASE)/$$FILE1" "$$TMP" ; \
82 echo "downloading $$URL..." ; \
83 $(WGET) -O"$$TMP" "$$URL" ; \
84 if [ ! -s "$$TMP" ]; then \
85 echo "downloading $$URL2..." ; \
86 $(WGET) -O"$$TMP" "$$URL2" ; \
88 if [ ! -s "$$TMP" ]; then \
90 echo "failed: $$URL" ; \
95 convert jpg:- $(CVT) "$$FILE2" < "$$TMP" ; \
96 if [ ! -s "$$FILE2" ]; then \
97 echo "$$FILE2 failed" >&2 ; \
98 rm -f "$$FILE2" "$$TMP" ; \
107 SRC=../utils/version.h ; \
108 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
109 DIR=build/Release ; \
111 for S in $$DIR/*.{saver,app} ; do \
112 for P in $$S/Contents/Info.plist ; do \
113 V2=`plutil -convert xml1 -o - "$$P" | \
115 'm@<key>CFBundleVersion</key>\s*<string>(.*?)</string>@si \
117 if [ "$$V2" != "$$V" ] ; then \
118 echo "Wrong version: $$S ($$V2)" ; \
123 if [ "$$RESULT" = 0 ]; then echo "Versions match ($$V2)" ; fi ; \
129 DIR="build/Release" ; \
131 for S in "$$DIR/"*.saver ; do \
132 SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/.saver$$//'` ; \
133 D="$$S/Contents/MacOS/$$SS" ; \
134 V=`otool -s __DATA __objc_imageinfo "$$D" \
135 | grep ' 00 02 00 '` ; \
136 if [ -z "$$V" ]; then \
137 echo "$$S does not have GC enabled" ; \
142 for D in "$$DIR"/webcollage-helper \
143 "$$DIR"/*.saver/Contents/*/webcollage-helper \
144 "$$DIR"/*.app/Contents/*/XScreenSaverUpdater \
146 V=`otool -s __DATA __objc_imageinfo "$$D" \
147 | grep ' 00 02 00 '` ; \
148 if [ ! -z "$$V" ]; then \
149 echo "$$D has GC enabled" ; \
154 if [ "$$RESULT" = 0 ]; then echo "GC enabled" ; fi ; \
160 DIR="build/Release" ; \
162 for S in "$$DIR/"*.{saver,app} ; do \
163 SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/[.][a-z]*$$//'` ; \
164 D="$$S/Contents/MacOS/$$SS" ; \
166 | fgrep '/CoreText.framework/' \
167 | sed -n 's/^ *name \([^ ]*\).*$$/\1/p'` ; \
168 if [ -z "$$FF" ] ; then \
169 echo "$$S not linked with CoreText" >/dev/null ; \
171 OK=`echo "$$FF" | fgrep -v '/ApplicationServices.framework/'` ; \
172 if [ ! -z "$$OK" ]; then \
173 echo "$$S is linked with the wrong CoreText: $$FF" ; \
176 echo "$$S linked right: $$FF" >/dev/null ; \
180 if [ "$$RESULT" = 0 ]; then echo "CoreText linked correctly" ; fi ; \
185 ios-function-table.m::
186 @./build-fntable.pl build/Debug-iphonesimulator/XScreenSaver.app $@
191 \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \
192 -o -name 'jwz.*' -o -name 'Screen Savers' \
193 -o -name xscreensaver.xcodeproj \) \
195 -o \( -type f -o -type l \) -print ; \
196 echo xscreensaver.xcodeproj/project.pbxproj ) \
200 update_plist_version:
202 SRC=../utils/version.h ; \
203 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
205 for S in *.plist ; do \
206 /bin/echo -n "Updating version number in $$S to \"$$V\"... " ; \
207 KEYS="CFBundleVersion|CFBundleShortVersionString|CFBundleLongVersionString|CFBundleGetInfoString|NSHumanReadableCopyright" ; \
209 "s@(<key>($$KEYS)</key>\s*<string>)[^<>]+(</string>)@\$${1}$$V\$${3}@g" \
211 if cmp -s $$S $$T ; then \
212 echo "unchanged." ; \
222 ./updates.pl xscreensaver ../README ../archive ~/www/xscreensaver
227 U=../utils/version.h ; \
228 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ;]*\).*/\1/p' < $$U` ; \
229 BASE="xscreensaver-$$V" ; \
230 OUTDIR="../archive" ; \
231 DMG="$$OUTDIR/$$BASE.dmg" ; \
232 SIG=`sed -n 's/^.*dsaSignature="\(.*\)".*/\1/p' updates.xml` ; \
233 PUB="sparkle_dsa_pub.pem" ; \
235 SIGB=/tmp/$$NN.sig ; \
236 HASH=/tmp/$$NN.hash ; \
237 rm -f "$$SIGB" "$$HASH" ; \
238 echo "$$SIG " | base64 -D > "$$SIGB" ; \
240 for OPENSSL in /usr/bin/openssl /opt/local/bin/openssl ; do \
241 $$OPENSSL dgst -sha1 -binary < "$$DMG" > "$$HASH" ; \
242 /bin/echo -n "$$OPENSSL `$$OPENSSL version`: " ; \
243 $$OPENSSL dgst -dss1 -verify "$$PUB" -signature "$$SIGB" "$$HASH" ; \
245 rm -f "$$SIGB" "$$HASH" ; \
248 build/Release/installer.pkg: installer.rtf installer.xml installer.sh installer.png ../utils/version.h
251 SRC=../utils/version.h ; \
252 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
254 DIST="installer.xml" ; \
255 STAGE="build/Release/pkg_stage" ; \
257 UNSIGNED="$$STAGE/contents.pkg" ; \
258 PRODUCT="$$STAGE/product_unsigned.pkg" ; \
259 SCRIPTS="$$STAGE/scripts" ; \
260 RES="$$STAGE/resources" ; \
264 mkdir -p "$$SCRIPTS" "$$RES" ; \
266 cp -p installer.sh "$$SCRIPTS/preinstall" ; \
267 cp -p installer.png "$$RES/background.png" ; \
268 cp -p installer.rtf "$$RES/welcome.rtf" ; \
270 pkgbuild --identifier "$(PKGID)" --version "$$V" \
271 --scripts "$$SCRIPTS" --nopayload "$$UNSIGNED" ; \
273 productbuild --distribution "$$DIST" --resources "$$RES" \
274 --package-path "$$STAGE" --version "$$V" "$$PRODUCT" ; \
276 productsign --sign $(CERT) "$$PRODUCT" "$$FINAL" ; \
277 spctl --assess --verbose=4 --type install "$$FINAL" ; \
282 # -format UDBZ saves 4% (~1.2 MB) over UDZO.
284 dmg:: check_versions check_coretext
286 dmg:: build/Release/installer.pkg
290 SRC=../utils/version.h ; \
291 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
293 SRC="build/Release" ; \
294 EXTRAS=../../xdaliclock/OSX/build/Release/*.saver ; \
295 BASE="xscreensaver-$$V" ; \
296 OUTDIR="../archive" ; \
297 DMG="$$OUTDIR/$$BASE.dmg" ; \
298 TMPDMG="$$TMPDIR/tmp.dmg" ; \
299 VOLNAME="XScreenSaver $$V" ; \
300 STAGE="$$TMPDIR/dmg_stage" ; \
301 DST="$$STAGE/Screen Savers" ; \
302 PKG="$$STAGE/Install Everything.pkg" ; \
305 echo + mkdir -p "$$DST" ; \
308 retired=`perl -0 -ne \
309 's/\\\\\\n//g; m/^RETIRED_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
310 ../hacks/Makefile.in ; \
312 's/\\\\\\n//g; m/^RETIRED_GL_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
313 ../hacks/glx/Makefile.in ; \
314 echo xscreensaver ; \
315 echo savertester` ; \
317 for f in $$SRC/*.{saver,app} $$EXTRAS ; do \
318 f2=`basename "$$f"` ; \
320 ff=`echo $$f | perl -e '$$_=<>; s@^.*/(.*)\..*$$@\L$$1@; print'`; \
321 for r in $$retired ; do \
322 if [ "$$ff" = "$$r" ]; then ok=no ; fi ; \
324 if [ "$$ff" = testx11 ]; then ok=no ; fi ; \
325 if [ "$$f2" = "XScreenSaverUpdater.app" ]; then \
326 DST_HACK="XScreenSaver.updater" ; \
327 echo + tar ... "$$DST/$$DST_HACK" ; \
328 ( cd $$SRC ; tar -czf - "$$f2" ) > "$$DST/$$DST_HACK" ; \
329 elif [ "$$ok" = yes ]; then \
330 echo + cp -pR "$$f" "$$DST/" ; \
331 cp -pR "$$f" "$$DST/" ; \
333 echo skipping "$$f" ; \
338 cp -p bindist.rtf "$$STAGE/Read Me.rtf" ; \
339 cp -p build/Release/installer.pkg "$$PKG" ; \
340 cp -p bindist-DS_Store "$$STAGE/.DS_Store" ; \
341 cp -p bindist.webloc "$$STAGE/" ; \
342 cp -p XScreenSaverDMG.icns "$$STAGE/.VolumeIcon.icns" ; \
343 ${SETFILE} -a C "$$STAGE" ; \
344 ${SETFILE} -a E "$$STAGE"/*.{rtf,pkg,webloc} ; \
345 $(SETICON) -d ../../xdaliclock/OSX/daliclockSaver.icns \
346 "$$DST/DaliClock.saver" ; \
347 $(SETICON) -d XScreenSaverFolder.icns "$$DST" ; \
348 $(SETICON) -d XScreenSaver.icns "$$DST"/*.saver ; \
349 $(SETICON) -d SaverRunner.icns "$$DST"/*.app ; \
350 $(SETICON) -d XScreenSaverWebloc.icns "$$STAGE"/*.webloc ; \
351 $(SETICON) -d XScreenSaverPkg.icns "$$STAGE"/*.pkg ; \
352 mv "$$STAGE/bindist.webloc" "$$STAGE/Get the iPhone:iPad Version.webloc" ; \
355 echo "Checking signatures..." ; \
356 spctl --assess --type install "$$PKG" ; \
357 spctl --assess --type execute "$$SRC/XScreenSaverUpdater.app" ; \
358 spctl --assess --type execute "$$DST/"*.app ; \
359 spctl --assess --type install "$$DST/"*.saver ; \
362 hdiutil makehybrid -quiet -ov -hfs -hfs-volume-name "$$VOLNAME" \
363 -hfs-openfolder "$$STAGE" "$$STAGE" -o "$$TMPDMG" ; \
366 hdiutil convert -quiet -ov -format UDBZ -imagekey zlib-level=9 \
367 "$$TMPDMG" -o "$$DMG" ; \
368 xattr -w com.apple.quarantine "0000;00000000;;" "$$DMG" ; \
373 # When debugging, sometimes I have to reset the preferences for all
374 # the savers. Also I like FPS to be turned on, and them all to be
375 # pointed at the same image directory.
379 for f in *.saver ; do \
380 f=`echo "$$f" | sed 's/\..*//'` ; \
381 echo "########################## $$f" ; \
382 defaults -currentHost read org.jwz.xscreensaver."$$f" 2>&- ; \
384 for f in Apple2 Phosphor updater ; do \
385 echo "########################## $$f" ; \
386 defaults read org.jwz.xscreensaver."$$f" 2>&- ; \
392 W2="$$W1 -currentHost write" ; \
393 img='~/Pictures/Screensaver' ; \
394 for f in *.saver ; do \
395 name=`echo "$$f" | sed 's/\..*//'` ; \
396 echo "########################## $$name" ; \
397 domain="org.jwz.xscreensaver" ; \
398 dd="$$domain.$$name" ; \
399 $$W1 -currentHost delete "$$dd" 2>&- ; \
400 $$W2 "$$dd" doFPS -bool true ; \
401 if [ -f $$f/Contents/Resources/xscreensaver-text ] ; then \
402 $$W2 "$$dd" textMode url ; \
404 if [ -f $$f/Contents/Resources/xscreensaver-getimage-file ] ; then \
405 $$W2 "$$dd" chooseRandomImages -bool true ; \
406 $$W2 "$$dd" grabDesktopImages -bool false ; \
407 $$W2 "$$dd" imageDirectory "$$img" ; \
409 if ( strings "$$f/Contents/MacOS/$$name" | \
410 grep NSOpenGLContext >/dev/null ) ; then \
411 $$W2 "$$dd" multiSample -bool true ; \
415 $$W1 delete "$$domain.Apple2" 2>&- ; \
416 $$W1 delete "$$domain.Phosphor" 2>&- ; \
417 $$W1 delete "$$domain.updater" 2>&- ; \
418 $$W1 write "$$domain.updater" SUScheduledCheckIntervalKey 86400; \
420 $$W2 "$$domain.BoxFit" grab -bool true ; \
421 $$W2 "$$domain.FlipFlop" textured -bool true ; \
422 $$W2 "$$domain.GLSlideshow" titles -bool true ; \
423 $$W2 "$$domain.Photopile" titles -bool true ; \
424 $$W2 "$$domain.SkyTentacles" mode cel ; \
425 $$W2 "$$domain.Sonar" ping \
426 '/etc/hosts,$$HOME/.ssh/known_hosts,$$HOME/.ssh/known_hosts2' ; \
427 $$W2 "$$domain.XMatrix" matrixFont small ; \
428 $$W2 "$$domain.XMatrix" textMode literal ; \
429 $$W2 "$$domain.XMatrix" textLiteral "MONKEY BUTTER" ; \
431 # defaults -currentHost write org.jwz.xscreensaver.FontGlide debugMetrics -bool true
432 # defaults -currentHost write org.jwz.xscreensaver.StarWars debug -bool true
433 # defaults -currentHost write org.jwz.xscreensaver.StarWars textMode file
434 # defaults -currentHost write org.jwz.xscreensaver.StarWars textFile ~/src/xscreensaver/hacks/glx/zalgo.txt