Blame SOURCES/remove-intree-libraries.sh

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