Blame SOURCES/remove-intree-libraries.sh

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