Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
/ jfx11u Public archive

Commit eec13f7

Browse files
8278260: JavaFX shared libraries not stripped on Linux or macOS
Backport-of: 1ebf7a24144b198e62b9b343821fdb155b9d703e
1 parent 6ab043f commit eec13f7

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

build.gradle

+60-3
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ ext.IS_WORKER_DEBUG = Boolean.parseBoolean(WORKER_DEBUG);
472472
defineProperty("CONF", "Debug")
473473
ext.IS_DEBUG_JAVA = CONF == "Debug" || CONF == "DebugNative"
474474
ext.IS_DEBUG_NATIVE = CONF == "DebugNative"
475+
ext.IS_RELEASE = !ext.IS_DEBUG_JAVA
475476

476477
// Defines the compiler warning levels to use. If empty, then no warnings are generated. If
477478
// not empty, then the expected syntax is as a space or comma separated list of names, such
@@ -5444,6 +5445,9 @@ compileTargets { t ->
54445445

54455446
def library = targetProperties.library
54465447

5448+
def doStrip = targetProperties.containsKey('strip') && IS_RELEASE
5449+
def strip = doStrip ? targetProperties.strip : null
5450+
def stripArgs = doStrip ? targetProperties.stripArgs : null
54475451
def useLipo = targetProperties.containsKey('useLipo') ? targetProperties.useLipo : false
54485452
def modLibDest = targetProperties.modLibDest
54495453
def moduleNativeDirName = "${platformPrefix}module-$modLibDest"
@@ -5492,7 +5496,8 @@ compileTargets { t ->
54925496
group = "Basic"
54935497
description = "copies javafx.graphics native libraries"
54945498

5495-
into "${graphicsProject.buildDir}/${moduleNativeDirName}"
5499+
def destDirName = "${graphicsProject.buildDir}/${moduleNativeDirName}"
5500+
into destDirName
54965501

54975502
from("${graphicsProject.buildDir}/libs/jsl-decora/${t.name}/${library(targetProperties.decora.lib)}")
54985503
def libs = ['font', 'prism', 'prismSW', 'glass', 'iio']
@@ -5518,13 +5523,32 @@ compileTargets { t ->
55185523
from ("$winsdklib");
55195524
}
55205525
}
5526+
5527+
if (doStrip) {
5528+
doLast {
5529+
def inputFiles = fileTree(dir: destDirName)
5530+
inputFiles.include("*.dll")
5531+
inputFiles.include("*.dylib")
5532+
inputFiles.include("*.so")
5533+
// FIXME: if we ever need to strip on Windows platforms, we must
5534+
// exclude the Microsoft DLLs (VS2017DLLNames and WinSDKDLLNames)
5535+
5536+
inputFiles.each { file ->
5537+
exec {
5538+
def cmd = [ strip, stripArgs, file ].flatten()
5539+
commandLine(cmd)
5540+
}
5541+
}
5542+
}
5543+
}
55215544
}
55225545

55235546
def buildModuleMediaTask = task("buildModuleMedia$t.capital", type: Copy, dependsOn: mediaProject.assemble) {
55245547
group = "Basic"
55255548
description = "copies javafx.media native libraries"
55265549

5527-
into "${mediaProject.buildDir}/${moduleNativeDirName}"
5550+
def destDirName = "${mediaProject.buildDir}/${moduleNativeDirName}"
5551+
into destDirName
55285552

55295553
def mediaBuildType = project(":media").ext.buildType
55305554
if (IS_COMPILE_MEDIA) {
@@ -5555,13 +5579,30 @@ compileTargets { t ->
55555579
from ("$MEDIA_STUB/${library("glib-lite")}")
55565580
}
55575581
}
5582+
5583+
if (doStrip && IS_COMPILE_MEDIA) {
5584+
doLast {
5585+
def inputFiles = fileTree(dir: destDirName)
5586+
inputFiles.include("*.dll")
5587+
inputFiles.include("*.dylib")
5588+
inputFiles.include("*.so")
5589+
5590+
inputFiles.each { file ->
5591+
exec {
5592+
def cmd = [ strip, stripArgs, file ].flatten()
5593+
commandLine(cmd)
5594+
}
5595+
}
5596+
}
5597+
}
55585598
}
55595599

55605600
def buildModuleWeb = task("buildModuleWeb$t.capital", type: Copy, dependsOn: webProject.assemble) {
55615601
group = "Basic"
55625602
description = "copies javafx.web native libraries"
55635603

5564-
into "${webProject.buildDir}/${moduleNativeDirName}"
5604+
def destDirName = "${webProject.buildDir}/${moduleNativeDirName}"
5605+
into destDirName
55655606

55665607
if (IS_COMPILE_WEBKIT) {
55675608
from ("${webProject.buildDir}/libs/${t.name}/${library('jfxwebkit')}")
@@ -5570,6 +5611,22 @@ compileTargets { t ->
55705611
from ("$WEB_STUB/${library('jfxwebkit')}")
55715612
}
55725613
}
5614+
5615+
if (doStrip && IS_COMPILE_WEBKIT) {
5616+
doLast {
5617+
def inputFiles = fileTree(dir: destDirName)
5618+
inputFiles.include("*.dll")
5619+
inputFiles.include("*.dylib")
5620+
inputFiles.include("*.so")
5621+
5622+
inputFiles.each { file ->
5623+
exec {
5624+
def cmd = [ strip, stripArgs, file ].flatten()
5625+
commandLine(cmd)
5626+
}
5627+
}
5628+
}
5629+
}
55735630
}
55745631

55755632
def buildModuleSWT = task("buildModuleSWT$t.capital", type: Copy) {

buildSrc/linux.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ setupTools("linux_freetype_tools",
212212
def compiler = IS_COMPILE_PARFAIT ? "parfait-gcc" : "${toolchainDir}gcc";
213213
def linker = IS_STATIC_BUILD ? "ar" : IS_COMPILE_PARFAIT ? "parfait-g++" : "${toolchainDir}g++";
214214

215+
// Strip native .so shared libraries as a postprocess step when copying them
216+
LINUX.strip = "${toolchainDir}strip"
217+
LINUX.stripArgs = [ "-x" ]
218+
215219
LINUX.glass = [:]
216220
LINUX.glass.variants = ["glass", "glassgtk2", "glassgtk3"]
217221

buildSrc/mac.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ if (hasProperty('toolchainDir')) {
158158
def compiler = IS_COMPILE_PARFAIT ? "parfait-clang" : "${toolchainDir}clang";
159159
def linker = IS_STATIC_BUILD ? "libtool" : IS_COMPILE_PARFAIT ? "parfait-clang++" : "${toolchainDir}clang++";
160160

161+
// Strip native .dylib shared libraries as a postprocess step when copying them
162+
MAC.strip = "${toolchainDir}strip"
163+
MAC.stripArgs = [ "-x" ]
164+
161165
MAC.glass = [:]
162166
MAC.glass.javahInclude = [
163167
"com/sun/glass/events/**",

0 commit comments

Comments
 (0)