123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #!/bin/bash
- # eecc - Eclectic Engineer's Control Center
- # See LICENSE file for copyright and license details.
-
- tmp=$(mktemp)
- sed -e 's/ = /=/' < config.mk > $tmp
- . $tmp
- rm -f $tmp
-
- bindir=${DESTDIR}${PREFIX}/bin
-
- list_of_bins() {
- echo bin/eeabrt
- echo bin/eedmenu
- echo bin/eeget
- echo bin/eeiam
- echo bin/eeini
- echo bin/eeln
- echo bin/eemk
- echo bin/eepush
- echo bin/eerevert
- echo bin/eewatch
- echo bin/eewww
- }
-
- list_of_installed_bins() {
- list_of_bins | sed -e "s/bin/$(sed -e 's/\//\\\//g' <<<$bindir)/"
- }
-
- die() {
- for l in "$@"; do echo "$l" >&2; done
- exit 9
- }
-
- build1() {
- local srcpath dstpath
- srcpath=$1
- dstpath=${srcpath%.in}
- perl -pe "
- s|__FFOO_INIT__|$ffoo_init|;
- s|__FFOO_INI_PATH__|$FFOO_INI_PATH_GLOBAL:\\\$HOME/$FFOO_INI_PATH_USER|;
- s|__VERSION__|$VERSION|;
- " < $srcpath > $dstpath
- echo $dstpath >> built.list
- }
-
- build() {
- ffoom init_path >& /dev/null \
- || die "-----" \
- "fastfoo not installed or ffoom is not available for $(id -un)." \
- "In the latter case try running (only) \`make\` under normal" \
- "user and repeating the \`make install\` again." \
- "-----"
- local ffoo_init=$(ffoom init_path)
- local srcpath
- find -type f -name '*.in' \
- | while read srcpath;
- do
- build1 "$srcpath"
- done
- }
-
- clean() {
- test -f built.list && {
- cat built.list | xargs rm -f
- rm -f built.list
- } || :
- }
-
- dist() {
- local dirname=eecc-${VERSION}
- mkdir -p $dirname
- cp -R bin \
- config.mk \
- Makefile \
- README \
- LICENSE \
- setup \
- test \
- utils \
- $dirname
- tar -cf $dirname.tar $dirname
- gzip $dirname.tar
- rm -rf $dirname
- echo $dirname.tar.gz >> built.list
- }
-
- install() {
- mkdir -vp $bindir
- list_of_bins | xargs cp -vrt $bindir
- list_of_installed_bins | xargs chmod -v 755
- test -f .autoclean && clean || :
- }
-
- run_test() {
- pushd test
- find -maxdepth 1 -type f \! -name '*.in' | while read test;
- do
- chmod 0755 $test
- $test || exit $?
- done
- popd
- }
-
- uninstall() {
- list_of_installed_bins | xargs rm -vf
- }
-
- case $1 in
- build|clean|dist|install|install_manpages|manpages|uninstall)
- $1
- ;;
- test)
- run_test
- ;;
- *)
- echo "usage: $(basename $0) build|clean|dist|install|test|uninstall" >&2
- esac
|