Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpine port #99

Merged
merged 2 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions installers/linux/alpine/tar/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
/*
* Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Amazon designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/


dependencies {
compile project(path: ':openjdksrc', configuration: 'archives')
}

ext {
// all linux distros and macos support 'uname -m'
arch = ['uname', '-m'].execute().text.trim()

switch (arch) {
case 'aarch64':
arch_alias = arch
break;
case 'x86_64':
arch_alias = 'x64'
break;
default:
throw new GradleException("${arch} is not suported")
}
}

def jdkResultingImage = "$buildRoot/src/build/linux-${arch}-normal-server-release/images/jdk"
def testResultingImage = "$buildRoot/src/build/linux-${arch}-normal-server-release/images/test"

/**
* Create a local copy of the source tree in our
* build root -- this is required since OpenJDK's
* build wants to occur inside the source tree,
* and we don't want to tamper with someone
* else's tree.
*/
task copySource(type: Copy) {
dependsOn project.configurations.compile
from tarTree(project.configurations.compile.singleFile)
into buildRoot
}

/**
* Scan the patches folder for any .patch that needs
* to be applied before start building.
*/
task applyPatches() {
dependsOn copySource
doLast {
fileTree('patches').matching {
include '*.patch'
}.each { f ->
ant.patch(patchfile: f, dir: "$buildRoot/src", strip: 0)
}
}
}

task configureBuild(type: Exec) {
dependsOn applyPatches
workingDir "$buildRoot/src"
commandLine 'bash', 'configure',
'--with-jvm-features=zgc',
"--with-version-feature=${version.major}",
'--with-freetype=bundled',
'--with-zlib=bundled',
'--with-version-opt=LTS',
"--with-version-string=${version.major}.${version.minor}.${version.security}",
"--with-version-build=${version.build}",
"--with-vendor-version-string=Corretto-${version.full}",
'--with-version-pre=',
'--with-vendor-name=Amazon.com Inc.',
'--with-vendor-url=https://aws.amazon.com/corretto/',
"--with-vendor-bug-url=https://github.com/corretto/corretto-${version.major}/issues/",
'--with-debug-level=release',
'--with-native-debug-symbols=none',
'--with-stdc++lib=static',
'--disable-warnings-as-errors'
}

task executeBuild(type: Exec) {
dependsOn configureBuild
workingDir "$buildRoot/src"
commandLine 'make', 'images'
outputs.dir jdkResultingImage
}

task importAmazonCacerts(type: Exec) {
dependsOn executeBuild
workingDir jdkResultingImage
// Default password for JSSE key store
def keystore_password = "changeit"
commandLine 'bin/keytool', '-importkeystore', '-noprompt',
'-srckeystore', "${buildRoot}/amazon-cacerts",
'-srcstorepass', keystore_password,
'-destkeystore', 'lib/security/cacerts',
'-deststorepass', keystore_password
}

task createTestImage(type: Exec) {
dependsOn executeBuild
workingDir "$buildRoot/src"
commandLine 'make','test-image-hotspot-jtreg-native','test-image-jdk-jtreg-native','test-image-hotspot-gtest'
}

task packageTestImage(type: Tar) {
dependsOn createTestImage
description 'Package test results'
archiveName "amazon-corretto-testimage-${project.version.full}-alpine-linux-${arch_alias}.tar.gz"
compression Compression.GZIP
from(testResultingImage) {
include '**'
}
into "amazon-corretto-testimage-${project.version.full}-alpine-linux-${arch_alias}"

}

task packageBuildResults(type: Tar) {
description 'Compresses the JDK image and puts the results in build/distributions.'
dependsOn packageTestImage
dependsOn importAmazonCacerts
archiveName "amazon-corretto-${project.version.full}-alpine-linux-${arch_alias}.tar.gz"
compression Compression.GZIP
from(buildRoot) {
include 'ADDITIONAL_LICENSE_INFO'
include 'ASSEMBLY_EXCEPTION'
include 'LICENSE'
include 'README.md'
include 'version.txt'
}
from(jdkResultingImage) {
include 'bin/**'
include 'conf/**'
include 'include/**'
include 'jmods/**'
include 'legal/**'
include 'lib/**'
include 'man/man1/**'
include 'release'
}
into "amazon-corretto-${project.version.full}-alpine-linux-${arch_alias}"
}

artifacts {
archives packageBuildResults
}
149 changes: 149 additions & 0 deletions installers/linux/alpine/tar/patches/zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
This patch is applied to disable implicit-fallthrough warnings on gcc7 or
higher when building the bundled version of zlib.

diff --git src/java.base/share/native/libzip/zlib/infback.c src/java.base/share/native/libzip/zlib/infback.c
index 4c8283909..1a9cc6b60 100644
--- src/java.base/share/native/libzip/zlib/infback.c
+++ src/java.base/share/native/libzip/zlib/infback.c
@@ -501,7 +501,7 @@ void FAR *out_desc;
}
Tracev((stderr, "inflate: codes ok\n"));
state->mode = LEN;
-
+ /* FALLTHROUGH */
case LEN:
/* use inflate_fast() if we have enough input and output */
if (have >= 6 && left >= 258) {
diff --git src/java.base/share/native/libzip/zlib/inflate.c src/java.base/share/native/libzip/zlib/inflate.c
index ca904e744..4abfe84a5 100644
--- src/java.base/share/native/libzip/zlib/inflate.c
+++ src/java.base/share/native/libzip/zlib/inflate.c
@@ -764,6 +764,7 @@ int flush;
CRC2(state->check, hold);
INITBITS();
state->mode = EXLEN;
+ /* FALLTHROUGH */
case EXLEN:
if (state->flags & 0x0400) {
NEEDBITS(16);
@@ -777,6 +778,7 @@ int flush;
else if (state->head != Z_NULL)
state->head->extra = Z_NULL;
state->mode = EXTRA;
+ /* FALLTHROUGH */
case EXTRA:
if (state->flags & 0x0400) {
copy = state->length;
@@ -799,6 +801,7 @@ int flush;
}
state->length = 0;
state->mode = NAME;
+ /* FALLTHROUGH */
case NAME:
if (state->flags & 0x0800) {
if (have == 0) goto inf_leave;
@@ -820,6 +823,7 @@ int flush;
state->head->name = Z_NULL;
state->length = 0;
state->mode = COMMENT;
+ /* FALLTHROUGH */
case COMMENT:
if (state->flags & 0x1000) {
if (have == 0) goto inf_leave;
@@ -840,6 +844,7 @@ int flush;
else if (state->head != Z_NULL)
state->head->comment = Z_NULL;
state->mode = HCRC;
+ /* FALLTHROUGH */
case HCRC:
if (state->flags & 0x0200) {
NEEDBITS(16);
@@ -863,6 +868,7 @@ int flush;
strm->adler = state->check = ZSWAP32(hold);
INITBITS();
state->mode = DICT;
+ /* FALLTHROUGH */
case DICT:
if (state->havedict == 0) {
RESTORE();
@@ -870,8 +876,10 @@ int flush;
}
strm->adler = state->check = adler32(0L, Z_NULL, 0);
state->mode = TYPE;
+ /* FALLTHROUGH */
case TYPE:
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
+ /* FALLTHROUGH */
case TYPEDO:
if (state->last) {
BYTEBITS();
@@ -922,8 +930,10 @@ int flush;
INITBITS();
state->mode = COPY_;
if (flush == Z_TREES) goto inf_leave;
+ /* FALLTHROUGH */
case COPY_:
state->mode = COPY;
+ /* FALLTHROUGH */
case COPY:
copy = state->length;
if (copy) {
@@ -1063,8 +1073,10 @@ int flush;
Tracev((stderr, "inflate: codes ok\n"));
state->mode = LEN_;
if (flush == Z_TREES) goto inf_leave;
+ /* FALLTHROUGH */
case LEN_:
state->mode = LEN;
+ /* FALLTHROUGH */
case LEN:
if (have >= 6 && left >= 258) {
RESTORE();
@@ -1114,6 +1126,7 @@ int flush;
}
state->extra = (unsigned)(here.op) & 15;
state->mode = LENEXT;
+ /* FALLTHROUGH */
case LENEXT:
if (state->extra) {
NEEDBITS(state->extra);
@@ -1124,6 +1137,7 @@ int flush;
Tracevv((stderr, "inflate: length %u\n", state->length));
state->was = state->length;
state->mode = DIST;
+ /* FALLTHROUGH */
case DIST:
for (;;) {
here = state->distcode[BITS(state->distbits)];
@@ -1151,6 +1165,7 @@ int flush;
state->offset = (unsigned)here.val;
state->extra = (unsigned)(here.op) & 15;
state->mode = DISTEXT;
+ /* FALLTHROUGH */
case DISTEXT:
if (state->extra) {
NEEDBITS(state->extra);
@@ -1167,6 +1182,7 @@ int flush;
#endif
Tracevv((stderr, "inflate: distance %u\n", state->offset));
state->mode = MATCH;
+ /* FALLTHROUGH */
case MATCH:
if (left == 0) goto inf_leave;
copy = out - left;
@@ -1242,6 +1258,7 @@ int flush;
}
#ifdef GUNZIP
state->mode = LENGTH;
+ /* FALLTHROUGH */
case LENGTH:
if (state->wrap && state->flags) {
NEEDBITS(32);
@@ -1255,6 +1272,7 @@ int flush;
}
#endif
state->mode = DONE;
+ /* FALLTHROUGH */
case DONE:
ret = Z_STREAM_END;
goto inf_leave;
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ if (Os.isFamily(Os.FAMILY_MAC)) {
':installers:linux:al2:docker',
':installers:linux:universal:tar',
':installers:linux:universal:rpm',
':installers:linux:universal:deb']
':installers:linux:universal:deb',
':installers:linux:alpine:tar']
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
subProjects += [':installers:windows:zip']
}
Expand Down
1 change: 1 addition & 0 deletions src/make/ReleaseFile.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ define create-info-file
$(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
$(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
$(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
$(call info-file-item, "LIBC", "$(OPENJDK_TARGET_LIBC)")
endef

# Param 1 - The file containing the MODULES list
Expand Down
11 changes: 11 additions & 0 deletions src/make/autoconf/build-aux/config.guess
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
DIR=`dirname $0`
OUT=`. $DIR/autoconf-config.guess`

# config.guess doesn't identify systems running the musl C library, and will
# instead return a string with a -gnu suffix. This block detects musl and
# modifies the string to have a -musl suffix instead.
echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
if test $? = 0; then
ldd_version=`ldd 2>&1 | head -1 | cut -f1 -d' '`
if [ x"${ldd_version}" = x"musl" ]; then
OUT=`echo $OUT | sed 's/-gnu/-musl/'`
fi
fi

# Test and fix solaris on x86_64
echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
if test $? = 0; then
Expand Down
5 changes: 5 additions & 0 deletions src/make/autoconf/build-aux/config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

DIR=`dirname $0`

if [ "$1"x = "x86_64-unknown-linux-musl"x ]; then
echo $1
exit
fi

# First, filter out everything that doesn't begin with "aarch64-"
if ! echo $* | grep '^aarch64-' >/dev/null ; then
. $DIR/autoconf-config.sub "$@"
Expand Down
3 changes: 3 additions & 0 deletions src/make/autoconf/buildjdk-spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,21 @@ IMAGES_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(IMAGES_OUT

OPENJDK_BUILD_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
OPENJDK_BUILD_CPU_LEGACY_LIB := @OPENJDK_BUILD_CPU_LEGACY_LIB@
OPENJDK_BUILD_LIBC := @OPENJDK_BUILD_LIBC@
OPENJDK_TARGET_CPU := @OPENJDK_BUILD_CPU@
OPENJDK_TARGET_CPU_ARCH := @OPENJDK_BUILD_CPU_ARCH@
OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
OPENJDK_TARGET_LIBC := @OPENJDK_BUILD_LIBC@
OPENJDK_TARGET_OS_INCLUDE_SUBDIR := @OPENJDK_BUILD_OS_INCLUDE_SUBDIR@

HOTSPOT_TARGET_OS := @HOTSPOT_BUILD_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_BUILD_OS_TYPE@
HOTSPOT_TARGET_CPU := @HOTSPOT_BUILD_CPU@
HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_BUILD_CPU_ARCH@
HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_BUILD_CPU_DEFINE@
HOTSPOT_TARGET_LIBC := @HOTSPOT_BUILD_LIBC@

CFLAGS_JDKLIB := @OPENJDK_BUILD_CFLAGS_JDKLIB@
CXXFLAGS_JDKLIB := @OPENJDK_BUILD_CXXFLAGS_JDKLIB@
Expand Down
1 change: 1 addition & 0 deletions src/make/autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ JDKOPT_SETUP_ADDRESS_SANITIZER

# Need toolchain to setup dtrace
HOTSPOT_SETUP_DTRACE
HOTSPOT_SETUP_SA
HOTSPOT_ENABLE_DISABLE_AOT
HOTSPOT_ENABLE_DISABLE_CDS
HOTSPOT_ENABLE_DISABLE_GTEST
Expand Down
Loading