# -*- shell-script -*-
-# cygwin/mknetrel - LilyPond mknetrel overrides
-
-# This script should be used to package LilyPond for Cygwin.
-# It can be used to build LilyPond on Cygwin, but also on GNU/Linux.
-#
-# See http://lilypond.org/web/devel/packaging.html for more information,
-# report bugs to bug-lilypond@gnu.org.
-#
-#
-# Get mknetrel from here:
-#
-# cvs -d:pserver:anoncvs@sources.redhat.com:/cvs/cygwin-apps co mknetrel
-#
-# To build the package do:
-cat >/dev/null <<EOC
-
- wget -P/var/tmp ftp://lilypond.org/pub/LilyPond/v1.9/lilypond-1.9.8.tar.gz
- rm -rf /netrel/src/lilypond-*
- mkdir -p /netrel/src && cd /home/netrel/src
- tar xzf /var/tmp/lilypond-*
- mv lilypond-1.9.8 lilypond-1.9.8-1
- cd -
- export ABI=1.5
- ./bin/mknetrel -xX lilypond
-
-EOC
sub_packages="doc"
-old_path=$PATH
-patch=$mknetrel_root/patch
+[ "$cygwin" == "mingw" ] && sub_packages="doc extra"
-# for cross-compiling LilyPond:
-if !iscygwin; then
- uploads=$here/uploads/$base && mkdir -p $uploads/
- tarstem=$uploads/$package
-fi
+depends="libfontconfig1 libfreetype6 libguile16 libintl3 libpango1"
+build_depends="mingw-devel gettext-devel guile-devel pango-devel"
-# the files mknetrel.doc, mknetrel.patch, etc. can be had from the
-# latest cygwin source, currently:
-#
-# http://lilypond.org/cygwin/uploads/lilypond/lilyond-1.8.2-1-src.tar.bz2
-#
+v=$(expr "$ver" : "\(.*\)-[0-9]*")
-# copy and include extra mknetrel stuff
-extras="doc patch auto cross split"
-for i in $extras; do
- f=mknetrel.$i
- [ -r $extra/$f ] && cp -pv $extra/$f $src/cygwin/$f
- . $src/cygwin/$f
-done
+save_PATH="$PATH"
+# copy and include extra mknetrel stuff
+. $src/$cygwin/mknetrel.extras || . $mknetrel/extras
-needdevoflags () {
- return 1
+doc () {
+ # doc works, but take too long to build each time
+ [ "$cygwin" == "mingw" ] && return 1
+ return 0
}
preconfig () {
+ extras_preconfig
- patchsrc
- rm -f config.cache
-
- # for cross-compiling LilyPond:
- if !iscygwin; then
- cd $build || exit 1
- GUILE=1.6.4
- cat > guile-config <<EOF
-[ "\$1" == "--version" ] && echo "guile-config - Guile version $GUILE"
-[ "\$1" == "compile" ] && echo "-I$cygwin_prefix/include"
-[ "\$1" == "link" ] && echo "-L$cygwin_prefix/lib -lguile"
-exit 0
-EOF
- chmod 755 guile-config
- PATH=$(pwd):$PATH
+ [ "$cygwin" == "mingw" ] && if grep 'PYTHON_DEVEL(REQUIRED)' $src/configure.in; then
+ sed -i~ -e 's/PYTHON_DEVEL(REQUIRED)/PYTHON_DEVEL(OPTIONAL)/' \
+ $src/configure.in
fi
-}
-
-postconfig () {
+ [ "$cygwin" == "mingw" ] && cd $src && ./autogen.sh --noconfigure
+
+ cd $build || exit 1
# cross-compiling: configure for build-host
- if !iscygwin; then
+ if ! iscygwin; then
rm -f config.cache
- export HOST_CC=gcc
- export HOST_CXX=g++
- if [ "$ABI" != "1.5" ]; then
- HOST_CC=gcc-2.95
- HOST_CXX=g++-2.95
- (cd $src && ln -s GNUmakefile.in GNUmakefile)
- fi
- (PATH="$old_path" \
- PATH="$HOME/usr/pkg/guile-1.6/bin:$PATH" \
+ export HOST_CC=${HOST_CC:-gcc}
+ export HOST_CXX=${HOST_CXX:-g++}
+ export HOST_PKG_CONFIG=${HOST_PKG_CONFIG:-pkg-config}
+ export HOST_PKG_CONFIG_PATH=${HOST_PKG_CONFIG_PATH:-}
+ export HOST_FREETYPE_CONFIG=${HOST_FREETYPE_CONFIG:-freetype-config}
+ (PATH="$build:$save_PATH" \
CFLAGS="-O2 -g" \
+ CPPFLAGS="" \
CC=$HOST_CC \
CXX=$HOST_CXX \
- $src/configure --prefix=/usr --enable-config=for-build)
+ LDFLAGS="" \
+ PKG_CONFIG=$HOST_PKG_CONFIG \
+ PKG_CONFIG_PATH=$HOST_PKG_CONFIG_PATH \
+ FREETYPE_CONFIG=$HOST_FREETYPE_CONFIG \
+ $src/configure --prefix=$prefix --enable-config=for-build)
+ fi
+
+ if [ "$cygwin" == "mingw" ]; then
+ cp /usr/include/FlexLexer.h .
+ mkdir python2.3
+ cp /usr/include/python2.3/Python.h python2.3
+ fi
+
+ GUILE=$($cygwin_prefix/bin/guile-config --version 2>&1 | awk '{print $NF}')
+ cat > $target-guile-config <<EOF
+[ "\$1" == "--version" ] && echo "$target-guile-config - Guile version $GUILE"
+[ "\$1" == "compile" ] && echo "-I$cygwin_prefix/include"
+[ "\$1" == "link" ] && echo "-L$cygwin_prefix/lib -lguile -lgmp"
+exit 0
+EOF
+ chmod 755 $target-guile-config
+ export PATH=.:$PATH
+ build_cxx="$build_cxx -I$(pwd)"
+ if [ "$cygwin" == "mingw" ]; then
+ CONFIGOPTS="--without-kpathsea $CONFIGOPTS"
+ CPPFLAGS="-DARGV0_RELOCATION=1 $CPPFLAGS"
+ # There's a problem with inlining the string utils.
+ # The -O2 flag is still passed by default through opt.
+ CONFIGOPTS="--disable-optimising $CONFIGOPTS"
+ ## debugging
+ ##opt='-g'
fi
+ :
}
prebuild () {
- for i in $sub_packages; do
- rm -rf $inst-$i
- mkdir -p $inst-$i || exit 1
- done
-
+ extras_prebuild
+
+ # shortcircuit python for mingw
+ if [ "$cygwin" == "mingw" ]; then
+ mkdir -p python/out
+ touch python/out/midi.lo python/out/midi.so python/out/midi.dll
+ fi
+
# cross-compiling: build for build-host, generate doc
- if !iscygwin; then
+ if ! iscygwin; then
cd $build || exit 1
- PATH=/bin:/usr/bin:$PATH \
- PYTHONPATH=$build/python/out-for-build:$PYTHONPATH \
- make conf=for-build all doc web || exit 1
+ if doc; then
+ args="all doc web"
+ else
+ args="all"
+ fi
+ (PATH="$build:$save_PATH" \
+ CFLAGS="-O2 -g" \
+ CPPFLAGS="" \
+ CC=$HOST_CC \
+ CXX=$HOST_CXX \
+ LDFLAGS="" \
+ eval make conf=for-build $args) || exit 1
- # as of 1.9.9, this should no longer be necessary:
- for i in $(find . -path ".*out-for-build/*.1"); do
- o=$(dirname $(dirname $i))/out
- mkdir -p $o
- cp -pv $i $o/$(basename $i)
- done
-
mkdir -p mf/out
cp -pv mf/out-for-build/* mf/out
+
+ mkdir -p Documentation/user/out
+ cp -pv Documentation/user/out-for-build/*{tely,texi} Documentation/user/out
+ fi
+
+ addmakeflags "target=$target" ' '
+ if [ -f "$cygwin_prefix/bin/libpython2.4.dll" ]; then
+ addmakeflags LDFLAGS="$cygwin_prefix/bin/libpython2.4.dll" ' '
+ fi
+
+ if iscygwin && doc; then
+ addmakeflags all ' ' doc ' ' web ' '
fi
-
- addmakeflags MAKE_PFA_FILES=1 ' ' LDFLAGS="$cygwin_prefix/bin/libpython2.3.dll" ' ' 'target=i686-pc-cygwin'
}
preinstall () {
-
- # cross-compiling: fix manual pages
- if !iscygwin; then
- # as of 1.9.9, this should no longer be necessary:
- cd $build || exit 1
- cp -v scripts/out-for-build/midi2ly.1 scripts/out
- cp -v lily/out-for-build/lilypond.1 lily/out
+ extras_preinstall
+ if iscygwin && doc; then
+ addmakeflags webdir="$inst-doc/$packagedocdir" ' ' web-install
fi
-
- addmakeflags MAKE_PFA_FILES=1 ' ' LDFLAGS="$cygwin_prefix/bin/libpython2.3.dll" ' ' 'target=i686-pc-cygwin'
}
postinstall () {
- fixdoc
-
- mkdir -p $inst-doc/$docprefix
- cd $build || exit 1
-
- make conf=for-build webdir=$inst-doc/$packagedocdir web-install
+ extras_postinstall
- ## copy READMEs etc
+ cd $build || exit 1
+ if ! iscygwin && doc; then
+ make conf=for-build webdir=$inst-doc/$packagedocdir web-install
+ fi
+ # txt files reside elsewhere
+ cd $build/Documentation/topdocs/out
+ install -m644 AUTHORS.txt INSTALL.txt NEWS.txt README.txt $inst/$packagedocdir
+ ## copy examples
cd $src || exit 1
- install -d -m755 $inst/$packagedocdir
+ cp -prv input $inst/$packagedocdir
+ rm -rf $(find $inst/$packagedocdir -name 'CVS')
+ rm -f $(find $inst/$packagedocdir -name 'SCons*')
+ rm -f $(find $inst/$packagedocdir -name 'GNUmakefile*')
- ## Generic READMEs
- find . -maxdepth 1 -type f -exec cp -pv \{\} $inst/$packagedocdir \;
+ rm -rf $(find $inst/usr/share/lilypond -name '*.pyc')
+ rm -f $inst/usr/share/lilypond/$v/tex/texinfo.tex
- ## Cygwin readmes
- cygwin=cygwin
- cd $src || exit 1
- install -d -m755 $inst/$cygdocdir
- install -m644 $cygwin/changelog $inst/$cygdocdir/changelog.Cygwin
+ if [ "$cygwin" == "mingw" ]; then
+ find $inst -name '*ly' | xargs unix2dos
+ fi
- cd $build || exit 1
- install -m644 $cygwin/out/README $inst/$packagedocdir/README.Cygwin
- install -m644 $cygwin/out/README $inst/$cygdocdir/$package.README
+ install -d -m755 $inst-doc/$infodir/lilypond
+ if doc; then
+ cd $inst-doc/$infodir/lilypond && ln -sf ../../doc/$base-$ver/Documentation/user/out-www/*png .
+ fi
+}
- ## copy examples
- cd $src || exit 1
- cp -prv input $inst/$packagedocdir
+doc_split () {
+ extras_doc_split
+ mkdir -p ./$packagedocdir/input
+ mv $inst/$packagedocdir/input/{no-notation,regression,test,tutorial} ./$packagedocdir/input
+ mkdir -p ./$prefix/share/lilypond/$v/fonts
+ mv $inst/$prefix/share/lilypond/$v/fonts/source ./$prefix/share/lilypond/$v/fonts
+}
+
+extra_name () {
+ echo lilypond-extra
+}
- cd $inst-doc/$packagedocdir &&
- ln -s $(find html/Documentation -name '*.ps.gz') .
+extra_split () {
+ mkdir -p
+ # should be in devel...
+ mkdir -p ./$prefix/share/lilypond/$v
+ for i in make python tex vim; do
+ mv $inst/$prefix/share/lilypond/$v/$i ./$prefix/share/lilypond/
+ done
+ mkdir -p ./$prefix/share/lilypond/$v/fonts
+ for i in source svg tfm; do
+ mv $inst/$prefix/share/lilypond/$v/fonts/$i ./$prefix/share/lilypond/fonts
+ done
+
+ mkdir -p ./$prefix/share
+ for i in locale omf; do
+ mv $inst/$prefix/share/$i ./$prefix/share
+ done
}