2016-01-20 13:03:36 +00:00
|
|
|
#!/bin/bash
|
2013-09-05 18:19:24 +00:00
|
|
|
# Generates the 'source tarball' for JDK 8 projects.
|
|
|
|
#
|
2015-12-08 11:55:18 +00:00
|
|
|
# Example:
|
2016-02-24 17:46:52 +00:00
|
|
|
# When used from local repo set REPO_ROOT pointing to file:// with your repo
|
2019-01-10 05:50:56 +00:00
|
|
|
# If your local repo follows upstream forests conventions, it may be enough to set OPENJDK_URL
|
2020-09-04 15:07:11 +00:00
|
|
|
# If you want to use a local copy of patch PR3799, set the path to it in the PR3799 variable
|
2013-09-05 18:19:24 +00:00
|
|
|
#
|
2015-12-08 11:55:18 +00:00
|
|
|
# In any case you have to set PROJECT_NAME REPO_NAME and VERSION. eg:
|
|
|
|
# PROJECT_NAME=jdk8u OR aarch64-port
|
|
|
|
# REPO_NAME=jdk8u60 OR jdk8u60
|
|
|
|
# VERSION=jdk8u60-b27 OR aarch64-jdk8u65-b17 OR for head, keyword 'tip' should do the job there
|
|
|
|
#
|
|
|
|
# They are used to create correct name and are used in construction of sources url (unless REPO_ROOT is set)
|
2015-08-19 11:20:20 +00:00
|
|
|
|
2013-09-05 18:19:24 +00:00
|
|
|
# This script creates a single source tarball out of the repository
|
2015-12-08 11:55:18 +00:00
|
|
|
# based on the given tag and removes code not allowed in fedora/rhel. For
|
2015-07-20 19:05:32 +00:00
|
|
|
# consistency, the source tarball will always contain 'openjdk' as the top
|
2015-12-08 11:55:18 +00:00
|
|
|
# level folder, name is created, based on parameter
|
|
|
|
#
|
2013-09-05 18:19:24 +00:00
|
|
|
|
2020-09-04 15:07:11 +00:00
|
|
|
if [ ! "x$PR3799" = "x" ] ; then
|
|
|
|
if [ ! -f "$PR3799" ] ; then
|
|
|
|
echo "You have specified PR3799 as $PR3799 but it does not exists. exiting"
|
2017-02-28 13:10:55 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2013-07-23 08:59:21 +00:00
|
|
|
set -e
|
|
|
|
|
2016-01-20 13:03:36 +00:00
|
|
|
OPENJDK_URL_DEFAULT=http://hg.openjdk.java.net
|
|
|
|
COMPRESSION_DEFAULT=xz
|
2016-08-25 12:41:14 +00:00
|
|
|
# jdk is last for its size
|
|
|
|
REPOS_DEFAULT="hotspot corba jaxws jaxp langtools nashorn jdk"
|
2016-01-20 13:03:36 +00:00
|
|
|
|
|
|
|
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)"
|
2016-02-24 17:46:52 +00:00
|
|
|
echo "OPENJDK_URL - the URL to retrieve code from (optional; defaults to ${OPENJDK_URL_DEFAULT})"
|
2016-01-20 13:03:36 +00:00
|
|
|
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)"
|
2020-09-04 15:07:11 +00:00
|
|
|
echo "PR3799 - the path to the PR3799 patch to apply (optional; downloaded if unavailable)"
|
2016-08-25 12:41:14 +00:00
|
|
|
echo "REPOS - specify the repositories to use (optional; defaults to ${REPOS_DEFAULT})"
|
2016-01-20 13:03:36 +00:00
|
|
|
exit 1;
|
2013-09-05 18:19:24 +00:00
|
|
|
fi
|
2016-01-20 13:03:36 +00:00
|
|
|
|
|
|
|
|
2015-12-08 11:55:18 +00:00
|
|
|
if [ "x$VERSION" = "x" ] ; then
|
2016-01-20 13:03:36 +00:00
|
|
|
echo "No VERSION specified"
|
|
|
|
exit -2
|
2015-12-08 11:55:18 +00:00
|
|
|
fi
|
2016-01-20 13:03:36 +00:00
|
|
|
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
|
|
|
|
|
2015-12-08 11:55:18 +00:00
|
|
|
if [ "x$OPENJDK_URL" = "x" ] ; then
|
2016-01-20 13:03:36 +00:00
|
|
|
OPENJDK_URL=${OPENJDK_URL_DEFAULT}
|
|
|
|
echo "No OpenJDK URL specified; defaulting to ${OPENJDK_URL}"
|
|
|
|
else
|
|
|
|
echo "OpenJDK URL: ${OPENJDK_URL}"
|
2013-03-12 13:35:26 +00:00
|
|
|
fi
|
|
|
|
|
2015-12-08 11:55:18 +00:00
|
|
|
if [ "x$COMPRESSION" = "x" ] ; then
|
|
|
|
# rhel 5 needs tar.gz
|
2016-01-20 13:03:36 +00:00
|
|
|
COMPRESSION=${COMPRESSION_DEFAULT}
|
2015-12-08 11:55:18 +00:00
|
|
|
fi
|
2016-01-20 13:03:36 +00:00
|
|
|
echo "Creating a tar.${COMPRESSION} archive"
|
|
|
|
|
2015-12-08 11:55:18 +00:00
|
|
|
if [ "x$FILE_NAME_ROOT" = "x" ] ; then
|
|
|
|
FILE_NAME_ROOT=${PROJECT_NAME}-${REPO_NAME}-${VERSION}
|
2016-01-20 13:03:36 +00:00
|
|
|
echo "No file name root specified; default to ${FILE_NAME_ROOT}"
|
2015-12-08 11:55:18 +00:00
|
|
|
fi
|
|
|
|
if [ "x$REPO_ROOT" = "x" ] ; then
|
|
|
|
REPO_ROOT="${OPENJDK_URL}/${PROJECT_NAME}/${REPO_NAME}"
|
2016-01-20 13:03:36 +00:00
|
|
|
echo "No repository root specified; default to ${REPO_ROOT}"
|
2015-12-08 11:55:18 +00:00
|
|
|
fi;
|
2013-09-05 18:19:24 +00:00
|
|
|
|
2015-12-08 11:55:18 +00:00
|
|
|
mkdir "${FILE_NAME_ROOT}"
|
|
|
|
pushd "${FILE_NAME_ROOT}"
|
2013-09-05 18:19:24 +00:00
|
|
|
|
2016-01-20 13:03:36 +00:00
|
|
|
echo "Cloning ${VERSION} root repository from ${REPO_ROOT}"
|
2015-12-08 11:55:18 +00:00
|
|
|
hg clone ${REPO_ROOT} openjdk -r ${VERSION}
|
2015-07-20 19:05:32 +00:00
|
|
|
pushd openjdk
|
2015-12-08 11:55:18 +00:00
|
|
|
|
2016-04-25 14:17:22 +00:00
|
|
|
|
|
|
|
if [ "x$REPOS" = "x" ] ; then
|
2016-08-25 12:41:14 +00:00
|
|
|
repos=${REPOS_DEFAULT}
|
|
|
|
echo "No repositories specified; defaulting to ${repos}"
|
2016-04-25 14:17:22 +00:00
|
|
|
else
|
2016-08-25 12:41:14 +00:00
|
|
|
repos=$REPOS
|
|
|
|
echo "Repositories: ${repos}"
|
2016-04-25 14:17:22 +00:00
|
|
|
fi;
|
2014-11-05 15:56:02 +00:00
|
|
|
|
|
|
|
for subrepo in $repos
|
2013-07-23 08:59:21 +00:00
|
|
|
do
|
2016-01-20 13:03:36 +00:00
|
|
|
echo "Cloning ${VERSION} ${subrepo} repository from ${REPO_ROOT}"
|
2015-12-08 11:55:18 +00:00
|
|
|
hg clone ${REPO_ROOT}/${subrepo} -r ${VERSION}
|
2013-07-21 17:35:12 +00:00
|
|
|
done
|
2013-09-05 18:19:24 +00:00
|
|
|
|
2016-04-25 14:17:22 +00:00
|
|
|
if [ -d jdk ]; then
|
2015-07-20 19:05:32 +00:00
|
|
|
echo "Removing EC source code we don't build"
|
2019-01-10 05:50:56 +00:00
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ec2.h
|
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ec2_163.c
|
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ec2_193.c
|
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ec2_233.c
|
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ec2_aff.c
|
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ec2_mont.c
|
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ecp_192.c
|
|
|
|
rm -vf jdk/src/share/native/sun/security/ec/impl/ecp_224.c
|
2015-07-20 19:05:32 +00:00
|
|
|
|
|
|
|
echo "Syncing EC list with NSS"
|
2019-01-10 05:50:56 +00:00
|
|
|
|
2020-09-04 15:07:11 +00:00
|
|
|
if [ "x$PR3799" = "x" ] ; then
|
|
|
|
# get pr3799.patch (from http://icedtea.classpath.org/hg/icedtea8) from most correct tag
|
|
|
|
# Do not push it or publish it (see http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=3799)
|
|
|
|
wget -O pr3799.patch http://icedtea.classpath.org/hg/icedtea8/raw-file/tip/patches/pr3799-4curve.patch
|
|
|
|
patch -Np1 < pr3799.patch
|
|
|
|
rm pr3799.patch
|
2015-12-08 11:55:18 +00:00
|
|
|
else
|
2020-09-04 15:07:11 +00:00
|
|
|
echo "Applying ${PR3799}"
|
|
|
|
patch -Np1 < $PR3799
|
2015-12-08 11:55:18 +00:00
|
|
|
fi;
|
2016-04-25 14:17:22 +00:00
|
|
|
fi
|
2017-04-21 07:56:16 +00:00
|
|
|
find . -name '*.orig' -exec rm -vf '{}' ';'
|
2015-07-20 19:05:32 +00:00
|
|
|
|
2013-09-05 18:19:24 +00:00
|
|
|
popd
|
2016-02-24 17:46:52 +00:00
|
|
|
echo "Compressing remaining forest"
|
2015-12-08 11:55:18 +00:00
|
|
|
if [ "X$COMPRESSION" = "Xxz" ] ; then
|
2020-05-22 11:56:41 +00:00
|
|
|
SWITCH=cJf
|
2015-12-08 11:55:18 +00:00
|
|
|
else
|
2020-05-22 11:56:41 +00:00
|
|
|
SWITCH=czf
|
2015-12-08 11:55:18 +00:00
|
|
|
fi
|
2020-05-22 11:56:41 +00:00
|
|
|
TARBALL_NAME=${FILE_NAME_ROOT}-4curve.tar.${COMPRESSION}
|
|
|
|
tar --exclude-vcs -$SWITCH ${TARBALL_NAME} openjdk
|
|
|
|
mv ${TARBALL_NAME} ..
|
2013-09-05 18:19:24 +00:00
|
|
|
|
|
|
|
popd
|
2016-02-24 17:46:52 +00:00
|
|
|
echo "Done. You may want to remove the uncompressed version."
|
2013-09-05 18:19:24 +00:00
|
|
|
|
2015-12-08 11:55:18 +00:00
|
|
|
|