1 # XScreenSaver for MacOS X, Copyright (c) 2006-2013 by Jamie Zawinski.
3 XCODEBUILD = /usr/bin/xcodebuild
4 TARGETS = -target "All Savers"
5 ARCH = -arch i386 -arch x86_64
6 CERT = 'Jamie Zawinski'
7 CERT = 'iPhone Developer: Jamie Zawinski (Y5M82TL69N)'
8 THUMBDIR = $(HOME)/www/xscreensaver/screenshots/
9 PKGID = org.jwz.xscreensaver
10 SETFILE = /Applications/Xcode.app/Contents/Developer/Tools/SetFile
11 SETICON = /usr/local/bin/seticon
18 # cd ..; $(XCODEBUILD) $(TARGETS) clean
21 -rm -f config.status config.cache config.log \
22 *.bak *.rej TAGS *~ "#"*
23 -rm -rf autom4te*.cache
24 -rm -rf build Sparkle.framework
26 distdepend:: Sparkle.framework
27 distdepend:: update_plist_version
30 cd ..; $(XCODEBUILD) $(ARCH) $(TARGETS) -configuration Debug build
33 cd ..; $(XCODEBUILD) $(ARCH) $(TARGETS) -configuration Release build
35 release:: check_versions
36 release:: update_thumbs
40 unzip ../archive/Sparkle.framework-2013-12-04.zip
43 @for f in build/Release/*.app/Contents/*/*.saver \
44 build/Release/*.{saver,app} ; do \
45 codesign --deep -vfs $(CERT) $$f ; \
50 SRC=../utils/version.h ; \
51 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
54 for S in $$DIR/*.{saver,app} ; do \
55 for P in $$S/Contents/Info.plist ; do \
56 V2=`plutil -convert xml1 -o - "$$P" | \
58 'm@<key>CFBundleVersion</key>\s*<string>(.*?)</string>@si \
60 if [ "$$V2" != "$$V" ] ; then \
61 echo "Wrong version: $$S ($$V2)" ; \
66 if [ "$$RESULT" = 0 ]; then echo "Versions match ($$V2)" ; fi ; \
70 ./update-thumbnail.pl $(THUMBDIR) build/Release/*.saver
74 ios-function-table.m::
75 @./build-fntable.pl build/Debug-iphonesimulator/XScreenSaver.app $@
80 \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \
81 -o -name 'jwz.*' -o -name 'Screen Savers' \) \
83 -o \( -type f -o -type l \) -print \
89 SRC=../utils/version.h ; \
90 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
92 for S in *.plist ; do \
93 /bin/echo -n "Updating version number in $$S to \"$$V\"... " ; \
94 KEYS="CFBundleVersion|CFBundleShortVersionString|CFBundleLongVersionString|CFBundleGetInfoString|NSHumanReadableCopyright" ; \
96 "s@(<key>($$KEYS)</key>\s*<string>)[^<>]+(</string>)@\$${1}$$V\$${3}@g" \
98 if cmp -s $$S $$T ; then \
109 ./updates.pl xscreensaver ../README ../archive ~/www/xscreensaver
114 U=../utils/version.h ; \
115 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ;]*\).*/\1/p' < $$U` ; \
116 BASE="xscreensaver-$$V" ; \
117 OUTDIR="../archive" ; \
118 DMG="$$OUTDIR/$$BASE.dmg" ; \
119 SIG=`sed -n 's/^.*dsaSignature="\(.*\)".*/\1/p' updates.xml` ; \
120 PUB="sparkle_dsa_pub.pem" ; \
122 SIGB=/tmp/$$NN.sig ; \
123 HASH=/tmp/$$NN.hash ; \
124 rm -f "$$SIGB" "$$HASH" ; \
125 echo "$$SIG " | base64 -D > "$$SIGB" ; \
127 for OPENSSL in /usr/bin/openssl /opt/local/bin/openssl ; do \
128 $$OPENSSL dgst -sha1 -binary < "$$DMG" > "$$HASH" ; \
129 /bin/echo -n "$$OPENSSL `$$OPENSSL version`: " ; \
130 $$OPENSSL dgst -dss1 -verify "$$PUB" -signature "$$SIGB" "$$HASH" ; \
132 rm -f "$$SIGB" "$$HASH" ; \
135 build/Release/installer.pkg: installer.rtf installer.xml installer.sh installer.png ../utils/version.h
138 SRC=../utils/version.h ; \
139 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
141 DIST="installer.xml" ; \
142 STAGE="build/Release/pkg_stage" ; \
144 PKG2="$$STAGE/contents.pkg" ; \
145 SCRIPTS="$$STAGE/scripts" ; \
146 RES="$$STAGE/resources" ; \
150 mkdir -p "$$SCRIPTS" "$$RES" ; \
152 cp -p installer.sh "$$SCRIPTS/preinstall" ; \
153 cp -p installer.png "$$RES/background.png" ; \
154 cp -p installer.rtf "$$RES/welcome.rtf" ; \
156 pkgbuild --identifier "$(PKGID)" --version "$$V" \
157 --scripts "$$SCRIPTS" --nopayload "$$PKG2" ; \
158 codesign -vfs $(CERT) "$$PKG2" ; \
159 codesign -vd "$$PKG2" ; \
161 productbuild --distribution "$$DIST" --resources "$$RES" \
162 --package-path "$$STAGE" --version "$$V" "$$PKG1" ; \
163 codesign -vfs $(CERT) "$$PKG1" ; \
164 codesign -vd "$$PKG1" ; \
169 # -format UDBZ saves 4% (~1.2 MB) over UDZO.
170 dmg:: distdepend check_versions build/Release/installer.pkg
173 SRC=../utils/version.h ; \
174 V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \
176 SRC="build/Release" ; \
177 EXTRAS=../../xdaliclock/OSX/build/Release/*.saver ; \
178 BASE="xscreensaver-$$V" ; \
179 OUTDIR="../archive" ; \
180 DMG="$$OUTDIR/$$BASE.dmg" ; \
181 TMPDMG="$$TMPDIR/tmp.dmg" ; \
182 VOLNAME="XScreenSaver $$V" ; \
183 STAGE="$$TMPDIR/dmg_stage" ; \
184 DST="$$STAGE/Screen Savers" ; \
185 PKG="$$STAGE/Install Everything.pkg" ; \
188 echo + mkdir -p "$$DST" ; \
191 retired=`perl -0 -ne \
192 's/\\\\\\n//g; m/^RETIRED_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
193 ../hacks/Makefile.in ; \
195 's/\\\\\\n//g; m/^RETIRED_GL_EXES\s*=\s*(.*)$$/m && print "$$1\n"' \
196 ../hacks/glx/Makefile.in ; \
197 echo xscreensaver ; \
198 echo savertester` ; \
200 for f in $$SRC/*.{saver,app} $$EXTRAS ; do \
202 ff=`echo $$f | perl -e '$$_=<>; s@^.*/(.*)\..*$$@\L$$1@; print'`; \
203 for r in $$retired ; do \
204 if [ "$$ff" = "$$r" ]; then ok=no ; fi ; \
206 if [ "$$ok" = yes ]; then \
207 echo + cp -pR "$$f" "$$DST/" ; \
208 cp -pR "$$f" "$$DST/" ; \
210 echo skipping "$$f" ; \
214 cp -p bindist.rtf "$$STAGE/Read Me.rtf" ; \
215 cp -p build/Release/installer.pkg "$$PKG" ; \
216 cp -p bindist-DS_Store "$$STAGE/.DS_Store" ; \
217 cp -p bindist.webloc "$$STAGE/Get the iPhone:iPad Version.webloc" ; \
218 cp -p XScreenSaverDMG.icns "$$STAGE/.VolumeIcon.icns" ; \
219 ${SETFILE} -a C "$$STAGE" ; \
220 ${SETFILE} -a E "$$STAGE"/*.{rtf,pkg,webloc} ; \
221 $(SETICON) -d ../../xdaliclock/OSX/daliclockSaver.icns \
222 "$$DST/DaliClock.saver" ; \
223 $(SETICON) -d XScreenSaverFolder.icns "$$DST" ; \
224 $(SETICON) -d XScreenSaverWebloc.icns "$$STAGE"/*.webloc ; \
225 $(SETICON) -d XScreenSaverPkg.icns "$$STAGE"/*.pkg ; \
226 hdiutil makehybrid -quiet -ov -hfs -hfs-volume-name "$$VOLNAME" \
227 -hfs-openfolder "$$STAGE" "$$STAGE" -o "$$TMPDMG" ; \
229 hdiutil convert -quiet -ov -format UDBZ -imagekey zlib-level=9 \
230 "$$TMPDMG" -o "$$DMG" ; \
231 xattr -w com.apple.quarantine "0000;00000000;;" "$$DMG" ; \