Skip to content

Commit

Permalink
JBR-8111 add vulkan package & calculate GLIBC expected version in che…
Browse files Browse the repository at this point in the history
…cking dependencies
  • Loading branch information
vprovodin committed Jan 18, 2025
1 parent 43e9aea commit 35aabb6
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
6 changes: 6 additions & 0 deletions jb/project/tools/common/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ else
WITH_BUNDLED_FREETYPE=""
fi

if [ "$bundle_type" == "vk" ]; then
WITH_VULKAN="--with-vulkan"
else
WITH_VULKAN=""
fi

REPRODUCIBLE_BUILD_OPTS="--with-source-date=$SOURCE_DATE_EPOCH
--with-hotspot-build-time=$BUILD_TIME
--with-copyright-year=$COPYRIGHT_YEAR
Expand Down
11 changes: 8 additions & 3 deletions jb/project/tools/linux/scripts/mkimages_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function do_configure {
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
--enable-cds=yes \
--with-vulkan \
$WITH_VULKAN \
$DISABLE_WARNINGS_AS_ERRORS \
$STATIC_CONF_ARGS \
$REPRODUCIBLE_BUILD_OPTS \
Expand Down Expand Up @@ -113,6 +113,11 @@ case "$bundle_type" in
jbr_name_postfix="_${bundle_type}"
do_maketest=1
;;
"vk")
do_reset_changes=1
jbr_name_postfix="_${bundle_type}"
do_maketest=1
;;
"nomod" | "")
bundle_type=""
;;
Expand Down Expand Up @@ -141,7 +146,7 @@ JBRSDK_BUNDLE=jbrsdk
echo Fixing permissions
chmod -R a+r $JSDK

if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "vk" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module_aarch64.patch || do_exit $?
update_jsdk_mods $JSDK $JCEF_PATH/jmods $JSDK/jmods $JSDK_MODS_DIR || do_exit $?
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
Expand All @@ -154,7 +159,7 @@ create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" ||

# create sdk image bundle
modules=$(cat $JSDK/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "vk" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
Expand Down
11 changes: 8 additions & 3 deletions jb/project/tools/linux/scripts/mkimages_x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function do_configure {
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
--enable-cds=yes \
--with-vulkan \
$WITH_VULKAN \
$LINUX_TARGET \
$DISABLE_WARNINGS_AS_ERRORS \
$STATIC_CONF_ARGS \
Expand Down Expand Up @@ -121,6 +121,11 @@ case "$bundle_type" in
jbr_name_postfix="_${bundle_type}"
do_maketest=1
;;
"vk")
do_reset_changes=1
jbr_name_postfix="_${bundle_type}"
do_maketest=1
;;
"nomod" | "")
bundle_type=""
;;
Expand Down Expand Up @@ -149,7 +154,7 @@ JBRSDK_BUNDLE=jbrsdk
echo Fixing permissions
chmod -R a+r $JSDK

if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "vk" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
update_jsdk_mods $JSDK $JCEF_PATH/jmods $JSDK/jmods $JSDK_MODS_DIR || do_exit $?
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
Expand All @@ -162,7 +167,7 @@ create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" ||

# create sdk image bundle
modules=$(cat $JSDK/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "vk" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
Expand Down
4 changes: 2 additions & 2 deletions jb/project/tools/linux/scripts/mkimages_x86.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ WITH_DEBUG_LEVEL="--with-debug-level=release"
RELEASE_NAME=linux-x86-server-release

case "$bundle_type" in
"jcef")
"jcef" | "vk")
echo "not implemented" && do_exit 1
;;
"nomod" | "")
Expand All @@ -119,7 +119,7 @@ JBRSDK_BUNDLE=jbrsdk
echo Fixing permissions
chmod -R a+r $JSDK

if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "vk" ]; then
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
Expand Down
18 changes: 14 additions & 4 deletions test/jdk/jb/build/VerifyDependencies.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@
/**
* @test
* @summary VerifyDependencies checks readability verifies that a Linux shared
* library has no dependency on symbols from glibc version higher than 2.17
* library has no dependency on symbols from glibc version higher than <code>expectedVersion</code>
* @run main VerifyDependencies
* @requires (os.family == "linux")
*/

public class VerifyDependencies {

static final public String EXPECTED_VERSION = "2.17";
static final public String EXPECTED_VERSION_LEGACY = "2.17";
static final public String EXPECTED_VERSION_VULKAN = "2.28";

static String expectedVersion;

public static void verifyLibrary(String libraryPath) throws IOException {
Process process;
BufferedReader reader;
Expand All @@ -52,12 +56,12 @@ public static void verifyLibrary(String libraryPath) throws IOException {
System.out.println(line);
if (line.contains("GLIBC_")) {
String version = extractVersion(line);
if (compareVersions(version, EXPECTED_VERSION) > 0) {
if (compareVersions(version, expectedVersion) > 0) {
throw new RuntimeException(libraryPath + " has a dependency on glibc version " + version);
}
}
}
System.out.println(libraryPath + " has no dependency on glibc version higher than " + EXPECTED_VERSION);
System.out.println(libraryPath + " has no dependency on glibc version higher than " + expectedVersion);
}

private static String extractVersion(String line) {
Expand Down Expand Up @@ -125,6 +129,12 @@ public boolean accept(File dir, String name) {

public static void main(String[] args) throws IOException {
String javaHome = System.getProperty("java.home");

String vendorVersion = System.getProperty("java.vendor.version");
expectedVersion = vendorVersion.substring(Math.max(vendorVersion.length() - 3, 0)).compareTo("-vk") == 0
? EXPECTED_VERSION_VULKAN : EXPECTED_VERSION_LEGACY;
System.out.println("supporting glibc version is not less than " + expectedVersion);

findInDirectory(javaHome + "/bin", false);
findInDirectory(javaHome + "/lib", true);
}
Expand Down

0 comments on commit 35aabb6

Please sign in to comment.