Skip to content

Commit 4e005e4

Browse files
committed
8227808: Make GTK3 libraries mandatory for building on Linux
Reviewed-by: jvos, kcr
1 parent 1140d34 commit 4e005e4

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

buildSrc/linux.gradle

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def gtk2CCFlags = [ ];
8383
def gtk3CCFlags = [ "-Wno-deprecated-declarations" ];
8484
def gtk2LinkFlags = [ ];
8585
def gtk3LinkFlags = [ ];
86-
LINUX.buildGTK3 = true
8786

8887
// Create $buildDir/linux_tools.properties file and load props from it
8988
setupTools("linux_gtk2",
@@ -120,28 +119,25 @@ setupTools("linux_gtk3",
120119
exec {
121120
commandLine("${toolchainDir}pkg-config", "--cflags", "gtk+-3.0", "gthread-2.0", "xtst")
122121
setStandardOutput(results2);
123-
ignoreExitValue(true)
124122
}
125123
propFile << "cflagsGTK3=" << results2.toString().trim() << "\n";
126124

127125
ByteArrayOutputStream results4 = new ByteArrayOutputStream();
128126
exec {
129127
commandLine("${toolchainDir}pkg-config", "--libs", "gtk+-3.0", "gthread-2.0", "xtst")
130128
setStandardOutput(results4);
131-
ignoreExitValue(true)
132129
}
133130
propFile << "libsGTK3=" << results4.toString().trim() << "\n";
134131

135132
},
136133
{ properties ->
137-
def ccflags = properties.getProperty("cflagsGTK3")
138-
def ldflags = properties.getProperty("libsGTK3")
139-
if (ccflags && ldflags) {
140-
gtk3CCFlags.addAll(ccflags.split(" "))
141-
gtk3LinkFlags.addAll(ldflags.split(" "))
134+
def cflagsGTK3 = properties.getProperty("cflagsGTK3")
135+
def libsGTK3 = properties.getProperty("libsGTK3")
136+
if (cflagsGTK3 && libsGTK3) {
137+
gtk3CCFlags.addAll(cflagsGTK3.split(" "))
138+
gtk3LinkFlags.addAll(libsGTK3.split(" "))
142139
} else {
143-
logger.info("Warning: GTK3 development packages not found, not building GTK3 support");
144-
LINUX.buildGTK3 = false
140+
throw new IllegalStateException("GTK3 development packages not found. If GTK3 packages are installed, please remove the build directory and try again.")
145141
}
146142
}
147143
)
@@ -213,13 +209,7 @@ def compiler = IS_COMPILE_PARFAIT ? "parfait-gcc" : "${toolchainDir}gcc";
213209
def linker = IS_STATIC_BUILD ? "ar" : IS_COMPILE_PARFAIT ? "parfait-g++" : "${toolchainDir}g++";
214210

215211
LINUX.glass = [:]
216-
LINUX.glass.variants = ["glass", "glassgtk2"]
217-
if (LINUX.buildGTK3) {
218-
logger.info("Building libglassgtk3")
219-
LINUX.glass.variants += "glassgtk3"
220-
} else {
221-
logger.warn("NOT Building libglassgtk3")
222-
}
212+
LINUX.glass.variants = ["glass", "glassgtk2", "glassgtk3"]
223213

224214
FileTree ft_gtk_launcher = fileTree("${project(":graphics").projectDir}/src/main/native-glass/gtk/") {
225215
include("**/launcher.c")
@@ -232,7 +222,7 @@ FileTree ft_gtk = fileTree("${project(":graphics").projectDir}/src/main/native-g
232222
LINUX.glass.glass = [:]
233223
LINUX.glass.glass.nativeSource = ft_gtk_launcher.getFiles()
234224
LINUX.glass.glass.compiler = compiler
235-
LINUX.glass.glass.ccFlags = [ccFlags, gtk2CCFlags, "-Werror"].flatten()
225+
LINUX.glass.glass.ccFlags = [ccFlags, "-Werror"].flatten()
236226
LINUX.glass.glass.linker = linker
237227
LINUX.glass.glass.linkFlags = IS_STATIC_BUILD? linkFlags : [linkFlags, "-lX11", "-ldl"].flatten()
238228
LINUX.glass.glass.lib = "glass"

0 commit comments

Comments
 (0)