Commit b2e6a732 authored by Rafaël Carré's avatar Rafaël Carré

zsh_completion.sh: remove automatic install

instead print where the script should be for zsh to find it
some cleaning of the script & its output
parent 08083ee7
...@@ -15,105 +15,77 @@ case $HOST in ...@@ -15,105 +15,77 @@ case $HOST in
SUFFIX=so SUFFIX=so
;; ;;
*) *)
echo WARNING: Unknown platform: \'$HOST\' echo "WARNING: Unknown platform: \'$HOST\', can't check for libraries"
;; ;;
esac esac
if test -z "$SUFFIX"; then
echo "ERROR: unknown suffix for shared objects
Please run \"SUFFIX=xxx $0\"
where xxx is the shared object extension on your platform."
exit 1
fi
#Distributors can run BUILDDIR=XXX ./zsh_completion.sh #Distributors can run BUILDDIR=XXX ./zsh_completion.sh
if test -z "$BUILDDIR"; then [ -z "$BUILDDIR" ] && BUILDDIR=../../
BUILDDIR=../../
fi
function find_libvlc { function find_libvlc {
[ -z "$SUFFIX" ] && return 0 # linking will fail if lib isn't found
for i in $BUILDDIR/src/.libs/libvlc.$SUFFIX $BUILDDIR/src/libvlc.$SUFFIX; do for i in $BUILDDIR/src/.libs/libvlc.$SUFFIX $BUILDDIR/src/libvlc.$SUFFIX; do
test -e $i && LIBVLC=$i && return 0 [ -e $i ] && LIBVLC=$i && return 0
done done
return 1 return 1
} }
function find_libvlccore { function find_libvlccore {
[ -z "$SUFFIX" ] && return 0 # linking will fail if lib isn't found
for i in $BUILDDIR/src/.libs/libvlccore.$SUFFIX $BUILDDIR/src/libvlccore.$SUFFIX; do for i in $BUILDDIR/src/.libs/libvlccore.$SUFFIX $BUILDDIR/src/libvlccore.$SUFFIX; do
test -e $i && LIBVLCCORE=$i && return 0 [ -e $i ] && LIBVLCCORE=$i && return 0
done done
return 1 return 1
} }
while test -z "$LIBVLC"; do while [ -z "$LIBVLC" ]; do
if ! find_libvlc; then if ! find_libvlc; then
/bin/echo -n "Please enter the directory where you built vlc: " printf "Please enter the directory where you built vlc: "
read BUILDDIR read BUILDDIR
fi fi
done done
echo "libvlc found !"
if ! find_libvlccore; then if ! find_libvlccore; then
/bin/echo -n "libvlccore not found ! Linking will fail !" echo "libvlccore not found !"
exit 1
fi fi
export LD_LIBRARY_PATH=$BUILDDIR/src/.libs export LD_LIBRARY_PATH=$BUILDDIR/src/.libs
if test -e ../../extras/contrib/config.mak -a ! "`grep HOST ../../extras/contrib/config.mak 2>/dev/null|awk '{print $3}'`" != "$HOST"; then if [ -e ../../extras/contrib/config.mak -a ! "`grep HOST ../../extras/contrib/config.mak 2>/dev/null|awk '{print $3}'`" != "$HOST" ]; then
echo "contribs found !"
CPPFLAGS="-I../../extras/contrib/include" CPPFLAGS="-I../../extras/contrib/include"
fi fi
if test -z "$CXX"; then [ -z "$CXX" ] && CXX=g++
CXX=g++
fi
ZSH_BUILD="$CXX $CPPFLAGS $CXXFLAGS -D__LIBVLC__ -DHAVE_CONFIG_H -I$BUILDDIR -I$BUILDDIR/include -I../../include zsh.cpp $LIBVLC $LIBVLCCORE -o zsh_gen" ZSH_BUILD="$CXX $CXXFLAGS -D__LIBVLC__ -DHAVE_CONFIG_H -I$BUILDDIR -I$BUILDDIR/include -I../../include zsh.cpp $LIBVLC $LIBVLCCORE -o zsh_gen"
echo "Building zsh completion generator ... "
echo $ZSH_BUILD echo $ZSH_BUILD
echo echo
eval $ZSH_BUILD || exit 1 eval $ZSH_BUILD || exit 1
echo "Generating zsh completion ..." printf "Generating zsh completion in _vlc ... "
if ! ./zsh_gen --plugin-path=$BUILDDIR >_vlc 2>/dev/null; then if ! ./zsh_gen --plugin-path=$BUILDDIR >_vlc 2>/dev/null; then
echo "ERROR: the generation failed.... :( echo "
ERROR: the generation failed.... :(
Please press enter to verify that all the VLC modules are shown" Please press enter to verify that all the VLC modules are shown"
read i read i
./zsh_gen --plugin-path=$BUILDDIR -vvv --list ./zsh_gen --plugin-path=$BUILDDIR -vv --list
echo " echo "
If they are shown, press enter to see if you can debug the problem If they are shown, press enter to see if you can debug the problem
It will be reproduced by running \"./zsh_gen --plugin-path=$BUILDDIR -vvv\"" It will be reproduced by running \"./zsh_gen --plugin-path=$BUILDDIR -vvv\""
read i read i
./zsh_gen --plugin-path=$BUILDDIR -vvv ./zsh_gen --plugin-path=$BUILDDIR -vv
exit 1
fi
echo "zsh completion is `echo \`wc -l _vlc\`` lines long !"
test -z "$NOINSTALL" || exit 0
#Distributors can run NOINSTALL=mg ./zsh_completion.sh
if ! /usr/bin/which zsh >/dev/null 2>&1; then
echo "ERROR: zsh not found, you'll have to copy the _vlc file manually"
exit 1 exit 1
fi fi
test -z "$ZSH_FPATH" && ZSH_FPATH=`zsh -c "echo \\$fpath|cut -d\" \" -f1"` echo "done"
if test -z "$ZSH_FPATH"; then
echo "ERROR: Could not find a directory where to install completion
Please run \"ZSH_FPATH=path $0\"
where path is the directory where you want to install completion"
exit 1
fi
echo "completion will be installed in $ZSH_FPATH , using root privileges ZSH_FPATH=`echo $fpath|cut -d\ -f1`
Press Ctrl+C to abort installation, and copy _vlc manually" [ -z "$ZSH_FPATH" ] && exit 0 # don't know where to install
read i
echo "Installing completion ..."
sudo sh -c "chown 0:0 _vlc && chmod 0644 _vlc && mv _vlc $ZSH_FPATH" || exit 1
echo "zsh completion for VLC successfully installed :)" echo "
echo "Restart running zsh instances after removing ~/.zcompdump, or" You should now copy _vlc to $ZSH_FPATH and then
echo "run \"compinit\" to start using it." remove ~/.zcompdump and restart your running zsh instances,
or run \"compinit\" to start using vlc completion immediately."
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment