Blame SOURCES/remove-intree-libraries.sh

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