Blame SOURCES/remove-intree-libraries.sh

67e3c5
#!/bin/sh
67e3c5
4a8021
# Arguments: <JDK TREE> <MINIMAL|FULL>
4a8021
TREE=${1}
4a8021
TYPE=${2}
4a8021
67e3c5
ZIP_SRC=src/java.base/share/native/libzip/zlib/
f078e6
FREETYPE_SRC=src/java.desktop/share/native/libfreetype/
67e3c5
JPEG_SRC=src/java.desktop/share/native/libjavajpeg/
67e3c5
GIF_SRC=src/java.desktop/share/native/libsplashscreen/giflib/
67e3c5
PNG_SRC=src/java.desktop/share/native/libsplashscreen/libpng/
67e3c5
LCMS_SRC=src/java.desktop/share/native/liblcms/
67e3c5
4a8021
if test "x${TREE}" = "x"; then
4a8021
    echo "$0 <JDK_TREE> (MINIMAL|FULL)";
4a8021
    exit 1;
4a8021
fi
4a8021
4a8021
if test "x${TYPE}" = "x"; then
4a8021
    TYPE=minimal;
4a8021
fi
4a8021
4a8021
if test "x${TYPE}" != "xminimal" -a "x${TYPE}" != "xfull"; then
4a8021
    echo "Type must be minimal or full";
4a8021
    exit 2;
4a8021
fi
4a8021
4a8021
echo "Removing in-tree libraries from ${TREE}"
4a8021
echo "Cleansing operation: ${TYPE}";
4a8021
4a8021
cd ${TREE}
67e3c5
67e3c5
echo "Removing built-in libs (they will be linked)"
67e3c5
f078e6
# On full runs, allow for zlib & freetype having already been deleted by minimal
67e3c5
echo "Removing zlib"
4a8021
if [ "x${TYPE}" = "xminimal" -a ! -d ${ZIP_SRC} ]; then
67e3c5
	echo "${ZIP_SRC} does not exist. Refusing to proceed."
67e3c5
	exit 1
67e3c5
fi	
67e3c5
rm -rvf ${ZIP_SRC}
f078e6
echo "Removing freetype"
f078e6
if [ "x${TYPE}" = "xminimal" -a ! -d ${FREETYPE_SRC} ]; then
f078e6
	echo "${FREETYPE_SRC} does not exist. Refusing to proceed."
f078e6
	exit 1
f078e6
fi
f078e6
rm -rvf ${FREETYPE_SRC}
67e3c5
f078e6
# Minimal is limited to just zlib and freetype so finish here
4a8021
if test "x${TYPE}" = "xminimal"; then
4a8021
    echo "Finished.";
4a8021
    exit 0;
4a8021
fi
4a8021
67e3c5
echo "Removing libjpeg"
4a8021
if [ ! -f ${JPEG_SRC}/jdhuff.c ]; then # some file that should definitely exist
67e3c5
	echo "${JPEG_SRC} does not contain jpeg sources. Refusing to proceed."
67e3c5
	exit 1
67e3c5
fi	
67e3c5
67e3c5
rm -vf ${JPEG_SRC}/jcomapi.c
67e3c5
rm -vf ${JPEG_SRC}/jdapimin.c
67e3c5
rm -vf ${JPEG_SRC}/jdapistd.c
67e3c5
rm -vf ${JPEG_SRC}/jdcoefct.c
67e3c5
rm -vf ${JPEG_SRC}/jdcolor.c
67e3c5
rm -vf ${JPEG_SRC}/jdct.h
67e3c5
rm -vf ${JPEG_SRC}/jddctmgr.c
67e3c5
rm -vf ${JPEG_SRC}/jdhuff.c
67e3c5
rm -vf ${JPEG_SRC}/jdhuff.h
67e3c5
rm -vf ${JPEG_SRC}/jdinput.c
67e3c5
rm -vf ${JPEG_SRC}/jdmainct.c
67e3c5
rm -vf ${JPEG_SRC}/jdmarker.c
67e3c5
rm -vf ${JPEG_SRC}/jdmaster.c
67e3c5
rm -vf ${JPEG_SRC}/jdmerge.c
67e3c5
rm -vf ${JPEG_SRC}/jdphuff.c
67e3c5
rm -vf ${JPEG_SRC}/jdpostct.c
67e3c5
rm -vf ${JPEG_SRC}/jdsample.c
67e3c5
rm -vf ${JPEG_SRC}/jerror.c
67e3c5
rm -vf ${JPEG_SRC}/jerror.h
67e3c5
rm -vf ${JPEG_SRC}/jidctflt.c
67e3c5
rm -vf ${JPEG_SRC}/jidctfst.c
67e3c5
rm -vf ${JPEG_SRC}/jidctint.c
67e3c5
rm -vf ${JPEG_SRC}/jidctred.c
67e3c5
rm -vf ${JPEG_SRC}/jinclude.h
67e3c5
rm -vf ${JPEG_SRC}/jmemmgr.c
67e3c5
rm -vf ${JPEG_SRC}/jmemsys.h
67e3c5
rm -vf ${JPEG_SRC}/jmemnobs.c
67e3c5
rm -vf ${JPEG_SRC}/jmorecfg.h
67e3c5
rm -vf ${JPEG_SRC}/jpegint.h
67e3c5
rm -vf ${JPEG_SRC}/jpeglib.h
67e3c5
rm -vf ${JPEG_SRC}/jquant1.c
67e3c5
rm -vf ${JPEG_SRC}/jquant2.c
67e3c5
rm -vf ${JPEG_SRC}/jutils.c
67e3c5
rm -vf ${JPEG_SRC}/jcapimin.c
67e3c5
rm -vf ${JPEG_SRC}/jcapistd.c
67e3c5
rm -vf ${JPEG_SRC}/jccoefct.c
67e3c5
rm -vf ${JPEG_SRC}/jccolor.c
67e3c5
rm -vf ${JPEG_SRC}/jcdctmgr.c
67e3c5
rm -vf ${JPEG_SRC}/jchuff.c
67e3c5
rm -vf ${JPEG_SRC}/jchuff.h
67e3c5
rm -vf ${JPEG_SRC}/jcinit.c
67e3c5
rm -vf ${JPEG_SRC}/jconfig.h
67e3c5
rm -vf ${JPEG_SRC}/jcmainct.c
67e3c5
rm -vf ${JPEG_SRC}/jcmarker.c
67e3c5
rm -vf ${JPEG_SRC}/jcmaster.c
67e3c5
rm -vf ${JPEG_SRC}/jcparam.c
67e3c5
rm -vf ${JPEG_SRC}/jcphuff.c
67e3c5
rm -vf ${JPEG_SRC}/jcprepct.c
67e3c5
rm -vf ${JPEG_SRC}/jcsample.c
67e3c5
rm -vf ${JPEG_SRC}/jctrans.c
67e3c5
rm -vf ${JPEG_SRC}/jdtrans.c
67e3c5
rm -vf ${JPEG_SRC}/jfdctflt.c
67e3c5
rm -vf ${JPEG_SRC}/jfdctfst.c
67e3c5
rm -vf ${JPEG_SRC}/jfdctint.c
67e3c5
rm -vf ${JPEG_SRC}/jversion.h
67e3c5
rm -vf ${JPEG_SRC}/README
67e3c5
67e3c5
echo "Removing giflib"
67e3c5
if [ ! -d ${GIF_SRC} ]; then
67e3c5
	echo "${GIF_SRC} does not exist. Refusing to proceed."
67e3c5
	exit 1
67e3c5
fi	
67e3c5
rm -rvf ${GIF_SRC}
67e3c5
67e3c5
echo "Removing libpng"
67e3c5
if [ ! -d ${PNG_SRC} ]; then
67e3c5
	echo "${PNG_SRC} does not exist. Refusing to proceed."
67e3c5
	exit 1
67e3c5
fi	
67e3c5
rm -rvf ${PNG_SRC}
67e3c5
67e3c5
echo "Removing lcms"
67e3c5
if [ ! -d ${LCMS_SRC} ]; then
67e3c5
	echo "${LCMS_SRC} does not exist. Refusing to proceed."
67e3c5
	exit 1
67e3c5
fi
67e3c5
rm -vf ${LCMS_SRC}/cmscam02.c
67e3c5
rm -vf ${LCMS_SRC}/cmscgats.c
67e3c5
rm -vf ${LCMS_SRC}/cmscnvrt.c
67e3c5
rm -vf ${LCMS_SRC}/cmserr.c
67e3c5
rm -vf ${LCMS_SRC}/cmsgamma.c
67e3c5
rm -vf ${LCMS_SRC}/cmsgmt.c
67e3c5
rm -vf ${LCMS_SRC}/cmshalf.c
67e3c5
rm -vf ${LCMS_SRC}/cmsintrp.c
67e3c5
rm -vf ${LCMS_SRC}/cmsio0.c
67e3c5
rm -vf ${LCMS_SRC}/cmsio1.c
67e3c5
rm -vf ${LCMS_SRC}/cmslut.c
67e3c5
rm -vf ${LCMS_SRC}/cmsmd5.c
67e3c5
rm -vf ${LCMS_SRC}/cmsmtrx.c
67e3c5
rm -vf ${LCMS_SRC}/cmsnamed.c
67e3c5
rm -vf ${LCMS_SRC}/cmsopt.c
67e3c5
rm -vf ${LCMS_SRC}/cmspack.c
67e3c5
rm -vf ${LCMS_SRC}/cmspcs.c
67e3c5
rm -vf ${LCMS_SRC}/cmsplugin.c
67e3c5
rm -vf ${LCMS_SRC}/cmsps2.c
67e3c5
rm -vf ${LCMS_SRC}/cmssamp.c
67e3c5
rm -vf ${LCMS_SRC}/cmssm.c
67e3c5
rm -vf ${LCMS_SRC}/cmstypes.c
67e3c5
rm -vf ${LCMS_SRC}/cmsvirt.c
67e3c5
rm -vf ${LCMS_SRC}/cmswtpnt.c
67e3c5
rm -vf ${LCMS_SRC}/cmsxform.c
67e3c5
rm -vf ${LCMS_SRC}/lcms2.h
67e3c5
rm -vf ${LCMS_SRC}/lcms2_internal.h
67e3c5
rm -vf ${LCMS_SRC}/lcms2_plugin.h
67e3c5
67e3c5