1 # XScreenSaver for Android
4 GRADLE = cd project ; ./gradlew
14 # Set this to the set of platforms you want to compile for in debug mode.
15 # E.g., if you are running an x86 emulator, there's no point in compiling
16 # for a dozen other platforms. Release builds override this to "all".
25 # These hacks have interdependencies with others, so we can't build without
26 # including them or there are link errors:
36 # These are the ones that currently work, at least to some degree:
38 export ANDROID_HACKS= \
39 $(ANDROID_BASE_HACKS) \
177 # These don't work well enough to turn on by default:
253 # Download and resize images from jwz.org.
254 # This saves us having to include 4MB of images in the tar file
255 # that will only be used by a vast minority of people building
257 # Android actually wants these to be 160x160 but our source is 200x150.
259 URL = https://www.jwz.org/xscreensaver/screenshots/
260 WGET = wget -q -U xscreensaver-build-android
261 CVT = -thumbnail '150x150^' -gravity center -extent 150x150 \
262 \( +clone -alpha extract \
263 -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
264 \( +clone -flip \) -compose Multiply -composite \
265 \( +clone -flop \) -compose Multiply -composite \
266 \) -alpha off -compose CopyOpacity -composite \
273 project/xscreensaver/res/drawable/%.png:
275 FILE1=`echo "$@" | sed 's!^.*/\([^/]*\)\.png$$!\1.jpg!'` ; \
277 FILE1=`echo "$$FILE1" | sed s/rdbomb/rd-bomb/` ; \
278 FILE2=`echo "$$FILE2" | sed s/rd-bomb/rdbomb/` ; \
279 URL="$(URL)$$FILE1" ; \
280 echo "converting $$URL..." ; \
282 $(WGET) -O- "$$URL" | \
283 convert jpg:- $(CVT) "$$FILE2" ; \
284 if [ ! -s "$$FILE2" ]; then \
285 echo "$$FILE2 failed" >&2 ; \
290 @for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \
291 $(MAKE) project/xscreensaver/res/drawable/$$f.png ; \
296 for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \
297 rm -f project/xscreensaver/res/drawable/$$f.png ; \
299 distclean:: clean_thumbs
302 EXTRA_TARFILES = project/xscreensaver/res/drawable/thumbnail.png \
305 @FILES=`find . $(EXTRA_TARFILES) \( \( \
308 -o -name '*.keystore' \
309 -o -name '*_dream.xml' \
310 -o -name '*_settings.xml' \
311 -o -name AndroidManifest.xml \
312 -o -name strings.xml \
313 -o -name settings.xml \
315 -o -name .gitignore \
323 -o \( \( -type f -o -type l \) \
330 $(GRADLE) assembleDebug
332 export APP_ABI=all ; \
333 $(GRADLE) assembleRelease
336 KEYSTORE = xscreensaver.keystore
338 keytool -genkey -v -keystore $@ \
339 -alias xscreensaver -keyalg RSA -keysize 2048 -validity 10000
341 APK_DIR = project/xscreensaver/build/outputs/apk/
342 APK_UNSIGNED = $(APK_DIR)/xscreensaver-release-unsigned.apk
343 APK_UNALIGNED = $(APK_DIR)/xscreensaver-release-unaligned.apk
344 APK_SIGNED = $(APK_DIR)/xscreensaver-release.apk
346 TOOLDIR = $(shell echo $$HOME/Library/Android/sdk/build-tools/* | tail -1)
347 ZIPALIGN = $(TOOLDIR)/zipalign
348 JARSIGNER = jarsigner
351 cp -p $(APK_UNSIGNED) $(APK_UNALIGNED)
352 $(JARSIGNER) -verbose -sigalg SHA1withRSA -digestalg SHA1 \
353 -keystore $(KEYSTORE) $(APK_UNALIGNED) xscreensaver
355 $(ZIPALIGN) -v 4 $(APK_UNALIGNED) $(APK_SIGNED)
356 rm -f $(APK_UNALIGNED)
357 $(JARSIGNER) -verify -verbose -certs $(APK_SIGNED)
358 @ls -lF $(APK_SIGNED)
362 VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' ../utils/version.h` ; \
363 HEAD="xscreensaver-$$VERS" ; \
364 if [ ! -s $(APK_SIGNED) -o $(APK_UNSIGNED) -nt $(APK_SIGNED) ]; then \
365 $(MAKE) sign_release ; \
368 cp -p $(APK_SIGNED) ../archive/$$HEAD.apk
371 ## #### Pare it down for faster debugging...
372 #export APP_ABI = armeabi-v7a
373 #export APP_ABI = x86
375 #export ANDROID_HACKS= \
376 # $(ANDROID_BASE_HACKS) \