summaryrefslogtreecommitdiff
path: root/data/openjdk/make.sh
blob: 358750e3a353957ee197dffa8b7ea528791d2ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
pkg:extract

_VERSION="$(cat ${PKG_DATA}/_metadata/version)"
_INSTALL="${PKG_TAPF}/openjdk-${_VERSION}"

target_args=(
'--enable-option-checking=fatal'
"--openjdk-target=${PKG_TARG}"
'--disable-warnings-as-errors'
'--enable-headless-only'
'--with-jdk-variant=normal'
'--with-jvm-variants=zero'
'--disable-hotspot-gtest'
'--disable-precompiled-headers'
"--with-cups-include=${PKG_WORK}/cups"
"--with-sysroot=${PKG_ROOT}"
'--with-debug-level=release'
'--enable-unlimited-crypto'
# Repo info (Remove me for eluc.):
#'--with-vendor-name=Athena'
#'--with-vendor-url=MCApollo@protonmail.com'
#'--with-vendor-bug-url=None'
#'--with-vendor-vm-bug-url=None'
"--with-version-build=${_VERSION}"
'--with-version-pre=""'
'--with-version-opt=""'
)

unset IPHONEOS_DEPLOYMENT_TARGET
# Build for host.
cd openjdk-*
chmod +x ./configure
if [[ -z "${_USE_JDK}" ]]; then
./configure --with-jvm-variants=client	|| \
	(
	echo "If you're missing java or dependencies try:"
	echo "	brew tap caskroom/versions"
	echo "	brew update"
	echo "	brew cask install adoptopenjdk11"
	echo "Or brew install libtiff, libffi, libpng, etc."
	exit 1
	)
env -i PATH=$PATH make JOBS=2 LOG=info  # => env vars causes errors.
# Build for target.
JDK=$(realpath build/*)
else
# Debug variable:
JDK="${_USE_JDK}"
fi
pkg:patch
rm -rf build/.configure-support
./configure ${target_args[@]} --with-build-jdk="${JDK}/jdk" --with-boot-jdk="${JDK}/jdk"	\
	--with-extra-ldflags="-framework Foundation" --with-extra-cflags="-D_DARWIN_FEATURE_64_BIT_INODE=1 -DDEFAULT_LIBPATH=\"/lib:/usr/lib:/usr/local/lib:${PKG_TAPF}/lib\" "
cd build/macosx-aarch64-*
#  Hacky way to switch to the custom target- avoid some macosx only things.
sed	-e "s|OPENJDK_TARGET_OS:=macosx|OPENJDK_TARGET_OS:=ios|"			\
	-e "s|OPENJDK_TARGET_OS_ENV:=macosx|OPENJDK_TARGET_OS_ENV:=ios|"		\
	-e "s|OPENJDK_TARGET_OS_UPPERCASE:=IOS|OPENJDK_TARGET_OS_UPPERCASE:=IOS|"	\
	-i spec.gmk
make images JOBS=2 LOG=info COMPRESS_JARS=true
# Install
pkg: mkdir -p "${_INSTALL}"
pkg: mkdir -p "${PKG_TAPF}"/bin
cp -Rv images/jdk/* "${PKG_DEST}/${_INSTALL}"
# Install cleanup
rm -rf $(find "${PKG_DEST}/${_INSTALL}" -iname '*.dSYM')
ln -rs "${PKG_DEST}/${_INSTALL}"/bin/* "${PKG_DEST}/${PKG_TAPF}"/bin/
rm -rf "${PKG_DEST}/${_INSTALL}"/{demo,legal,man}
# Reduce filesize.
rm "${PKG_DEST}/${_INSTALL}"/bin/jconsole
rm "${PKG_DEST}/${_INSTALL}"/lib/src.zip