diff --git a/disabled-packages/openjdk-9-headless/build.sh b/disabled-packages/openjdk-9-headless/build.sh index e93bf2fe0..4d5623a87 100644 --- a/disabled-packages/openjdk-9-headless/build.sh +++ b/disabled-packages/openjdk-9-headless/build.sh @@ -2,119 +2,110 @@ TERMUX_PKG_HOMEPAGE=http://openjdk.java.net TERMUX_PKG_DESCRIPTION='OpenJDK 9 Java Runtime Environment (prerelease)' _jbuild=158 _hg_tag="jdk-9+${_jbuild}" -TERMUX_PKG_VERSION="9b$_jbuild" +TERMUX_PKG_VERSION="9.2017.3.3" TERMUX_PKG_MAINTAINER='Vishal Biswas @vishalbiswas' -TERMUX_PKG_DEPENDS="freetype, alsa-lib" +TERMUX_PKG_DEPENDS="freetype, libpng, libffi" +# currently upstream has no support building for these arches on android +# this will change in the future +TERMUX_PKG_BLACKLISTED_ARCHES="aarch64 x86_64" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" --disable-hotspot-gtest --disable-option-checking --disable-warnings-as-errors --enable-headless-only ---with-debug-level=release ---with-libffi-include=$TERMUX_PREFIX/include ---with-libffi-lib=$TERMUX_PREFIX/lib +--with-libffi=$TERMUX_PREFIX +--with-freetype=$TERMUX_PREFIX --with-libpng=system --with-zlib=system " TERMUX_PKG_CLANG=no _cups_ver=2.2.2 -termux_step_extract_package () { - _url_src=http://hg.openjdk.java.net/jdk9/dev - targzs=(${_url_src}/archive/$_hg_tag.tar.bz2 - ${_url_src}/corba/archive/$_hg_tag.tar.bz2 - ${_url_src}/hotspot/archive/$_hg_tag.tar.bz2 - ${_url_src}/jdk/archive/$_hg_tag.tar.bz2 - ${_url_src}/jaxws/archive/$_hg_tag.tar.bz2 - ${_url_src}/jaxp/archive/$_hg_tag.tar.bz2 - ${_url_src}/langtools/archive/$_hg_tag.tar.bz2 - ${_url_src}/nashorn/archive/$_hg_tag.tar.bz2 - "https://github.com/apple/cups/releases/download/v$_cups_ver/cups-$_cups_ver-source.tar.gz") +changesets=('84493751ba37' + '6feea77d2083' + '95ce736479b8' + 'e45f1067d76b' + '0ea34706c7fa' + '5695854e8831' + '39449d2a6398' + 'd75af059cff6') - sha256sums=('d11fba6c6aea0d815bf37ec33b95a9eabf5cf6bd85c998d2a2945de610340a82' - '6c38a48a9a4095604b0feeaacad7fec6337186631a1d11b27215ad3b3f0f4e96' - 'd646f5e0166b1877951540cac6b9eff6be130cb1324e5a63871104aad3b6d6f0' - '773d4420b556baaad69b06434b6e21b488cf8df1f437b3b83ddbbbd32e906e83' - 'af5d86f1e2b4ac8773ee9e5cb799797c1e9c7e606a1618bfad0e4f7854b062d2' - '3d1b96268c6b1fc35f69b4e62be32a0a1b4ef299f95f2139b0c57b982d792869' - '94fb51401a4aa6387d0d35df4cba0d2e6560329ca842604be1752f8e4a253e33' - '23afc54946898ffc51d1e22a40a078c69441bd1c8b4a99b7e84d471e6ca1f302' - 'f589bb7d5d1dc3aa0915d7cf2b808571ef2e1530cd1a6ebe76ae8f9f4994e4f6') +sha256sums=('8dba157e41bd3ffcec681d2dfc3141951f19c0a19a68d1e2568b314d0978c018' + '1a269f62e7e99b097fd7620c2ce995833336c1b79f03bd8a7af3f066f6099862' + '2fff75a970c4ae21620ece45dcb4015ec13cdfd265ab1746503adf786922d200' + 'd58e2f4a7e8421a5f9396870d4a47f42dd41dfff1232e52add71410c75f35832' + 'dcb0efdf5e633396957c18c0c8b54531c44d8f6c24d03c3f87cc9b41ff633957' + '7da207e287e6df85c955b5d7a45e7f747934dcaa15a12741d022c50ef89799e7' + '90980cd581b426a51fa22d77cbcb68e5ddea4c048a282cf82ef438e5da0a7bf0' + 'f35e87e80ad01cec5d445e59d4b37ba55899651845081f76b6d56a348ca1ce97' + 'f589bb7d5d1dc3aa0915d7cf2b808571ef2e1530cd1a6ebe76ae8f9f4994e4f6') - reponames=(dev corba hotspot jdk jaxws jaxp langtools nashorn cups) +reponames=(dev corba hotspot jdk jaxws jaxp langtools nashorn cups) - for index in "${!targzs[@]}"; do - if [ $index != '8' ]; then - filename=${reponames[index]}-`basename ${targzs[index]}` - folder=`basename $filename .tar.bz2` - folder=`echo $folder | sed 's/_/-/'` - else - filename=`basename ${targzs[index]}` - folder="cups-$_cups_ver" - fi - sum=${sha256sums[index]} - file=$TERMUX_PKG_CACHEDIR/$filename - termux_download ${targzs[index]} $file $sum - rm -Rf $folder - $TERMUX_TAR xf $file - mkdir -p $TERMUX_PKG_SRCDIR - mv $folder $TERMUX_PKG_SRCDIR/ - done -} +_url_src=http://hg.openjdk.java.net/mobile/dev + +TERMUX_PKG_SRCURL=$_url_src/archive/${changesets[0]}.tar.bz2 +TERMUX_PKG_SHA256=${sha256sums[0]} +TERMUX_PKG_FOLDERNAME=dev-${changesets[0]} termux_step_post_extract_package () { - for patch in $TERMUX_PKG_BUILDER_DIR/*.diff; do - sed "s%\@TAG_VER\@%${_jbuild}%g" "$patch" | \ - patch --silent -p1 + cd "$TERMUX_PKG_TMPDIR" + # download and extract repo archives + for index in {1..7}; do + local sum=${sha256sums[index]} + local repo=${reponames[index]} + local change=${changesets[index]} + local file=$TERMUX_PKG_CACHEDIR/$repo-$change.tar.bz2 + local url=${_url_src}/$repo/archive/$change.tar.bz2 + + termux_download $url $file $sum + $TERMUX_TAR xf $file -C $TERMUX_PKG_SRCDIR + mv $TERMUX_PKG_SRCDIR/$repo-$change $TERMUX_PKG_SRCDIR/$repo done - cd $TERMUX_PKG_SRCDIR/dev-$_hg_tag - chmod a+x configure - for subrepo in corba hotspot jdk jaxws jaxp langtools nashorn; do - ln -s ../${subrepo}-$_hg_tag ${subrepo} - done - ln -s ../cups-$_cups_ver cups + # setup cups source dir + file=$TERMUX_PKG_CACHEDIR/cups-$_cups_ver-source.tar.gz + url="https://github.com/apple/cups/releases/download/v$_cups_ver/`basename $file`" + termux_download $url $file ${sha256sums[8]} + $TERMUX_TAR xf $file -C $TERMUX_PKG_SRCDIR +} + +# override this step to since openjdk provides their own customized guess scripts +termux_step_replace_guess_scripts () { + return } termux_step_pre_configure () { - TERMUX_PKG_SRCDIR=$TERMUX_PKG_SRCDIR/dev-$_hg_tag - #export MAKEFLAGS=${MAKEFLAGS/-j*} - #export CFLAGS+=" -Wno-error=deprecated-declarations -DSIGCLD=SIGCHLD" - CFLAGS="$CFLAGS -I$TERMUX_PKG_BUILDER_DIR -I$TERMUX_PREFIX/include -DTERMUX_SHMEM_STUBS" - CXXFLAGS="$CXXFLAGS -I$TERMUX_PKG_BUILDER_DIR -I$TERMUX_PREFIX/include" - #LDFLAGS="$LDFLAGS -landroid-shmem" + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-cups-include=$TERMUX_PKG_SRCDIR/cups-$_cups_ver" - TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-cups-include=$TERMUX_PKG_SRCDIR/cups" - TERMUX_JVM_VARIANT=zero - if [ "$TERMUX_ARCH" == 'i686' -o "$TERMUX_ARCH" == 'x86_64' ]; then - TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=' --with-jvm-variants=client' - TERMUX_PKG_JVM_VARIANT=client - else - TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=' --with-jvm-variants=zero' - TERMUX_PKG_JVM_VARIANT=zero - fi + # might be required + # libffi dependency is required if zero interpreter is used + #if [ -o "$TERMUX_ARCH" == 'i686' -o "$TERMUX_ARCH" == 'x86_64' ]; then + # TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=' --with-jvm-variants=client' + #else + # TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=' --with-jvm-variants=zero' + #fi cat > "$TERMUX_STANDALONE_TOOLCHAIN/devkit.info" < - # include - # include -+# ifndef __ANDROID__ - # include -+# endif - # include - # include - # include -@@ -496,6 +498,7 @@ - // detecting pthread library - - void os::Linux::libpthread_init() { -+#ifndef __ANDROID__ - // Save glibc and pthread version strings. - #if !defined(_CS_GNU_LIBC_VERSION) || \ - !defined(_CS_GNU_LIBPTHREAD_VERSION) -@@ -513,6 +516,10 @@ - str = (char *)malloc(n, mtInternal); - confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n); - os::Linux::set_libpthread_version(str); -+#else -+ os::Linux::set_glibc_version("bionic 21"); -+ os::Linux::set_libpthread_version("pthread 21"); -+#endif - } - - ///////////////////////////////////////////////////////////////////////////// -@@ -2809,7 +2816,10 @@ - // If we are running with earlier version, which did not have symbol versions, - // we should use the base version. - void* os::Linux::libnuma_dlsym(void* handle, const char *name) { -- void *f = dlvsym(handle, name, "libnuma_1.1"); -+ void *f = NULL; -+ #ifndef __ANDROID__ -+ f = dlvsym(handle, name, "libnuma_1.1"); -+ #endif - if (f == NULL) { - f = dlsym(handle, name); - } -@@ -5471,7 +5481,11 @@ - // Linux doesn't yet have a (official) notion of processor sets, - // so just return the system wide load average. - int os::loadavg(double loadavg[], int nelem) { -+#ifdef __ANDROID__ -+ return -1; -+#else - return ::getloadavg(loadavg, nelem); -+#endif - } - - void os::pause() { -@@ -6194,7 +6208,15 @@ - struct stat st; - int ret = os::stat(filename, &st); - assert(ret == 0, "failed to stat() file '%s': %s", filename, strerror(errno)); -+#ifdef __ANDROID__ -+ struct timespec ts; -+ unsigned long ms = st.st_mtime; -+ ts.tv_sec = ms / 1000; -+ ts.tv_nsec = (ms % 1000) * 1000000; -+ return ts; -+#else - return st.st_mtim; -+#endif - } - - int os::compare_file_modified_times(const char* file1, const char* file2) {