1 # XScreenSaver for Android
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) \
194 # These don't work well enough to turn on by default:
260 # Download and resize images from jwz.org.
261 # This saves us having to include 4MB of images in the tar file
262 # that will only be used by a vast minority of people building
264 # Android actually wants these to be 160x160 but our source is 200x150.
266 URL = https://www.jwz.org/xscreensaver/screenshots/
267 WGET = wget -q -U xscreensaver-build-android
268 CVT = -thumbnail '150x150^' -gravity center -extent 150x150 \
269 \( +clone -alpha extract \
270 -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
271 \( +clone -flip \) -compose Multiply -composite \
272 \( +clone -flop \) -compose Multiply -composite \
273 \) -alpha off -compose CopyOpacity -composite \
279 # If we are making the m6502 hack, create the header file for Android
281 @for h in $(ANDROID_HACKS) ; do \
282 if [ $${h} = "m6502" ] ; then \
283 echo "Making $${h} header ..."; \
284 ../hacks/m6502.sh ../hacks/m6502.h ../hacks/images/m6502/*.asm ; \
285 echo "Made $${h} header"; \
289 xscreensaver/res/drawable/%.png:
291 FILE1=`echo "$@" | sed 's!^.*/\([^/]*\)\.png$$!\1.jpg!'` ; \
293 FILE1=`echo "$$FILE1" | sed s/rdbomb/rd-bomb/` ; \
294 FILE2=`echo "$$FILE2" | sed s/rd-bomb/rdbomb/` ; \
295 URL="$(URL)$$FILE1" ; \
296 echo "converting $$URL..." ; \
298 $(WGET) -O- "$$URL" | \
299 convert jpg:- $(CVT) "$$FILE2" ; \
300 if [ ! -s "$$FILE2" ]; then \
301 echo "$$FILE2 failed" >&2 ; \
306 @for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \
307 $(MAKE) xscreensaver/res/drawable/$$f.png ; \
312 for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \
313 rm -f xscreensaver/res/drawable/$$f.png ; \
316 distclean:: clean_thumbs clean
319 EXTRA_TARFILES = xscreensaver/res/drawable/thumbnail.png \
322 @FILES=`find . $(EXTRA_TARFILES) \( \( \
325 -o -name '*.keystore' \
326 -o -name '*_dream.xml' \
327 -o -name '*_settings.xml' \
328 -o -name '*_wallpaper.xml' \
329 -o -name AndroidManifest.xml \
330 -o -name strings.xml \
331 -o -name settings.xml \
333 -o -name .gitignore \
341 -o \( \( -type f -o -type l \) \
348 ../hacks/check-configs.pl --build-android $(ANDROID_HACKS)
350 debug:: m6502.h run_check
351 $(GRADLE) assembleDebug
352 release:: m6502.h run_check
353 export APP_ABI=all ; \
354 $(GRADLE) assembleRelease
357 KEYSTORE = xscreensaver.keystore
359 keytool -genkey -v -keystore $@ \
360 -alias xscreensaver -keyalg RSA -keysize 2048 -validity 10000
362 APK_DIR = xscreensaver/build/outputs/apk/
363 APK_UNSIGNED = $(APK_DIR)/xscreensaver-release-unsigned.apk
364 APK_UNALIGNED = $(APK_DIR)/xscreensaver-release-unaligned.apk
365 APK_SIGNED = $(APK_DIR)/xscreensaver-release.apk
367 TOOLDIR = $(shell echo $$HOME/Library/Android/sdk/build-tools/* | tail -1)
368 ZIPALIGN = $(TOOLDIR)/zipalign
369 JARSIGNER = jarsigner
372 cp -p $(APK_UNSIGNED) $(APK_UNALIGNED)
373 $(JARSIGNER) -verbose -sigalg SHA1withRSA -digestalg SHA1 \
374 -keystore $(KEYSTORE) $(APK_UNALIGNED) xscreensaver
376 $(ZIPALIGN) -v 4 $(APK_UNALIGNED) $(APK_SIGNED)
377 rm -f $(APK_UNALIGNED)
378 $(JARSIGNER) -verify -verbose -certs $(APK_SIGNED)
379 @ls -lF $(APK_SIGNED)
383 VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' ../utils/version.h` ; \
384 HEAD="xscreensaver-$$VERS" ; \
385 if [ ! -s $(APK_SIGNED) -o $(APK_UNSIGNED) -nt $(APK_SIGNED) ]; then \
386 $(MAKE) sign_release ; \
389 cp -p $(APK_SIGNED) ../archive/$$HEAD.apk
392 ## #### Pare it down for faster debugging...
393 #export APP_ABI = armeabi-v7a
394 #export APP_ABI = x86
396 #export ANDROID_HACKS= \
397 # $(ANDROID_BASE_HACKS) \