#!/bin/bash -e #--------------------------------------------------------------------- # Get absolute path for script directory. BS=${BASH_SOURCE[0]} if [ -h $BS ]; then BS=`readlink $BS` fi THISDIR="$( dirname $BS )" cd $THISDIR || exit 1 THISDIR=`pwd` #--------------------------------------------------------------------- # Confirm that script is running in the right place. if [ \! -d mtsrc ]; then cat << END Error: This script must be stored in, and preferably executed in, the directory which contains the "mtsrc" directory. END exit 1 fi #--------------------------------------------------------------------- # Check usage. if [ "x$1" \!= "xclean" ]; then if [ "x$1" \!= "xcleanup" ]; then cat << END This is "mtcleanup-program.sh". This Linux script deletes left-over "build" files in a previously compiled copy of Final Minetest in an attempt to produce a tree that is closer to directly usable with "git". If you're sure of what you're doing, execute: bash -e mtclean-program.sh clean You can specify either "clean" or "cleanup" as the parameter. END exit 1 fi fi #--------------------------------------------------------------------- # Initial setup. BALLDIR=$THISDIR/mtsrc/newline PRODDIR=$THISDIR/minetest TOOLS_PREFIX=$THISDIR/toolstree BINDIR=$TOOLS_PREFIX/bin INCDIR=$TOOLS_PREFIX/include LIBDIR=$TOOLS_PREFIX/lib #--------------------------------------------------------------------- pushd $PRODDIR || exit 1 #--------------------------------------------------------------------- for x in \ C.includecache \ CXX.includecache \ CMakeCache.txt \ CMakeCCompiler.cmake \ CMakeCXXCompiler.cmake \ CMakeDirectoryInformation.cmake \ CMakeRuleHashes.txt \ CPackConfig.cmake \ CPackSourceConfig.cmake \ DependInfo.cmake \ Makefile2 \ TargetDirectories.txt \ build.make \ depend.make \ depend.internal \ cmake_config.h \ cmake_install.cmake \ flags.make \ link.txt \ progress.make \ relink.txt do rm -fr `find . -name $x` done #--------------------------------------------------------------------- rm -fr `find . -name Makefile | grep -v build/android` rm -fr `find . -name \*.a` rm -fr `find . -name \*.log` rm -fr `find . -name \*.o` rm -fr `find . -type d -name CMakeFiles` rm -fr textures/base/pack/menu_header_old.png rm -fr bin/minetest* games/Bucket_Game rm -fr cache worlds rm -fr debug.txt doc/Doxyfile install_manifest.txt rm -fr src/cmake_config_githash.h #--------------------------------------------------------------------- echo Done || exit 1