]> git.sesse.net Git - vlc/blobdiff - extras/analyser/zsh_completion.sh
zsh: really use the arguments given to the zsh generator.
[vlc] / extras / analyser / zsh_completion.sh
index b49afe06316e261208789cbb48db6312d85f065c..37de947a2e85b72f008042e0cfff303e9ecc270b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env zsh
 # Helper script to install zsh completion for VLC media player
 # © 2008 Rafaël Carré <funman@videolanorg>
 
@@ -38,6 +38,13 @@ function find_libvlc {
     return 1
 }
 
+function find_libvlccore {
+    for i in $BUILDDIR/src/.libs/libvlccore.$SUFFIX $BUILDDIR/src/libvlccore.$SUFFIX; do
+        test -e $i && LIBVLCCORE=$i && return 0
+    done
+    return 1
+}
+
 while test -z "$LIBVLC"; do
     if ! find_libvlc; then
         /bin/echo -n "Please enter the directory where you built vlc: "
@@ -47,6 +54,12 @@ done
 
 echo "libvlc found !"
 
+if ! find_libvlccore; then
+    /bin/echo -n "libvlccore not found ! Linking will fail !"
+fi
+
+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
     echo "contribs found !"
     CPPFLAGS="-I../../extras/contrib/include"
@@ -56,13 +69,12 @@ if test -z "$CXX"; then
     CXX=g++
 fi
 
-ZSH_BUILD="$CXX $CPPFLAGS $CXXFLAGS -D__LIBVLC__ -DHAVE_CONFIG_H -I$BUILDDIR -I$BUILDDIR/include -I../../include zsh.cpp $LIBVLC -o zsh_gen"
+ZSH_BUILD="$CXX $CPPFLAGS $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 "Building zsh completion generator ...  "
 echo $ZSH_BUILD
 echo
-$ZSH_BUILD || exit 1
+eval $ZSH_BUILD || exit 1
 
 echo "Generating zsh completion ..."
 if ! ./zsh_gen --plugin-path=$BUILDDIR >_vlc 2>/dev/null; then
@@ -83,7 +95,7 @@ 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 -s zsh; then
+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
 fi