| /* |
| * Copyright (c) 2013, 2015, 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.LINUX = [:] |
| |
| // Declare whether this particular target file applies to the current system |
| LINUX.canBuild = IS_LINUX; |
| if (!LINUX.canBuild) return; |
| |
| // All desktop related packages should be built |
| LINUX.compileSwing = true; |
| LINUX.compileSWT = true; |
| LINUX.compileFXPackager = true; |
| |
| // Libraries end up in the sdk/rt/lib/$OS_ARCH directory for Linux |
| LINUX.libDest = "lib/$OS_ARCH" |
| |
| // Lambda for naming the generated libs |
| LINUX.library = { name -> return "lib${name}.so" as String } |
| |
| // A set of common parameters to use for both compiling and linking |
| def commonFlags = [ |
| "-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags |
| "-W", "-Wall", "-Wno-unused", "-Wno-parentheses", "-Werror=implicit-function-declaration"] // warning flags |
| |
| if (!IS_64) { |
| commonFlags += "-m32" |
| } |
| |
| // 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", "-DNDEBUG"]].flatten() |
| //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"]) |
| def linkFlags = ["-shared", commonFlags].flatten() |
| |
| // Create $buildDir/linux_tools.properties file and load props from it |
| setupTools("linux_tools", |
| { propFile -> |
| ByteArrayOutputStream results = new ByteArrayOutputStream(); |
| exec { |
| commandLine("pkg-config", "--cflags", "gtk+-2.0", "gthread-2.0", "xtst"); |
| setStandardOutput(results); |
| } |
| propFile << "cflags=" << results.toString().trim() << "\n"; |
| |
| results = new ByteArrayOutputStream(); |
| exec { |
| commandLine "pkg-config", "--libs", "gtk+-2.0", "gthread-2.0", "xtst" |
| standardOutput = results |
| } |
| propFile << "libs=" << results.toString().trim(); |
| }, |
| { properties -> |
| ccFlags.addAll(properties.getProperty("cflags").split(" ")) |
| linkFlags.addAll(properties.getProperty("libs").split(" ")) |
| } |
| ) |
| |
| def pangoCCFlags = ["-D_ENABLE_PANGO"]; |
| def pangoLinkFlags = []; |
| setupTools("linux_pango_tools", |
| { propFile -> |
| ByteArrayOutputStream results = new ByteArrayOutputStream(); |
| exec { |
| commandLine "pkg-config", "--cflags", "pangoft2" |
| standardOutput = results |
| } |
| propFile << "cflags=" << results.toString().trim() << "\n"; |
| |
| results = new ByteArrayOutputStream(); |
| exec { |
| commandLine "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.IS_COMPILE_PANGO ? "-D_ENABLE_PANGO" : |
| ext.IS_COMPILE_HARFBUZZ ? "-D_ENABLE_HARFBUZZ" : ""] |
| def freetypeLinkFlags = [] |
| setupTools("linux_freetype_tools", |
| { propFile -> |
| ByteArrayOutputStream results = new ByteArrayOutputStream(); |
| exec { |
| commandLine "pkg-config", "--cflags", "freetype2" |
| standardOutput = results |
| } |
| propFile << "cflags=" << results.toString().trim() << "\n"; |
| |
| results = new ByteArrayOutputStream(); |
| exec { |
| commandLine "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 = IS_COMPILE_PARFAIT ? "parfait-gcc" : "gcc"; |
| def linker = IS_COMPILE_PARFAIT ? "parfait-g++" : "g++"; |
| |
| LINUX.glass = [:] |
| LINUX.glass.javahInclude = [ |
| "com/sun/glass/events/**", |
| "com/sun/glass/ui/*", |
| "com/sun/glass/ui/gtk/*"] |
| LINUX.glass.nativeSource = file("modules/graphics/src/main/native-glass/gtk") |
| LINUX.glass.compiler = compiler |
| LINUX.glass.ccFlags = [ccFlags, "-Werror"].flatten() |
| LINUX.glass.linker = linker |
| LINUX.glass.linkFlags = [linkFlags].flatten() |
| LINUX.glass.lib = "glass" |
| |
| LINUX.decora = [:] |
| LINUX.decora.compiler = compiler |
| LINUX.decora.ccFlags = [ccFlags, "-ffast-math"].flatten() |
| LINUX.decora.linker = linker |
| LINUX.decora.linkFlags = [linkFlags].flatten() |
| LINUX.decora.lib = "decora_sse" |
| |
| LINUX.prism = [:] |
| LINUX.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"] |
| LINUX.prism.nativeSource = file("modules/graphics/src/main/native-prism") |
| LINUX.prism.compiler = compiler |
| LINUX.prism.ccFlags = [ccFlags, "-DINLINE=inline"].flatten() |
| LINUX.prism.linker = linker |
| LINUX.prism.linkFlags = [linkFlags].flatten() |
| LINUX.prism.lib = "prism_common" |
| |
| LINUX.prismSW = [:] |
| LINUX.prismSW.javahInclude = ["com/sun/pisces/**/*"] |
| LINUX.prismSW.nativeSource = file("modules/graphics/src/main/native-prism-sw") |
| LINUX.prismSW.compiler = compiler |
| LINUX.prismSW.ccFlags = [ccFlags, "-DINLINE=inline"].flatten() |
| LINUX.prismSW.linker = linker |
| LINUX.prismSW.linkFlags = [linkFlags].flatten() |
| LINUX.prismSW.lib = "prism_sw" |
| |
| LINUX.launcher = [:] |
| LINUX.launcher.compiler = compiler |
| LINUX.launcher.ccFlags = ["-DJAVAARCH=\"$OS_ARCH\"", "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c"] |
| LINUX.launcher.linker = linker |
| LINUX.launcher.linkFlags = ["-ldl"] |
| if (!IS_64) { |
| LINUX.launcher.ccFlags += "-m32" |
| LINUX.launcher.linkFlags += "-m32" |
| } |
| |
| LINUX.launcherlibrary = [:] |
| LINUX.launcherlibrary.compiler = compiler |
| LINUX.launcherlibrary.ccFlags = ["-DJAVAARCH=\"$OS_ARCH\"", "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c", "-fPIC"] |
| LINUX.launcherlibrary.linker = linker |
| LINUX.launcherlibrary.linkFlags = ["-ldl", "-lpthread", "-shared"] |
| if (!IS_64) { |
| LINUX.launcherlibrary.ccFlags += "-m32" |
| LINUX.launcherlibrary.linkFlags += "-m32" |
| } |
| |
| LINUX.iio = [:] |
| LINUX.iio.javahInclude = ["com/sun/javafx/iio/**/*"] |
| LINUX.iio.nativeSource = [ |
| file("modules/graphics/src/main/native-iio"), |
| file("modules/graphics/src/main/native-iio/libjpeg7")] |
| LINUX.iio.compiler = compiler |
| LINUX.iio.ccFlags = [ccFlags].flatten() |
| LINUX.iio.linker = linker |
| LINUX.iio.linkFlags = [linkFlags].flatten() |
| LINUX.iio.lib = "javafx_iio" |
| |
| LINUX.prismES2 = [:] |
| LINUX.prismES2.javahInclude = ["com/sun/prism/es2/**/*"] |
| LINUX.prismES2.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/x11") |
| ] |
| LINUX.prismES2.compiler = compiler |
| LINUX.prismES2.ccFlags = ["-DLINUX", ccFlags].flatten() |
| LINUX.prismES2.linker = linker |
| LINUX.prismES2.linkFlags = [linkFlags, "-lX11", "-lXxf86vm", "-lGL"].flatten() |
| LINUX.prismES2.lib = "prism_es2" |
| |
| def closedDir = file("$projectDir/../rt-closed") |
| LINUX.font = [:] |
| LINUX.font.javahInclude = [ |
| "com/sun/javafx/font/**/*", |
| "com/sun/javafx/text/**/*"] |
| LINUX.font.compiler = compiler |
| LINUX.font.nativeSource = [file("modules/graphics/src/main/native-font")] |
| LINUX.font.ccFlags = ["-DJFXFONT_PLUS", ccFlags].flatten() |
| LINUX.font.linker = linker |
| LINUX.font.linkFlags = [linkFlags].flatten() |
| LINUX.font.lib = "javafx_font" |
| |
| LINUX.fontT2K = [:] |
| LINUX.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"] |
| LINUX.fontT2K.nativeSource = [ |
| file("$closedDir/javafx-font-t2k-native/src"), |
| file("$closedDir/javafx-font-t2k-native/src/layout")] |
| LINUX.fontT2K.compiler = compiler |
| LINUX.fontT2K.ccFlags = ["-DJFXFONT_PLUS", "-DLE_STANDALONE", ccFlags].flatten() |
| LINUX.fontT2K.linker = linker |
| LINUX.fontT2K.linkFlags = [linkFlags].flatten() |
| LINUX.fontT2K.lib = "javafx_font_t2k" |
| |
| LINUX.fontFreetype = [:] |
| LINUX.fontFreetype.javahInclude = ["com/sun/javafx/font/freetype/OSFreetype.class"] |
| LINUX.fontFreetype.nativeSource = ["src/main/native-font/freetype.c"] |
| LINUX.fontFreetype.compiler = compiler |
| LINUX.fontFreetype.ccFlags = ["-DJFXFONT_PLUS", ccFlags, freetypeCCFlags].flatten() |
| LINUX.fontFreetype.linker = linker |
| LINUX.fontFreetype.linkFlags = [linkFlags, freetypeLinkFlags].flatten() |
| LINUX.fontFreetype.lib = "javafx_font_freetype" |
| |
| LINUX.fontPango = [:] |
| LINUX.fontPango.javahInclude = ["com/sun/javafx/font/freetype/OSPango.class"] |
| LINUX.fontPango.nativeSource = ["src/main/native-font/pango.c"] |
| LINUX.fontPango.compiler = compiler |
| LINUX.fontPango.ccFlags = ["-DJFXFONT_PLUS", ccFlags, pangoCCFlags].flatten() |
| LINUX.fontPango.linker = linker |
| LINUX.fontPango.linkFlags = [linkFlags, pangoLinkFlags].flatten() |
| LINUX.fontPango.lib = "javafx_font_pango" |
| |
| LINUX.media = [:] |
| LINUX.media.compiler = compiler |
| LINUX.media.linker = linker |
| LINUX.media.lib = "ar" |