Blame SOURCES/remove-intree-libraries.sh

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