| 1 |
#!/usr/bin/env zsh |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
HOST=`gcc -dumpmachine` |
|---|
| 7 |
case $HOST in |
|---|
| 8 |
*darwin*) |
|---|
| 9 |
SUFFIX=dylib |
|---|
| 10 |
;; |
|---|
| 11 |
*cygwin*|*mingw*) |
|---|
| 12 |
SUFFIX=dll |
|---|
| 13 |
;; |
|---|
| 14 |
*linux*|*bsd*) |
|---|
| 15 |
SUFFIX=so |
|---|
| 16 |
;; |
|---|
| 17 |
*) |
|---|
| 18 |
echo WARNING: Unknown platform: \'$HOST\' |
|---|
| 19 |
;; |
|---|
| 20 |
esac |
|---|
| 21 |
|
|---|
| 22 |
if test -z "$SUFFIX"; then |
|---|
| 23 |
echo "ERROR: unknown suffix for shared objects |
|---|
| 24 |
Please run \"SUFFIX=xxx $0\" |
|---|
| 25 |
where xxx is the shared object extension on your platform." |
|---|
| 26 |
exit 1 |
|---|
| 27 |
fi |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
if test -z "$BUILDDIR"; then |
|---|
| 31 |
BUILDDIR=../../ |
|---|
| 32 |
fi |
|---|
| 33 |
|
|---|
| 34 |
function find_libvlc { |
|---|
| 35 |
for i in $BUILDDIR/src/.libs/libvlc.$SUFFIX $BUILDDIR/src/libvlc.$SUFFIX; do |
|---|
| 36 |
test -e $i && LIBVLC=$i && return 0 |
|---|
| 37 |
done |
|---|
| 38 |
return 1 |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
while test -z "$LIBVLC"; do |
|---|
| 42 |
if ! find_libvlc; then |
|---|
| 43 |
/bin/echo -n "Please enter the directory where you built vlc: " |
|---|
| 44 |
read BUILDDIR |
|---|
| 45 |
fi |
|---|
| 46 |
done |
|---|
| 47 |
|
|---|
| 48 |
echo "libvlc found !" |
|---|
| 49 |
|
|---|
| 50 |
LD_LIBRARY_PATH=$BUILDDIR/src/.libs |
|---|
| 51 |
|
|---|
| 52 |
if test -e ../../extras/contrib/config.mak -a ! "`grep HOST ../../extras/contrib/config.mak 2>/dev/null|awk '{print $3}'`" != "$HOST"; then |
|---|
| 53 |
echo "contribs found !" |
|---|
| 54 |
CPPFLAGS="-I../../extras/contrib/include" |
|---|
| 55 |
fi |
|---|
| 56 |
|
|---|
| 57 |
if test -z "$CXX"; then |
|---|
| 58 |
CXX=g++ |
|---|
| 59 |
fi |
|---|
| 60 |
|
|---|
| 61 |
ZSH_BUILD="$CXX $CPPFLAGS $CXXFLAGS -D__LIBVLC__ -DHAVE_CONFIG_H -I$BUILDDIR -I$BUILDDIR/include -I../../include zsh.cpp $LIBVLC -o zsh_gen" |
|---|
| 62 |
|
|---|
| 63 |
echo "Building zsh completion generator ... " |
|---|
| 64 |
echo $ZSH_BUILD |
|---|
| 65 |
echo |
|---|
| 66 |
eval $ZSH_BUILD || exit 1 |
|---|
| 67 |
|
|---|
| 68 |
echo "Generating zsh completion ..." |
|---|
| 69 |
if ! ./zsh_gen --plugin-path=$BUILDDIR >_vlc 2>/dev/null; then |
|---|
| 70 |
echo "ERROR: the generation failed.... :( |
|---|
| 71 |
Please press enter to verify that all the VLC modules are shown" |
|---|
| 72 |
read i |
|---|
| 73 |
./zsh_gen --plugin-path=$BUILDDIR -vvv --list |
|---|
| 74 |
echo " |
|---|
| 75 |
If they are shown, press enter to see if you can debug the problem |
|---|
| 76 |
It will be reproduced by running \"./zsh_gen --plugin-path=$BUILDDIR -vvv\"" |
|---|
| 77 |
read i |
|---|
| 78 |
./zsh_gen --plugin-path=$BUILDDIR -vvv |
|---|
| 79 |
exit 1 |
|---|
| 80 |
fi |
|---|
| 81 |
|
|---|
| 82 |
echo "zsh completion is `echo \`wc -l _vlc\`` lines long !" |
|---|
| 83 |
|
|---|
| 84 |
test -z "$NOINSTALL" || exit 0 |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
if ! /usr/bin/which zsh >/dev/null 2>&1; then |
|---|
| 88 |
echo "ERROR: zsh not found, you'll have to copy the _vlc file manually" |
|---|
| 89 |
exit 1 |
|---|
| 90 |
fi |
|---|
| 91 |
|
|---|
| 92 |
test -z "$ZSH_FPATH" && ZSH_FPATH=`zsh -c "echo \\$fpath|cut -d\" \" -f1"` |
|---|
| 93 |
if test -z "$ZSH_FPATH"; then |
|---|
| 94 |
echo "ERROR: Could not find a directory where to install completion |
|---|
| 95 |
Please run \"ZSH_FPATH=path $0\" |
|---|
| 96 |
where path is the directory where you want to install completion" |
|---|
| 97 |
exit 1 |
|---|
| 98 |
fi |
|---|
| 99 |
|
|---|
| 100 |
echo "completion will be installed in $ZSH_FPATH , using root privileges |
|---|
| 101 |
Press Ctrl+C to abort installation, and copy _vlc manually" |
|---|
| 102 |
read i |
|---|
| 103 |
echo "Installing completion ..." |
|---|
| 104 |
sudo sh -c "chown 0:0 _vlc && chmod 0644 _vlc && mv _vlc $ZSH_FPATH" || exit 1 |
|---|
| 105 |
|
|---|
| 106 |
echo "zsh completion for VLC successfully installed :) |
|---|
| 107 |
Restart running zsh instances, or run \"compinit\" to start using it." |
|---|