Skip to content

Commit

Permalink
making local alsa properly optional (#3756)
Browse files Browse the repository at this point in the history
* Fixed issue when downloaded alsa was used only for jdk8

* Made download (and its usage) of alsa optional

* Update sbin/prepareWorkspace.sh

Co-authored-by: Martijn Verburg <martijnverburg@gmail.com>

* s/skip/Skip in makejdk-any-platform.1

Co-authored-by: Martijn Verburg <martijnverburg@gmail.com>

---------

Co-authored-by: Martijn Verburg <martijnverburg@gmail.com>
  • Loading branch information
judovana and karianna authored May 1, 2024
1 parent bc0709a commit 48a734d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
6 changes: 6 additions & 0 deletions makejdk-any-platform.1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ Build JDK (tip), defaults to https://github.com/adoptium/jdk

.SH OPTIONS
.TP
.BR \-A ", " \-\-skip-alsa
Skip downloading of alsa automatically.
If you do so, the underlying configure will detect system lib and headers.
If you wish to point to some custom build/install pass it via \fI\-C, \-\-configure-args <args>\fR
Presence of \-\-with-alsa in \-\-configure-args will also not include freshly installed alsa to build.
.TP
.BR \-b ", " \-\-branch " " \fI<branch>\fR
specify a custom branch to build from, e.g. dev.
For reference, Adoptium GitHub source repos default to the \fI<dev>\fR
Expand Down
10 changes: 9 additions & 1 deletion sbin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ buildingTheRestOfTheConfigParameters() {

if [ "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" == "${JDK8_CORE_VERSION}" ]; then
addConfigureArg "--with-x=" "/usr/include/X11"
addConfigureArg "--with-alsa=" "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/installedalsa"
fi
}

Expand All @@ -505,6 +504,14 @@ configureDebugParameters() {
fi
}

configureAlsaLocation() {
if [[ ! "${CONFIGURE_ARGS}" =~ "--with-alsa" ]]; then
if [[ "${BUILD_CONFIG[ALSA]}" == "true" ]]; then
addConfigureArg "--with-alsa=" "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/installedalsa"
fi
fi
}

configureFreetypeLocation() {
if [[ ! "${CONFIGURE_ARGS}" =~ "--with-freetype" ]]; then
if [[ "${BUILD_CONFIG[FREETYPE]}" == "true" ]]; then
Expand Down Expand Up @@ -551,6 +558,7 @@ configureCommandParameters() {
else
echo "Building up the configure command..."
buildingTheRestOfTheConfigParameters
configureAlsaLocation
fi

echo "Adjust configure for reproducible build"
Expand Down
7 changes: 6 additions & 1 deletion sbin/common/config_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
CONFIG_PARAMS=(
ADOPTIUM_DEVKIT_LOCATION
ADOPT_PATCHES
ALSA
ASSEMBLE_EXPLODED_IMAGE
OPENJDK_BUILD_REPO_BRANCH
OPENJDK_BUILD_REPO_URI
Expand Down Expand Up @@ -297,6 +298,9 @@ function parseConfigurationArguments() {
"--skip-freetype" | "-F" )
BUILD_CONFIG[FREETYPE]=false;;

"--skip-alsa" | "-A" )
BUILD_CONFIG[ALSA]=false;;

"--help" | "-h" )
man ./makejdk-any-platform.1 && exit 0;;

Expand Down Expand Up @@ -477,7 +481,8 @@ function configDefaults() {

BUILD_CONFIG[COPY_MACOSX_FREE_FONT_LIB_FOR_JDK_FLAG]="false"
BUILD_CONFIG[COPY_MACOSX_FREE_FONT_LIB_FOR_JRE_FLAG]="false"
BUILD_CONFIG[FREETYPE]=true
BUILD_CONFIG[ALSA]="true"
BUILD_CONFIG[FREETYPE]="true"
BUILD_CONFIG[FREETYPE_DIRECTORY]=""
BUILD_CONFIG[FREETYPE_FONT_VERSION]="86bc8a95056c97a810986434a3f268cbe67f2902" # 2.9.1
BUILD_CONFIG[FREETYPE_FONT_BUILD_TYPE_PARAM]=""
Expand Down
9 changes: 8 additions & 1 deletion sbin/prepareWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ createWorkspace() {

# ALSA first for sound
checkingAndDownloadingAlsa() {

cd "${BUILD_CONFIG[WORKSPACE_DIR]}/libs/" || exit

echo "Checking for ALSA"
Expand Down Expand Up @@ -667,7 +668,13 @@ downloadingRequiredDependencies() {
echo "Non-Linux-based environment detected, skipping download of dependency Alsa."
else
echo "Checking and downloading Alsa dependency because OSTYPE=\"${OSTYPE}\""
checkingAndDownloadingAlsa
if [[ "${BUILD_CONFIG[ALSA]}" == "true" ]]; then
checkingAndDownloadingAlsa
else
echo ""
echo "---> Skipping the process of checking and downloading the Alsa dependency, a pre-built version should be provided via -C/--configure-args <---"
echo ""
fi
fi

if [[ "${BUILD_CONFIG[FREETYPE]}" == "true" ]]; then
Expand Down

0 comments on commit 48a734d

Please sign in to comment.