diff --git a/doc/building.html b/doc/building.html
index 5f615f9d4ef..8774e5562d6 100644
--- a/doc/building.html
+++ b/doc/building.html
@@ -78,6 +78,7 @@
Build Performancesudo apt-get install build-essential
For rpm-based distributions (Fedora, Red Hat, etc), try this:
sudo yum groupinstall "Development Tools"
+For Alpine Linux, aside from basic tooling, install the GNU versions of some programs:
+sudo apk add build-base bash grep zip
AIX
Please consult the AIX section of the Supported Build Platforms OpenJDK Build Wiki page for details about which versions of AIX are supported.
@@ -313,6 +316,7 @@
- To install on an apt-based Linux, try running
sudo apt-get install libfreetype6-dev.
- To install on an rpm-based Linux, try running
sudo yum install freetype-devel.
+- To install on Alpine Linux, try running
sudo apk add freetype-dev.
Use --with-freetype-include=<path> and --with-freetype-lib=<path> if configure does not automatically locate the platform FreeType files.
CUPS
@@ -320,6 +324,7 @@
- To install on an apt-based Linux, try running
sudo apt-get install libcups2-dev.
- To install on an rpm-based Linux, try running
sudo yum install cups-devel.
+- To install on Alpine Linux, try running
sudo apk add cups-dev.
Use --with-cups=<path> if configure does not properly locate your CUPS files.
X11
@@ -327,6 +332,7 @@
- To install on an apt-based Linux, try running
sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev.
- To install on an rpm-based Linux, try running
sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel.
+- To install on Alpine Linux, try running
sudo apk add libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev.
Use --with-x=<path> if configure does not properly locate your X11 files.
ALSA
@@ -334,6 +340,7 @@
- To install on an apt-based Linux, try running
sudo apt-get install libasound2-dev.
- To install on an rpm-based Linux, try running
sudo yum install alsa-lib-devel.
+- To install on Alpine Linux, try running
sudo apk add alsa-lib-dev.
Use --with-alsa=<path> if configure does not properly locate your ALSA files.
libffi
@@ -341,6 +348,7 @@
- To install on an apt-based Linux, try running
sudo apt-get install libffi-dev.
- To install on an rpm-based Linux, try running
sudo yum install libffi-devel.
+- To install on Alpine Linux, try running
sudo apk add libffi-dev.
Use --with-libffi=<path> if configure does not properly locate your libffi files.
@@ -349,6 +357,7 @@
- To install on an apt-based Linux, try running
sudo apt-get install autoconf.
- To install on an rpm-based Linux, try running
sudo yum install autoconf.
+- To install on Alpine Linux, try running
sudo apk add autoconf.
- To install on macOS, try running
brew install autoconf.
- To install on Windows, try running
<path to Cygwin setup>/setup-x86_64 -q -P autoconf.
@@ -688,6 +697,15 @@ ls build/linux-aarch64-normal-server-release/
Additional architectures might be supported by Debian/Ubuntu Ports.
Building for ARM/aarch64
A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using --with-abi-profile: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported by the JDK.
+Building for musl
+Just like it's possible to cross-compile for a different CPU, it's possible to cross-compile for musl libc on a glibc-based build system. A devkit suitable for most target CPU architectures can be obtained from musl.cc. After installing the required packages in the sysroot, configure the build with --openjdk-target:
+sh ./configure --with-jvm-variants=server \
+--with-boot-jdk=$BOOT_JDK \
+--with-build-jdk=$BUILD_JDK \
+--openjdk-target=x86_64-unknown-linux-musl \
+--with-devkit=$DEVKIT \
+--with-sysroot=$SYSROOT
+and run make normally.
Verifying the Build
The build will end up in a directory named like build/linux-arm-normal-server-release.
Inside this build output directory, the images/jdk will contain the newly built JDK, for your target system.
diff --git a/doc/building.md b/doc/building.md
index 47fa445998d..fa6b0ae31b6 100644
--- a/doc/building.md
+++ b/doc/building.md
@@ -273,6 +273,13 @@ For rpm-based distributions (Fedora, Red Hat, etc), try this:
sudo yum groupinstall "Development Tools"
```
+For Alpine Linux, aside from basic tooling, install the GNU versions of some
+programs:
+
+```
+sudo apk add build-base bash grep zip
+```
+
### AIX
Please consult the AIX section of the [Supported Build Platforms](
@@ -431,6 +438,7 @@ rather than bundling the JDK's own copy.
libfreetype6-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
freetype-devel`.
+ * To install on Alpine Linux, try running `sudo apk add freetype-dev`.
Use `--with-freetype-include=` and `--with-freetype-lib=`
if `configure` does not automatically locate the platform FreeType files.
@@ -445,6 +453,7 @@ your operating system.
libcups2-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
cups-devel`.
+ * To install on Alpine Linux, try running `sudo apk add cups-dev`.
Use `--with-cups=` if `configure` does not properly locate your CUPS
files.
@@ -458,6 +467,8 @@ Linux.
libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel`.
+ * To install on Alpine Linux, try running `sudo apk add libx11-dev
+ libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev`.
Use `--with-x=` if `configure` does not properly locate your X11 files.
@@ -470,6 +481,7 @@ required on Linux. At least version 0.9.1 of ALSA is required.
libasound2-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
alsa-lib-devel`.
+ * To install on Alpine Linux, try running `sudo apk add alsa-lib-dev`.
Use `--with-alsa=` if `configure` does not properly locate your ALSA
files.
@@ -484,6 +496,7 @@ Hotspot.
libffi-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
libffi-devel`.
+ * To install on Alpine Linux, try running `sudo apk add libffi-dev`.
Use `--with-libffi=` if `configure` does not properly locate your libffi
files.
@@ -499,6 +512,7 @@ platforms. At least version 2.69 is required.
autoconf`.
* To install on an rpm-based Linux, try running `sudo yum install
autoconf`.
+ * To install on Alpine Linux, try running `sudo apk add autoconf`.
* To install on macOS, try running `brew install autoconf`.
* To install on Windows, try running `/setup-x86_64 -q
-P autoconf`.
@@ -1113,6 +1127,25 @@ available using `--with-abi-profile`: arm-vfp-sflt, arm-vfp-hflt, arm-sflt,
armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer
properly supported by the JDK.
+### Building for musl
+
+Just like it's possible to cross-compile for a different CPU, it's possible to
+cross-compile for musl libc on a glibc-based *build* system.
+A devkit suitable for most target CPU architectures can be obtained from
+[musl.cc](https://musl.cc). After installing the required packages in the
+sysroot, configure the build with `--openjdk-target`:
+
+```
+sh ./configure --with-jvm-variants=server \
+--with-boot-jdk=$BOOT_JDK \
+--with-build-jdk=$BUILD_JDK \
+--openjdk-target=x86_64-unknown-linux-musl \
+--with-devkit=$DEVKIT \
+--with-sysroot=$SYSROOT
+```
+
+and run `make` normally.
+
### Verifying the Build
The build will end up in a directory named like