JDK 19+21 early-access build is reproducible
John Neffenger
john at status6.com
Sun May 8 16:47:28 UTC 2022
On 5/8/22 7:42 AM, Bernhard M. Wiedemann wrote:
> however building JDK is still hard, so
I admit I've been doing it for a long time, but I find OpenJDK, after
about version 9, to be one of the easiest open-source projects to build.
You might be picking up any old Java version on your system to use in
the build. Instead, set the JAVA_HOME environment variable explicitly to
the Boot JDK, described below.
An explanation of the build procedure is found here:
Building the JDK
https://github.com/openjdk/jdk/blob/master/doc/building.md
Pay particular attention to the main heading called "Reproducible
Builds." It suggests starting with a build script as follows:
==================================================
export SOURCE_DATE_EPOCH=946684800
bash configure --with-version-opt=adhoc
make
==================================================
The exact script I'm using is a "scriptlet" that can run under either
the Bash or Dash shell and is found in the section called
'override-build' in this YAML file:
https://github.com/jgneff/openjdk/blob/edge/snap/snapcraft.yaml#L123
and contains:
==================================================
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
export SOURCE_DATE_EPOCH
# Option '--enable-warnings-as-errors=no' for armhf
bash configure \
--enable-warnings-as-errors=no \
--enable-javac-server=no \
--with-vendor-name="Snap Build" \
--with-vendor-url="https://snapcraft.io/openjdk" \
--with-vendor-bug-url="https://github.com/jgneff/openjdk/issues" \
--with-version-pre=ea \
--with-version-opt=snap \
--with-version-build="${SNAPCRAFT_PROJECT_VERSION#*+}" \
--with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CXXFLAGS" \
--with-extra-ldflags="$LDFLAGS" \
--with-native-debug-symbols=none
make images docs
cd build/linux-*-server-release/images || exit
mv jdk docs "$SNAPCRAFT_PART_INSTALL"
==================================================
The package dependencies are listed under the section 'build-packages',
and the only environment variable you might want to set is JAVA_HOME,
which points to the Boot JDK. The minimum version required for the Boot
JDK is either the previous version or, for an early-access build, the
most recently released version.
Note: For reproducible builds, you must build JDK 19+21 or later with
JDK 19+21 or later.
John
More information about the rb-general
mailing list