#!/bin/bash
## src2pkg script for: 	lilypond
## Auto-generated by src2pkg-1.9
## src2pkg Copyright 2005-2007 Gilbert Ashley <amigo@ibilio.org>

# to use with a different version of lily pond,
# just edit the following line, the SOURCE_NAME and the ALT_VERSION
# To install to a differerent prefix, just edit the PRE_FIX line
if ! [[ -e $SOURCES_DIR/lilypond-2.11.36-1.linux-x86.tar.bz2 ]] ; then
sh  $SOURCES_DIR/lilypond-2.11.36-1.linux-x86.sh --tarball &> /dev/null
fi
SOURCE_NAME='lilypond-2.11.36-1.linux-x86.tar.bz2'
ALT_NAME='lilypond'
ALT_VERSION='2.11.36'
ARCH='i486'
BUILD='1'
PRE_FIX='usr'
# Any extra options go here
# EXTRA_CONFIGS=''
# STD_FLAGS='-O2 -march=i486 -mtune=i686'

# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;

# do_all_processes can substitute these 16 steps:

pre_process
find_source
make_dirs
unpack_source
fix_source_perms

# configure_source
# compile_source
# fake_install

mkdir -p $PKG_DIR/$PRE_FIX/bin

 cat<<EOF > "$PKG_DIR/$PRE_FIX/bin/lilypond"
#!/bin/sh
export LD_LIBRARY_PATH='/usr/lilypond/usr/lib/'
exec "/usr/lilypond/usr/bin/lilypond" "\$@"
EOF

mkdir -p $PKG_DIR/usr/doc/$NAME-$VERSION
cp -a $SRC_DIR/license/* $PKG_DIR/usr/doc/$NAME-$VERSION/
rm -rf $SRC_DIR/license

mkdir -p $PKG_DIR/$PRE_FIX/lilypond
cp -a $SRC_DIR/usr $PKG_DIR/$PRE_FIX/lilypond/


 cat<<EOF > "$PKG_DIR/$PRE_FIX/bin/lilypond-wrapper.guile"
#!/bin/sh
export PYTHONPATH="/$PRE_FIX/lilypond/usr/lib/lilypond/current/python/:/usr/lilypond/usr/share/lilypond/current/python/:\$PYTHONPATH"
export GUILE_LOAD_PATH="/$PRE_FIX/lilypond/usr/share/lilypond/current/"
export LD_LIBRARY_PATH="/$PRE_FIX/lilypond/usr/lib/:\$LD_LIBRARY_PATH"
exec "/$PRE_FIX/lilypond/usr/bin/guile" -e main "/$PRE_FIX/lilypond/usr/bin/lilypond" "\$@"
EOF

 cat<<EOF > "$PKG_DIR/$PRE_FIX/bin/lilypond-wrapper.python"
#!/bin/sh
export PYTHONPATH="/$PRE_FIX/lilypond/usr/lib/lilypond/current/python/:/usr/lilypond/usr/share/lilypond/current/python/:\$PYTHONPATH"
export GUILE_LOAD_PATH="/$PRE_FIX/lilypond/usr/share/lilypond/current/"
export LD_LIBRARY_PATH="/$PRE_FIX/lilypond/usr/lib/:\$LD_LIBRARY_PATH"
exec "/$PRE_FIX/lilypond/usr/bin/python" "/$PRE_FIX/lilypond/usr/bin/lilypond" "\$@"
EOF

chown root:root $PKG_DIR/$PRE_FIX/bin/*
chmod 755 $PKG_DIR/$PRE_FIX/bin/*

( cd $PKG_DIR/$PRE_FIX/bin
 for a in abc2ly musicxml2ly convert-ly midi2ly etf2ly lilypond-book mup2ly ; do
   rm -f $a;
   ln -s lilypond-wrapper.python $a;
 done
 for a in lilypond-invoke-editor ; do
   rm -f $a;
   ln -s lilypond-wrapper.guile $a;
 done
)

fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process

# src2pkg - Copyright 2005-2007  Gilbert Ashley <amigo@ibiblio.org>
## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# EXTRA_CONFIGS='' PRE_FIX='' DOCLIST=''
# MAKE_COMMAND='' INSTALL_LINE='' 
# SHELL_INSTALL='YES' CORRECT_PERMS='NO'
