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 # cd ..; $(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 cd ..; $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Debug build
40 cd ..; $(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" ; \
91 if [ "$$RESULT" = 0 ]; then echo "GC enabled" ; fi ; \
97 DIR="build/Release" ; \
99 for S in "$$DIR/"*.{saver,app} ; do \
100 SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/[.][a-z]*$$//'` ; \
101 D="$$S/Contents/MacOS/$$SS" ; \
103 | fgrep '/CoreText.framework/' \
104 | sed -n 's/^ *name \([^ ]*\).*$$/\1/p'` ; \
105 if [ -z "$$FF" ] ; then \
106 echo "$$S not linked with CoreText" >/dev/null ; \
108 OK=`echo "$$FF" | fgrep -v '/ApplicationServices.framework/'` ; \
109 if [ ! -z "$$OK" ]; then \
110 echo "$$S is linked with the wrong CoreText: $$FF" ; \
113 echo "$$S linked right: $$FF" >/dev/null ; \
117 if [ "$$RESULT" = 0 ]; then echo "CoreText linked correctly" ; fi ; \
122 ./update-thumbnail.pl $(THUMBDIR) build/Release/*.saver
126 ios-function-table.m::
127 @./build-fntable.pl build/Debug-iphonesimulator/XScreenSaver.app $@
132 \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \
133 -o -name 'jwz.*' -o -name 'Screen Savers' \) \
135 -o \( -type f -o -type l \) -print \
139 update_plist_version:
141 SRC=../utils/version.h ; \
142 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
144 for S in *.plist ; do \
145 /bin/echo -n "Updating version number in $$S to \"$$V\"... " ; \
146 KEYS="CFBundleVersion|CFBundleShortVersionString|CFBundleLongVersionString|CFBundleGetInfoString|NSHumanReadableCopyright" ; \
148 "s@(<key>($$KEYS)</key>\s*<string>)[^<>]+(</string>)@\$${1}$$V\$${3}@g" \
150 if cmp -s $$S $$T ; then \
151 echo "unchanged." ; \
161 ./updates.pl xscreensaver ../README ../archive ~/www/xscreensaver
166 U=../utils/version.h ; \
167 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ;]*\).*/\1/p' < $$U` ; \
168 BASE="xscreensaver-$$V" ; \
169 OUTDIR="../archive" ; \
170 DMG="$$OUTDIR/$$BASE.dmg" ; \
171 SIG=`sed -n 's/^.*dsaSignature="\(.*\)".*/\1/p' updates.xml` ; \
172 PUB="sparkle_dsa_pub.pem" ; \
174 SIGB=/tmp/$$NN.sig ; \
175 HASH=/tmp/$$NN.hash ; \
176 rm -f "$$SIGB" "$$HASH" ; \
177 echo "$$SIG " | base64 -D > "$$SIGB" ; \
179 for OPENSSL in /usr/bin/openssl /opt/local/bin/openssl ; do \
180 $$OPENSSL dgst -sha1 -binary < "$$DMG" > "$$HASH" ; \
181 /bin/echo -n "$$OPENSSL `$$OPENSSL version`: " ; \
182 $$OPENSSL dgst -dss1 -verify "$$PUB" -signature "$$SIGB" "$$HASH" ; \
184 rm -f "$$SIGB" "$$HASH" ; \
187 build/Release/installer.pkg: installer.rtf installer.xml installer.sh installer.png ../utils/version.h
190 SRC=../utils/version.h ; \
191 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
193 DIST="installer.xml" ; \
194 STAGE="build/Release/pkg_stage" ; \
196 PKG2="$$STAGE/contents.pkg" ; \
197 SCRIPTS="$$STAGE/scripts" ; \
198 RES="$$STAGE/resources" ; \
202 mkdir -p "$$SCRIPTS" "$$RES" ; \
204 cp -p installer.sh "$$SCRIPTS/preinstall" ; \
205 cp -p installer.png "$$RES/background.png" ; \
206 cp -p installer.rtf "$$RES/welcome.rtf" ; \
208 pkgbuild --identifier "$(PKGID)" --version "$$V" \
209 --scripts "$$SCRIPTS" --nopayload "$$PKG2" ; \
210 codesign -vfs $(CERT) "$$PKG2" ; \
211 codesign -vd "$$PKG2" ; \
213 productbuild --distribution "$$DIST" --resources "$$RES" \
214 --package-path "$$STAGE" --version "$$V" "$$PKG1" ; \
215 codesign -vfs $(CERT) "$$PKG1" ; \
216 codesign -vd "$$PKG1" ; \
221 # -format UDBZ saves 4% (~1.2 MB) over UDZO.
223 dmg:: check_versions check_gc check_coretext
224 dmg:: build/Release/installer.pkg
228 SRC=../utils/version.h ; \
229 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
231 SRC="build/Release" ; \
232 EXTRAS=../../xdaliclock/OSX/build/Release/*.saver ; \
233 BASE="xscreensaver-$$V" ; \
234 OUTDIR="../archive" ; \
235 DMG="$$OUTDIR/$$BASE.dmg" ; \
236 TMPDMG="$$TMPDIR/tmp.dmg" ; \
237 VOLNAME="XScreenSaver $$V" ; \
238 STAGE="$$TMPDIR/dmg_stage" ; \
239 DST="$$STAGE/Screen Savers" ; \
240 PKG="$$STAGE/Install Everything.pkg" ; \
243 echo + mkdir -p "$$DST" ; \
246 retired=`perl -0 -ne \
247 's/\\\\\\n//g; m/^RETIRED_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
248 ../hacks/Makefile.in ; \
250 's/\\\\\\n//g; m/^RETIRED_GL_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
251 ../hacks/glx/Makefile.in ; \
252 echo xscreensaver ; \
253 echo savertester` ; \
255 for f in $$SRC/*.{saver,app} $$EXTRAS ; do \
256 f2=`basename "$$f"` ; \
258 ff=`echo $$f | perl -e '$$_=<>; s@^.*/(.*)\..*$$@\L$$1@; print'`; \
259 for r in $$retired ; do \
260 if [ "$$ff" = "$$r" ]; then ok=no ; fi ; \
263 if [ "$$f2" = "XScreenSaverUpdater.app" ]; then \
266 if [ "$$ok" = yes ]; then \
267 echo + cp -pR "$$f" "$$DST/$$DSTNAME" ; \
268 cp -pR "$$f" "$$DST/$$DSTNAME" ; \
270 echo skipping "$$f" ; \
275 cp -p bindist.rtf "$$STAGE/Read Me.rtf" ; \
276 cp -p build/Release/installer.pkg "$$PKG" ; \
277 cp -p bindist-DS_Store "$$STAGE/.DS_Store" ; \
278 cp -p bindist.webloc "$$STAGE/Get the iPhone:iPad Version.webloc" ; \
279 cp -p XScreenSaverDMG.icns "$$STAGE/.VolumeIcon.icns" ; \
280 ${SETFILE} -a C "$$STAGE" ; \
281 ${SETFILE} -a E "$$STAGE"/*.{rtf,pkg,webloc} ; \
282 $(SETICON) -d ../../xdaliclock/OSX/daliclockSaver.icns \
283 "$$DST/DaliClock.saver" ; \
284 $(SETICON) -d XScreenSaverFolder.icns "$$DST" ; \
285 $(SETICON) -d XScreenSaverWebloc.icns "$$STAGE"/*.webloc ; \
286 $(SETICON) -d XScreenSaverPkg.icns "$$STAGE"/*.pkg ; \
287 hdiutil makehybrid -quiet -ov -hfs -hfs-volume-name "$$VOLNAME" \
288 -hfs-openfolder "$$STAGE" "$$STAGE" -o "$$TMPDMG" ; \
290 hdiutil convert -quiet -ov -format UDBZ -imagekey zlib-level=9 \
291 "$$TMPDMG" -o "$$DMG" ; \
292 xattr -w com.apple.quarantine "0000;00000000;;" "$$DMG" ; \
297 # When debugging, sometimes I have to reset the preferences for all
298 # the savers. Also I like FPS to be turned on, and them all to be
299 # pointed at the same image directory.
303 for f in *.saver ; do \
304 f=`echo "$$f" | sed 's/\..*//'` ; \
305 echo "########################## $$f" ; \
306 defaults -currentHost read org.jwz.xscreensaver."$$f" 2>&- ; \
308 for f in Apple2 Phosphor updater ; do \
309 echo "########################## $$f" ; \
310 defaults read org.jwz.xscreensaver."$$f" 2>&- ; \
316 W2="$$W1 -currentHost write" ; \
317 img='~/Pictures/Screensaver' ; \
318 for f in *.saver ; do \
319 name=`echo "$$f" | sed 's/\..*//'` ; \
320 echo "########################## $$name" ; \
321 domain="org.jwz.xscreensaver" ; \
322 dd="$$domain.$$name" ; \
323 $$W1 -currentHost delete "$$dd" 2>&- ; \
324 $$W2 "$$dd" doFPS -bool true ; \
325 if [ -f $$f/Contents/Resources/xscreensaver-text ] ; then \
326 $$W2 "$$dd" textMode url ; \
328 if [ -f $$f/Contents/Resources/xscreensaver-getimage-file ] ; then \
329 $$W2 "$$dd" chooseRandomImages -bool true ; \
330 $$W2 "$$dd" grabDesktopImages -bool false ; \
331 $$W2 "$$dd" imageDirectory "$$img" ; \
333 if ( strings "$$f/Contents/MacOS/$$name" | \
334 grep NSOpenGLContext >/dev/null ) ; then \
335 $$W2 "$$dd" multiSample -bool true ; \
339 $$W1 delete "$$domain.Apple2" 2>&- ; \
340 $$W1 delete "$$domain.Phosphor" 2>&- ; \
341 $$W1 delete "$$domain.updater" 2>&- ; \
342 $$W1 write "$$domain.updater" SUScheduledCheckIntervalKey 86400; \
344 $$W2 "$$domain.BoxFit" grab -bool true ; \
345 $$W2 "$$domain.FlipFlop" textured -bool true ; \
346 $$W2 "$$domain.GLSlideshow" titles -bool true ; \
347 $$W2 "$$domain.Photopile" titles -bool true ; \
348 $$W2 "$$domain.SkyTentacles" mode cel ; \
349 $$W2 "$$domain.Sonar" ping \
350 '/etc/hosts,$$HOME/.ssh/known_hosts,$$HOME/.ssh/known_hosts2' ; \
351 $$W2 "$$domain.XMatrix" matrixFont small ; \
352 $$W2 "$$domain.XMatrix" textMode literal ; \
353 $$W2 "$$domain.XMatrix" textLiteral "MONKEY BUTTER" ; \