From e1190eb1f34418f6c7a422f537eb75a434e71240 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 12 Jan 2013 15:18:19 -0800 Subject: Remove seq.in, in favor of the new function. Remove seq detection from configure.ac. Teach the Makefile how to remove old installed seqs. --- Makefile.in | 21 ++++++++++++++++----- configure.ac | 34 +--------------------------------- seq.in | 47 ----------------------------------------------- 3 files changed, 17 insertions(+), 85 deletions(-) delete mode 100755 seq.in diff --git a/Makefile.in b/Makefile.in index d0b58f5b..b8942b50 100644 --- a/Makefile.in +++ b/Makefile.in @@ -204,7 +204,7 @@ MAIN_DIR_FILES_UNSORTED := Doxyfile Doxyfile.user Doxyfile.help \ $(COMMON_FILES) $(COMMON_FILES:.cpp=.h) $(FISH_OBJS:.o=.cpp) \ fish.spec.in INSTALL README user_doc.head.html xsel-0.9.6.tar \ ChangeLog config.sub config.guess fish_tests.cpp fish.cpp fish_pager.cpp \ - fishd.cpp seq.in make_vcs_completions.fish $(FISH_INDENT_OBJS:.o=.cpp) + fishd.cpp make_vcs_completions.fish $(FISH_INDENT_OBJS:.o=.cpp) # # The sorting is not meaningful in itself, but it has the side effect @@ -242,7 +242,7 @@ FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish) # SIMPLE_PROGRAMS := fish set_color mimedb fish_pager fishd fish_indent -PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL_BIN@ @SEQ_FALLBACK@ +PROGRAMS := $(SIMPLE_PROGRAMS) @XSEL_BIN@ # @@ -443,10 +443,10 @@ doc.h: $(HDR_FILES) # Create a template translation object # -messages.pot: *.cpp *.h share/completions/*.fish share/functions/*.fish seq +messages.pot: *.cpp *.h share/completions/*.fish share/functions/*.fish if test $(HAVE_GETTEXT) = 1;then \ xgettext -k_ -kN_ *.cpp *.h -o messages.pot; \ - if xgettext -j -k_ -kN_ -k--description -LShell share/completions/*.fish share/functions/*.fish seq -o messages.pot; then true; else \ + if xgettext -j -k_ -kN_ -k--description -LShell share/completions/*.fish share/functions/*.fish -o messages.pot; then true; else \ echo "Your xgettext version is too old to build the messages.pot file"\ rm messages.pot\ false;\ @@ -527,6 +527,17 @@ check-uninstall: .PHONY: check-uninstall +# seq used to be a shell script that we would install +# Now we just look for previously installed seqs, and erase them +# No big deal if it fails +cleanup_old_seq: + SEQLOC=`which seq`;\ + if test -x "$$SEQLOC" && grep -q '\(^#!/.*/fish\|^#!/usr/bin/env fish\)' "$$SEQLOC"; then\ + rm -f "$$SEQLOC";\ + fi;\ + true; +.PHONY: cleanup_old_seq + # # This check makes sure that the install-sh script is executable. The # darcs repo doesn't preserve the executable bit, so this needs to be @@ -542,7 +553,7 @@ install-sh: # Try to install after checking for incompatible installed versions. # -install: all install-sh check-uninstall install-force +install: all cleanup_old_seq install-sh check-uninstall install-force .PHONY: install # diff --git a/configure.ac b/configure.ac index 85c9fed4..bf3defcf 100644 --- a/configure.ac +++ b/configure.ac @@ -34,7 +34,6 @@ AC_SUBST(LIBS_SET_COLOR) AC_SUBST(localedir) AC_SUBST(optbindirs) AC_SUBST(prefix) -AC_SUBST(SEQ_FALLBACK) AC_SUBST(XSEL) AC_SUBST(XSEL_MAN) AC_SUBST(XSEL_BIN) @@ -167,37 +166,6 @@ AC_PROG_CXX([g++ c++]) AC_PROG_CPP AC_PROG_INSTALL -# -# Check for seq command. If missing, make sure fallback shellscript -# implementation is installed. -# - -AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq]) - - -if test "$SEQ_FALLBACK"; then - - # - # We already have seq. Check if the seq version is installed by an - # earlier fish version. If it is, we'll replace it. - # - - file=`which seq` - if test -f "$file"; then - - AC_MSG_CHECKING([if seq comes from a previous fish version]) - shebang=`grep "\(^#!/.*/fish\|^#!/usr/bin/env fish\)" $file` - - if test "$shebang"; then - SEQ_FALLBACK=seq - AC_MSG_RESULT(yes, replace it) - else - AC_MSG_RESULT(no, keep it) - fi - fi -fi - - # # Optionally drop xsel command # @@ -950,7 +918,7 @@ case $target_os in esac # Tell the world what we know -AC_CONFIG_FILES([Makefile fish.spec seq]) +AC_CONFIG_FILES([Makefile fish.spec]) AC_OUTPUT if test ! x$local_found_posix_switch = xyes; then diff --git a/seq.in b/seq.in deleted file mode 100755 index 97bd6290..00000000 --- a/seq.in +++ /dev/null @@ -1,47 +0,0 @@ -# If seq is not installed, then define a function that invokes __fish_fallback_seq -if begin ; test -x /usr/bin/seq ; or type --no-functions seq > /dev/null; end - function seq --description "Print sequences of numbers" - __fish_fallback_seq $argv - end -end - - -function __fish_fallback_seq --description "Fallback implementation of the seq command" - - set -l from 1 - set -l step 1 - set -l to 1 - - switch (count $argv) - case 1 - set to $argv[1] - - case 2 - set from $argv[1] - set to $argv[2] - - case 3 - set from $argv[1] - set step $argv[2] - set to $argv[3] - - case '*' - printf (_ "%s: Expected 1, 2 or 3 arguments, got %d\n") seq (count $argv) - exit 1 - - end - - for i in $from $step $to - if not echo $i | grep -E '^-?[0-9]*([0-9]*|\.[0-9]+)$' >/dev/null - printf (_ "%s: '%s' is not a number\n") seq $i - exit 1 - end - end - - if [ $step -ge 0 ] - echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc - else - echo "for( i=$from; i>=$to ; i+=$step ) i;" | bc - end -end - -- cgit v1.2.3