Blame SOURCES/remove-intree-libraries.sh

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