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