chiark / gitweb /
fixes x86_64 because it has lib64 in sysroot...
[termux-packages] / disabled-packages / openjdk-9-jre-headless / build.sh
CommitLineData
ffcb22f1 1TERMUX_PKG_HOMEPAGE=http://openjdk.java.net
efb97f17 2TERMUX_PKG_DESCRIPTION="OpenJDK 9 Java Runtime Environment (prerelease)"
9a92118f 3_jbuild=181
ffcb22f1 4_hg_tag="jdk-9+${_jbuild}"
d4b5d52c 5_jvm_dir="lib/jvm/openjdk-9"
9a92118f 6TERMUX_PKG_VERSION="9.2017.8.20"
efb97f17
VB
7TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
8TERMUX_PKG_HOMEPAGE=http://openjdk.java.net/projects/jdk9
d4b5d52c
VB
9TERMUX_PKG_DEPENDS="freetype, libpng, ca-certificates-java"
10TERMUX_PKG_CONFFILES="$_jvm_dir/lib/jvm.cfg"
b8589503 11TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
1f3323ce 12--disable-aot
b8589503
FF
13--disable-hotspot-gtest
14--disable-option-checking
15--disable-warnings-as-errors
16--enable-headless-only
77b0e696 17--with-freetype=$TERMUX_PREFIX
b8589503
FF
18--with-libpng=system
19--with-zlib=system
d4b5d52c 20--with-jdk-variant=normal
1f3323ce 21--with-jvm-variants=server
b8589503 22"
ffcb22f1 23TERMUX_PKG_CLANG=no
d4b5d52c 24TERMUX_PKG_RM_AFTER_INSTALL="$_jvm_dir/demo $_jvm_dir/sample"
9a92118f 25_cups_ver=2.2.4
26
27changesets=('e5455438db96'
28 '5666eba44ac6'
29 '8076a7391ba0'
30 '17bb8a98d5e3'
31 'a1d64f45f9d5'
32 '364631d8ff2e'
33 '65bfdabaab9c'
34 '17cc754c8936')
35
36sha256sums=('c759faa5bff4b3d7bcf87dce57e9d1a39600ef67ec68f96d6d12d07b1bf773ce'
37 '34518bf8b27aa893f834f8f81293ac0e04a210ee4f2e11bb2c89331f87912d96'
38 '3b649e34e2a1c8758c6311931d201a38432088ccb86a720afb1cb99fe193537f'
39 'bb330b8b516178304dc11c755994db20eccc696ae5c2a16b04a4a67b20b33b79'
40 'a213ebc4bf896c55855761891932a19f42ad5276d3fd155cfb604b27f4866d9d'
41 '0bc1953e9f23d59dafc415a7a37ff2da23cf8782e0532e253a6d7d63aa0ea954'
42 '739a5d275db4a2a81cf3c3ca17a78212b8c47092e5c10888b79e9599dd9dcc2d'
43 'fbc9b49a7f0fa1723e369d91068d51a11de40e931f281a3ed9650484b437cc7f'
44 '596d4db72651c335469ae5f37b0da72ac9f97d73e30838d787065f559dea98cc')
77b0e696
VB
45
46reponames=(dev corba hotspot jdk jaxws jaxp langtools nashorn cups)
47
48_url_src=http://hg.openjdk.java.net/mobile/dev
49
50TERMUX_PKG_SRCURL=$_url_src/archive/${changesets[0]}.tar.bz2
51TERMUX_PKG_SHA256=${sha256sums[0]}
52TERMUX_PKG_FOLDERNAME=dev-${changesets[0]}
ffcb22f1
VB
53
54termux_step_post_extract_package () {
77b0e696
VB
55 cd "$TERMUX_PKG_TMPDIR"
56 # download and extract repo archives
57 for index in {1..7}; do
58 local sum=${sha256sums[index]}
59 local repo=${reponames[index]}
60 local change=${changesets[index]}
61 local file=$TERMUX_PKG_CACHEDIR/$repo-$change.tar.bz2
62 local url=${_url_src}/$repo/archive/$change.tar.bz2
63
64 termux_download $url $file $sum
2f122eed 65 tar xf $file -C $TERMUX_PKG_SRCDIR
77b0e696 66 mv $TERMUX_PKG_SRCDIR/$repo-$change $TERMUX_PKG_SRCDIR/$repo
ffcb22f1
VB
67 done
68
77b0e696
VB
69 # setup cups source dir
70 file=$TERMUX_PKG_CACHEDIR/cups-$_cups_ver-source.tar.gz
71 url="https://github.com/apple/cups/releases/download/v$_cups_ver/`basename $file`"
72 termux_download $url $file ${sha256sums[8]}
2f122eed 73 tar xf $file -C $TERMUX_PKG_SRCDIR
77b0e696
VB
74}
75
d4b5d52c 76# override this step to since openjdk provides its own customized guess scripts
77b0e696
VB
77termux_step_replace_guess_scripts () {
78 return
ffcb22f1
VB
79}
80
81termux_step_pre_configure () {
77b0e696
VB
82 TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-cups-include=$TERMUX_PKG_SRCDIR/cups-$_cups_ver"
83
9a92118f 84 ln -sf $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/libc.so $TERMUX_PKG_TMPDIR/libpthread.so
85
ffcb22f1
VB
86 cat > "$TERMUX_STANDALONE_TOOLCHAIN/devkit.info" <<HERE
87DEVKIT_NAME="Android ${TERMUX_ARCH^^}"
88DEVKIT_TOOLCHAIN_PATH="\$DEVKIT_ROOT/$TERMUX_HOST_PLATFORM/bin"
77b0e696 89DEVKIT_SYSROOT="\$DEVKIT_ROOT/sysroot"
ffcb22f1
VB
90HERE
91
92 export ANDROID_DEVKIT=$TERMUX_STANDALONE_TOOLCHAIN
93
77b0e696 94 if [ -n "$TERMUX_DEBUG" ]; then TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-debug-level=slowdebug"; fi
1f3323ce
VB
95 BUILD_TRIPLE=$TERMUX_ARCH-linux-gnu
96 test "$TERMUX_ARCH" == "arm" && BUILD_TRIPLE+="eabi"
97
98 JVM_FEATURES="compiler1,compiler2,jvmti,fprof,vm-structs,jni-check,services,management,all-gcs,nmt,cds"
99 # enable features specific to some arches
100 if [ "$TERMUX_ARCH" == "aarch64" ] || [ "$TERMUX_ARCH" == "x86_64" ]; then JVM_FEATURES+=",jvmci,graal"; fi
101
102 # remove sa_proc support
103 rm $TERMUX_PKG_SRCDIR/hotspot/make/lib/Lib-jdk.hotspot.agent.gmk
ffcb22f1 104}
ffcb22f1 105termux_step_configure () {
922458df 106 if [ $TERMUX_ARCH = "x86_64" ]; then
107 ln -sf $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib64/libc.so $TERMUX_PKG_TMPDIR/libpthread.so
108 else
109 ln -sf $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/libc.so $TERMUX_PKG_TMPDIR/libpthread.so
110 fi
9a92118f 111 ARM64=""
112 if [ $TERMUX_ARCH = aarch64 ]; then
113 export ARM64=" --with-cpu-port=arm64"
114 fi
115
77b0e696 116 bash $TERMUX_PKG_SRCDIR/configure \
9a92118f 117 $ARM64 \
ffcb22f1 118 --prefix=$TERMUX_PREFIX \
1f3323ce 119 --openjdk-target=$BUILD_TRIPLE \
ffcb22f1
VB
120 --libexecdir=$TERMUX_PREFIX/libexec \
121 --with-devkit=$ANDROID_DEVKIT \
77b0e696
VB
122 --with-extra-cflags="$CPPFLAGS $CFLAGS" \
123 --with-extra-cxxflags="$CPPFLAGS $CXXFLAGS" \
9a92118f 124 --with-extra-ldflags="-L$TERMUX_PKG_TMPDIR $LDFLAGS -ldl" \
1f3323ce 125 --with-jvm-features="$JVM_FEATURES" \
ffcb22f1
VB
126 $TERMUX_PKG_EXTRA_CONFIGURE_ARGS
127}
128
129termux_step_make () {
130 make JOBS=$TERMUX_MAKE_PROCESSES images
131}
132
d4b5d52c
VB
133termux_step_post_make_install () {
134 # move jvm install dir
135 mkdir -p $TERMUX_PREFIX/lib/jvm
136 rm -rf "$TERMUX_PREFIX/lib/jvm/openjdk-9"
137 mv $TERMUX_PREFIX/jvm/openjdk-9-internal $TERMUX_PREFIX/$_jvm_dir
138
139 # place src.zip in standard location mimicking ubuntu
140 mv $TERMUX_PREFIX/$_jvm_dir/lib/src.zip $TERMUX_PREFIX/$_jvm_dir/src.zip
141
142 # create shell wrappers for binaries
143 for binary in $TERMUX_PREFIX/$_jvm_dir/bin/*; do
144 binary=`basename $binary`
145 rm -f $TERMUX_PREFIX/bin/$binary
146 echo "export JAVA_HOME=\$PREFIX/$_jvm_dir" > $TERMUX_PREFIX/bin/$binary
147 echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$JAVA_HOME/lib:\$JAVA_HOME/lib/jli" >> $TERMUX_PREFIX/bin/$binary
9a92118f 148 echo "exec \$JAVA_HOME/bin/$binary \"\$@\"" >> $TERMUX_PREFIX/bin/$binary
d4b5d52c
VB
149 chmod u+x $TERMUX_PREFIX/bin/$binary
150 done
151
152 # use cacerts provided by ca-certificates-java
153 ln -sf "$TERMUX_PREFIX/$_jvm_dir/lib/security/jssecacerts" "$TERMUX_PREFIX/$_jvm_dir/lib/security/cacerts"
154}