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) \
226 # These don't work well enough to turn on by default:
264 # Download and resize images from jwz.org.
265 # This saves us having to include 4MB of images in the tar file
266 # that will only be used by a vast minority of people building
268 # Android actually wants these to be 160x160 but our source is 200x150.
270 URL = https://www.jwz.org/xscreensaver/screenshots/
271 WGET = wget -q -U xscreensaver-build-android
272 CVT = -thumbnail '150x150^' -gravity center -extent 150x150 \
273 \( +clone -alpha extract \
274 -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
275 \( +clone -flip \) -compose Multiply -composite \
276 \( +clone -flop \) -compose Multiply -composite \
277 \) -alpha off -compose CopyOpacity -composite \
283 # If we are making the m6502 hack, create the header file for Android
285 @for h in $(ANDROID_HACKS) ; do \
286 if [ $${h} = "m6502" ] ; then \
287 echo "Making $${h} header ..."; \
288 ../hacks/m6502.sh ../hacks/m6502.h ../hacks/images/m6502/*.asm ; \
289 echo "Made $${h} header"; \
293 xscreensaver/res/drawable/%.png:
295 FILE1=`echo "$@" | sed 's!^.*/\([^/]*\)\.png$$!\1.jpg!'` ; \
297 FILE1=`echo "$$FILE1" | sed s/rdbomb/rd-bomb/` ; \
298 FILE2=`echo "$$FILE2" | sed s/rd-bomb/rdbomb/` ; \
299 URL="$(URL)$$FILE1" ; \
300 echo "converting $$URL..." ; \
302 $(WGET) -O- "$$URL" | \
303 convert jpg:- $(CVT) "$$FILE2" ; \
304 if [ ! -s "$$FILE2" ]; then \
305 echo "$$FILE2 failed" >&2 ; \
310 @for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \
311 $(MAKE) xscreensaver/res/drawable/$$f.png ; \
316 for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \
317 rm -f xscreensaver/res/drawable/$$f.png ; \
320 distclean:: clean_thumbs clean
323 EXTRA_TARFILES = xscreensaver/res/drawable/thumbnail.png \
326 @FILES=`find . $(EXTRA_TARFILES) \( \( \
330 -o -name '*.keystore' \
331 -o -name '*_dream.xml' \
332 -o -name '*_settings.xml' \
333 -o -name '*_wallpaper.xml' \
334 -o -name AndroidManifest.xml \
335 -o -name strings.xml \
336 -o -name settings.xml \
338 -o -name .gitignore \
346 -o \( \( -type f -o -type l \) \
353 cd ../hacks/images && $(MAKE)
356 ../hacks/check-configs.pl --build-android $(ANDROID_HACKS)
358 debug:: m6502.h run_check images_png_h
359 $(GRADLE) assembleDebug
360 release:: m6502.h run_check images_png_h
361 export APP_ABI=all ; \
362 $(GRADLE) assembleRelease
365 KEYSTORE = xscreensaver.jks
367 keytool -genkey -v -keystore $@ \
368 -alias xscreensaver -keyalg RSA -keysize 2048 -validity 10000
370 APK_DIR = xscreensaver/build/outputs/apk/
371 APK_UNSIGNED = $(APK_DIR)xscreensaver-release-unsigned.apk
372 APK_UNALIGNED = $(APK_DIR)xscreensaver-release-unaligned.apk
373 APK_SIGNED = $(APK_DIR)xscreensaver-release.apk
375 TOOLDIR = $(shell ls -d $$HOME/Library/Android/sdk/build-tools/* | tail -1)
376 ZIPALIGN = $(TOOLDIR)/zipalign
377 JARSIGNER = jarsigner
380 cp -p $(APK_UNSIGNED) $(APK_UNALIGNED)
381 $(JARSIGNER) -verbose -sigalg SHA1withRSA -digestalg SHA1 \
382 -keystore $(KEYSTORE) $(APK_UNALIGNED) xscreensaver
384 $(ZIPALIGN) -v 4 $(APK_UNALIGNED) $(APK_SIGNED)
385 rm -f $(APK_UNALIGNED)
386 $(JARSIGNER) -verify -verbose -certs $(APK_SIGNED)
387 @ls -lF $(APK_SIGNED)
391 VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' ../utils/version.h` ; \
392 HEAD="xscreensaver-$$VERS" ; \
393 if [ ! -s $(APK_SIGNED) -o $(APK_UNSIGNED) -nt $(APK_SIGNED) ]; then \
394 $(MAKE) sign_release ; \
397 cp -p $(APK_SIGNED) ../archive/$$HEAD.apk
400 ## #### Pare it down for faster debugging...
401 #export APP_ABI = armeabi-v7a
402 #export APP_ABI = x86
404 #export ANDROID_HACKS= \
405 # $(ANDROID_BASE_HACKS) \