Skip to content

Commit

Permalink
Redo installation file structure, move lots of things to $PREFIX/shar…
Browse files Browse the repository at this point in the history
…e/fish

darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
  • Loading branch information
liljencrantz committed Feb 17, 2006
1 parent 95a01f3 commit 343cafe
Show file tree
Hide file tree
Showing 196 changed files with 300 additions and 253 deletions.
69 changes: 37 additions & 32 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ datadir = @datadir@
bindir = @bindir@
mandir = @mandir@
sysconfdir = @sysconfdir@
fishdir = @fishdir@
fishfile = @fishfile@
fishinputfile = @fishinputfile@
docdir = @docdir@

#Init files to install
INIT_DIR_INSTALL = init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish
#etc files to install
ETC_DIR_INSTALL = etc/fish_interactive.fish etc/fish_function.fish

# Set to 1 if we have gettext
HAVE_GETTEXT=@HAVE_GETTEXT@
Expand Down Expand Up @@ -162,18 +160,20 @@ MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
user_doc.head.html xsel-0.9.6.tar ChangeLog config.sub \
config.guess fish_tests.c main.c fish_pager.c fishd.c seq.in

# Files in ./init/
INIT_DIR_FILES :=init/fish.in init/fish_complete.fish.in \
init/fish_function.fish init/fish_inputrc \
init/fish_interactive.fish.in
# Files in ./etc/
ETC_DIR_FILES :=etc/fish.in etc/fish_function.fish etc/fish_inputrc \
etc/fish_interactive.fish.in

# Files in ./share/
SHARE_DIR_FILES :=share/fish

# Files in ./tests/
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
$(TEST_IN:.in=.status) tests/test.fish tests/gen_output.fish

COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish)

FUNCTIONS_DIR_FILES := $(wildcard init/functions/*.fish)
FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)

# Programs to build
PROGRAMS:=fish set_color @XSEL@ @SEQ_FALLBACK@ mimedb count fish_pager fishd
Expand Down Expand Up @@ -266,10 +266,10 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
fi

# Create a template translation object
messages.pot: *.c *.h init/*.in init/*.fish init/completions/*.fish init/functions/*.fish seq
messages.pot: *.c *.h etc/*.in etc/*.fish share/*.in share/completions/*.fish share/functions/*.fish seq
if test $(HAVE_GETTEXT) = 1;then \
xgettext -k_ -kN_ -kcomplete_desc *.c *.h -o messages.pot; \
if ! xgettext -j -k_ -LShell init/*.in init/*.fish init/functions/*.fish init/completions/*.fish seq -o messages.pot; then \
if ! xgettext -j -k_ -LShell etc/*.in etc/*.fish share/*.in share/completions/*.fish share/functions/*.fish seq -o messages.pot; then \
echo "Your xgettext version is too old to build the messages.pot file"\
rm messages.pot\
false;\
Expand Down Expand Up @@ -348,20 +348,22 @@ install: all install-translations
for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
done;
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/completions
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/functions
$(INSTALL) -m 644 init/fish $(DESTDIR)$(sysconfdir)$(fishfile)
for i in $(INIT_DIR_INSTALL); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir); \
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish.d
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
$(INSTALL) -m 644 etc/fish $(DESTDIR)$(sysconfdir)/fish
$(INSTALL) -m 644 share/fish $(DESTDIR)$(datadir)/fish
for i in $(ETC_DIR_INSTALL); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)/fish.d; \
done;
for i in $(COMPLETIONS_DIR_FILES); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir)/completions/; \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \
done;
for i in $(FUNCTIONS_DIR_FILES); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir)/functions/; \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \
done;
$(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
$(INSTALL) -m 644 etc/fish_inputrc $(DESTDIR)$(sysconfdir)/fish_inputrc;
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
for i in user_doc/html/* ChangeLog; do \
if test -f $$i; then \
Expand All @@ -387,9 +389,10 @@ uninstall: uninstall-translations
rm -f $(DESTDIR)$(bindir)/$$i; \
done;
rm -f $(DESTDIR)$(bindir)/xsel
rm -f $(DESTDIR)$(sysconfdir)$(fishfile)
rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
rm -f $(DESTDIR)$(sysconfdir)/fish
rm -f $(DESTDIR)$(sysconfdir)/fish_inputrc
rm -r $(DESTDIR)$(sysconfdir)/fish.d
rm -r $(DESTDIR)$(datadir)/fish
rm -r $(DESTDIR)$(docdir)
for i in fish.1* @XSEL_MAN@ mimedb.1* fishd.1* set_color.1* count.1*; do \
rm $(DESTDIR)$(mandir)/man1/$$i; \
Expand Down Expand Up @@ -458,20 +461,22 @@ depend:
#
# Uses install instead of mkdir so build won't fail if the directory
# exists
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FILES) $(TEST_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
rm -rf fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/functions
$(INSTALL) -d fish-@PACKAGE_VERSION@/etc
$(INSTALL) -d fish-@PACKAGE_VERSION@/share
$(INSTALL) -d fish-@PACKAGE_VERSION@/share/completions
$(INSTALL) -d fish-@PACKAGE_VERSION@/share/functions
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
$(INSTALL) -d fish-@PACKAGE_VERSION@/po
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
cp -f $(FUNCTIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/functions/
cp -f $(ETC_DIR_FILES) fish-@PACKAGE_VERSION@/etc/
cp -f $(SHARE_DIR_FILES) fish-@PACKAGE_VERSION@/share/
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/completions/
cp -f $(FUNCTIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/functions/
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/po/
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
Expand Down Expand Up @@ -499,7 +504,7 @@ rpm: fish-@PACKAGE_VERSION@.tar.bz2

distclean: clean
rm -f fish.spec doc_src/fish.1 doc_src/Doxyfile
rm -f init/fish init/fish_interactive.fish init/fish_complete.fish
rm -f etc/fish etc/fish_interactive.fish share/fish
rm -f config.status config.log config.h Makefile
.PHONY: distclean

Expand Down
8 changes: 3 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ else
AC_SUBST( PREFIX, [$prefix])
fi

AC_SUBST(fishdir,[/fish.d])
AC_SUBST(fishfile,[/fish])
AC_SUBST(fishinputfile,[/fish_inputrc])

AC_ARG_VAR( [docdir], [Documentation direcotry] )

if test -z $docdir; then
Expand All @@ -116,7 +112,9 @@ fi

AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
AC_DEFINE_UNQUOTED( DATADIR, [L"$(eval echo $datadir)"], [System configuration directory] )
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
AC_SUBST( DATADIR, ["$(eval echo $datadir)"] )

# Set up locale directory
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
Expand Down Expand Up @@ -235,7 +233,7 @@ fi
# Check if we have ncurses, and use it rather than curses if possible.
AC_SEARCH_LIBS( setupterm, [ncurses curses], [ AC_MSG_NOTICE([Found curses implementation])], [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )

AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish seq])
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc/fish_interactive.fish seq])
AC_OUTPUT

echo "Now run 'make' and 'make install' to built and install fish."
Expand Down
83 changes: 69 additions & 14 deletions doc_src/doc.hdr
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,42 @@ the <a href="builtins.html#fg">fg</a> command.
To get a listing of all currently started jobs, use the <a
href="builtins.html#jobs">jobs</a> command.

\subsection syntax-function Shellscript functions

Functions are used to group together commands and arguments
using a single name. For example, the following is a function
definition that calls the command 'ls -l' to print a detailed listing
of the contents of the current directory:

<pre>
function ll
ls -l $argv
end
</pre>

The first line tells fish that a function by the name of ll is to be
defined. To use it, simply write <code>ll</code> on the
commandline. The second line tells fish that the command <code>ls -l
$argv</code> should be called when ll is invoked. $argv is an array
variable, which always contains all arguments sent to the function. In
the example above, these are simply passed on to the ls command. For
more information on functions, see the documentation for the <a
href='builtin.html#function'>function builtin</a>.

Functions can be defined on the commandline or in a configuration
file, but they can also be automatically loaded. Fish automatically
searches through any directories in the array variable
\$fish_function_path, and any functions defined are automatically
loaded when needed. A function definition file must have a filename
consisting of the name of the function and the suffix '.fish'.

The default value for \$fish_function_path is ~/.fish.d/functions,
/etc/fish.d/functions /usr/share/fish/functions. The exact path to the
last two of these may be slighly different depending on what install
path prefix was chosen at configuration time. The rationale behind
having three different directories is that the first one is for user
specific functions, the second one is for system-wide additional
functions and the last one is for default fish functions.

\subsection syntax-words Some common words

Expand Down Expand Up @@ -313,17 +349,33 @@ href="builtins.html#complete">complete</a> builtin, or write 'complete
--help' inside the \c fish shell.

For examples of how to write your own complex completions, study the
completions in /etc/fish.d/completions (or ~/etc/fish.d/completions if
you installed fish in your home directory).

If you wish to use a completion, you should consider adding it to your
startup files. When completion has been requested for a command \c
COMMAND, fish will automatically look for the file
~/.fish.d/completions/COMMAND.fish. If it exists, it will be
automatically loaded. If you have written new completions for a common
completions in /usr/share/fish/completions. (The exact path depends on
your chosen installation prefix and may be slightly different)

\subsection completion-path Where to put completions

Completions can be defined on the commandline or in a configuration
file, but they can also be automatically loaded. Fish automatically
searches through any directories in the array variable
\$fish_complete_path, and any completions defined are automatically
loaded when needed. A completion file must have a filename consisting
of the name of the command to complete and the suffix '.fish'.

The default value for \$fish_complete_path is ~/.fish.d/completions,
/etc/fish.d/completions and /usr/share/fish/completions. The exact
path to the last two of these may be slighly different depending on
what install path prefix was chosen at configuration time. If a
suitable file is found in one of these directories, it will be
automatically loaded and the search will be stopped. The rationale
behind having three different directories is that the first one is for
user specific completions, the second one is for system-wide
completions and the last one is for default fish completions.

If you have written new completions for a common
Unix command, please consider sharing your work by sending it to <a
href='mailto: fish-users@lists.sf.net'>the fish mailinglist</a>.


\section expand Parameter expansion (Globbing)

When an argument for a program is given on the commandline, it
Expand Down Expand Up @@ -878,12 +930,15 @@ which the user can change <code>fish</code>'s behaviour.

\section initialization Initialization files

On startup, \c fish evaluates the file /etc/fish (Or ~/etc/fish if you
installed fish in your home directory) and ~/.fish, in that order. If
you want to run a command only on starting an interactive shell, use
the exit status of the command 'status --is-interactive' to determine
if the shell is interactive. If you want to run a command only when
using a login shell, use 'status --is-login' instead.
On startup, \c fish evaluates the files /usr/share/fish/fish,
/etc/fish (Or ~/etc/fish if you installed fish in your home directory)
and ~/.fish, in that order. The first file should not be directly
edited, the second one is meant for systemwide configuration and the
last one is meant for user configuration. If you want to run a command
only on starting an interactive shell, use the exit status of the
command 'status --is-interactive' to determine if the shell is
interactive. If you want to run a command only when using a login
shell, use 'status --is-login' instead.

Examples:

Expand Down
103 changes: 103 additions & 0 deletions etc/fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#
# Init file for fish
#
# etc/fish. Generated from fish.in by configure.

#
# Set default search paths
#

set -g fish_function_path /usr/share/functions /etc/fish.d/functions ~/.fish.d/functions
set -g fish_complete_path /usr/share/completions /etc/fish.d/completions ~/.fish.d/completions

#
# Set default field separators
#

set -g IFS \ \t\n

#
# Add a few common directories to path, if they exists. Note that pure
# console programs like makedep sometimes live in /usr/X11R6/bin, so we
# want this even for text-only terminals.
#

set -l path_list /bin /usr/bin /usr/X11R6/bin /usr/bin /sw/bin

# Root should also have the sbin directories in the path
if test "$USER" = root
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
end

for i in $path_list
if not expr "$PATH" : .\*$i.\* >/dev/null
if test -d $i
set PATH $PATH $i
end
end
end


#
# Set some value for LANG if nothing was set before, and this is a
# login shell. Also check for i18n information in /etc/sysconfig/i18n
#

if status --is-login
if not set -q LANG >/dev/null
set -gx LANG en_US.UTF-8
end

if test -f /etc/sysconfig/i18n
eval (cat /etc/sysconfig/i18n |sed -ne 's/^\([a-zA-Z]*\)=\(.*\)$/set -gx \1 \2;/p')
end
end


#
# Put linux console in unicode mode. Should this be done in any other
# situation as well?
#

if expr "$LANG" : ".*[Uu][Tt][Ff]" >/dev/null
if test linux = "$TERM"
unicode_start ^/dev/null
end
end


#
# There are variables that contain colons that are not arrays. This
# reverts them back to regular strings.
#

for i in DISPLAY
if set -q $i
set -- $i (printf ":%s" $$i|cut -c 2-)
end
end

#
# Alias for gettext (or a fallback if gettext isn't installed) This
# needs to be defined here and not in fish_function.fish, since it is
# used by other init files.
#

function _ -d "Alias for the gettext command"
printf "%s" $argv
end
if test 1 = "1"
if which gettext ^/dev/null >/dev/null
function _ -d "Alias for the gettext command"
gettext fish $argv
end
end
end

#
# Load additional initialization files
#

for i in fish.d/*.fish
. $i
end
Loading

0 comments on commit 343cafe

Please sign in to comment.