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 = 'Jamie Zawinski'
15 CERT = 'iPhone Developer: Jamie Zawinski (Y5M82TL69N)'
16 PKGID = org.jwz.xscreensaver
17 THUMBDIR = build/screenshots
18 XCODEBUILD = $(XCODE_APP)/Contents/Developer/usr/bin/xcodebuild
19 SETFILE = $(XCODE_APP)/Contents/Developer/Tools/SetFile
20 SETICON = ./seticon.pl
27 # $(XCODEBUILD) -target "$(TARGETS)" clean
30 -rm -f config.status config.cache config.log \
31 *.bak *.rej TAGS *~ "#"*
32 -rm -rf autom4te*.cache
33 -rm -rf build Sparkle.framework
35 distdepend:: Sparkle.framework
36 distdepend:: update_plist_version
39 $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Debug build
42 $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Release build
44 release:: check_versions
48 unzip ../archive/Sparkle.framework-2013-12-04.zip
50 # Download and resize images from jwz.org.
51 # This saves us having to include 4MB of images in the tar file
52 # that will only be used by a vast minority of people building
54 # update-info-plist.pl runs this as needed.
55 # Might be better to do this with curl, since that is installed by default.
57 URL = https://www.jwz.org/xscreensaver/screenshots/
58 WGET = wget -q -U xscreensaver-build-osx
59 CVT = -thumbnail '200x150^' -gravity center -extent 200x150 \
60 \( +clone -alpha extract \
61 -draw 'fill black polygon 0,0 0,6 6,0 fill white circle 6,6 6,0' \
62 \( +clone -flip \) -compose Multiply -composite \
63 \( +clone -flop \) -compose Multiply -composite \
64 \) -alpha off -compose CopyOpacity -composite \
72 FILE1=`echo "$@" | sed 's!^.*/\([^/]*\)\.png$$!\1.jpg!'` ; \
75 URL="$(URL)$$FILE1" ; \
76 URL2="$(URL)retired/$$FILE1" ; \
77 if [ ! -d $(THUMBDIR) ]; then mkdir -p $(THUMBDIR) ; fi ; \
78 rm -f "$$FILE2" "$$TMP" ; \
80 echo "downloading $$URL..." ; \
81 $(WGET) -O"$$TMP" "$$URL" ; \
82 if [ ! -s "$$TMP" ]; then \
83 echo "downloading $$URL2..." ; \
84 $(WGET) -O"$$TMP" "$$URL2" ; \
86 if [ ! -s "$$TMP" ]; then \
88 echo "failed: $$URL" ; \
92 convert jpg:- $(CVT) "$$FILE2" < "$$TMP" ; \
93 if [ ! -s "$$FILE2" ]; then \
94 echo "$$FILE2 failed" >&2 ; \
95 rm -f "$$FILE2" "$$TMP" ; \
103 @for f in build/Release/*.app/Contents/*/*.saver \
104 build/Release/*.{saver,app} ; do \
105 codesign --deep -vfs $(CERT) $$f ; \
110 SRC=../utils/version.h ; \
111 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
112 DIR=build/Release ; \
114 for S in $$DIR/*.{saver,app} ; do \
115 for P in $$S/Contents/Info.plist ; do \
116 V2=`plutil -convert xml1 -o - "$$P" | \
118 'm@<key>CFBundleVersion</key>\s*<string>(.*?)</string>@si \
120 if [ "$$V2" != "$$V" ] ; then \
121 echo "Wrong version: $$S ($$V2)" ; \
126 if [ "$$RESULT" = 0 ]; then echo "Versions match ($$V2)" ; fi ; \
132 DIR="build/Release" ; \
134 for S in "$$DIR/"*.saver ; do \
135 SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/.saver$$//'` ; \
136 D="$$S/Contents/MacOS/$$SS" ; \
137 V=`otool -s __DATA __objc_imageinfo "$$D" \
138 | grep ' 00 02 00 '` ; \
139 if [ -z "$$V" ]; then \
140 echo "$$S does not have GC enabled" ; \
145 for D in "$$DIR"/webcollage-helper \
146 "$$DIR"/*.saver/Contents/*/webcollage-helper \
147 "$$DIR"/*.app/Contents/*/XScreenSaverUpdater \
149 V=`otool -s __DATA __objc_imageinfo "$$D" \
150 | grep ' 00 02 00 '` ; \
151 if [ ! -z "$$V" ]; then \
152 echo "$$D has GC enabled" ; \
157 if [ "$$RESULT" = 0 ]; then echo "GC enabled" ; fi ; \
163 DIR="build/Release" ; \
165 for S in "$$DIR/"*.{saver,app} ; do \
166 SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/[.][a-z]*$$//'` ; \
167 D="$$S/Contents/MacOS/$$SS" ; \
169 | fgrep '/CoreText.framework/' \
170 | sed -n 's/^ *name \([^ ]*\).*$$/\1/p'` ; \
171 if [ -z "$$FF" ] ; then \
172 echo "$$S not linked with CoreText" >/dev/null ; \
174 OK=`echo "$$FF" | fgrep -v '/ApplicationServices.framework/'` ; \
175 if [ ! -z "$$OK" ]; then \
176 echo "$$S is linked with the wrong CoreText: $$FF" ; \
179 echo "$$S linked right: $$FF" >/dev/null ; \
183 if [ "$$RESULT" = 0 ]; then echo "CoreText linked correctly" ; fi ; \
188 ios-function-table.m::
189 @./build-fntable.pl build/Debug-iphonesimulator/XScreenSaver.app $@
194 \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \
195 -o -name 'jwz.*' -o -name 'Screen Savers' \
196 -o -name xscreensaver.xcodeproj \) \
198 -o \( -type f -o -type l \) -print ; \
199 echo xscreensaver.xcodeproj/project.pbxproj ) \
203 update_plist_version:
205 SRC=../utils/version.h ; \
206 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
208 for S in *.plist ; do \
209 /bin/echo -n "Updating version number in $$S to \"$$V\"... " ; \
210 KEYS="CFBundleVersion|CFBundleShortVersionString|CFBundleLongVersionString|CFBundleGetInfoString|NSHumanReadableCopyright" ; \
212 "s@(<key>($$KEYS)</key>\s*<string>)[^<>]+(</string>)@\$${1}$$V\$${3}@g" \
214 if cmp -s $$S $$T ; then \
215 echo "unchanged." ; \
225 ./updates.pl xscreensaver ../README ../archive ~/www/xscreensaver
230 U=../utils/version.h ; \
231 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ;]*\).*/\1/p' < $$U` ; \
232 BASE="xscreensaver-$$V" ; \
233 OUTDIR="../archive" ; \
234 DMG="$$OUTDIR/$$BASE.dmg" ; \
235 SIG=`sed -n 's/^.*dsaSignature="\(.*\)".*/\1/p' updates.xml` ; \
236 PUB="sparkle_dsa_pub.pem" ; \
238 SIGB=/tmp/$$NN.sig ; \
239 HASH=/tmp/$$NN.hash ; \
240 rm -f "$$SIGB" "$$HASH" ; \
241 echo "$$SIG " | base64 -D > "$$SIGB" ; \
243 for OPENSSL in /usr/bin/openssl /opt/local/bin/openssl ; do \
244 $$OPENSSL dgst -sha1 -binary < "$$DMG" > "$$HASH" ; \
245 /bin/echo -n "$$OPENSSL `$$OPENSSL version`: " ; \
246 $$OPENSSL dgst -dss1 -verify "$$PUB" -signature "$$SIGB" "$$HASH" ; \
248 rm -f "$$SIGB" "$$HASH" ; \
251 build/Release/installer.pkg: installer.rtf installer.xml installer.sh installer.png ../utils/version.h
254 SRC=../utils/version.h ; \
255 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
257 DIST="installer.xml" ; \
258 STAGE="build/Release/pkg_stage" ; \
260 PKG2="$$STAGE/contents.pkg" ; \
261 SCRIPTS="$$STAGE/scripts" ; \
262 RES="$$STAGE/resources" ; \
266 mkdir -p "$$SCRIPTS" "$$RES" ; \
268 cp -p installer.sh "$$SCRIPTS/preinstall" ; \
269 cp -p installer.png "$$RES/background.png" ; \
270 cp -p installer.rtf "$$RES/welcome.rtf" ; \
272 pkgbuild --identifier "$(PKGID)" --version "$$V" \
273 --scripts "$$SCRIPTS" --nopayload "$$PKG2" ; \
274 codesign -vfs $(CERT) "$$PKG2" ; \
275 codesign -vd "$$PKG2" ; \
277 productbuild --distribution "$$DIST" --resources "$$RES" \
278 --package-path "$$STAGE" --version "$$V" "$$PKG1" ; \
279 codesign -vfs $(CERT) "$$PKG1" ; \
280 codesign -vd "$$PKG1" ; \
285 # -format UDBZ saves 4% (~1.2 MB) over UDZO.
287 dmg:: check_versions check_coretext
289 dmg:: build/Release/installer.pkg
293 SRC=../utils/version.h ; \
294 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
296 SRC="build/Release" ; \
297 EXTRAS=../../xdaliclock/OSX/build/Release/*.saver ; \
298 BASE="xscreensaver-$$V" ; \
299 OUTDIR="../archive" ; \
300 DMG="$$OUTDIR/$$BASE.dmg" ; \
301 TMPDMG="$$TMPDIR/tmp.dmg" ; \
302 VOLNAME="XScreenSaver $$V" ; \
303 STAGE="$$TMPDIR/dmg_stage" ; \
304 DST="$$STAGE/Screen Savers" ; \
305 PKG="$$STAGE/Install Everything.pkg" ; \
308 echo + mkdir -p "$$DST" ; \
311 retired=`perl -0 -ne \
312 's/\\\\\\n//g; m/^RETIRED_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
313 ../hacks/Makefile.in ; \
315 's/\\\\\\n//g; m/^RETIRED_GL_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
316 ../hacks/glx/Makefile.in ; \
317 echo xscreensaver ; \
318 echo savertester` ; \
320 for f in $$SRC/*.{saver,app} $$EXTRAS ; do \
321 f2=`basename "$$f"` ; \
323 ff=`echo $$f | perl -e '$$_=<>; s@^.*/(.*)\..*$$@\L$$1@; print'`; \
324 for r in $$retired ; do \
325 if [ "$$ff" = "$$r" ]; then ok=no ; fi ; \
327 if [ "$$ff" = testx11 ]; then ok=no ; fi ; \
328 if [ "$$f2" = "XScreenSaverUpdater.app" ]; then \
329 DST_HACK="XScreenSaver.updater" ; \
330 echo + tar ... "$$DST/$$DST_HACK" ; \
331 ( cd $$SRC ; tar -czf - "$$f2" ) > "$$DST/$$DST_HACK" ; \
332 elif [ "$$ok" = yes ]; then \
333 echo + cp -pR "$$f" "$$DST/" ; \
334 cp -pR "$$f" "$$DST/" ; \
336 echo skipping "$$f" ; \
341 cp -p bindist.rtf "$$STAGE/Read Me.rtf" ; \
342 cp -p build/Release/installer.pkg "$$PKG" ; \
343 cp -p bindist-DS_Store "$$STAGE/.DS_Store" ; \
344 cp -p bindist.webloc "$$STAGE/" ; \
345 cp -p XScreenSaverDMG.icns "$$STAGE/.VolumeIcon.icns" ; \
346 ${SETFILE} -a C "$$STAGE" ; \
347 ${SETFILE} -a E "$$STAGE"/*.{rtf,pkg,webloc} ; \
348 $(SETICON) -d ../../xdaliclock/OSX/daliclockSaver.icns \
349 "$$DST/DaliClock.saver" ; \
350 $(SETICON) -d XScreenSaverFolder.icns "$$DST" ; \
351 $(SETICON) -d XScreenSaverWebloc.icns "$$STAGE"/*.webloc ; \
352 $(SETICON) -d XScreenSaverPkg.icns "$$STAGE"/*.pkg ; \
353 mv "$$STAGE/bindist.webloc" "$$STAGE/Get the iPhone:iPad Version.webloc" ; \
354 hdiutil makehybrid -quiet -ov -hfs -hfs-volume-name "$$VOLNAME" \
355 -hfs-openfolder "$$STAGE" "$$STAGE" -o "$$TMPDMG" ; \
357 hdiutil convert -quiet -ov -format UDBZ -imagekey zlib-level=9 \
358 "$$TMPDMG" -o "$$DMG" ; \
359 xattr -w com.apple.quarantine "0000;00000000;;" "$$DMG" ; \
364 # When debugging, sometimes I have to reset the preferences for all
365 # the savers. Also I like FPS to be turned on, and them all to be
366 # pointed at the same image directory.
370 for f in *.saver ; do \
371 f=`echo "$$f" | sed 's/\..*//'` ; \
372 echo "########################## $$f" ; \
373 defaults -currentHost read org.jwz.xscreensaver."$$f" 2>&- ; \
375 for f in Apple2 Phosphor updater ; do \
376 echo "########################## $$f" ; \
377 defaults read org.jwz.xscreensaver."$$f" 2>&- ; \
383 W2="$$W1 -currentHost write" ; \
384 img='~/Pictures/Screensaver' ; \
385 for f in *.saver ; do \
386 name=`echo "$$f" | sed 's/\..*//'` ; \
387 echo "########################## $$name" ; \
388 domain="org.jwz.xscreensaver" ; \
389 dd="$$domain.$$name" ; \
390 $$W1 -currentHost delete "$$dd" 2>&- ; \
391 $$W2 "$$dd" doFPS -bool true ; \
392 if [ -f $$f/Contents/Resources/xscreensaver-text ] ; then \
393 $$W2 "$$dd" textMode url ; \
395 if [ -f $$f/Contents/Resources/xscreensaver-getimage-file ] ; then \
396 $$W2 "$$dd" chooseRandomImages -bool true ; \
397 $$W2 "$$dd" grabDesktopImages -bool false ; \
398 $$W2 "$$dd" imageDirectory "$$img" ; \
400 if ( strings "$$f/Contents/MacOS/$$name" | \
401 grep NSOpenGLContext >/dev/null ) ; then \
402 $$W2 "$$dd" multiSample -bool true ; \
406 $$W1 delete "$$domain.Apple2" 2>&- ; \
407 $$W1 delete "$$domain.Phosphor" 2>&- ; \
408 $$W1 delete "$$domain.updater" 2>&- ; \
409 $$W1 write "$$domain.updater" SUScheduledCheckIntervalKey 86400; \
411 $$W2 "$$domain.BoxFit" grab -bool true ; \
412 $$W2 "$$domain.FlipFlop" textured -bool true ; \
413 $$W2 "$$domain.GLSlideshow" titles -bool true ; \
414 $$W2 "$$domain.Photopile" titles -bool true ; \
415 $$W2 "$$domain.SkyTentacles" mode cel ; \
416 $$W2 "$$domain.Sonar" ping \
417 '/etc/hosts,$$HOME/.ssh/known_hosts,$$HOME/.ssh/known_hosts2' ; \
418 $$W2 "$$domain.XMatrix" matrixFont small ; \
419 $$W2 "$$domain.XMatrix" textMode literal ; \
420 $$W2 "$$domain.XMatrix" textLiteral "MONKEY BUTTER" ; \
422 # defaults -currentHost write org.jwz.xscreensaver.FontGlide debugMetrics -bool true
423 # defaults -currentHost write org.jwz.xscreensaver.StarWars debug -bool true
424 # defaults -currentHost write org.jwz.xscreensaver.StarWars textMode file
425 # defaults -currentHost write org.jwz.xscreensaver.StarWars textFile ~/src/xscreensaver/hacks/glx/zalgo.txt