< prev index next >

buildSrc/linux.gradle

Print this page




  26 ext.LINUX = [:]
  27 
  28 // Declare whether this particular target file applies to the current system
  29 LINUX.canBuild = IS_LINUX;
  30 if (!LINUX.canBuild) return;
  31 
  32 // All desktop related packages should be built
  33 LINUX.compileSwing = true;
  34 LINUX.compileSWT = true;
  35 LINUX.compileFXPackager = true;
  36 
  37 // Libraries end up in the lib/$OS_ARCH directory for Linux
  38 LINUX.libDest = "lib"
  39 
  40 // Lambda for naming the generated libs
  41 LINUX.library = { name -> return "lib${name}.so" as String }
  42 
  43 // A set of common parameters to use for both compiling and linking
  44 def commonFlags = [
  45         "-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags

  46         "-Wextra", "-Wall", "-Wformat-security", "-Wno-unused", "-Wno-parentheses", "-Werror=implicit-function-declaration"] // warning flags
  47 
  48 if (!IS_64) {
  49     commonFlags += "-m32"
  50 }
  51 
  52 // Specify the compilation parameters and link parameters
  53 def ccFlags = [
  54         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
  55         "-ffunction-sections", "-fdata-sections",
  56         IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
  57 def ccFlagsGTK3 = ccFlags
  58 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
  59 def linkFlags = ["-static-libgcc", "-static-libstdc++", "-shared", commonFlags,

  60                  "-Wl,--gc-sections"].flatten()
  61 
  62 if (IS_DEBUG_NATIVE) {
  63     linkFlags += "-g"
  64 }
  65 
  66 def gtk2CCFlags = [  ];
  67 def gtk3CCFlags = [ "-Wno-deprecated-declarations" ];
  68 def gtk2LinkFlags = [ ];
  69 def gtk3LinkFlags = [ ];
  70 LINUX.buildGTK3 = true
  71 
  72 // Create $buildDir/linux_tools.properties file and load props from it
  73 setupTools("linux_gtk2",
  74     { propFile ->
  75         ByteArrayOutputStream results1 = new ByteArrayOutputStream();
  76         exec {
  77             commandLine("pkg-config", "--cflags", "gtk+-2.0", "gthread-2.0", "xtst")
  78             setStandardOutput(results1);
  79         }




  26 ext.LINUX = [:]
  27 
  28 // Declare whether this particular target file applies to the current system
  29 LINUX.canBuild = IS_LINUX;
  30 if (!LINUX.canBuild) return;
  31 
  32 // All desktop related packages should be built
  33 LINUX.compileSwing = true;
  34 LINUX.compileSWT = true;
  35 LINUX.compileFXPackager = true;
  36 
  37 // Libraries end up in the lib/$OS_ARCH directory for Linux
  38 LINUX.libDest = "lib"
  39 
  40 // Lambda for naming the generated libs
  41 LINUX.library = { name -> return "lib${name}.so" as String }
  42 
  43 // A set of common parameters to use for both compiling and linking
  44 def commonFlags = [
  45         "-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags
  46         "-fstack-protector",
  47         "-Wextra", "-Wall", "-Wformat-security", "-Wno-unused", "-Wno-parentheses", "-Werror=implicit-function-declaration"] // warning flags
  48 
  49 if (!IS_64) {
  50     commonFlags += "-m32"
  51 }
  52 
  53 // Specify the compilation parameters and link parameters
  54 def ccFlags = [
  55         commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
  56         "-ffunction-sections", "-fdata-sections",
  57         IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
  58 def ccFlagsGTK3 = ccFlags
  59 //ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
  60 def linkFlags = ["-static-libgcc", "-static-libstdc++", "-shared", commonFlags,
  61                  "-z", "relro",
  62                  "-Wl,--gc-sections"].flatten()
  63 
  64 if (IS_DEBUG_NATIVE) {
  65     linkFlags += "-g"
  66 }
  67 
  68 def gtk2CCFlags = [  ];
  69 def gtk3CCFlags = [ "-Wno-deprecated-declarations" ];
  70 def gtk2LinkFlags = [ ];
  71 def gtk3LinkFlags = [ ];
  72 LINUX.buildGTK3 = true
  73 
  74 // Create $buildDir/linux_tools.properties file and load props from it
  75 setupTools("linux_gtk2",
  76     { propFile ->
  77         ByteArrayOutputStream results1 = new ByteArrayOutputStream();
  78         exec {
  79             commandLine("pkg-config", "--cflags", "gtk+-2.0", "gthread-2.0", "xtst")
  80             setStandardOutput(results1);
  81         }


< prev index next >