java-openjdk/generate_source_tarball.sh

131 lines
4.7 KiB
Bash
Raw Normal View History

#!/bin/bash
2018-07-04 19:19:04 +00:00
# Generates the 'source tarball' for JDK projects.
#
# Example:
# When used from local repo set REPO_ROOT pointing to file:// with your repo
# if your local repo follows upstream forests conventions, you may be enough by setting OPENJDK_URL
# if you wont to use local copy of patch PR2126 set path to it to PR2126 variable
#
# In any case you have to set PROJECT_NAME REPO_NAME and VERSION. eg:
# PROJECT_NAME=jdk9
# REPO_NAME=jdk9
# VERSION=inDevelopment (but keyword tip will still do its job)
#
# They are used to create correct name and are used in construction of sources url (unless REPO_ROOT is set)
# This script creates a single source tarball out of the repository
# based on the given tag and removes code not allowed in fedora/rhel. For
# consistency, the source tarball will always contain 'openjdk' as the top
# level folder, name is created, based on parameter
#
if [ ! "x$PR2126" = "x" ] ; then
if [ ! -f "$PR2126" ] ; then
echo "You have specified PR2126 as $PR2126 but it does not exists. exiting"
exit 1
fi
fi
set -e
OPENJDK_URL_DEFAULT=http://hg.openjdk.java.net
COMPRESSION_DEFAULT=xz
if [ "x$1" = "xhelp" ] ; then
echo -e "Behaviour may be specified by setting the following variables:\n"
echo "VERSION - the version of the specified OpenJDK project"
echo "PROJECT_NAME -- the name of the OpenJDK project being archived (optional; only needed by defaults)"
echo "REPO_NAME - the name of the OpenJDK repository (optional; only needed by defaults)"
echo "OPENJDK_URL - the URL to retrieve code from (optional; defaults to ${OPENJDK_URL_DEFAULT})"
echo "COMPRESSION - the compression type to use (optional; defaults to ${COMPRESSION_DEFAULT})"
echo "FILE_NAME_ROOT - name of the archive, minus extensions (optional; defaults to PROJECT_NAME-REPO_NAME-VERSION)"
echo "REPO_ROOT - the location of the Mercurial repository to archive (optional; defaults to OPENJDK_URL/PROJECT_NAME/REPO_NAME)"
echo "PR2126 - the path to the PR2126 patch to apply (optional; downloaded if unavailable)"
exit 1;
fi
if [ "x$VERSION" = "x" ] ; then
echo "No VERSION specified"
exit -2
fi
echo "Version: ${VERSION}"
# REPO_NAME is only needed when we default on REPO_ROOT and FILE_NAME_ROOT
if [ "x$FILE_NAME_ROOT" = "x" -o "x$REPO_ROOT" = "x" ] ; then
if [ "x$PROJECT_NAME" = "x" ] ; then
echo "No PROJECT_NAME specified"
exit -1
fi
echo "Project name: ${PROJECT_NAME}"
if [ "x$REPO_NAME" = "x" ] ; then
echo "No REPO_NAME specified"
exit -3
fi
echo "Repository name: ${REPO_NAME}"
fi
if [ "x$OPENJDK_URL" = "x" ] ; then
OPENJDK_URL=${OPENJDK_URL_DEFAULT}
echo "No OpenJDK URL specified; defaulting to ${OPENJDK_URL}"
else
echo "OpenJDK URL: ${OPENJDK_URL}"
fi
if [ "x$COMPRESSION" = "x" ] ; then
# rhel 5 needs tar.gz
COMPRESSION=${COMPRESSION_DEFAULT}
fi
echo "Creating a tar.${COMPRESSION} archive"
if [ "x$FILE_NAME_ROOT" = "x" ] ; then
FILE_NAME_ROOT=${PROJECT_NAME}-${REPO_NAME}-${VERSION}
echo "No file name root specified; default to ${FILE_NAME_ROOT}"
fi
if [ "x$REPO_ROOT" = "x" ] ; then
REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}"
echo "No repository root specified; default to ${REPO_ROOT}"
fi;
if [ -d ${FILE_NAME_ROOT} ] ; then
2018-07-04 19:19:04 +00:00
echo "exists exists exists exists exists exists exists "
echo "reusing reusing reusing reusing reusing reusing "
echo ${FILE_NAME_ROOT}
else
mkdir "${FILE_NAME_ROOT}"
pushd "${FILE_NAME_ROOT}"
echo "Cloning ${VERSION} root repository from ${REPO_ROOT}"
hg clone ${REPO_ROOT} openjdk -r ${VERSION}
popd
fi
pushd "${FILE_NAME_ROOT}"
pushd openjdk
if [ -d src ]; then
echo "Removing EC source code we don't build"
CRYPTO_PATH=src/jdk.crypto.ec/share/native/libsunec/impl
rm -vrf $CRYPTO_PATH
echo "Syncing EC list with NSS"
if [ "x$PR2126" = "x" ] ; then
# orriginally for 8:
# get pr2126.patch (from http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=8d2c9a898f50) from most correct tag
# Do not push it or publish it (see http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2126)
# there is currnetly no "upstram version of this patch, hardcoding custom version
Udpated to jdk11+19 - adapted RHBZ-1565658-system-nss-SunEC.patch; hopefully correct - broken system lcms - probably caused by http://hg.openjdk.java.net/jdk/jdk/rev/f0aeede1b855 === Output from failing command(s) repeated here === make/Init.gmk:342: Building on-failure /usr/bin/printf "* For target support_native_java.desktop_libjavajpeg_imageioJPEG.o:\n" + /usr/bin/printf '* For target support_native_java.desktop_libjavajpeg_imageioJPEG.o:\n' * For target support_native_java.desktop_libjavajpeg_imageioJPEG.o: make/Init.gmk:342: Building on-failure (/usr/bin/grep -v -e "^Note: including file:" < /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/build/make-support/failure-logs/support_native_java.desktop_libjavajpeg_imageioJPEG.o.log || true) | /usr/bin/head -n 12 + /usr/bin/grep -v -e '^Note: including file:' + /usr/bin/head -n 12 cc1: warning: command line option '-std=gnu++98' is valid for C++/ObjC++ but not for C /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c:49:10: fatal error: com_sun_imageio_plugins_jpeg_JPEGImageReader.h: No such file or directory #include "com_sun_imageio_plugins_jpeg_JPEGImageReader.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make/Init.gmk:342: Building on-failure if test `/usr/bin/wc -l < /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/build/make-support/failure-logs/support_native_java.desktop_libjavajpeg_imageioJPEG.o.log` -gt 12; then /usr/bin/echo " ... (rest of output omitted)" ; fi ++ /usr/bin/wc -l + test 5 -gt 12 make/Init.gmk:342: Building on-failure /usr/bin/printf "* For target support_native_java.desktop_liblcms_LCMS.o:\n" + /usr/bin/printf '* For target support_native_java.desktop_liblcms_LCMS.o:\n' * For target support_native_java.desktop_liblcms_LCMS.o: make/Init.gmk:342: Building on-failure (/usr/bin/grep -v -e "^Note: including file:" < /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/build/make-support/failure-logs/support_native_java.desktop_liblcms_LCMS.o.log || true) | /usr/bin/head -n 12 + /usr/bin/grep -v -e '^Note: including file:' + /usr/bin/head -n 12 cc1: warning: command line option '-std=gnu++98' is valid for C++/ObjC++ but not for C /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/src/java.desktop/share/native/liblcms/LCMS.c:29:10: fatal error: sun_java2d_cmm_lcms_LCMS.h: No such file or directory #include "sun_java2d_cmm_lcms_LCMS.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make/Init.gmk:342: Building on-failure if test `/usr/bin/wc -l < /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/build/make-support/failure-logs/support_native_java.desktop_liblcms_LCMS.o.log` -gt 12; then /usr/bin/echo " ... (rest of output omitted)" ; fi ++ /usr/bin/wc -l + test 5 -gt 12 make/Init.gmk:342: Building on-failure /usr/bin/printf "\n* All command lines available in /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/build/make-support/failure-logs.\n" + /usr/bin/printf '\n* All command lines available in /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/build/make-support/failure-logs.\n' * All command lines available in /home/jvanek/rpmbuild/BUILD/java-11-openjdk-11.0.ea.19-5.fc27.x86_64/openjdk/build/make-support/failure-logs. make/Init.gmk:342: Building on-failure /usr/bin/printf "=== End of repeated output ===\n" + /usr/bin/printf '=== End of repeated
2018-06-22 08:45:30 +00:00
PR2126="../../pr2126-11.patch"
fi;
echo "Applying ${PR2126}"
patch -Np1 < $PR2126
fi
find . -name '*.orig' -exec rm -vf '{}' ';'
popd
echo "Compressing remaining forest"
if [ "X$COMPRESSION" = "Xxz" ] ; then
tar --exclude-vcs -cJf ${FILE_NAME_ROOT}.tar.${COMPRESSION} openjdk
else
tar --exclude-vcs -czf ${FILE_NAME_ROOT}.tar.${COMPRESSION} openjdk
fi
mv ${FILE_NAME_ROOT}.tar.${COMPRESSION} ..
popd
echo "Done. You may want to remove the uncompressed version."