Update get_bundle_versions.sh to match other scripts

- get_bundle_versions.sh: Add license
- get_bundle_versions.sh: Set compile-command in Emacs
- get_bundle_versions.sh: Use different error codes for different failures
- get_bundle_versions.sh: Remove unneeded '.' in JPEG version
- get_bundle_versions.sh: shellcheck: Double-quote variable references (SC2086)
- get_bundle_versions.sh: shellcheck: Drop use of cat and pass file to awk directly (SC2002)

Related: RHEL-103209
This commit is contained in:
Andrew Hughes 2025-07-08 23:30:02 +01:00
parent 599694ea9e
commit 4961d88038
2 changed files with 61 additions and 24 deletions

View File

@ -2563,6 +2563,16 @@ cjc.mainProgram(args)
%endif
%changelog
* Wed Jul 09 2025 Andrew Hughes <gnu.andrew@redhat.com> - 1:21.0.8.0.1-0.1.ea
- Update get_bundle_versions.sh to match other scripts
- * get_bundle_versions.sh: Add license
- * get_bundle_versions.sh: Set compile-command in Emacs
- * get_bundle_versions.sh: Use different error codes for different failures
- * get_bundle_versions.sh: Remove unneeded '.' in JPEG version
- * get_bundle_versions.sh: shellcheck: Double-quote variable references (SC2086)
- * get_bundle_versions.sh: shellcheck: Drop use of cat and pass file to awk directly (SC2002)
- Related: RHEL-103209
* Wed Jul 09 2025 Antonio Vieiro <avieirov@redhat.com> - 1:21.0.8.0.1-0.1.ea
- Add script to obtain bundled library versions from OpenJDK sources
- Related: RHEL-103209

View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh
# Copyright (C) 2025 Red Hat, Inc.
# Original written by Antonio Vieiro <avieirov@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ $# -ne 1 ]; then
echo "Usage: $0 openjdk-root-directory"
exit 1
@ -11,73 +27,84 @@ JDKROOT=$1
# Freetype
#
FREETYPE=src/java.desktop/share/native/libfreetype/include/freetype/freetype.h
if [ ! -f $JDKROOT/$FREETYPE ]; then
echo "freetype header not found!"
ABS_FREETYPE="${JDKROOT}"/"${FREETYPE}"
if [ ! -f "${ABS_FREETYPE}" ]; then
echo "Freetype header not found!"
exit 2
fi
FREETYPE_VERSION=$(cat $JDKROOT/$FREETYPE | awk '/#define FREETYPE_MAJOR/ {MAJOR=$3} /#define FREETYPE_MINOR/ {MINOR=$3} /#define FREETYPE_PATCH/ {PATCH=$3} END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}')
FREETYPE_VERSION=$(awk '/#define FREETYPE_MAJOR/ {MAJOR=$3} /#define FREETYPE_MINOR/ {MINOR=$3} /#define FREETYPE_PATCH/ {PATCH=$3} END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}' "${ABS_FREETYPE}")
echo "# Version in ${FREETYPE}"
echo "Provides: bundled(freetype) = ${FREETYPE_VERSION}"
# giflib
GIFLIB=src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h
if [ ! -f $JDKROOT/$GIFLIB ]; then
ABS_GIFLIB="${JDKROOT}"/"${GIFLIB}"
if [ ! -f "${ABS_GIFLIB}" ]; then
echo "giflib header not found!"
exit 2
exit 3
fi
GIFLIB_VERSION=$(cat $JDKROOT/$GIFLIB| awk '/#define GIFLIB_MAJOR/ {MAJOR=$3} /#define GIFLIB_MINOR/ {MINOR=$3} /#define GIFLIB_RELEASE/ {PATCH=$3} END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}')
GIFLIB_VERSION=$(awk '/#define GIFLIB_MAJOR/ {MAJOR=$3} /#define GIFLIB_MINOR/ {MINOR=$3} /#define GIFLIB_RELEASE/ {PATCH=$3} END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}' "${ABS_GIFLIB}")
echo "# Version in ${GIFLIB}"
echo "Provides: bundled(giflib) = ${GIFLIB_VERSION}"
# hatfbuzz
HARFBUZZ=src/java.desktop/share/native/libharfbuzz/hb-version.h
if [ ! -f $JDKROOT/$HARFBUZZ ]; then
echo "harfbuzz header not found!"
exit 2
ABS_HARFBUZZ="${JDKROOT}/${HARFBUZZ}"
if [ ! -f "${ABS_HARFBUZZ}" ]; then
echo "HarfBuzz header not found!"
exit 4
fi
HARFBUZZ_VERSION=$(cat $JDKROOT/$HARFBUZZ | awk '/#define HB_VERSION_MAJOR/ {MAJOR=$3} /#define HB_VERSION_MINOR/ {MINOR=$3} /#define HB_VERSION_MICRO/ {PATCH=$3} END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}')
HARFBUZZ_VERSION=$(awk '/#define HB_VERSION_MAJOR/ {MAJOR=$3} /#define HB_VERSION_MINOR/ {MINOR=$3} /#define HB_VERSION_MICRO/ {PATCH=$3} END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}' "${ABS_HARFBUZZ}")
echo "# Version in ${HARFBUZZ}"
echo "Provides: bundled(harfbuzz) = ${HARFBUZZ_VERSION}"
# lcms
LCMS=src/java.desktop/share/native/liblcms/lcms2.h
if [ ! -f $JDKROOT/$LCMS ]; then
ABS_LCMS="${JDKROOT}"/"${LCMS}"
if [ ! -f "${ABS_LCMS}" ]; then
echo "lcms header not found!"
exit 2
exit 5
fi
LCMS_VERSION=$(cat $JDKROOT/$LCMS | awk '/#define LCMS_VERSION/ { MAJOR=int($3 / 1000); REST=$3 % 1000; MINOR=int(REST / 10); PATCH=REST % 10; } END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}')
LCMS_VERSION=$(awk '/#define LCMS_VERSION/ { MAJOR=int($3 / 1000); REST=$3 % 1000; MINOR=int(REST / 10); PATCH=REST % 10; } END {printf "%s.%s.%s", MAJOR, MINOR, PATCH}' "${ABS_LCMS}")
echo "# Version in ${LCMS}"
echo "Provides: bundled(lcms2) = ${LCMS_VERSION}"
# jpeg
JPEG=src/java.desktop/share/native/libjavajpeg/jpeglib.h
if [ ! -f $JDKROOT/$JPEG ]; then
ABS_JPEG="${JDKROOT}"/"${JPEG}"
if [ ! -f "${ABS_JPEG}" ]; then
echo "jpeg header not found!"
exit 2
exit 6
fi
JPEG_VERSION=$(cat $JDKROOT/$JPEG | awk '/#define JPEG_LIB_VERSION/ { VERSION=$3; MAJOR=int(VERSION / 10); MINOR=VERSION%10; } END {printf "%s.%c", MAJOR, (MINOR+96)}')
JPEG_VERSION=$(awk '/#define JPEG_LIB_VERSION/ { VERSION=$3; MAJOR=int(VERSION / 10); MINOR=VERSION%10; } END {printf "%s%c", MAJOR, (MINOR+96)}' "${ABS_JPEG}")
echo "# Version in ${JPEG}"
echo "Provides: bundled(libjpeg) = ${JPEG_VERSION}"
# png
PNG=src/java.desktop/share/native/libsplashscreen/libpng/png.h
if [ ! -f $JDKROOT/$PNG ]; then
ABS_PNG="${JDKROOT}"/"${PNG}"
if [ ! -f "${ABS_PNG}" ]; then
echo "png header not found!"
exit 2
exit 7
fi
PNG_VERSION=$(cat $JDKROOT/$PNG | awk '/#define PNG_LIBPNG_VER_STRING/ { VERSION=$3; gsub("\"", "", VERSION) } END {print VERSION}')
PNG_VERSION=$(awk '/#define PNG_LIBPNG_VER_STRING/ { VERSION=$3; gsub("\"", "", VERSION) } END {print VERSION}' "${ABS_PNG}")
echo "# Version in ${PNG}"
echo "Provides: bundled(libpng) = ${PNG_VERSION}"
# zlib
ZLIB=src/java.base/share/native/libzip/zlib/zlib.h
if [ ! -f $JDKROOT/$ZLIB ]; then
ABS_ZLIB="${JDKROOT}"/"${ZLIB}"
if [ ! -f "${ABS_ZLIB}" ]; then
echo "zlib header not found!"
exit 2
exit 8
fi
ZLIB_VERSION=$(cat $JDKROOT/$ZLIB | awk '/#define ZLIB_VERSION/ { VERSION=$3; gsub("\"", "", VERSION) } END {print VERSION}')
ZLIB_VERSION=$(awk '/#define ZLIB_VERSION/ { VERSION=$3; gsub("\"", "", VERSION) } END {print VERSION}' "${ABS_ZLIB}")
echo "# Version in ${ZLIB}"
echo "Provides: bundled(zlib) = ${ZLIB_VERSION}"
# Local Variables:
# compile-command: "shellcheck get_bundle_versions.sh"
# fill-column: 80
# indent-tabs-mode: nil
# sh-basic-offset: 4
# End: