mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-04 09:08:30 +00:00
Simplify and cleanup bootstrap script
This commit is contained in:
175
bootstrap
175
bootstrap
@@ -9,133 +9,104 @@
|
|||||||
# Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
|
# Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
|
||||||
# Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
|
# Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
|
||||||
# Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
|
# Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
|
||||||
|
# Copyright (c) 2020 Carsten Teibes <dev f4ke de>
|
||||||
#
|
#
|
||||||
|
|
||||||
progname=`basename $0`
|
progname=`basename $0`
|
||||||
top_srcdir=`dirname $0`
|
top_srcdir=`dirname $0`
|
||||||
|
|
||||||
verbose="";
|
verbose=""
|
||||||
quiet="false"
|
quiet=0
|
||||||
mode="generate"
|
generate=1
|
||||||
|
|
||||||
usage()
|
usage() {
|
||||||
{
|
|
||||||
echo
|
echo
|
||||||
echo "usage: ${progname} [-h|-q|-v|-c]"
|
echo "usage: ${progname} [-h|-q|-v|-c]"
|
||||||
echo
|
echo
|
||||||
echo "options:"
|
echo "options:"
|
||||||
echo " -h .. display this message and exit";
|
echo " -h .. display this message and exit"
|
||||||
echo " -q .. quiet, don't display directories";
|
echo " -q .. quiet, don't display messages"
|
||||||
echo " -v .. verbose, pass -v to automake when invoking automake"
|
echo " -v .. verbose, report processed files/directories"
|
||||||
echo " -c .. clean, remove all aclocal/autoconf/automake generated files"
|
echo " -c .. clean, remove all autotools generated files"
|
||||||
echo
|
echo
|
||||||
exit 1;
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if test ! -f $top_srcdir/VERSION; then
|
msg() {
|
||||||
|
[ $quiet -eq 0 ] && echo $1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -f $top_srcdir/VERSION ]; then
|
||||||
echo "${progname}:"
|
echo "${progname}:"
|
||||||
echo " Installation problem: Can't find file VERSION"
|
echo " Installation problem: Can't find file VERSION"
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while test $# -gt 0; do
|
while [ $# -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|--he|--hel|--help)
|
-h|--help)
|
||||||
usage ;;
|
usage ;;
|
||||||
-q|--qu|--qui|--quie|--quiet)
|
-q|--quiet)
|
||||||
quiet="true";
|
quiet=1
|
||||||
shift;;
|
shift ;;
|
||||||
-v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
|
-v|--verbose)
|
||||||
verbose="-v";
|
verbose="--verbose"
|
||||||
shift;;
|
shift ;;
|
||||||
-c|--cl|--cle|--clea|--clean)
|
-c|--clean)
|
||||||
mode="clean";
|
generate=0
|
||||||
shift;;
|
shift ;;
|
||||||
-*) echo "unknown option $1" ;
|
-*)
|
||||||
|
echo "Unknown option: $1"
|
||||||
usage ;;
|
usage ;;
|
||||||
*) echo "invalid parameter $1" ;
|
*)
|
||||||
|
echo "Invalid parameter: $1"
|
||||||
usage ;;
|
usage ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
case $mode in
|
# default mode is generation
|
||||||
generate)
|
if [ $generate -eq 1 ]; then
|
||||||
|
msg "Running aclocal:"
|
||||||
|
aclocal --install
|
||||||
|
msg "Running autoconf:"
|
||||||
|
autoconf
|
||||||
|
msg "Running autoheader:"
|
||||||
|
autoheader
|
||||||
|
msg "Running automake:"
|
||||||
|
automake --add-missing --copy
|
||||||
|
|
||||||
case $top_srcdir in
|
exit
|
||||||
/* ) aclocal_dir=$top_srcdir
|
fi
|
||||||
;;
|
|
||||||
*) aclocal_dir=`pwd`/$top_srcdir
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
|
# cleanup mode
|
||||||
for i in $confs; do
|
if [ -f Makefile ]; then
|
||||||
dir=`dirname $i`;
|
msg "running distclean"
|
||||||
configure=`basename $i`;
|
make distclean
|
||||||
( test "$quiet" = "true" || echo "$dir";
|
fi
|
||||||
cd $dir;
|
msg "removing automake generated Makefile[.in] files:"
|
||||||
pat="s,\$(TOPdir),${aclocal_dir},g"
|
files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'`
|
||||||
aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \
|
files="$files `echo $files | sed -e 's%\.in%%g'`"
|
||||||
sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat ` ;
|
for i in $files; do if test -f $i; then
|
||||||
test "$verbose" = "-v" && echo "aclocal $aclocal_args"
|
rm $verbose -f $i
|
||||||
aclocal $aclocal_args;
|
fi; done
|
||||||
test -n "`grep CONFIG_HEADER ${configure}`" && autoheader \
|
|
||||||
&& test "$verbose" = "-v" && echo "autoheader";
|
|
||||||
test -f Makefile.am && automake -a -c --foreign $verbose ;
|
|
||||||
test "$verbose" = "-v" && echo "autoconf";
|
|
||||||
autoconf;
|
|
||||||
test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
|
|
||||||
&& echo timestamp > stamp-h.in
|
|
||||||
)
|
|
||||||
done
|
|
||||||
|
|
||||||
# HACK: Fixup the version in the generated configure script. This would be less of
|
msg "removing configure files:"
|
||||||
# hack if it wasn't pspsdk-specific. I'm doing this because I don't want to look
|
files="configure compile depcomp install-sh missing stamp-h1"
|
||||||
# into how to do it the autoconf way.
|
for i in $files; do if test -f $i; then
|
||||||
version=`cat "$top_srcdir/VERSION"`
|
rm $verbose -f $i
|
||||||
cat configure | sed "s/PSPSDK_VERSION/$version/g" > configure.out
|
fi; done
|
||||||
cp configure.out configure
|
|
||||||
rm -f configure.out
|
|
||||||
;;
|
|
||||||
|
|
||||||
clean)
|
msg "removing aclocal.m4"
|
||||||
test "$quiet" = "true" || echo "removing automake generated Makefile.in files"
|
rm -f aclocal.m4
|
||||||
files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'` ;
|
|
||||||
for i in $files; do if test -f $i; then
|
|
||||||
rm -f $i
|
|
||||||
test "$verbose" = "-v" && echo "$i"
|
|
||||||
fi; done
|
|
||||||
|
|
||||||
test "$quiet" = "true" || echo "removing configure files"
|
msg "removing autom4te.cache"
|
||||||
files=`find . -name 'configure' -print` ;
|
rm -fr autom4te.cache
|
||||||
test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
|
|
||||||
for i in $files; do if test -f $i; then
|
|
||||||
rm -f $i config.guess config.sub depcomp install-sh mdate-sh missing \
|
|
||||||
mkinstalldirs texinfo.tex
|
|
||||||
test "$verbose" = "-v" && echo "$i"
|
|
||||||
fi; done
|
|
||||||
|
|
||||||
test "$quiet" = "true" || echo "removing aclocal.m4 files"
|
msg "removing additional files:"
|
||||||
files=`find . -name 'aclocal.m4' -print` ;
|
find . -name '*~' -print | xargs rm $verbose -f
|
||||||
test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
|
rm $verbose -f config.status
|
||||||
for i in $files; do if test -f $i; then
|
rm $verbose -f config.log
|
||||||
rm -f $i
|
rm $verbose -f config.h
|
||||||
test "$verbose" = "-v" && echo "$i"
|
rm $verbose -f config.h.in
|
||||||
fi; done
|
find . -name '.deps' -print | xargs rm -rf
|
||||||
|
find . -name '.libs' -print | xargs rm -rf
|
||||||
test "$quiet" = "true" || echo "removing autom4te.cache"
|
|
||||||
rm -fr autom4te.cache
|
|
||||||
|
|
||||||
find . -name '*~' -print | xargs rm -f
|
|
||||||
find . -name '*.orig' -print | xargs rm -f
|
|
||||||
find . -name '*.rej' -print | xargs rm -f
|
|
||||||
find . -name 'config.status' -print | xargs rm -f
|
|
||||||
find . -name 'config.log' -print | xargs rm -f
|
|
||||||
find . -name 'config.cache' -print | xargs rm -f
|
|
||||||
find . -name 'config.h.in' -print | xargs rm -f
|
|
||||||
find . -name 'Makefile' -print | xargs rm -f
|
|
||||||
find . -name '.deps' -print | xargs rm -rf
|
|
||||||
find . -name '.libs' -print | xargs rm -rf
|
|
||||||
find . -name 'stamp-h.in' | xargs rm -rf
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
Reference in New Issue
Block a user