1# XScreenSaver for Android 2 3export TERM=dumb 4GRADLE = ./gradlew 5 6default:: debug 7all:: release 8 9# Your sdk.dir and ndk.dir might go in here; gradle wants the file to exist. 10local.properties: 11 touch local.properties 12 13clean:: local.properties 14 @\ 15 if [ "x" == x"$$JAVA_HOME" ] && ! ( which java >&- 2>&- ) ; then \ 16 echo "android: not cleaning: no java" >&2 ; \ 17 else \ 18 echo $(GRADLE) clean ; \ 19 $(GRADLE) clean ; \ 20 fi 21 22 23distdepend:: local.properties 24 25# Set this to the set of platforms you want to compile for in debug mode. 26# E.g., if you are running an x86 emulator, there's no point in compiling 27# for a dozen other platforms. Release builds override this to "all". 28# 29export APP_ABI = all 30 31 32# TODO: 33# check_versions: 34 35 36# These hacks have interdependencies with others, so we can't build without 37# including them or there are link errors: 38# 39ANDROID_BASE_HACKS= \ 40 apple2 \ 41 bubble3d \ 42 pacman \ 43 polyhedra \ 44 sonar \ 45 sproingies \ 46 47# These are the ones that currently work, at least to some degree: 48# 49export ANDROID_HACKS= \ 50 $(ANDROID_BASE_HACKS) \ 51 abstractile \ 52 anemone \ 53 anemotaxis \ 54 antmaze \ 55 antspotlight \ 56 apollonian \ 57 atlantis \ 58 attraction \ 59 atunnel \ 60 binaryring \ 61 blaster \ 62 blinkbox \ 63 blitspin \ 64 blocktube \ 65 boing \ 66 bouboule \ 67 bouncingcow \ 68 boxed \ 69 boxfit \ 70 braid \ 71 bsod \ 72 bumps \ 73 cage \ 74 ccurve \ 75 celtic \ 76 circuit \ 77 cityflow \ 78 cloudlife \ 79 companioncube \ 80 compass \ 81 coral \ 82 crackberg \ 83 crumbler \ 84 crystal \ 85 cube21 \ 86 cubenetic \ 87 cubestack \ 88 cubestorm \ 89 cubetwist \ 90 cubicgrid \ 91 cwaves \ 92 cynosure \ 93 dangerball \ 94 decayscreen \ 95 deco \ 96 deepstars \ 97 deluxe \ 98 demon \ 99 discoball \ 100 discrete \ 101 distort \ 102 dnalogo \ 103 drift \ 104 dymaxionmap \ 105 endgame \ 106 energystream \ 107 engine \ 108 epicycle \ 109 eruption \ 110 esper \ 111 etruscanvenus \ 112 euler2d \ 113 fadeplot \ 114 fiberlamp \ 115 filmleader \ 116 fireworkx \ 117 flame \ 118 flipflop \ 119 flipscreen3d \ 120 flow \ 121 fluidballs \ 122 flyingtoasters \ 123 fuzzyflakes \ 124 galaxy \ 125 gears \ 126 geodesic \ 127 geodesicgears \ 128 gflux \ 129 gibson \ 130 glblur \ 131 glcells \ 132 gleidescope \ 133 glhanoi \ 134 glknots \ 135 glmatrix \ 136 glplanet \ 137 glschool \ 138 glslideshow \ 139 glsnake \ 140 gltext \ 141 goop \ 142 grav \ 143 gravitywell \ 144 greynetic \ 145 halftone \ 146 halo \ 147 handsy \ 148 helix \ 149 hexadrop \ 150 hexstrut \ 151 hilbert \ 152 hopalong \ 153 hypertorus \ 154 hypnowheel \ 155 ifs \ 156 imsmap \ 157 interaggregate \ 158 interference \ 159 intermomentary \ 160 jigglypuff \ 161 jigsaw \ 162 julia \ 163 kaleidescope \ 164 kaleidocycle \ 165 klein \ 166 kumppa \ 167 lament \ 168 lavalite \ 169 loop \ 170 m6502 \ 171 maze \ 172 maze3d \ 173 memscroller \ 174 menger \ 175 metaballs \ 176 mirrorblob \ 177 moebius \ 178 moebiusgears \ 179 moire \ 180 moire2 \ 181 morph3d \ 182 mountain \ 183 munch \ 184 nerverot \ 185 noof \ 186 noseguy \ 187 peepers \ 188 penetrate \ 189 penrose \ 190 petri \ 191 piecewise \ 192 pinion \ 193 pipes \ 194 polytopes \ 195 pong \ 196 popsquares \ 197 projectiveplane \ 198 providence \ 199 pulsar \ 200 pyro \ 201 quasicrystal \ 202 queens \ 203 raverhoop \ 204 razzledazzle \ 205 rd-bomb \ 206 ripples \ 207 rocks \ 208 romanboy \ 209 rorschach \ 210 rotzoomer \ 211 rubik \ 212 rubikblocks \ 213 sballs \ 214 scooter \ 215 shadebobs \ 216 sierpinski \ 217 sierpinski3d \ 218 skytentacles \ 219 slidescreen \ 220 slip \ 221 spheremonics \ 222 splitflap \ 223 splodesic \ 224 spotlight \ 225 squiral \ 226 stairs \ 227 stonerview \ 228 strange \ 229 substrate \ 230 superquadrics \ 231 surfaces \ 232 swirl \ 233 tangram \ 234 tessellimage \ 235 thornbird \ 236 timetunnel \ 237 topblock \ 238 triangle \ 239 tronbit \ 240 truchet \ 241 twang \ 242 unknownpleasures \ 243 vermiculate \ 244 vfeedback \ 245 vigilance \ 246 voronoi \ 247 wander \ 248 whirlwindwarp \ 249 winduprobot \ 250 wormhole \ 251 xanalogtv \ 252 xflame \ 253 xjack \ 254 xlyap \ 255 xmatrix \ 256 xrayswarm \ 257 xspirograph \ 258 zoom \ 259 260 261# These don't work well enough to turn on by default: 262# 263ANDROID_TODO= \ 264 antinspect \ 265 barcode \ 266 carousel \ 267 fliptext \ 268 fontglide \ 269 juggler3d \ 270 molecule \ 271 pedal \ 272 phosphor \ 273 photopile \ 274 polyominoes \ 275 qix \ 276 speedmine \ 277 starfish \ 278 starwars \ 279 testx11 \ 280 unicrud \ 281 282 283# Download and resize images from jwz.org. 284# This saves us having to include 4MB of images in the tar file 285# that will only be used by a vast minority of people building 286# from source. 287# Android actually wants these to be 160x160 but our source is 200x150. 288 289URL = https://www.jwz.org/xscreensaver/screenshots/ 290WGET = wget -q -U xscreensaver-build-android 291CVT = -thumbnail '150x150^' -gravity center -extent 150x150 \ 292 \( +clone -alpha extract \ 293 -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \ 294 \( +clone -flip \) -compose Multiply -composite \ 295 \( +clone -flop \) -compose Multiply -composite \ 296 \) -alpha off -compose CopyOpacity -composite \ 297 -colorspace sRGB \ 298 -strip \ 299 -quality 95 \ 300 +dither -colors 128 301 302# If we are making the m6502 hack, create the header file for Android 303m6502.h:: 304 @for h in $(ANDROID_HACKS) ; do \ 305 if [ $${h} = "m6502" ] ; then \ 306 echo "Making $${h} header ..."; \ 307 ../hacks/m6502.sh ../hacks/m6502.h ../hacks/images/m6502/*.asm ; \ 308 echo "Made $${h} header"; \ 309 fi; \ 310 done 311 312xscreensaver/res/drawable/%.png: 313 @\ 314 FILE1=`echo "$@" | sed 's!^.*/\([^/]*\)\.png$$!\1.jpg!'` ; \ 315 FILE2="$@" ; \ 316 FILE1=`echo "$$FILE1" | sed s/rdbomb/rd-bomb/` ; \ 317 FILE2=`echo "$$FILE2" | sed s/rd-bomb/rdbomb/` ; \ 318 URL="$(URL)$$FILE1" ; \ 319 echo "converting $$URL..." ; \ 320 rm -f "$$FILE2" ; \ 321 $(WGET) -O- "$$URL" | \ 322 convert jpg:- $(CVT) "$$FILE2" ; \ 323 if [ ! -s "$$FILE2" ]; then \ 324 echo "$$FILE2 failed" >&2 ; \ 325 exit 1 ; \ 326 fi 327 328thumbs:: 329 @for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \ 330 $(MAKE) xscreensaver/res/drawable/$$f.png ; \ 331 done 332 333clean_thumbs:: 334 @\ 335 for f in $(ANDROID_HACKS) $(ANDROID_TODO) ; do \ 336 rm -f xscreensaver/res/drawable/$$f.png ; \ 337 done 338 339distclean:: clean_thumbs clean 340 rm -rf .gradle 341 342 343EXTRA_TARFILES = xscreensaver/res/drawable/thumbnail.png \ 344 345echo_tarfiles: 346 @FILES=`find . $(EXTRA_TARFILES) \( \( \ 347 -name .DS_Store \ 348 -o -name '*~' \ 349 -o -name '*.jks' \ 350 -o -name '*.keystore' \ 351 -o -name '*_dream.xml' \ 352 -o -name '*_settings.xml' \ 353 -o -name '*_wallpaper.xml' \ 354 -o -name AndroidManifest.xml \ 355 -o -name .gitignore \ 356 -o -name .gradle \ 357 -o -name .idea \ 358 -o -name attrs.xml \ 359 -o -name build \ 360 -o -name caches \ 361 -o -name drawable \ 362 -o -name gen \ 363 -o -name libs \ 364 -o -name local.properties \ 365 -o -name obj \ 366 -o -name settings.xml \ 367 -o -name strings.xml \ 368 \) -prune \) \ 369 -o \( \( -type f -o -type l \) \ 370 -print \) \ 371 | sed 's@^\./@@' \ 372 | sort` ; \ 373 echo $$FILES 374 375images_png_h: 376 cd ../hacks/images && $(MAKE) 377 378run_check:: 379 ../hacks/check-configs.pl --build-android $(ANDROID_HACKS) 380 381debug:: local.properties m6502.h run_check images_png_h 382 $(GRADLE) assembleDebug 383release:: local.properties m6502.h run_check images_png_h 384 export APP_ABI=all ; \ 385 $(GRADLE) assembleRelease 386 387 388KEYSTORE = xscreensaver.jks 389$(KEYSTORE): 390 keytool -genkey -v -keystore $@ \ 391 -alias xscreensaver -keyalg RSA -keysize 2048 -validity 10000 392 393APK_DIR = xscreensaver/build/outputs/apk/release/ 394APK_UNSIGNED = $(APK_DIR)xscreensaver-release-unsigned.apk 395APK_UNALIGNED = $(APK_DIR)xscreensaver-release-unaligned.apk 396APK_SIGNED = $(APK_DIR)xscreensaver-release.apk 397 398 TOOLDIR = $(shell ls -d $$HOME/Library/Android/sdk/build-tools/* | tail -1) 399 ZIPALIGN = $(TOOLDIR)/zipalign 400JARSIGNER = jarsigner 401 402sign_release:: 403 cp -p $(APK_UNSIGNED) $(APK_UNALIGNED) 404 $(JARSIGNER) -verbose -sigalg SHA1withRSA -digestalg SHA1 \ 405 -keystore $(KEYSTORE) $(APK_UNALIGNED) xscreensaver 406 rm -f $(APK_SIGNED) 407 $(ZIPALIGN) -v 4 $(APK_UNALIGNED) $(APK_SIGNED) 408 rm -f $(APK_UNALIGNED) 409 $(JARSIGNER) -verify -verbose -certs $(APK_SIGNED) 410 @ls -lF $(APK_SIGNED) 411 412apk:: release 413 @\ 414 VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' ../utils/version.h` ; \ 415 HEAD="xscreensaver-$$VERS" ; \ 416 if [ ! -s $(APK_SIGNED) -o $(APK_UNSIGNED) -nt $(APK_SIGNED) ]; then \ 417 $(MAKE) sign_release ; \ 418 fi ; \ 419 set -x ; \ 420 cp -p $(APK_SIGNED) ../archive/$$HEAD.apk 421 422 423## #### Pare it down for faster debugging... 424#export APP_ABI = armeabi-v7a 425#export APP_ABI = x86 426# 427#export ANDROID_HACKS= \ 428# $(ANDROID_BASE_HACKS) \ 429# bsod \ 430# apollonian \ 431# engine \ 432# dnalogo \ 433# twang \ 434# memscroller \ 435# phosphor \ 436# discoball \ 437# cubetwist \ 438# cubestack \ 439# splodesic \ 440