X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=OSX%2FMakefile;h=d8664552cbc383e4acc0a6c53de53240bbc6844e;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=545f45eea8572228b1b98c1b567d8f11e5581029;hpb=2762a7d7cf8d83e68b8f635941f6609119d630ae;p=xscreensaver diff --git a/OSX/Makefile b/OSX/Makefile index 545f45ee..d8664552 100644 --- a/OSX/Makefile +++ b/OSX/Makefile @@ -1,42 +1,108 @@ -# XScreenSaver for MacOS X, Copyright (c) 2006-2013 by Jamie Zawinski. +# XScreenSaver for MacOS X, Copyright (c) 2006-2015 by Jamie Zawinski. -XCODEBUILD = /usr/bin/xcodebuild -TARGETS = -target "All Savers" -ARCH = -arch i386 -arch x86_64 +XCODE_APP = /Applications/Xcode.app + +# To build savers that will run on MacOS 10.6 and 10.7, Xcode 5.0.2 must +# be used (as that's the latest version of Xcode that ships with a version +# of clang that implements "-fobjc-gc"). However, Xcode 5.0.2 will not +# launch on MacOS 10.11 or later. +# +# XCODE_APP = /Applications/Xcode-5.0.2.app + +TARGETS = All Savers +ARCH = -arch i386 -arch x86_64 ONLY_ACTIVE_ARCH=NO CERT = 'Jamie Zawinski' CERT = 'iPhone Developer: Jamie Zawinski (Y5M82TL69N)' -THUMBDIR = $(HOME)/www/xscreensaver/screenshots/ PKGID = org.jwz.xscreensaver +THUMBDIR = build/screenshots +XCODEBUILD = $(XCODE_APP)/Contents/Developer/usr/bin/xcodebuild +SETFILE = $(XCODE_APP)/Contents/Developer/Tools/SetFile +SETICON = ./seticon.pl default: release all: debug release clean: -rm -rf build -# cd ..; $(XCODEBUILD) $(TARGETS) clean +# $(XCODEBUILD) -target "$(TARGETS)" clean distclean: -rm -f config.status config.cache config.log \ *.bak *.rej TAGS *~ "#"* -rm -rf autom4te*.cache - -rm -rf build + -rm -rf build Sparkle.framework +distdepend:: Sparkle.framework distdepend:: update_plist_version debug: distdepend - cd ..; $(XCODEBUILD) $(ARCH) $(TARGETS) -configuration Debug build + $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Debug build release:: distdepend - cd ..; $(XCODEBUILD) $(ARCH) $(TARGETS) -configuration Release build + $(XCODEBUILD) $(ARCH) -target "$(TARGETS)" -configuration Release build release:: check_versions -release:: update_thumbs release:: sign +Sparkle.framework: + unzip ../archive/Sparkle.framework-2013-12-04.zip + +# Download and resize images from jwz.org. +# This saves us having to include 4MB of images in the tar file +# that will only be used by a vast minority of people building +# from source. +# update-info-plist.pl runs this as needed. +# Might be better to do this with curl, since that is installed by default. + +URL = https://www.jwz.org/xscreensaver/screenshots/ +WGET = wget -q -U xscreensaver-build-osx +CVT = -thumbnail '200x150^' -gravity center -extent 200x150 \ + \( +clone -alpha extract \ + -draw 'fill black polygon 0,0 0,6 6,0 fill white circle 6,6 6,0' \ + \( +clone -flip \) -compose Multiply -composite \ + \( +clone -flop \) -compose Multiply -composite \ + \) -alpha off -compose CopyOpacity -composite \ + -colorspace sRGB \ + -strip \ + -quality 95 \ + +dither -colors 128 + +$(THUMBDIR)/%.png: + @\ + FILE1=`echo "$@" | sed 's!^.*/\([^/]*\)\.png$$!\1.jpg!'` ; \ + FILE2="$@" ; \ + TMP="$$FILE2".tmp ; \ + URL="$(URL)$$FILE1" ; \ + URL2="$(URL)retired/$$FILE1" ; \ + if [ ! -d $(THUMBDIR) ]; then mkdir -p $(THUMBDIR) ; fi ; \ + rm -f "$$FILE2" "$$TMP" ; \ + set +e ; \ + echo "downloading $$URL..." ; \ + $(WGET) -O"$$TMP" "$$URL" ; \ + if [ ! -s "$$TMP" ]; then \ + echo "downloading $$URL2..." ; \ + $(WGET) -O"$$TMP" "$$URL2" ; \ + fi ; \ + if [ ! -s "$$TMP" ]; then \ + rm -f "$$TMP" ; \ + echo "failed: $$URL" ; \ + exit 1 ; \ + fi ; \ + rm -f "$$FILE2" ; \ + convert jpg:- $(CVT) "$$FILE2" < "$$TMP" ; \ + if [ ! -s "$$FILE2" ]; then \ + echo "$$FILE2 failed" >&2 ; \ + rm -f "$$FILE2" "$$TMP" ; \ + exit 1 ; \ + else \ + rm -f "$$TMP" ; \ + fi + + sign: @for f in build/Release/*.app/Contents/*/*.saver \ build/Release/*.{saver,app} ; do \ - codesign -vfs $(CERT) $$f ; \ + codesign --deep -vfs $(CERT) $$f ; \ done check_versions: @@ -60,8 +126,62 @@ check_versions: if [ "$$RESULT" = 0 ]; then echo "Versions match ($$V2)" ; fi ; \ exit $$RESULT -update_thumbs:: - ./update-thumbnail.pl $(THUMBDIR) build/Release/*.saver + +check_gc: + @\ + DIR="build/Release" ; \ + RESULT=0 ; \ + for S in "$$DIR/"*.saver ; do \ + SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/.saver$$//'` ; \ + D="$$S/Contents/MacOS/$$SS" ; \ + V=`otool -s __DATA __objc_imageinfo "$$D" \ + | grep ' 00 02 00 '` ; \ + if [ -z "$$V" ]; then \ + echo "$$S does not have GC enabled" ; \ + RESULT=1 ; \ + fi ; \ + done ; \ + \ + for D in "$$DIR"/webcollage-helper \ + "$$DIR"/*.saver/Contents/*/webcollage-helper \ + "$$DIR"/*.app/Contents/*/XScreenSaverUpdater \ + ; do \ + V=`otool -s __DATA __objc_imageinfo "$$D" \ + | grep ' 00 02 00 '` ; \ + if [ ! -z "$$V" ]; then \ + echo "$$D has GC enabled" ; \ + RESULT=1 ; \ + fi ; \ + done ; \ + \ + if [ "$$RESULT" = 0 ]; then echo "GC enabled" ; fi ; \ + exit $$RESULT + + +check_coretext: + @\ + DIR="build/Release" ; \ + RESULT=0 ; \ + for S in "$$DIR/"*.{saver,app} ; do \ + SS=`echo "$$S" | sed -e 's@^.*/@@' -e 's/[.][a-z]*$$//'` ; \ + D="$$S/Contents/MacOS/$$SS" ; \ + FF=`otool -l "$$D" \ + | fgrep '/CoreText.framework/' \ + | sed -n 's/^ *name \([^ ]*\).*$$/\1/p'` ; \ + if [ -z "$$FF" ] ; then \ + echo "$$S not linked with CoreText" >/dev/null ; \ + else \ + OK=`echo "$$FF" | fgrep -v '/ApplicationServices.framework/'` ; \ + if [ ! -z "$$OK" ]; then \ + echo "$$S is linked with the wrong CoreText: $$FF" ; \ + RESULT=1 ; \ + else \ + echo "$$S linked right: $$FF" >/dev/null ; \ + fi ; \ + fi ; \ + done ; \ + if [ "$$RESULT" = 0 ]; then echo "CoreText linked correctly" ; fi ; \ + exit $$RESULT # Arrrrgh @@ -70,12 +190,14 @@ ios-function-table.m:: echo_tarfiles: - @echo `find . \ - \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \ - -o -name 'jwz.*' \) \ - -prune \) \ - -o -type f -print \ - | sed 's@^\./@@' \ + @echo `( find . \ + \( \( -name '.??*' -o -name build -o -name CVS -o -name '*~*' \ + -o -name 'jwz.*' -o -name 'Screen Savers' \ + -o -name xscreensaver.xcodeproj \) \ + -prune \) \ + -o \( -type f -o -type l \) -print ; \ + echo xscreensaver.xcodeproj/project.pbxproj ) \ + | sed 's@^\./@@' \ | sort` update_plist_version: @@ -83,7 +205,7 @@ update_plist_version: SRC=../utils/version.h ; \ V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' $$SRC` ; \ T=/tmp/xs.$$$$ ; \ - for S in XScreenSaver.plist SaverRunner.plist iSaverRunner.plist ; do \ + for S in *.plist ; do \ /bin/echo -n "Updating version number in $$S to \"$$V\"... " ; \ KEYS="CFBundleVersion|CFBundleShortVersionString|CFBundleLongVersionString|CFBundleGetInfoString|NSHumanReadableCopyright" ; \ perl -0777 -pne \ @@ -99,6 +221,33 @@ update_plist_version: rm $$T +updates.xml:: + ./updates.pl xscreensaver ../README ../archive ~/www/xscreensaver + @$(MAKE) test_sig + +test_sig:: + @ \ + U=../utils/version.h ; \ + V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ;]*\).*/\1/p' < $$U` ; \ + BASE="xscreensaver-$$V" ; \ + OUTDIR="../archive" ; \ + DMG="$$OUTDIR/$$BASE.dmg" ; \ + SIG=`sed -n 's/^.*dsaSignature="\(.*\)".*/\1/p' updates.xml` ; \ + PUB="sparkle_dsa_pub.pem" ; \ + NN="t.$$$$" ; \ + SIGB=/tmp/$$NN.sig ; \ + HASH=/tmp/$$NN.hash ; \ + rm -f "$$SIGB" "$$HASH" ; \ + echo "$$SIG " | base64 -D > "$$SIGB" ; \ + set -e ; \ + for OPENSSL in /usr/bin/openssl /opt/local/bin/openssl ; do \ + $$OPENSSL dgst -sha1 -binary < "$$DMG" > "$$HASH" ; \ + /bin/echo -n "$$OPENSSL `$$OPENSSL version`: " ; \ + $$OPENSSL dgst -dss1 -verify "$$PUB" -signature "$$SIGB" "$$HASH" ; \ + done ; \ + rm -f "$$SIGB" "$$HASH" ; \ + + build/Release/installer.pkg: installer.rtf installer.xml installer.sh installer.png ../utils/version.h @\ set -e ; \ @@ -134,7 +283,11 @@ build/Release/installer.pkg: installer.rtf installer.xml installer.sh installer. # -format UDBZ saves 4% (~1.2 MB) over UDZO. -dmg:: distdepend check_versions build/Release/installer.pkg +dmg:: distdepend +dmg:: check_versions check_coretext +#dmg:: check_gc +dmg:: build/Release/installer.pkg +dmg:: @ \ set -e ; \ SRC=../utils/version.h ; \ @@ -165,30 +318,39 @@ dmg:: distdepend check_versions build/Release/installer.pkg echo savertester` ; \ \ for f in $$SRC/*.{saver,app} $$EXTRAS ; do \ + f2=`basename "$$f"` ; \ ok=yes ; \ ff=`echo $$f | perl -e '$$_=<>; s@^.*/(.*)\..*$$@\L$$1@; print'`; \ for r in $$retired ; do \ if [ "$$ff" = "$$r" ]; then ok=no ; fi ; \ done ; \ - if [ "$$ok" = yes ]; then \ - echo + cp -pr "$$f" "$$DST/" ; \ - cp -pr "$$f" "$$DST/" ; \ + if [ "$$ff" = testx11 ]; then ok=no ; fi ; \ + if [ "$$f2" = "XScreenSaverUpdater.app" ]; then \ + DST_HACK="XScreenSaver.updater" ; \ + echo + tar ... "$$DST/$$DST_HACK" ; \ + ( cd $$SRC ; tar -czf - "$$f2" ) > "$$DST/$$DST_HACK" ; \ + elif [ "$$ok" = yes ]; then \ + echo + cp -pR "$$f" "$$DST/" ; \ + cp -pR "$$f" "$$DST/" ; \ else \ echo skipping "$$f" ; \ fi ; \ done ; \ + \ set -x ; \ cp -p bindist.rtf "$$STAGE/Read Me.rtf" ; \ cp -p build/Release/installer.pkg "$$PKG" ; \ cp -p bindist-DS_Store "$$STAGE/.DS_Store" ; \ - cp -p bindist.webloc "$$STAGE/Get the iPhone:iPad Version.webloc" ; \ + cp -p bindist.webloc "$$STAGE/" ; \ cp -p XScreenSaverDMG.icns "$$STAGE/.VolumeIcon.icns" ; \ - /Developer/Tools/SetFile -a C "$$STAGE" ; \ - /Developer/Tools/SetFile -a E "$$STAGE"/*.{rtf,pkg,webloc} ; \ - seticon -d ../../xdaliclock/OSX/daliclockSaver.icns "$$DST/DaliClock.saver";\ - seticon -d XScreenSaverFolder.icns "$$DST" ; \ - seticon -d XScreenSaverWebloc.icns "$$STAGE"/*.webloc ; \ - seticon -d XScreenSaverPkg.icns "$$STAGE"/*.pkg ; \ + ${SETFILE} -a C "$$STAGE" ; \ + ${SETFILE} -a E "$$STAGE"/*.{rtf,pkg,webloc} ; \ + $(SETICON) -d ../../xdaliclock/OSX/daliclockSaver.icns \ + "$$DST/DaliClock.saver" ; \ + $(SETICON) -d XScreenSaverFolder.icns "$$DST" ; \ + $(SETICON) -d XScreenSaverWebloc.icns "$$STAGE"/*.webloc ; \ + $(SETICON) -d XScreenSaverPkg.icns "$$STAGE"/*.pkg ; \ + mv "$$STAGE/bindist.webloc" "$$STAGE/Get the iPhone:iPad Version.webloc" ; \ hdiutil makehybrid -quiet -ov -hfs -hfs-volume-name "$$VOLNAME" \ -hfs-openfolder "$$STAGE" "$$STAGE" -o "$$TMPDMG" ; \ rm -rf "$$STAGE" ; \ @@ -197,3 +359,67 @@ dmg:: distdepend check_versions build/Release/installer.pkg xattr -w com.apple.quarantine "0000;00000000;;" "$$DMG" ; \ rm -f "$$TMPDMG" ; \ ls -ldhgF "$$DMG" + + +# When debugging, sometimes I have to reset the preferences for all +# the savers. Also I like FPS to be turned on, and them all to be +# pointed at the same image directory. +# +show_prefs:: + @cd build/Debug ; \ + for f in *.saver ; do \ + f=`echo "$$f" | sed 's/\..*//'` ; \ + echo "########################## $$f" ; \ + defaults -currentHost read org.jwz.xscreensaver."$$f" 2>&- ; \ + done ; \ + for f in Apple2 Phosphor updater ; do \ + echo "########################## $$f" ; \ + defaults read org.jwz.xscreensaver."$$f" 2>&- ; \ + done + +reset_prefs:: + @cd build/Debug ; \ + W1='defaults' ; \ + W2="$$W1 -currentHost write" ; \ + img='~/Pictures/Screensaver' ; \ + for f in *.saver ; do \ + name=`echo "$$f" | sed 's/\..*//'` ; \ + echo "########################## $$name" ; \ + domain="org.jwz.xscreensaver" ; \ + dd="$$domain.$$name" ; \ + $$W1 -currentHost delete "$$dd" 2>&- ; \ + $$W2 "$$dd" doFPS -bool true ; \ + if [ -f $$f/Contents/Resources/xscreensaver-text ] ; then \ + $$W2 "$$dd" textMode url ; \ + fi ; \ + if [ -f $$f/Contents/Resources/xscreensaver-getimage-file ] ; then \ + $$W2 "$$dd" chooseRandomImages -bool true ; \ + $$W2 "$$dd" grabDesktopImages -bool false ; \ + $$W2 "$$dd" imageDirectory "$$img" ; \ + fi ; \ + if ( strings "$$f/Contents/MacOS/$$name" | \ + grep NSOpenGLContext >/dev/null ) ; then \ + $$W2 "$$dd" multiSample -bool true ; \ + fi ; \ + done ; \ + \ + $$W1 delete "$$domain.Apple2" 2>&- ; \ + $$W1 delete "$$domain.Phosphor" 2>&- ; \ + $$W1 delete "$$domain.updater" 2>&- ; \ + $$W1 write "$$domain.updater" SUScheduledCheckIntervalKey 86400; \ + \ + $$W2 "$$domain.BoxFit" grab -bool true ; \ + $$W2 "$$domain.FlipFlop" textured -bool true ; \ + $$W2 "$$domain.GLSlideshow" titles -bool true ; \ + $$W2 "$$domain.Photopile" titles -bool true ; \ + $$W2 "$$domain.SkyTentacles" mode cel ; \ + $$W2 "$$domain.Sonar" ping \ + '/etc/hosts,$$HOME/.ssh/known_hosts,$$HOME/.ssh/known_hosts2' ; \ + $$W2 "$$domain.XMatrix" matrixFont small ; \ + $$W2 "$$domain.XMatrix" textMode literal ; \ + $$W2 "$$domain.XMatrix" textLiteral "MONKEY BUTTER" ; \ + +# defaults -currentHost write org.jwz.xscreensaver.FontGlide debugMetrics -bool true +# defaults -currentHost write org.jwz.xscreensaver.StarWars debug -bool true +# defaults -currentHost write org.jwz.xscreensaver.StarWars textMode file +# defaults -currentHost write org.jwz.xscreensaver.StarWars textFile ~/src/xscreensaver/hacks/glx/zalgo.txt