### Basic OpenJDK Build Example Source: https://github.com/adoptium/temurin-build/blob/master/README.md A simple example demonstrating how to initiate an OpenJDK build using the `makejdk-any-platform` script. ```bash ./makejdk-any-platform -D jdk8u ``` -------------------------------- ### Install Cygwin and Packages Source: https://github.com/adoptium/temurin-build/wiki/Step‐by‐step:-Temurin-reproducible-verification-instructions-for-Windows-x64 Securely install Cygwin and a specific set of development packages required for building. Ensure GPG key verification for the setup executable. ```bash curl -L -O https://cygwin.com/setup-x86_64.exe curl -l -O https://cygwin.com/setup-x86_64.exe.sig # Verify download: Import "Cygwin " GPG key gpg --keyserver keyserver.ubuntu.com --recv-keys 1A698DE9E2E56300 gpg --verify setup-x86_64.exe.sig setup-x86_64.exe # Check for “Good signature” ?? setup-x86_64.exe --packages autoconf,automake,bsdtar,cmake,cpio,curl,gcc-core,git,gnupg,grep,jq,libtool,make,mingw64-x86_64-gcc-core,perl,rsync,unzip,wget,zip --download --local-install --delete-orphans --site https://mirrors.kernel.org/sourceware/cygwin/ --local-package-dir C:\cygwin_packages --root C:\cygwin64 ``` -------------------------------- ### Install Visual Studio Build Tools Source: https://github.com/adoptium/temurin-build/wiki/Temurin-reproducible-verification-instructions-for-setting-up-a-new-Windows-machine-with-the-current-required-VS2022-toolchain-(Visual-Studio-2022-LTSC-17.12.12) Run the Visual Studio Build Tools installer with specific components for C++ development, including ARM64 support. The --wait flag ensures the script pauses until installation is complete. ```bash .\vs_BuildTools.exe --nocache --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ``` -------------------------------- ### Start Docker Container for Building Source: https://github.com/adoptium/temurin-build/wiki/How-to-create-a-"reproducible-build"-on-a-Linux-OS This command starts a Docker container, mounting your local workspace and setting the working directory. Ensure you replace `` with the appropriate image name (e.g., adoptopenjdk/centos6_build_image). ```bash mkdir workspace docker run -it -u=$(id -u):$(id -g) -w $(pwd)/workspace -v $(pwd)/workspace:$(pwd)/workspace bash ``` -------------------------------- ### Install Visual Studio Build Tools Interactively Source: https://github.com/adoptium/temurin-build/wiki/Eclipse-Temurin-Windows-Visual-Studio,-Toolset,-SDK-and-ReDist-versions Use this command to install Visual Studio Build Tools interactively, specifying the necessary components for Temurin builds. Ensure you have the correct version of Visual Studio installed. ```bash vs_BuildTools.exe --nocache --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ``` -------------------------------- ### Example comparable_patch.sh execution with specific parameters Source: https://github.com/adoptium/temurin-build/blob/master/tooling/reproducible/ReproducibleBuilds.md An example of how to run the comparable_patch.sh script with concrete values for JDK directory, version, and vendor information. This is useful for testing vendor branding neutrality. ```bash bash ./comparable_patch.sh --jdk-dir "jdk1/jdk-21.0.1+12" --version-string "Temurin-21.0.1+12" --vendor-name "Eclipse Adoptium" --vendor_url "https://adoptium.net/" --vendor-bug-url "https://github.com/adoptium/adoptium-support/issues" --vendor-vm-bug-url "https://github.com/adoptium/adoptium-support/issues" ``` -------------------------------- ### Alpine Package APKBUILD File Example Source: https://github.com/adoptium/temurin-build/wiki/Temurin-Release-Guide This example shows modifications to the Alpine Linux 'APKBUILD' file, specifically for 'pkgver' and checksum values. ```shell pkgver=11.0.20.1 checksum="sha256--..." ``` -------------------------------- ### Download Visual Studio Build Tools Installer Source: https://github.com/adoptium/temurin-build/wiki/Temurin-reproducible-verification-instructions-for-setting-up-a-new-Windows-machine-with-the-current-required-VS2022-toolchain-(Visual-Studio-2022-LTSC-17.12.12) Use curl to download the Visual Studio Build Tools installer. Ensure the downloaded file is executable. ```bash curl -LO https://download.visualstudio.microsoft.com/download/pr/8eb6bd5d-4ec9-4328-a0e7-f59e7e51fdca/9b748c66ba6a2b22f346cc113f354ded3b202b53a109fff93111167741acb6c1/vs_BuildTools.exe attrib +x vs_BuildTools.exe ``` -------------------------------- ### Debian Package Rules File Example Source: https://github.com/adoptium/temurin-build/wiki/Temurin-Release-Guide This example shows a snippet from the Debian 'rules' file, which contains URLs and checksums for each package. The 'changelog' file should also be updated for new versions. ```makefile override_dh_auto_install: # Install the package $(call install-package,temurin-11-jdk_11.0.20.1_amd64.deb) # Override dh_install to install the package install: $(call install-package,temurin-11-jdk_11.0.20.1_amd64.deb) ``` -------------------------------- ### Install Windows 11 SDK Source: https://github.com/adoptium/temurin-build/wiki/Temurin-reproducible-verification-instructions-for-building-current-Windows-ReDist-DevKit-DLL-package-(vs2022_redist_14.40.33807_10.0.26100.1742) Installs the Windows 11 SDK version 10.0.26100.1742. This is a prerequisite for the DevKit. ```bash ./winsdksetup.exe ``` -------------------------------- ### Custom Build Directory and Source Location Source: https://github.com/adoptium/temurin-build/blob/master/README.md Example for configuring custom source and build directories, along with a specific JDK version and target file name. ```bash ./makejdk-any-platform.sh -J /usr/lib/jvm/jdk-10.0.2 -s $HOME/openjdk-jdk11u/src -d $HOME/openjdk-jdk11u/build -T MyOpenJDK11.tar.gz jdk11u ``` -------------------------------- ### Start Docker Build Container Source: https://github.com/adoptium/temurin-build/wiki/Building-OpenJDK-using-temurin-build-scripts-within-the-adopt-build-docker-container Initiates a Docker container for building, mounting a local workspace and setting the working directory. Substitute /.path./workspace with the actual path to your workspace. ```bash docker run -it -u=$(id -u):$(id -g) -w /.path./workspace -v /.path./workspace:/.path./workspace bash ``` -------------------------------- ### Red Hat/SuSE Package Spec File Example Source: https://github.com/adoptium/temurin-build/wiki/Temurin-Release-Guide This example illustrates modifications to a 'temurin--jdk.spec' file for Red Hat/SuSE packaging. Links and checksums are defined as 'Source' variables. ```spec Source0: https://github.com/adoptium/temurin-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.20.1_1.tar.gz Source1: https://github.com/adoptium/temurin-binaries/releases/download/jdk-11.0.20.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.20.1_1.tar.gz.sha256.txt ``` -------------------------------- ### Example Website Banner Change for Releases Source: https://github.com/adoptium/temurin-build/blob/master/RELEASING.md This example demonstrates a code change for adding a banner to the website to announce upcoming releases. It shows a diff view of the changes made to a specific file. ```diff Add a banner to the website to indicate that the releases are coming in the near future ([Example Change](https://github.com/adoptium/adoptium.net/pull/192/files#diff-6b08211ad4b7a58e27314a896bfb15679d0c3fb026b512ce562b434a02ec4f7a)). ``` -------------------------------- ### Example PR: Adding Configure Flag for OpenJ9 on AIX Source: https://github.com/adoptium/temurin-build/blob/master/FAQ.md This pull request illustrates adding a new configure flag for OpenJ9 specifically on all AIX machines. ```diff https://github.com/adoptium/temurin-build/pull/1442/files ``` -------------------------------- ### Install Visual Studio Build Tools Source: https://github.com/adoptium/temurin-build/wiki/Temurin-reproducible-verification-instructions-for-building-current-Windows-ReDist-DevKit-DLL-package-(vs2022_redist_14.40.33807_10.0.26100.1742) Installs Visual Studio 2022 Build Tools with native desktop and C++ components. Use --passive for unattended installation. ```bash ./vs_BuildTools.exe --passive --norestart --wait --arch all --add "Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended;includeOptional" --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ``` -------------------------------- ### Initialize Vendor Repositories and Directories Source: https://github.com/adoptium/temurin-build/blob/master/SmokeTesting.md Use the get.sh script to initialize vendor repositories and specify directories for testing. Ensure vendor parameters are passed correctly. ```bash ./get.sh --vendor_repos https://github.com/adoptium/temurin-build --vendor_branches master --vendor_dirs /test/functional ``` -------------------------------- ### Building from a Non-Adoptium Repository Source: https://github.com/adoptium/temurin-build/blob/master/README.md Demonstrates how to build OpenJDK from a specified Git repository and branch using the `-r` and `-b` flags. ```bash ./makejdk-any-platform.sh -r https://github.com/sxa/openjdk-jdk8u -b main -J /usr/lib/jvm/java-1.7.0 jdk8u ``` -------------------------------- ### Configured Release Build Version Source: https://github.com/adoptium/temurin-build/wiki/A-Conversation-about-versions-and-setting-them-in-build-configuration This example demonstrates how to configure the build for a specific update and build number, removing the "-internal" tag. Assertive configuration is required for release-ready binaries. ```bash # bash ./configure --with-update-version=972 --with-build-number=b41 --with-milestone="snapshot" # make clean; make all # build/linux-x86_64-normal-server-release/jdk/bin/java -version openjdk version "1.8.0_972-snapshot" OpenJDK Runtime Environment (build 1.8.0_972-snapshot-b41) OpenJDK 64-Bit Server VM (build 25.972-b41, mixed mode) ``` -------------------------------- ### Install Build Dependencies (Linux) Source: https://github.com/adoptium/temurin-build/blob/master/FAQ.md Installs essential development libraries required for building the JDK on a Linux system. Ensure you have sudo privileges. ```bash sudo apt-get install libfontconfig1-dev ``` ```bash sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev ``` ```bash sudo apt-get install libasound2-dev ``` ```bash sudo apt-get install libcups2-dev ``` -------------------------------- ### Example AWK Filtered Output Source: https://github.com/adoptium/temurin-build/blob/master/SOLARIS.md This is an example of the output you can expect when using the AWK command to diagnose test failures. It highlights the 'FAILED test targets' section. ```text 12:42:00 PASSED test targets: 12:42:00 jdk_lang_0 - Test results: passed: 474 12:42:00 12:42:00 FAILED test targets: 12:42:00 jdk_security3_0 - Test results: passed: 606; failed: 1 12:42:00 Failed test cases: 12:42:00 TEST: sun/security/ssl/X509TrustManagerImpl/Entrust/Distrust.java 12:42:00 12:42:00 jdk_util_0 - Test results: passed: 675; failed: 2 12:42:00 Failed test cases: 12:42:00 TEST: java/util/Currency/ValidateISO4217.java 12:42:00 TEST: java/util/TimeZone/AssureTzdataVersion.java ``` -------------------------------- ### Build JDK Natively Source: https://github.com/adoptium/temurin-build/blob/master/README.md Use this script to build a JDK natively on your system. Ensure prerequisites are installed. The -J parameter specifies the boot JDK, and the build variant defaults to HotSpot if omitted. ```bash ./makejdk-any-platform.sh (-J /usr/lib/jvm/jdk-xx) (--build-variant ) ``` ```bash ./makejdk-any-platform.sh -J /usr/lib/jvm/jdk-10.0.2 --build-variant hotspot jdk11u ``` -------------------------------- ### Example API Request for Temurin Releases Source: https://github.com/adoptium/temurin-build/wiki/Temurin-Release-Guide This is an example of an API request to retrieve Temurin release information. Ensure the API is returning the correct data and metadata files are uploaded. ```json https://api.adoptium.net/v3/assets/feature_releases/17/ga?architecture=x64&heap_size=normal&image_type=jre&jvm_impl=hotspot&os=linux&page=0&page_size=10&project=jdk&sort_method=DEFAULT&sort_order=DESC&vendor=eclipse ``` -------------------------------- ### Jenkins Pipeline Script Example Source: https://github.com/adoptium/temurin-build/blob/master/SOLARIS.md This is an example of an inline pipeline script used in the -simplepipe jobs. It outlines the stages involved in the build process, including build, signing, and testing. ```groovy pipeline { agent any stages { stage('build') { steps { echo 'Invokes the -simple build job' } } stage('sign_sbom_jsf') { steps { echo 'Signing SBOM JSF' } } stage('sign_temurin_gpg') { steps { echo 'Signing with GPG' } } stage('test') { steps { echo 'Invokes the -simpletest job' } } stage('release') { steps { echo 'Releasing artifacts' } } } } ``` -------------------------------- ### Running the Release Pipeline for Point Releases Source: https://github.com/adoptium/temurin-build/wiki/Temurin-Release-Guide Execute the release-openjdkXX-pipeline with specific parameters for a point release, including the new _adopt tag as scmReference and version build adjustments. ```bash release-openjdkXX-pipeline \ --scmReference jdk-21.0.1+12.1_adopt \ --additionalConfigureArgs "--with-version-build=12" \ --aqaReference \ --targetConfigurations ``` -------------------------------- ### Run Windows Reproducible Build Verification Source: https://github.com/adoptium/temurin-build/wiki/Step‐by‐step:-Temurin-reproducible-verification-instructions-for-Windows-x64 Execute the 'windows_repro_build_compare.sh' script from the temurin-build tooling directory. Provide the SBOM URL, JDK URL, report directory, and the location of the user-created DevKit. The --reproducible-verification flag is crucial. ```bash cd temurin-build/blob/master/tooling/reproducible mkdir report bash ./windows_repro_build_compare.sh --sbom-url [SBOM_URL] --jdk-url [JDK_URL] --report-dir report --user-devkit-location [REDIST_DEVKIT_URL|LOCATION] --reproducible-verification ``` -------------------------------- ### Display Java Version Source: https://github.com/adoptium/temurin-build/wiki/A-Conversation-about-versions-and-setting-them-in-build-configuration Use the `java -version` command to display the installed Java version information. ```bash java -version ``` -------------------------------- ### Shell Script for Build Job Setup Source: https://github.com/adoptium/temurin-build/blob/master/SOLARIS.md This shell script snippet illustrates the process within a build job on a proxy machine. It includes creating metadata, establishing an SSH connection to the target Solaris machine, cloning the repository, and running the build script. ```shell # createMetaDataFile() is required by the SBOM generation createMetaDataFile() # Set some variables export BUILD_ID=dontKillMe # ssh into the target machine ssh solarisbuild@${SOLARIS_HOST} << EOF # clone temurin-build git clone https://github.com/adoptium/temurin-build.git cd temurin-build # run make-adopt-build-farm.sh ./make-adopt-build-farm.sh -p solaris -a x64 -t temurin -b 8u -d /var/tmp/jdk8u-solaris-x64-temurin EOF # copy contents of workspace/target back to the proxy machine scp -r solarisbuild@${SOLARIS_HOST}:/var/tmp/jdk8u-solaris-x64-temurin/target/* workspace/target/ # create sha256.txt and the metadata file sha256sum workspace/target/* > workspace/target/sha256.txt createMetaDataFile() # create a filenames.txt file find workspace/target -type f -printf "%f\n" > workspace/target/filenames.txt ``` -------------------------------- ### Clone OpenJDK Source Code Source: https://github.com/adoptium/temurin-build/blob/master/docker/README.md Use this command to clone the OpenJDK source code repository. Ensure you have Git installed. ```bash git clone git@github.com:adoptium/openjdk-jdk8u.git ~/adoptium/openjdk-jdk8u ```