Skip to content

Commit

Permalink
Build GTK3 support for linux x86-64 to maximize compatibility
Browse files Browse the repository at this point in the history
Recently all SWT builds for Linux x86-64 have been done on a new
Debian image. This leads to requiring such a new distro to be
able to run SWT successfully.

This change builds GTK3 and common code on an older debian container
to increase the range of versions we support. Only GTK4's key library,
libswt-pi4-gtk*.so is shipped from a build on the new debaian container.

We continue to build all of the natives on latest debian so we benefit
from compiler warnings/errors and other such tooling.

Prerequisite eclipse-platform/eclipse.platform.releng.aggregator#2802

Fixes eclipse-platform#1791
  • Loading branch information
jonahgraham committed Feb 3, 2025
1 parent 4a201e2 commit 067369f
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

def runOnNativeBuildAgent(String platform, Closure body) {
def final nativeBuildStageName = 'Build SWT-native binaries'
if (platform == 'gtk.linux.x86_64') {
if (platform == 'gtk4.linux.x86_64') {
podTemplate(inheritFrom: 'basic' /* inherit general configuration */, containers: [
containerTemplate(name: 'swtbuild', image: 'eclipse/platformreleng-debian-swtnativebuild:12',
resourceRequestCpu:'1000m', resourceRequestMemory:'512Mi',
Expand All @@ -26,6 +26,15 @@ def runOnNativeBuildAgent(String platform, Closure body) {
]) {
node(POD_LABEL) { stage(nativeBuildStageName) { container('swtbuild') { body() } } }
}
} else if (platform == 'gtk.linux.x86_64') {
podTemplate(inheritFrom: 'basic' /* inherit general configuration */, containers: [
containerTemplate(name: 'swtbuild', image: 'eclipse/platformreleng-debian-swtgtk3nativebuild:10',
resourceRequestCpu:'1000m', resourceRequestMemory:'512Mi',
resourceLimitCpu:'2000m', resourceLimitMemory:'4096Mi',
alwaysPullImage: true, command: 'cat', ttyEnabled: true)
]) {
node(POD_LABEL) { stage(nativeBuildStageName) { container('swtbuild') { body() } } }
}
} else {
// See the Definition of the RelEng Jenkins instance in
// https://github.com/eclipse-cbi/jiro/tree/master/instances/eclipse.platform.releng
Expand Down Expand Up @@ -199,6 +208,7 @@ pipeline {
'gtk.linux.ppc64le',\
'gtk.linux.riscv64',\
'gtk.linux.x86_64',\
'gtk4.linux.x86_64',\
'win32.win32.aarch64',\
'win32.win32.x86_64'
}
Expand All @@ -220,22 +230,29 @@ pipeline {
runOnNativeBuildAgent("${PLATFORM}") {
cleanWs() // Workspace is not cleaned up by default, so we do it explicitly
echo "OS: ${os}, ARCH: ${arch}"
unstash "swt.binaries.sources.${ws}"
unstash "swt.binaries.sources.${ws == 'gtk4' ? 'gtk' : ws }"
dir('jdk.resources') {
unstash "jdk.resources.${os}.${arch}"
}
withEnv(['MODEL=' + arch, "OUTPUT_DIR=${WORKSPACE}/libs", "SWT_JAVA_HOME=${WORKSPACE}/jdk.resources"]) {
if (isUnix()){
sh '''
mkdir libs
if [ "${PLATFORM}" = "gtk.linux.aarch64" ]; then
if [[ ${PLATFORM} == gtk.linux.* ]]; then
sh build.sh -gtk3 install
elif [ "${PLATFORM}" = "gtk.linux.ppc64le" ]; then
sh build.sh -gtk3 install
elif [ "${PLATFORM}" = "gtk.linux.riscv64" ]; then
sh build.sh -gtk3 install
else
elif [[ ${PLATFORM} == gtk4.linux.* ]]; then
# We build both 3 + 4, but we only keep libswt-pi4-gtk
# (see 'Collect and sign binaries' stage)
#
# We build both to help catch build errors as this
# build runs against more modern gcc/libs and helps
# with verification
sh build.sh install
elif [[ ${PLATFORM} == cocoa.macosx.* ]]; then
sh build.sh install
else
echo "Unexpected build platform ${PLATFORM}"
exit 1
fi
ls -1R libs
'''
Expand All @@ -259,9 +276,13 @@ pipeline {
dir("libs/${PLATFORM}") {
unstash "swt.binaries.${PLATFORM}"
sh '''
DEST_PLATFORM=${PLATFORM}
if [[ ${PLATFORM} == cocoa.macosx.* ]]; then
binariesExtension='jnilib'
signerUrl='https://cbi.eclipse.org/macos/codesign/sign'
elif [[ ${PLATFORM} == gtk4.linux.x86_64 ]]; then
binariesExtension='so'
DEST_PLATFORM=gtk.linux.x86_64
elif [[ ${PLATFORM} == gtk.linux.* ]]; then
binariesExtension='so'
elif [[ ${PLATFORM} == win32.win32.* ]]; then
Expand All @@ -278,7 +299,11 @@ pipeline {
done
fi
fi
cp *.$binariesExtension "${WORKSPACE}/eclipse.platform.swt/binaries/org.eclipse.swt.${PLATFORM}/"
if [[ ${PLATFORM} == gtk4.linux.x86_64 ]]; then
cp libswt-pi4-gtk*.so "${WORKSPACE}/eclipse.platform.swt/binaries/org.eclipse.swt.${DEST_PLATFORM}/"
else
cp *.$binariesExtension "${WORKSPACE}/eclipse.platform.swt/binaries/org.eclipse.swt.${DEST_PLATFORM}/"
fi
'''
}
}
Expand Down

0 comments on commit 067369f

Please sign in to comment.