/* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ext.ARMV6HF = [:] fetchExternalTools('ARMV6HF', ["armhf-raspberry-pi-10.tgz", "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tgz" ], rootProject.CROSS_TOOLS_DIR, rootProject.IS_IMPORT_CROSS_TOOLS) // Define the location of the sdk and toolchain def sdk=file("${rootProject.CROSS_TOOLS_DIR}/armhf-raspberry-pi-10") def compilerHome=file("${rootProject.CROSS_TOOLS_DIR}/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux") // Declare whether this particular target file applies to the current system ARMV6HF.canBuild = IS_LINUX && compilerHome.exists() && sdk.exists() if (!ARMV6HF.canBuild) { if (!compilerHome.exists()) println "ERROR: Mising compiler $compilerHome" if (!sdk.exists()) println "ERROR: Mising sdk $sdk" return; } // Lambda for naming the generated libs ARMV6HF.library = { name -> return "lib${name}.so" as String } // alias for this platform in legacy artifacts ARMV6HF.artifactsName = "armv6hf-vfp" ARMV6HF.compileSwing = false; ARMV6HF.compileSWT = false; ARMV6HF.compileFXPackager = false; ARMV6HF.compileDesignTime = false; // Libraries end up in the sdk/rt/lib/arm directory for arm builds ARMV6HF.libDest = "lib/arm" // TODO this is garbage. Each target file should define what it includes, // not what it excludes. ARMV6HF.jfxrtJarExcludes = [ "**/*.hlsl", "com/sun/glass/ui/win", "com/sun/glass/ui/accessible/win", "com/sun/prism/d3d", "com/sun/prism/es2/gl/win", //"com/sun/prism/null3d", "com/sun/scenario/effect/impl/hw/d3d", "com/sun/glass/events/mac", "com/sun/glass/ui/mac", "com/sun/glass/ui/accessible/mac", "com/sun/prism/es2/gl/mac", "com/sun/glass/ui/android", "com/sun/glass/ui/ios", "com/sun/glass/ui/swt", // SWT glass "javafx/embed/swing", // Swing Interop "javafx/embed/swt", // SWT Interop "com/sun/prism/es2/MacGL*", "com/sun/prism/es2/IOSGL*", "com/sun/prism/es2/WinGL*", ] def commonFlags = [ "-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags "-W", "-Wall", "-Wno-unused", "-Wno-parentheses", "-Werror=implicit-function-declaration"] // warning flags // Specify the compilation parameters and link parameters def ccFlags = [ commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c", IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : "-O2"].flatten() //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"]) def linkFlags = ["-shared", commonFlags].flatten() // Specify the compilation parameters and link parameters def extraCFlags = [ "-I", "-L", ccFlags, "-marm", "-mfloat-abi=hard", "-mfpu=vfp", "-I$sdk/usr/include", "-I$sdk/opt/vc/include", "-I$sdk/opt/vc/include/interface/vcos/pthreads", "-I$sdk/opt/vc/include/interface/vmcs_host/linux", "-DOMAP3", "-DUSE_DISPMAN"].flatten(); //See if we should build for imx6 def imxHeader=file("$sdk/usr/include/linux/mxcfb.h") if (imxHeader.exists()) { extraCFlags = [extraCFlags,"-DIMX6_PLATFORM"].flatten(); } def extraLFlags = [ "-I", "-L", linkFlags, "-L$sdk/lib/arm-linux/gnueabihf", "-L$sdk/usr/lib", "-L$sdk/usr/lib/arm-linux-gnueabihf", "-L$sdk/opt/vc/lib"].flatten() def lensLFlags = [extraLFlags, "-lpthread", "-ludev", "-ldl", "-lm"].flatten() def fontCFlags = [extraCFlags].flatten() def fontLFlags = [extraLFlags].flatten() def iioCFlags = [extraCFlags].flatten() def iioLFlags = [extraLFlags].flatten() def es2EglfbCFlags = [extraCFlags, "-DIS_EGLFB", "-DLINUX"].flatten() def es2EglfbLFlags = [extraLFlags].flatten() def es2X11CFlags = [extraCFlags, "-DUSE_XSHM", "-DDEBUG", "-DIS_EGLX11", "-DLINUX"].flatten() def es2X11LFlags = [extraLFlags, "-lX11", "-lXext", "-lXdmcp", "-lXau"].flatten() def mediaCFlags = [extraCFlags, "-I$sdk/usr/include/gstreamer-0.10", "-I$sdk/usr/include/glib-2.0", "-I$sdk/usr/lib/arm-linux-gnueabihf/glib-2.0/include", "-DENABLE_NATIVE_SOURCE=1", "-DENABLE_GST_FFMPEG=1"].flatten() def mediaLFlags = [extraLFlags, "-lgstreamer-0.10", "-lgstapp-0.10", "-lgstbase-0.10", "-lglib-2.0", "-lgobject-2.0", "-lgmodule-2.0", "-lgthread-2.0"].flatten() def webCFlags = [extraCFlags].flatten() def webLFlags = [extraLFlags].flatten() // libraries to remove from the SDK //deploy.trim.public.library.filter= \ // fxavcodecplugin-52.so \ // fxavcodecplugin-53.so \ // fxplugins.so \ // libjfxwebkit.so \ // libgstplugins-lite.so \ // libgstreamer-lite.so \ // libprism-es2-eglx11.so \ // libglass_lens_fb.so \ def gtkCFlags = [extraCFlags].flatten() def gtkLFlags = [extraLFlags].flatten() setupTools("armv6hf_tools", { propFile -> ByteArrayOutputStream results = new ByteArrayOutputStream(); exec { commandLine("$sdk/bin/pkg-config", "--cflags", "gtk+-2.0", "gthread-2.0", "xtst"); setStandardOutput(results); } propFile << "cflags=" << results.toString().trim() << "\n"; results = new ByteArrayOutputStream(); exec { commandLine "$sdk/bin/pkg-config", "--libs", "gtk+-2.0", "gthread-2.0", "xtst" standardOutput = results } propFile << "libs=" << results.toString().trim(); }, { properties -> gtkCFlags.addAll(properties.getProperty("cflags").split(" ")) gtkLFlags.addAll(properties.getProperty("libs").split(" ")) } ) ARMV6HF.javafxPlatformProperties ="""javafx.platform=eglfb directfb.glass.platform=Lens directfb.glass.lens=dfb directfb.prism.order=sw directfb.com.sun.javafx.isEmbedded=true directfb.com.sun.javafx.scene.control.skin.FXVK.cache=true eglfb.glass.platform=Lens eglfb.glass.lens=eglfb eglfb.prism.order=es2 eglfb.prism.eglfb=true eglfb.prism.lcdtext=false eglfb.prism.maxvram=128m eglfb.prism.targetvram=112m eglfb.use.egl=true eglfb.use.gles2=true eglfb.embedded=eglfb eglfb.com.sun.javafx.isEmbedded=true eglfb.doNativeComposite=true eglfb.com.sun.javafx.scene.control.skin.FXVK.cache=true eglfb.prism.glDepthSize=0 fb.glass.platform=Lens fb.glass.lens=fb fb.prism.order=sw fb.com.sun.javafx.isEmbedded=true fb.glass.restrictWindowToScreen=true fb.com.sun.javafx.scene.control.skin.FXVK.cache=true eglx11.glass.platform=Lens eglx11.glass.lens=eglx11 eglx11.prism.order=es2 eglx11.prism.eglx11=true eglx11.prism.lcdtext=false eglx11.prism.maxvram=128m eglx11.prism.targetvram=112m eglx11.use.egl=true eglx11.use.gles2=true eglx11.embedded=eglx11 eglx11.com.sun.javafx.isEmbedded=true eglx11.com.sun.javafx.scene.control.skin.FXVK.cache=true eglx11.prism.glDepthSize=0 gtk.glass.platform=gtk gtk.prism.order=sw gtk.com.sun.javafx.isEmbedded=true gtk.com.sun.javafx.scene.control.skin.FXVK.cache=true""" def pangoCCFlags = [extraCFlags, "-D_ENABLE_PANGO"]; def pangoLinkFlags = [extraLFlags]; setupTools("armv6hf_pango_tools", { propFile -> ByteArrayOutputStream results = new ByteArrayOutputStream(); exec { commandLine "$sdk/bin/pkg-config", "--cflags", "pangoft2" standardOutput = results } propFile << "cflags=" << results.toString().trim() << "\n"; results = new ByteArrayOutputStream(); exec { commandLine "$sdk/bin/pkg-config", "--libs", "pangoft2" standardOutput = results } propFile << "libs=" << results.toString().trim(); }, { properties -> pangoCCFlags.addAll(properties.getProperty("cflags").split(" ")) pangoLinkFlags.addAll(properties.getProperty("libs").split(" ")) } ) def freetypeCCFlags = [ext.COMPILE_PANGO ? "-D_ENABLE_PANGO" : ext.COMPILE_HARFBUZZ ? "-D_ENABLE_HARFBUZZ" : ""] def freetypeLinkFlags = [] setupTools("armv6hf_freetype_tools", { propFile -> ByteArrayOutputStream results = new ByteArrayOutputStream(); exec { commandLine "$sdk/bin/pkg-config", "--cflags", "freetype2" standardOutput = results } propFile << "cflags=" << results.toString().trim() << "\n"; results = new ByteArrayOutputStream(); exec { commandLine "$sdk/bin/pkg-config", "--libs", "freetype2" standardOutput = results } propFile << "libs=" << results.toString().trim(); }, { properties -> freetypeCCFlags.addAll(properties.getProperty("cflags").split(" ")) freetypeLinkFlags.addAll(properties.getProperty("libs").split(" ")) } ) def compiler = file("$compilerHome/bin/arm-linux-gnueabihf-gcc").getAbsolutePath() def linker = file("$compilerHome/bin/arm-linux-gnueabihf-g++").getAbsolutePath() ARMV6HF.glass = [:] ARMV6HF.glass.variants = ["eglfb", "directfb", "fb", "gtk", "lensport" ] ARMV6HF.glass.javahInclude = [ "com/sun/glass/events/**", "com/sun/glass/ui/*", "com/sun/glass/ui/lens/*", "com/sun/glass/ui/gtk/*", "com/sun/glass/ui/accessible/gtk/*"] ARMV6HF.glass.lib = "glass" ARMV6HF.glass.lensport = [:] ARMV6HF.glass.lensport.nativeSource = [ file("modules/graphics/src/main/native-glass/lens/lensport") ] ARMV6HF.glass.lensport.compiler = compiler ARMV6HF.glass.lensport.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX", "-DISEGLFB", "-DLENSPORT", "-I", file("modules/graphics/src/main/native-glass/lens/") ].flatten() ARMV6HF.glass.lensport.linker = linker ARMV6HF.glass.lensport.linkFlags = [lensLFlags].flatten() ARMV6HF.glass.lensport.lib = "lens_porting" ARMV6HF.glass.eglfb = [:] // TODO when building headless, use lens/cursor/nullcursor/ // otherwise we use lens/cursor/fbCursor/ and lens/input/udev // TODO when USE_RFB is specified use lens/rfb // TODO use /eglfb/x11ContainerScreen when using eglfb and EGL_X11_FB_CONTAINER // TODO use /headless/headlessScreen when using headless ARMV6HF.glass.eglfb.nativeSource = [ file("modules/graphics/src/main/native-glass/lens"), file("modules/graphics/src/main/native-glass/lens/wm"), file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"), file("modules/graphics/src/main/native-glass/lens/input/udev"), file("modules/graphics/src/main/native-glass/lens/wm/screen/fbdevScreen.c") ] ARMV6HF.glass.eglfb.compiler = compiler ARMV6HF.glass.eglfb.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX", "-DISEGLFB"].flatten() ARMV6HF.glass.eglfb.linker = linker ARMV6HF.glass.eglfb.linkFlags = [lensLFlags].flatten() ARMV6HF.glass.eglfb.lib = "glass_lens_eglfb" ARMV6HF.glass.directfb = [:] ARMV6HF.glass.directfb.nativeSource = [ file("modules/graphics/src/main/native-glass/lens"), file("modules/graphics/src/main/native-glass/lens/wm"), file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"), file("modules/graphics/src/main/native-glass/lens/input/udev"), file("modules/graphics/src/main/native-glass/lens/wm/screen/dfbScreen.c") ] ARMV6HF.glass.directfb.compiler = compiler ARMV6HF.glass.directfb.ccFlags = ["-ffast-math", extraCFlags, "-I$sdk/usr/include/directfb", "-DLINUX"].flatten() ARMV6HF.glass.directfb.linker = linker ARMV6HF.glass.directfb.linkFlags = [lensLFlags].flatten() ARMV6HF.glass.directfb.lib = "glass_lens_dfb" ARMV6HF.glass.fb = [:] ARMV6HF.glass.fb.nativeSource = [ file("modules/graphics/src/main/native-glass/lens"), file("modules/graphics/src/main/native-glass/lens/wm"), file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"), file("modules/graphics/src/main/native-glass/lens/input/udev"), file("modules/graphics/src/main/native-glass/lens/wm/screen/fbdevScreen.c") ] ARMV6HF.glass.fb.compiler = compiler ARMV6HF.glass.fb.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX"].flatten() ARMV6HF.glass.fb.linker = linker ARMV6HF.glass.fb.linkFlags = [lensLFlags].flatten() ARMV6HF.glass.fb.lib = "glass_lens_fb" ARMV6HF.glass.eglx11 = [:] ARMV6HF.glass.eglx11.nativeSource = [ file("modules/graphics/src/main/native-glass/lens"), file("modules/graphics/src/main/native-glass/lens/wm"), file("modules/graphics/src/main/native-glass/lens/cursor/fbCursor"), file("modules/graphics/src/main/native-glass/lens/input/udev"), file("modules/graphics/src/main/native-glass/lens/wm/screen/x11ContainerScreen.c")] //file("modules/graphics/src/main/native-glass/lens/wm/screen")] ARMV6HF.glass.eglx11.compiler = compiler ARMV6HF.glass.eglx11.ccFlags = ["-ffast-math", extraCFlags, "-DLINUX"].flatten() ARMV6HF.glass.eglx11.linker = linker ARMV6HF.glass.eglx11.linkFlags = [lensLFlags].flatten() ARMV6HF.glass.eglx11.lib = "glass_lens_eglx11" ARMV6HF.glass.gtk = [:] ARMV6HF.glass.gtk.nativeSource = file("modules/graphics/src/main/native-glass/gtk") ARMV6HF.glass.gtk.compiler = compiler ARMV6HF.glass.gtk.ccFlags = ["-ffast-math", gtkCFlags, "-DLINUX"].flatten() ARMV6HF.glass.gtk.linker = linker ARMV6HF.glass.gtk.linkFlags = [gtkLFlags, "-lstdc++"].flatten() ARMV6HF.glass.gtk.lib = "glass" ARMV6HF.decora = [:] ARMV6HF.decora.compiler = compiler ARMV6HF.decora.ccFlags = extraCFlags ARMV6HF.decora.linker = linker ARMV6HF.decora.linkFlags = extraLFlags ARMV6HF.decora.lib = "decora_sse" ARMV6HF.prism = [:] ARMV6HF.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"] ARMV6HF.prism.nativeSource = file("modules/graphics/src/main/native-prism") ARMV6HF.prism.compiler = compiler ARMV6HF.prism.ccFlags = [extraCFlags].flatten() ARMV6HF.prism.linker = linker ARMV6HF.prism.linkFlags = [extraLFlags, "-lX11", "-lXext", "-lXdmcp", "-lXau"].flatten() ARMV6HF.prism.lib = "prism_common" ARMV6HF.prismSW = [:] ARMV6HF.prismSW.javahInclude = ["com/sun/pisces/**/*"] ARMV6HF.prismSW.nativeSource = file("modules/graphics/src/main/native-prism-sw") ARMV6HF.prismSW.compiler = compiler ARMV6HF.prismSW.ccFlags = [extraCFlags].flatten() ARMV6HF.prismSW.linker = linker ARMV6HF.prismSW.linkFlags = [extraLFlags].flatten() ARMV6HF.prismSW.lib = "prism_sw" ARMV6HF.iio = [:] ARMV6HF.iio.javahInclude = ["com/sun/javafx/iio/**/*"] ARMV6HF.iio.nativeSource = [ file("modules/graphics/src/main/native-iio"), file("modules/graphics/src/main/native-iio/libjpeg7")] ARMV6HF.iio.compiler = compiler ARMV6HF.iio.ccFlags = iioCFlags ARMV6HF.iio.linker = linker ARMV6HF.iio.linkFlags = iioLFlags ARMV6HF.iio.lib = "javafx_iio" ARMV6HF.prismES2 = [:] ARMV6HF.prismES2.variants = ["eglfb"] ARMV6HF.prismES2.javahInclude = ["com/sun/prism/es2/**/*"] ARMV6HF.prismES2.eglfb = [:] ARMV6HF.prismES2.eglfb.nativeSource = [ file("modules/graphics/src/main/native-prism-es2"), file("modules/graphics/src/main/native-prism-es2/GL"), file("modules/graphics/src/main/native-prism-es2/eglfb") ] ARMV6HF.prismES2.eglfb.compiler = compiler ARMV6HF.prismES2.eglfb.ccFlags = [ es2EglfbCFlags, "-I", ARMV6HF.glass.lensport.nativeSource ].flatten() ARMV6HF.prismES2.eglfb.linker = linker ARMV6HF.prismES2.eglfb.linkFlags = es2EglfbLFlags ARMV6HF.prismES2.eglfb.lib = "prism_es2_eglfb" ARMV6HF.prismES2.eglx11 = [:] ARMV6HF.prismES2.eglx11.nativeSource = [ file("modules/graphics/src/main/native-prism-es2"), file("modules/graphics/src/main/native-prism-es2/GL"), file("modules/graphics/src/main/native-prism-es2/eglx11") ] ARMV6HF.prismES2.eglx11.compiler = compiler ARMV6HF.prismES2.eglx11.ccFlags = es2X11CFlags ARMV6HF.prismES2.eglx11.linker = linker ARMV6HF.prismES2.eglx11.linkFlags = es2X11LFlags ARMV6HF.prismES2.eglx11.lib = "prism_es2_eglx11" def closedDir = file("$projectDir/../rt-closed") ARMV6HF.font = [:] ARMV6HF.font.javahInclude = [ "com/sun/javafx/font/**/*", "com/sun/javafx/text/**/*"] ARMV6HF.font.nativeSource = [file("modules/graphics/src/main/native-font")] ARMV6HF.font.compiler = compiler ARMV6HF.font.ccFlags = fontCFlags ARMV6HF.font.linker = linker ARMV6HF.font.linkFlags = fontLFlags ARMV6HF.font.lib = "javafx_font" ARMV6HF.fontT2K = [:] ARMV6HF.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"] ARMV6HF.fontT2K.nativeSource = [ file("$closedDir/javafx-font-t2k-native/src"), file("$closedDir/javafx-font-t2k-native/src/layout")] ARMV6HF.fontT2K.compiler = compiler ARMV6HF.fontT2K.ccFlags = [fontCFlags, "-DLE_STANDALONE"].flatten() ARMV6HF.fontT2K.linker = linker ARMV6HF.fontT2K.linkFlags = fontLFlags ARMV6HF.fontT2K.lib = "javafx_font_t2k" ARMV6HF.fontFreetype = [:] ARMV6HF.fontFreetype.javahInclude = ["com/sun/javafx/font/freetype/OSFreetype.class*"] ARMV6HF.fontFreetype.nativeSource = ["src/main/native-font/freetype.c"] ARMV6HF.fontFreetype.compiler = compiler ARMV6HF.fontFreetype.ccFlags = ["-DJFXFONT_PLUS", ccFlags, fontCFlags, freetypeCCFlags].flatten() ARMV6HF.fontFreetype.linker = linker ARMV6HF.fontFreetype.linkFlags = [linkFlags, fontLFlags, freetypeLinkFlags].flatten() ARMV6HF.fontFreetype.lib = "javafx_font_freetype" ARMV6HF.fontPango = [:] ARMV6HF.fontPango.javahInclude = ["com/sun/javafx/font/freetype/OSPango.class"] ARMV6HF.fontPango.nativeSource = ["src/main/native-font/pango.c"] ARMV6HF.fontPango.compiler = compiler ARMV6HF.fontPango.ccFlags = ["-DJFXFONT_PLUS", ccFlags, pangoCCFlags].flatten() ARMV6HF.fontPango.linker = linker ARMV6HF.fontPango.linkFlags = [linkFlags, pangoLinkFlags].flatten() ARMV6HF.fontPango.lib = "javafx_font_pango" ARMV6HF.webkit = [:] ARMV6HF.webkit.binDir = "$compilerHome/bin" ARMV6HF.webkit.compiler = compiler ARMV6HF.webkit.linker = linker ARMV6HF.webkit.ar = file("$compilerHome/bin/arm-linux-gnueabihf-ar").getAbsolutePath() ARMV6HF.webkit.objcopy = file("$compilerHome/bin/arm-linux-gnueabihf-objcopy").getAbsolutePath() ARMV6HF.webkit.strip = file("$compilerHome/bin/arm-linux-gnueabihf-strip").getAbsolutePath() ARMV6HF.webkit.ccFlags = extraCFlags.join(' ') ARMV6HF.webkit.linkFlags = extraLFlags.join(' ') ARMV6HF.media = [:] ARMV6HF.media.compiler = compiler ARMV6HF.media.linker = linker ARMV6HF.media.extra_cflags = mediaCFlags.join(' ') ARMV6HF.media.extra_ldflags = mediaLFlags.join(' ')