From bb16937e998f4e41f7e45c4976b581a6c6d064ce Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 19 Aug 2012 01:14:33 +0200 Subject: ./configure prototype --- configure | 254 +++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 160 insertions(+), 94 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 2868fb5..fc6af15 100755 --- a/configure +++ b/configure @@ -3,19 +3,37 @@ PREFIX="/usr" INFODESC=\''My Little Ponies for your terminal'\' -CPPFLAGS="" -CFLAGS="" -LDFLAGS="" - -compileMethods='all' completions='completion/bash-completion.sh completion/fish-completion.fish completion/zsh-completion.zsh' -shareDirs='ponies ttyponies quote' +shareDirs='ponies ttyponies quotes' manFiles='manuals/manpage.6 manuals/manpage.es.6' licenseFiles='COPYING' +oldInstalledFiles='bin/ponysaytruncater lib/ponysay/list.pl lib/ponysay/linklist.pl lib/ponysay/pq4ps lib/ponysay/pq4ps.pl lib/ponysay/pq4ps-list lib/ponysay/pq4ps-list.pl' +oldInstalledDirs='share/ponies share/ttyponies' +oldCompiledFiles='ponysaytruncater ponysay.install' +oldCompiledDirs='' + +installedFiles='bin/ponysay bin/ponythink bin/ponysay.py bin/ponythink.py doc/ponysay.pdf share/info/ponysay.info.gz share/info/ponythink.info.gz' +installedDirs='share/ponysay lib/ponysay' +compiledFiles='truncater ponysay.info.gz ponysay.py.install' +compiledDirs='' + +for man in $manFiles; do + oldCompiledFiles="$oldCompiledFiles $man.gz" +done +for completion in $completions; do + thinkfile="${completion%%.*}-think.${completion##*.}" + compiledFiles="$compiledFiles $completion.install $thinkfile" +done +for file in $licenseFiles; do + installedFiles="$installedFiles share/licenses/ponysay/$file" +done + + + function getcompdir() { if [ "$1" == 'bash' ]; then echo -n 'bash-completion/completions' @@ -34,16 +52,51 @@ function getcompfile() +installPdf='' +installInfo=' install-info' +installMan=' install-man' +installManEs='' +installBash=' install-bash' +installFish=' install-fish' +installZsh=' install-zsh' + for arg in "$@"; do opt="${arg%%=*}" val="${arg##*=}" + if [ "$opt" = '--prefix' ]; then PREFIX="$val" elif [ "$opt" = '--info-desc' ]; then INFODESC=\'"$(sed -e s/\'/\''\\'\'\'/g <<<"$val")"\' + + elif [ "$opt" = '--with-pdf' ]; then installPdf=' install-pdf' + elif [ "$opt" = '--without-info' ]; then installInfo='' + elif [ "$opt" = '--without-man' ]; then installMan='' + elif [ "$opt" = '--with-man-es' ]; then installManEs=' install-man-es' + elif [ "$opt" = '--without-bash' ]; then installBash='' + elif [ "$opt" = '--without-fish' ]; then installFish='' + elif [ "$opt" = '--without-zsh' ]; then installZsh='' + + elif [ "$opt" = "--with-everyting" ]; then + installPdf=' install-pdf' + installInfo=' install-info' + installMan=' install-man' + installManEs=' install-man-es' + installBash=' install-bash' + installFish=' install-fish' + installZsh=' install-zsh' + + else + echo "$0: error: option not recongised: $arg" >&2 fi done +compileMethods='core truncater manpages ponysaycompletion ponythinkcompletion' +installMethods='install-min'"$installPdf$installInfo$installMan'$installManEs$installBash$installFish$installZsh" +if [ ! "$installInfo" = '' ]; then + compileMethods="$compileMethods infomanual" +fi + function correctPrefix() @@ -65,11 +118,11 @@ function gzCompress() function thinkCompletion() { for file in "$@"; do - echo -en '\tsed ' - echo -n '-e '\''s/ponysay/ponythink/g'\' - echo -n ' < "'"$file"'.install" | sed ' - echo -n '-e '\''s/\/ponythink\//\/ponysay\//g'\' - echo -n '-e '\''s/\\\/ponythink\\\//\\\/ponysay\\\//g'\' + echo -en '\tsed' + echo -n ' -e '\''s/ponysay/ponythink/g'\' + echo -n ' < "'"$file"'.install" | sed' + echo -n ' -e '\''s/\/ponythink\//\/ponysay\//g'\' + echo -n ' -e '\''s/\\\/ponythink\\\//\\\/ponysay\\\//g'\' thinkfile="${file%%.*}-think.${file##*.}" echo ' > "'"$thinkfile"'"' done @@ -77,20 +130,31 @@ function thinkCompletion() -echo "PREFIX = $PREFIX" -echo "INFODESC = $INFODESC" -echo "CPPFLAGS = $CPPFLAGS" -echo "CFLAGS = $CFLAGS" -echo "LDFLAGS = $LDFLAGS" +echo "PREFIX = $PREFIX, edit with option --prefix=PREFIX" +echo "INFODESC = $INFODESC, edit with option --info-desc=INFODESC" +echo +[ ! "$installPdf" = '' ] && echo "Installing PDF manual" +[ ! "$installInfo" = '' ] && echo "Installing info manual, add option --without-info to skip" +[ ! "$installMan" = '' ] && echo "Installing English manpage manual, add option --without-man to skip" +[ ! "$installManEs" = '' ] && echo "Installing Spanish manpage manual" +[ ! "$installBash" = '' ] && echo "Installing autocompletion for GNU Bash, add option --without-bash to skip" +[ ! "$installFish" = '' ] && echo "Installing autocompletion for fish, add option --without-fish to skip" +[ ! "$installZsh" = '' ] && echo "Installing autocompletion for zsh, add option --without-zsh to skip" +echo +[ ! "$installPdf" = '' ] || echo "Skipping PDF manual, add option --with-pdf to install" +[ ! "$installInfo" = '' ] || echo "Skipping info manual" +[ ! "$installMan" = '' ] || echo "Skipping English manpage manual" +[ ! "$installManEs" = '' ] || echo "Skipping Spanish manpage manual, add option --with-man-es to install" +[ ! "$installBash" = '' ] || echo "Skipping autocompletion for GNU Bash" +[ ! "$installFish" = '' ] || echo "Skipping autocompletion for fish" +[ ! "$installZsh" = '' ] || echo "Skipping autocompletion for zsh" +echo function makeMakefile() { echo 'PREFIX='\'"$PREFIX"\' - echo 'CPPFLAGS='\'"$CPPFLAGS"\' - echo 'CFLAGS='\'"$CFLAGS"\' - echo 'LDFLAGS='\'"$LDFLAGS"\' echo 'INSTALLDIR="$(DESTDIR)$(PREFIX)"' echo 'SED_PREFIX=$$(sed -e '\''s/\//\\\//g'\'' <<<$(PREFIX))' echo @@ -127,10 +191,10 @@ function makeMakefile() echo echo 'install-min: core truncater' - echo -en '\t' ; echo 'mkdir -p "'"$shareDir"'"' + echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/"' for dir in $shareDirs; do - echo -en '\t' ; echo 'mkdir "$(INSTALLDIR)/share/ponysay/ponies'"$dir"'"' - echo -en '\t' ; echo 'cp -P "'"$dir"'/"*.* "$(INSTALLDIR)/share/ponysay/ponies'"$dir"'/"' + echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/'"$dir"'"' + echo -en '\t' ; echo 'cp -P "'"$dir"'/"*.* "$(INSTALLDIR)/share/ponysay/'"$dir"'/"' done echo echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/bin/"' @@ -153,12 +217,13 @@ function makeMakefile() shell="${completion##*/}" shell="${shell%%-*}" thinkfile="${completion%%.*}-think.${completion##*.}" - shelldir='$(INSTALLDIR)/share/'"$(getcompdir $shell)"'/' + shelldir='share/'"$(getcompdir $shell)"'/' echo 'install-'"$shell"': ponysaycompletion ponythinkcompletion' - echo -en '\t' ; echo 'mkdir -p "'"$shelldir"'"' - echo -en '\t' ; echo 'install "'"$completion"'" "'"$shelldir$(getcompfile $shell ponysay)"'"' - echo -en '\t' ; echo 'install "'"$thinkfile"'" "'"$shelldir$(getcompfile $shell ponythink)"'"' + echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/'"$shelldir"'"' + echo -en '\t' ; echo 'install "'"$completion"'" "$(INSTALLDIR)/'"$shelldir$(getcompfile $shell ponysay)"'"' + echo -en '\t' ; echo 'install "'"$thinkfile"'" "$(INSTALLDIR)/'"$shelldir$(getcompfile $shell ponythink)"'"' echo + installedFiles="$installedFiles $shelldir$(getcompfile $shell ponysay) $shelldir$(getcompfile $shell ponythink)" done echo 'install-pdf:' @@ -183,8 +248,76 @@ function makeMakefile() echo -en '\t' ; echo 'install "'"$man"'.gz" "$(INSTALLDIR)/share/man'"$mandir"'/man6/ponysay.6.gz"' echo -en '\t' ; echo 'ln -sf "ponysay.6.gz" "$(INSTALLDIR)/share/man'"$mandir"'/man6/ponythink.6.gz"' echo + installedFiles="$installedFiles share/man$mandir/man6/ponysay.6.gz share/man$mandir/man6/ponythink.6.gz" done + echo + echo 'install: '"$installMethods" + echo -en '\t' ; echo '@echo -e \\n\\n\' + cat < Makefile - +makeMakefile > Makefile -#install: install-no-info install-info -# @echo -e '\n\n'\ -#'/--------------------------------------------------\\\n'\ -#'| ___ |\n'\ -#'| / (_) o |\n'\ -#'| \__ _ _ __ |\n'\ -#'| / / |/ | | / \_| | |\n'\ -#'| \___/ | |_/|/\__/ \_/|/ |\n'\ -#'| /| /| |\n'\ -#'| \| \| |\n'\ -#'| ____ |\n'\ -#'| | _ \ ___ _ __ _ _ ___ __ _ _ _ |\n'\ -#'| | |_) |/ _ \ | '\''_ \ | | | |/ __| / _` || | | | |\n'\ -#'| | __/| (_) || | | || |_| |\__ \| (_| || |_| | |\n'\ -#'| |_| \___/ |_| |_| \__, ||___/ \__,_| \__, | |\n'\ -#'| |___/ |___/ |\n'\ -#'\\--------------------------------------------------/' -# @echo 'dummy' | ./ponysay -f ./`if [[ "$$TERM" = "linux" ]]; then echo ttyponies; else echo ponies; fi`/pinkiecannon.pony | tail --lines=30 ; echo -e '\n' -# -#uninstall: -# if [ -d "$(INSTALLDIR)/share/ponysay" ]; then rm -fr "$(INSTALLDIR)/share/ponysay" ; fi -# if [ -d "$(INSTALLDIR)/lib/ponysay" ]; then rm -fr "$(INSTALLDIR)/lib/ponysay" ; fi -# if [ -f "$(INSTALLDIR)/bin/ponysay" ]; then unlink "$(INSTALLDIR)/bin/ponysay" ; fi -# if [ -f "$(INSTALLDIR)/bin/ponythink" ]; then unlink "$(INSTALLDIR)/bin/ponythink" ; fi -# if [ -f "$(INSTALLDIR)/share/licenses/ponysay/COPYING" ]; then unlink "$(INSTALLDIR)/share/licenses/ponysay/COPYING" ; fi -# if [ -f "$(INSTALLDIR)/share/bash-completion/completions/ponysay" ]; then unlink "$(INSTALLDIR)/share/bash-completion/completions/ponysay" ; fi -# if [ -f "$(INSTALLDIR)/share/bash-completion/completions/ponythink" ]; then unlink "$(INSTALLDIR)/share/bash-completion/completions/ponythink"; fi -# if [ -f "$(INSTALLDIR)/share/fish/completions/ponysay.fish" ]; then unlink "$(INSTALLDIR)/share/fish/completions/ponysay.fish" ; fi -# if [ -f "$(INSTALLDIR)/share/fish/completions/ponythink.fish" ]; then unlink "$(INSTALLDIR)/share/fish/completions/ponythink.fish" ; fi -# if [ -f "$(INSTALLDIR)/share/zsh/site-functions/_ponysay"; ]; then unlink "$(INSTALLDIR)/share/zsh/site-functions/_ponysay" ; fi -# if [ -f "$(INSTALLDIR)/share/zsh/site-functions/_ponythink"; ]; then unlink "$(INSTALLDIR)/share/zsh/site-functions/_ponythink" ; fi -# if [ -f "$(INSTALLDIR)/share/man/man6/ponysay.6.gz" ]; then unlink "$(INSTALLDIR)/share/man/man6/ponysay.6.gz" ; fi -# if [ -f "$(INSTALLDIR)/share/man/man6/ponythink.6.gz" ]; then unlink "$(INSTALLDIR)/share/man/man6/ponythink.6.gz" ; fi -# if [ -f "$(INSTALLDIR)/share/man/es/man6/ponysay.6.gz" ]; then unlink "$(INSTALLDIR)/share/man/es/man6/ponysay.6.gz" ; fi -# if [ -f "$(INSTALLDIR)/share/man/es/man6/ponythink.6.gz" ]; then unlink "$(INSTALLDIR)/share/man/es/man6/ponythink.6.gz" ; fi -# if [ -f "$(INSTALLDIR)/share/info/ponysay.info.gz" ]; then unlink "$(INSTALLDIR)/share/info/ponysay.info.gz" ; fi -# if [ -f "$(INSTALLDIR)/share/info/ponythink.info.gz" ]; then unlink "$(INSTALLDIR)/share/info/ponythink.info.gz" ; fi -# if [ -f "$(INSTALLDIR)/doc/ponysay.pdf" ]; then unlink "$(INSTALLDIR)/doc/ponysay.pdf" ; fi -# -#clean: -# if [ -f "truncater" ]; then rm -f "truncater" ; fi -# if [ -f "completion/bash-completion-think.sh" ]; then rm -f "completion/bash-completion-think.sh" ; fi -# if [ -f "completion/fish-completion-think.fish" ]; then rm -f "completion/fish-completion-think.fish" ; fi -# if [ -f "completion/zsh-completion-think.zsh" ]; then rm -f "completion/zsh-completion-think.zsh" ; fi -# if [ -f "completion/bash-completion.sh.install" ]; then rm -f "completion/bash-completion.sh.install" ; fi -# if [ -f "completion/fish-completion.fish.install" ]; then rm -f "completion/fish-completion.fish.install"; fi -# if [ -f "completion/zsh-completion.zsh.install" ]; then rm -f "completion/zsh-completion.zsh.install" ; fi -# if [ -f "manuals/manpage.6.gz" ]; then rm -f "manuals/manpage.6.gz" ; fi -# if [ -f "manuals/manpage.es.6.gz" ]; then rm -f "manuals/manpage.es.6.gz" ; fi -# if [ -f "ponysay.info.gz" ]; then rm -f "ponysay.info.gz" ; fi -# if [ -f "ponysay.py.install" ]; then rm -f "ponysay.py.install" ; fi -# -#uninstall-old: -# if [ -d "$(INSTALLDIR)/share/ponies" ]; then rm -fr "$(INSTALLDIR)/share/ponies" ; fi -# if [ -d "$(INSTALLDIR)/share/ttyponies" ]; then rm -fr "$(INSTALLDIR)/share/ttyponies" ; fi -# if [ -f "$(INSTALLDIR)/bin/ponysaytruncater" ]; then unlink "$(INSTALLDIR)/bin/ponysaytruncater" ; fi -# if [ -d "$(INSTALLDIR)/lib/ponysay/link.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/link.pl" ; fi -# if [ -d "$(INSTALLDIR)/lib/ponysay/linklist.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/linklist.pl" ; fi -# if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps" ; fi -# if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps.pl" ; fi -# if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps-list" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps-list" ; fi -# if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps-list.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps-list.pl" ; fi -# -#clean-old: -# if [ -f "ponysaytruncater" ]; then rm -f "ponysaytruncater"; fi -# -- cgit