1 /*
   2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 /**
  28  * Gets the most recent android platform installed, relative to the given path.
  29  * The path will either be ANDROID_SDK or ANDROID_NDK
  30  * TODO Shouldn't we instead just ask people to point to the one they want to use?
  31  *
  32  * @param path The path to the Android SDK or NDK
  33  * @return The name of the most recent platform
  34  */
  35 String getLatestPlatform(String path) {
  36     def max = 0
  37     println("$path")
  38     file(cygpath("$path/platforms")).eachFile() {file->
  39         def pname = file.getName() - "android-"
  40         def ptf = pname?.isInteger() ? pname.toInteger() : 0
  41         if (max < ptf) {
  42             max = ptf
  43         }
  44     }
  45     if (max == 0) {
  46         return null;
  47     }
  48     return "android-" + max
  49 }
  50 
  51 int compareVersions(String s1, String s2) {
  52     def v1t = s1.tokenize(".")
  53     def v2t = s2.tokenize(".")
  54     for(int i = 0; i < v1t.size(); i++) {
  55         if (i == v2t.size()) {
  56             return 1
  57         }
  58         int n1 = v1t[i].isInteger() ? v1t[i].toInteger() : 0
  59         int n2 = v2t[i].isInteger() ? v2t[i].toInteger() : 0
  60         if (n1 == n2) {
  61             continue
  62         } else if (n1 > n2) {
  63             return 1;
  64         } else {
  65             return -1
  66         }        
  67     }    
  68     return (v2t.size() > v1t.size()) ? -1 : 0
  69 }
  70 
  71 String getLatestToolchain(String ndk, String tch) {
  72     def max = "0.0"
  73     def matchFile = null
  74     file(cygpath("$ndk/toolchains")).eachFile() {file->        
  75         def filename = file.getName()
  76         if (filename.startsWith(tch)) {
  77             def p = filename - "$tch-"
  78             if (compareVersions(p, max) > 0) {
  79                 max = p
  80                 matchFile = file
  81             }
  82         }
  83     }
  84     return matchFile.getAbsolutePath()
  85 }
  86 
  87 boolean assertDir(File dir) {
  88     return dir != null && dir.exists() && dir.isDirectory() && dir.canRead();
  89 }
  90 
  91 boolean assertDir(String dir) {
  92     return assertDir(file(dir))
  93 }
  94 
  95 def closedDir = file("$projectDir/../rt-closed")
  96 
  97 def toolchainArchs = ["arm-linux-androideabi", "mipsel-linux-android", "x86"]
  98 def armArchs = ["armeabi", "armeabiv-7a"]
  99 
 100 ext.DALVIK = [:]
 101 DALVIK.compileSwing = false;
 102 DALVIK.compileSWT = false;
 103 DALVIK.compileFXPackager = false;
 104 DALVIK.glassPlatform = "android"
 105 DALVIK.armArch = armArchs[0]
 106 DALVIK.libDest = "lib/${DALVIK.armArch}"
 107 DALVIK.jfxdvklib = "jfxdvk.jar"
 108 DALVIK.library = { name -> return "lib${name}.so" as String }
 109 DALVIK.includeMonocole = true
 110 DALVIK.includeLens = false
 111 
 112 def sdk = project.hasProperty("ANDROID_SDK") ? "${ANDROID_SDK}" : null;
 113 def ndk = project.hasProperty("ANDROID_NDK") ? "${ANDROID_NDK}" : null;
 114 DALVIK.canBuild = sdk != null && ndk != null
 115 if (!DALVIK.canBuild) {
 116     logger.error("Can't build Android. Path to SDK or NDK was not set or is invalid!")
 117     return;
 118 }
 119 
 120 DALVIK.canBuild = assertDir(sdk) && assertDir(ndk)
 121 if (!DALVIK.canBuild) {
 122     if (!assertDir(sdk)) {
 123         logger.error("Path to ANDROID_SDK is invalid! [$sdk]")
 124     }
 125     if (!assertDir(ndk)) {
 126         logger.error("Path to ANDROID_NDK is invalid! [$ndk]")
 127     }
 128     return
 129 }
 130 
 131 def sdk_target = project.hasProperty("ANDROID_SDK_TARGET") ?  "${ANDROID_SDK_TARGET}" : getLatestPlatform(sdk);
 132 if (!assertDir(file("$sdk/platforms/$sdk_target"))) {            
 133     sdk_target = getLatestPlatform(sdk); 
 134     logger.warn("Redefine ANDROID_SDK_TARGET to: [$sdk_target]")
 135 }
 136 
 137 def ndk_target = project.hasProperty("ANDROID_NDK_TARGET") ? "${ANDROID_NDK_TARGET}" : getLatestPlatform(ndk);
 138 if (!assertDir(file("$ndk/platforms/$ndk_target"))) {            
 139     ndk_target = getLatestPlatform(ndk);
 140     logger.warn("Redefine ANDROID_NDK_TARGET to: [$ndk_target]")
 141 }
 142 
 143 DALVIK.canBuild = sdk_target != null && ndk_target != null
 144 if (!DALVIK.canBuild) {
 145     logger.error("Can't determine sdk or ndk target platform!")
 146     return
 147 }
 148 
 149 def toolchainHome = project.hasProperty("ANDROID_CROSS_TOOLS_VER") ? 
 150     "$ndk/toolchains/${ANDROID_CROSS_TOOLS_VER}" : getLatestToolchain(ndk, toolchainArchs[0])
 151 if (!assertDir(toolchainHome)) {
 152     toolchainHome = getLatestToolchain(ndk, toolchainArchs[0])
 153     logger.warn("Redefine toolchain to [$toolchainHome]")
 154 }
 155 
 156 // Look for the the Android SDK & NDK to use, as well as the compiler stuff
 157 def compilerHome = null
 158 file("$toolchainHome/prebuilt").eachDir() {subdir ->
 159     compilerHome = subdir.getAbsolutePath()
 160     return
 161 }
 162 
 163 DALVIK.canBuild = compilerHome != null
 164 if (!DALVIK.canBuild) {
 165     logger.error("Failed to access toolchain [$toolchainHome/prebuilt/$toolsPlatform]!")
 166     return
 167 }
 168 
 169 def freetypeDir = project.hasProperty("FREETYPE_DIR") ? "${FREETYPE_DIR}" : null
 170 if (!assertDir(freetypeDir)) {
 171     logger.warn("FREETYPE_DIR $freetypeDir doesn't exists! Build continues without native text support.")
 172     freetypeDir = null
 173 }
 174 def compileNativeText = freetypeDir != null
 175 
 176 def compiler = file("$compilerHome/bin/${toolchainArchs[0]}-gcc").getAbsolutePath()
 177 def linker = file("$compilerHome/bin/${toolchainArchs[0]}-g++").getAbsolutePath()
 178 
 179 // Log the settings we're building with
 180 logger.quiet("ANDROID_SDK: $sdk")
 181 logger.quiet("ANDROID_SDK_TARGET: $sdk_target")
 182 logger.quiet("ANDROID_NDK: $ndk")
 183 logger.quiet("ANDROID_NDK_TARGET: $ndk_target")
 184 logger.quiet("FREETYPE_DIR: $freetypeDir")
 185 logger.quiet("Compile native text: $compileNativeText") 
 186 logger.quiet("Android Compiler: $compiler")
 187 logger.quiet("Android Linker: $linker")
 188 
 189 //exclude from build
 190 project(":swing") {
 191     apply plugin: 'java'
 192 
 193     compileJava {
 194         enabled = false
 195     }
 196 }
 197 
 198 project(":fxml") {
 199     apply plugin: 'java'
 200 
 201     jar.dependsOn("retroClass");
 202 
 203     compileJava {
 204         enabled = true
 205     }
 206 }
 207 
 208 project(":jmx") {
 209     apply plugin: 'java'
 210 
 211     compileJava {
 212         enabled = false
 213     }
 214 }
 215 
 216 
 217 allprojects() {
 218     repositories {
 219         mavenCentral()
 220     }
 221     configurations {
 222         retroconfig
 223     }
 224 
 225     dependencies {
 226         retroconfig 'net.orfjackal.retrolambda:retrolambda:1.1.4'
 227     }
 228     task retroClass() <<{
 229             file classdirs = file ("$buildDir/classes");
 230             lf = classdirs.listFiles();
 231             classdirs.eachDir{t -> 
 232                 javaexec {
 233                     inputdir = t
 234                     basecp = files(lf, "modules/base/build/classes/main", "modules/graphics/build/classes/main").asPath
 235                     myconfig = configurations.retroconfig;
 236                     lambdaloc = myconfig.resolve().toArray()[0];
 237                     classpath = configurations.retroconfig
 238                     main = 'net.orfjackal.retrolambda.Main'
 239                     jvmArgs = [
 240                                "-Xbootclasspath:$JDK_HOME/jre/lib/rt.jar",
 241                                 "-Dretrolambda.inputDir=$inputdir",
 242                                 "-Dretrolambda.classpath=$basecp",
 243                                 "-Dretrolambda.bytecodeVersion=51",
 244                                 "-javaagent:$lambdaloc"
 245                    ]
 246             }
 247         }
 248     }
 249 }
 250 
 251 
 252 project(":base") {
 253 
 254     apply plugin: 'java'
 255 
 256     jar.dependsOn("retroClass");
 257 
 258 }
 259 
 260 
 261 project(":graphics") {
 262 
 263     apply plugin: 'java'
 264 
 265     sourceSets.main.java {
 266         exclude "com/sun/glass/ui/swt/**"
 267     }
 268 
 269     assemble.dependsOn("retroClass");
 270     task compileDalvikLibs(type: JavaCompile, group: "Build") {
 271         description = "Task compiles dalvik vm based libraries."
 272         options.bootClasspath = "$sdk/platforms/$sdk_target/android.jar"
 273         classpath = files("build/classes/dalvik", "build/classes/main")
 274         destinationDir = file("build/classes/dalvik")
 275         dependencyCacheDir = file("build/dependency-cache")
 276         source fileTree(dir: 'src/dalvik/java').matching { include 'javafxports/**' }
 277     }
 278 
 279     task jarDalvikLibs(type: Jar, group: "Build", dependsOn: compileDalvikLibs) {
 280         description = "Creates jfxdvk.jar with all dalvik based classes."
 281         archiveName = "jfxdvk.jar"
 282         includeEmptyDirs = false
 283         from("build/classes/dalvik")
 284         include("javafxports/**/*")
 285         dependsOn(compileDalvikLibs)
 286     }
 287     
 288     jarDalvikLibs {
 289         eachFile {
 290                 if (it.name.endsWith('.class')) {
 291                     RandomAccessFile raf = new RandomAccessFile(it.file.path, "rw");
 292                     raf.seek(7);
 293                     raf.writeByte(0x32); //make it jdk6
 294                     raf.close();
 295                 }
 296             }
 297     }
 298      
 299     afterEvaluate {
 300         addNative(project, "activity")
 301         if (compileNativeText) {
 302             addNative(project, "fontNativeFreetype")
 303         }
 304         tasks["javahDalvikGlass"].dependsOn(compileDalvikLibs)
 305         tasks["javahDalvikActivity"].dependsOn(compileDalvikLibs)
 306         tasks["native"].dependsOn("nativeActivity")
 307         if (compileNativeText) {
 308             tasks["native"].dependsOn("nativeFontNativeFreetype")
 309         }
 310         tasks["javahDalvikPrismSW"].enabled = false
 311         tasks["ccDalvikPrismSW"].enabled = false;
 312         tasks["linkDalvikPrismSW"].enabled = false;
 313         
 314         sdkDalvik  {
 315             dependsOn(jarDalvikLibs)
 316             doLast {
 317                 def props = project.ext["DALVIK"]
 318                 copy {
 319                     from(
 320                          "modules/graphics/build/libs/activity/dalvik/${props.library(props.activity.lib)}"
 321                     )                    
 322                     into ("build/dalvik-sdk/rt/${props.libDest}")
 323                 }
 324                 copy {
 325                     from ("modules/graphics/build/libs/${props.jfxdvklib}")
 326                     into ("build/dalvik-sdk/rt/lib/ext")
 327                 }
 328 /*
 329                 copy {
 330                     from ("modules/compat/build/libs/compat.jar")
 331                     into ("build/dalvik-sdk/rt/lib/ext")
 332                 }
 333 */
 334                 if (compileNativeText) {
 335                     copy {
 336                         from ("modules/graphics/build/libs/fontNativeFreetype/dalvik")
 337                         into ("build/dalvik-sdk/rt/${props.libDest}")
 338                     }
 339                 }
 340             }
 341         }
 342     }
 343 }
 344 
 345 project(":controls") {
 346 
 347     apply plugin: 'java'
 348 
 349     assemble.dependsOn("compileControlsJavaDalvik","retroClass");
 350 
 351     sourceSets.main.java {
 352         exclude 'javafx/scene/control/Date*.java'
 353         exclude 'com/sun/javafx/scene/control/skin/Date*.java'
 354         exclude 'com/sun/javafx/scene/control/behavior/Date*.java'
 355     }
 356     task compileControlsJavaDalvik(type: JavaCompile, group: "Build", dependsOn: [":graphics:compileJava", ":controls:compileJava"]) << {
 357         description = "Task compiles controls for Android"
 358         classpath = files("modules/base/build/classes/main",
 359             "modules/graphics/build/classes/main",
 360             "modules/controls/build/classes/main"
 361         )
 362         destinationDir = file("modules/controls/build/classes/dalvik")
 363         dependencyCacheDir = file("modules/controls/build/dependency-cache")
 364         source file("modules/controls/src/android/java")
 365     }
 366     afterEvaluate {
 367 
 368        task processControlsResourcesDalvik() {
 369            copy {
 370                from ("modules/controls/src/android/resources")
 371                into ("modules/controls/build/resources/dalvik")
 372            }
 373         }
 374 
 375         jfxrtDalvik {
 376             from ("modules/controls/build/classes/dalvik",
 377                   "modules/controls/build/resources/dalvik")
 378             dependsOn(compileControlsJavaDalvik, processControlsResourcesDalvik)
 379         }
 380 
 381     }
 382 }        
 383 
 384 allprojects {
 385     afterEvaluate {
 386         sdkDalvik {
 387             doLast {
 388                 ant.jar(update: "true", destfile: "build/dalvik-sdk/rt/lib/ext/jfxrt.jar", 
 389                     basedir: "build/dalvik-sdk/rt/lib", includes: "*.properties")
 390             }
 391         }
 392     }
 393 }
 394 
 395 
 396 DALVIK.jfxrtJarExcludes = [
 397     "**/*.hlsl",
 398     "com/sun/glass/ui/win",
 399     "com/sun/glass/ui/accessible/win",    
 400     "com/sun/prism/j2d",
 401     "com/sun/prism/sw",
 402     "com/sun/glass/ui/accessible/mac",
 403     "com/sun/glass/ui/ios",
 404     "com/sun/glass/ui/swt", // SWT glass
 405     "com/oracle/dalvik",
 406     "javafx/scene/media", //exclude all media for now
 407     "com/sun/media",
 408     "com/sun/javafx/media",
 409     "com/sun/javafx/font/directwrite", //exclude non freetype font support
 410     "com/sun/javafx/font/coretext",
 411     "com/sun/javafx/font/freetype/Pango*",
 412     "com/sun/javafx/font/freetype/OSPango*",
 413     "com/sun/webkit",   //exclude all WebView for now
 414     "com/sun/javafx/webkit",
 415     "com/sun/javafx/scene/web",
 416     "javafx/scene/web",
 417     "com/sun/javafx/sg/prism/NGWeb*",
 418     "javafx/print", //exclude printing
 419     "com/sun/javafx/print",
 420     "com/sun/javafx/tk/Print*"
 421 ]
 422 
 423 def text = (compileNativeText) ? "native" : "t2k"
 424 
 425 DALVIK.javafxPlatformProperties = """
 426 javafx.platform=android
 427 android.glass.platform=Monocle
 428 android.glass.lens=eglfb
 429 android.log.lens=FINEST
 430 android.prism.glDepthSize=16
 431 android.prism.lcdtext=false
 432 android.prism.debugfonts=true
 433 android.prism.text=$text
 434 android.embedded=eglfb
 435 android.prism.allowhidpi=false
 436 android.prism.maxTextureSize=2048
 437 android.prism.dirtyopts=true
 438 android.prism.vsync=false
 439 android.use.egl=true
 440 android.com.sun.javafx.isEmbedded=true
 441 """
 442 def sysroot = "$ndk/platforms/$ndk_target/arch-arm"
 443 
 444 def ccFlags = ["--sysroot=$sysroot","-std=c99", "-DANDROID", "-c", "-nostdlib", 
 445                "-DANDROID_NDK", "-DDALVIK_VM"]
 446 
 447 def ccOptFlags = ["-fpic", "-ffunction-sections", "-funwind-tables","-fstack-protector",
 448                   "-Os", "-O2", "-fno-strict-aliasing", "-finline-limit=64", "-fomit-frame-pointer"]
 449 def ccWarnFlags = ["-Wa,--noexecstack", "-Wno-psabi"]
 450 def ccArchFlags = ["-mthumb", "-msoft-float", "-D__ARM_ARCH_5__", "-D__ARM_ARCH_5T__", "-D__ARM_ARCH_5E__",
 451                    "-D__ARM_ARCH_5TE__", "-march=armv5te" , "-mtune=xscale"]
 452 def ccDebugFlags = [IS_DEBUG_NATIVE ? "-DDEBUG" : "-DNDEBUG"]
 453 def ccDefaultIncludeFlags = ["-I$ndk/platforms/$ndk_target/arch-arm/usr/include"]
 454 
 455 def linkFlags = ["--sysroot=$sysroot",
 456                  "-Wl,--no-undefined", "-Wl,-z,noexecstack", "-lc", "-lm", "-shared",
 457                  "-L$ndk/platforms/$ndk_target/arch-arm/usr/lib"]
 458 
 459 DALVIK.activity = [:]
 460 DALVIK.activity.javahSource = files("modules/graphics/build/classes/dalvik")
 461 DALVIK.activity.javahClasspath = files("modules/graphics/build/classes/dalvik", "$sdk/platforms/$sdk_target/android.jar")
 462 DALVIK.activity.javahInclude = ["javafxports/android/**"]
 463 DALVIK.activity.nativeSource = file("modules/graphics/src/dalvik/native")
 464 DALVIK.activity.compiler = compiler
 465 DALVIK.activity.linker = linker
 466 DALVIK.activity.lib = "activity"
 467 DALVIK.activity.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 468     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 469 DALVIK.activity.linkFlags = [linkFlags, "-landroid", "-llog"].flatten()
 470 
 471 DALVIK.webview = [:]
 472 DALVIK.webview.javahSource = files("modules/web/build/classes/dalvik")
 473 DALVIK.webview.javahClasspath = files("modules/web/build/classes/dalvik")
 474 DALVIK.webview.javahInclude = [
 475     "com/sun/webkit/NativeWebView.class"
 476 ]
 477 DALVIK.webview.nativeSource = [
 478     file("modules/web/src/android/native/native_webview.c")
 479 ]
 480 DALVIK.webview.compiler = compiler
 481 DALVIK.webview.linker = linker
 482 DALVIK.webview.lib = "webview"
 483 DALVIK.webview.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 484     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 485 DALVIK.webview.linkFlags = [linkFlags, "-ldl", "-llog"].flatten()
 486 
 487 DALVIK.dvkwebview = [:]
 488 DALVIK.dvkwebview.javahSource = files("modules/web/build/classes/dalvik")
 489 DALVIK.dvkwebview.javahClasspath = files("modules/web/build/classes/dalvik")
 490 DALVIK.dvkwebview.javahInclude = [
 491     "com/sun/webkit/NativeWebView.class"
 492 ]
 493 DALVIK.dvkwebview.nativeSource = [
 494     file("modules/web/src/android/native/android_webview.c")
 495 ]
 496 DALVIK.dvkwebview.compiler = compiler
 497 DALVIK.dvkwebview.linker = linker
 498 DALVIK.dvkwebview.lib = "android_webview"
 499 DALVIK.dvkwebview.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 500     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 501 DALVIK.dvkwebview.linkFlags = [linkFlags, "-ldl", "-llog"].flatten()
 502 
 503 DALVIK.glass = [:]
 504 // DALVIK.glass.variants = ["eglfb", "lensport"]
 505 DALVIK.glass.variants = []
 506 DALVIK.glass.variants = ["monocle"]
 507 DALVIK.glass.javahSource = files("modules/graphics/build/classes/dalvik",
 508  "modules/graphics/build/classes/main")
 509 DALVIK.glass.javahClasspath = files("modules/graphics/build/classes/main",
 510  "modules/graphics/build/classes/dalvik",
 511  "modules/base/build/classes/main",
 512  "$sdk/platforms/$sdk_target/android.jar")
 513 DALVIK.glass.javahInclude = [
 514     "javafxports/android/**",
 515     "com/sun/glass/ui/monocle/*",
 516     "com/sun/glass/ui/monocle/util/*",
 517     "com/sun/glass/events/**",
 518     "com/sun/glass/ui/*",
 519     "com/sun/glass/ui/android/*",
 520     "com/sun/glass/ui/lens/*"]
 521 
 522 DALVIK.glass.lensport = [:]
 523 DALVIK.glass.lensport.nativeSource = [
 524     file("modules/graphics/src/main/native-glass/lens/lensport/initPlatform.c"),
 525     file("modules/graphics/src/main/native-glass/lens/lensport/wrapped_functions.c")    
 526 ]
 527 DALVIK.glass.lensport.compiler = compiler
 528 DALVIK.glass.lensport.linker = linker
 529 DALVIK.glass.lensport.lib = "lens_porting"
 530 DALVIK.glass.lensport.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 531     ccDebugFlags, ccDefaultIncludeFlags, "-DISEGLFB", "-DLENSPORT",
 532     "-I", file("modules/graphics/src/main/native-glass/lens")].flatten()
 533 DALVIK.glass.lensport.linkFlags = [linkFlags, "-ldl", "-llog"].flatten()
 534 
 535 def monocleCFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 536     ccDebugFlags, ccDefaultIncludeFlags, "-DISEGLFB",
 537     "-I", file("modules/graphics/src/main/native-glass/monocle/")
 538 ].flatten()
 539 
 540 DALVIK.glass.monocle = [:]
 541 DALVIK.glass.monocle.nativeSource = [
 542         file("modules/graphics/src/main/native-glass/monocle"),
 543         file("modules/graphics/src/main/native-glass/monocle/android"),
 544         file("modules/graphics/src/main/native-glass/monocle/util") ]
 545 DALVIK.glass.monocle.compiler = compiler
 546 DALVIK.glass.monocle.ccFlags = monocleCFlags
 547 DALVIK.glass.monocle.linker = linker
 548 DALVIK.glass.monocle.linkFlags =  [linkFlags, "-ldl", "-llog", "-lGLESv2", "-lEGL"].flatten()
 549 DALVIK.glass.monocle.lib = "glass_monocle"
 550 
 551 
 552 DALVIK.glass.eglfb = [:]
 553 DALVIK.glass.eglfb.nativeSource = [
 554     file("modules/graphics/src/main/native-glass/lens"),
 555     file("modules/graphics/src/main/native-glass/lens/wm"),
 556     file("modules/graphics/src/main/native-glass/lens/cursor/nullCursor"),
 557     file("modules/graphics/src/main/native-glass/lens/dalvik")
 558 ]
 559 DALVIK.glass.eglfb.compiler = compiler
 560 DALVIK.glass.eglfb.linker = linker
 561 DALVIK.glass.eglfb.lib = "glass_lens_eglfb"
 562 DALVIK.glass.eglfb.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 563     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 564 DALVIK.glass.eglfb.linkFlags = [linkFlags, "-ldl", "-landroid", "-llog"].flatten()
 565 
 566 DALVIK.prism = [:]
 567 DALVIK.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"]
 568 DALVIK.prism.nativeSource = file("modules/graphics/src/main/native-prism")
 569 DALVIK.prism.compiler = compiler
 570 DALVIK.prism.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 571     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 572 DALVIK.prism.linker = linker
 573 DALVIK.prism.linkFlags = [linkFlags].flatten()
 574 DALVIK.prism.lib = "prism_common"
 575 
 576 DALVIK.prismSW = [:]
 577 DALVIK.prismSW.javahInclude = ["com/sun/pisces/**/*"]
 578 DALVIK.prismSW.nativeSource = file("modules/graphics/src/main/native-prism-sw")
 579 DALVIK.prismSW.compiler = compiler
 580 DALVIK.prismSW.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 581     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 582 DALVIK.prismSW.linker = linker
 583 DALVIK.prismSW.linkFlags = [linkFlags].flatten()
 584 DALVIK.prismSW.lib = "prism_sw"
 585 
 586 DALVIK.decora = [:]
 587 DALVIK.decora.compiler = compiler
 588 DALVIK.decora.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 589     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 590 DALVIK.decora.linker = linker
 591 DALVIK.decora.linkFlags = [linkFlags].flatten()
 592 DALVIK.decora.lib = "decora_sse"
 593 
 594 DALVIK.iio = [:]
 595 DALVIK.iio.javahInclude = ["com/sun/javafx/iio/**/*"]
 596 DALVIK.iio.nativeSource = [
 597     file("modules/graphics/src/main/native-iio"),
 598     file("modules/graphics/src/main/native-iio/libjpeg7")]
 599 DALVIK.iio.compiler = compiler
 600 DALVIK.iio.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 601     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 602 DALVIK.iio.linker = linker
 603 DALVIK.iio.linkFlags = [linkFlags].flatten()
 604 DALVIK.iio.lib = "javafx_iio"
 605 
 606 DALVIK.prismES2 = [:]
 607 DALVIK.prismES2.variants = ["eglfb"]
 608 DALVIK.prismES2.javahInclude = ["com/sun/prism/es2/**/*"]
 609 
 610 DALVIK.prismES2.eglfb = [:]
 611 DALVIK.prismES2.eglfb.nativeSource = [
 612     file("modules/graphics/src/main/native-prism-es2"),
 613     file("modules/graphics/src/main/native-prism-es2/GL"),
 614     file("modules/graphics/src/main/native-prism-es2/eglfb")]
 615 DALVIK.prismES2.eglfb.compiler = compiler
 616 DALVIK.prismES2.eglfb.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 617     ccDebugFlags, ccDefaultIncludeFlags, "-DIS_EGLFB"].flatten()
 618 DALVIK.prismES2.eglfb.linker = linker
 619 DALVIK.prismES2.eglfb.linkFlags = [linkFlags, "-ldl", "-llog", "-lGLESv2", "-lEGL"].flatten()
 620 DALVIK.prismES2.eglfb.lib = "prism_es2_eglfb"
 621 
 622 DALVIK.font = [:]
 623 DALVIK.font.javahInclude = [
 624         "com/sun/javafx/font/**/*",
 625         "com/sun/javafx/text/**/*"]
 626 DALVIK.font.nativeSource = [file("$closedDir/javafx-font-native/src")]
 627 DALVIK.font.compiler = compiler
 628 DALVIK.font.ccFlags = [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 629     ccDebugFlags, ccDefaultIncludeFlags].flatten()
 630 DALVIK.font.linker = linker
 631 DALVIK.font.linkFlags = [linkFlags].flatten()
 632 DALVIK.font.lib = "javafx_font"
 633 
 634 if (BUILD_CLOSED) {
 635     DALVIK.fontT2K = [:]
 636     DALVIK.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"]
 637     DALVIK.fontT2K.nativeSource = [
 638         file("$closedDir/javafx-font-t2k-native/src"),
 639         file("$closedDir/javafx-font-t2k-native/src/layout"),
 640         file("$closedDir/javafx-font-t2k-native/src/layoutfx")]
 641     DALVIK.fontT2K.compiler = compiler
 642     DALVIK.fontT2K.ccFlags = [ccFlags, "-fno-exceptions", "-fno-rtti", ccWarnFlags,
 643         ccArchFlags, ccOptFlags, ccDebugFlags, ccDefaultIncludeFlags].flatten()
 644     DALVIK.fontT2K.linker = linker
 645     DALVIK.fontT2K.linkFlags = [linkFlags, "-lstdc++"].flatten()
 646     DALVIK.fontT2K.lib = "javafx_font_t2k"
 647 } 
 648 
 649 if (compileNativeText) {
 650     DALVIK.fontNativeFreetype = [:]
 651     DALVIK.fontNativeFreetype.javahInclude = [
 652         "com/sun/javafx/font/freetype/OSFreetype.class"
 653     ]
 654     DALVIK.fontNativeFreetype.nativeSource = [
 655         file("modules/graphics/src/main/native-font/freetype.c")
 656     ]
 657     DALVIK.fontNativeFreetype.compiler = compiler
 658     DALVIK.fontNativeFreetype.linker = linker
 659     DALVIK.fontNativeFreetype.lib = "javafx_font_freetype"
 660 
 661     ccFlags += ["-D_ENABLE_HARFBUZZ"]
 662 
 663     DALVIK.fontNativeFreetype.ccFlags = 
 664         [ccFlags, ccWarnFlags, ccArchFlags, ccOptFlags,
 665         ccDebugFlags, ccDefaultIncludeFlags,
 666         "-I$freetypeDir/include", "-I$freetypeDir/include/freetype2"].flatten()  
 667         
 668     DALVIK.fontNativeFreetype.linkFlags = 
 669         [linkFlags, "-llog", 
 670          "-L$freetypeDir/lib", "$freetypeDir/lib/libfreetype.a"].flatten()
 671 }
 672 
 673 DALVIK.media = [:]
 674 DALVIK.media.compiler = compiler
 675 DALVIK.media.linker = linker
 676 DALVIK.media.lib = file("$compilerHome/bin/${toolchainArchs[0]}-ar").getAbsolutePath()
 677 DALVIK.includeEGL = true
 678 DALVIK.includeGTK = true
 679 DALVIK.includeLens = true
 680 ext.IS_COMPILE_PANGO = false
 681 ext.IS_COMPILE_JFR = false