]> git.donarmstrong.com Git - lilypond.git/blobdiff - cygwin/mknetrel
Documentation/user/lilypond-book.itely: Build fix.
[lilypond.git] / cygwin / mknetrel
index d29c76c294561de32c360cacb764caff694e6793..390a1db84af68fdb592ae6d21b7a31894cd353e6 100644 (file)
 # -*- shell-script -*-
 
-# stable LilyPond releases: lilypond-1.4
-# archive=ftp://lilypond.org/pub/LilyPond/v1.4
-
-# LilyPond development: lilypond-1.5
-# archive=ftp://lilypond.org/pub/LilyPond/v1.5
-
-# Guile specific mknetrel overrides
-# To use this, do something like:
-cat >/dev/null <<EOC
-
-   wget -P/var/tmp ftp://lilypond.org/pub/LilyPond/v1.5/lilypond-1.5.71.tar.gz
-   rm -rf /home/netrel/src/lilypond-*
-   mkdir -p /home/netrel/src && cd /home/netrel/src
-   ## TODO: look at pimport
-   tar xzf /var/tmp/lilypond-*
-   mv lilypond-* $(echo lilypond-*)-1
-   cd -
-   ./bin/mknetrel -xXC lilypond
-
-EOC
-
-
-BUILD=1
-# sover=14
-
-patch=$mknetrel_root/patch
-if iscygwin; then
-    true
-else    
-    uploads=$here/uploads/$base && mkdir -p $uploads
-    tarstem=$uploads/$package
-fi
-
 sub_packages="doc"
-old_path=$PATH
-
-
-
-##. $extra/jcn
-
-
-# -*- shell-script -*-
-
-# jcn -- unsorted stuff
-
-
-#
-# Patching and configuring
-#
-
-presplit () { true; }
-
-# Maybe add to mknetrel or pimport.
-dopatchsrc () {
-    cd $src
-    patch -p1 < $patch/$package.patch
-    [ -d cygwin -a ! -e CYGWIN-PATCHES ] && ln -s cygwin CYGWIN-PATCHES
-    [ -d CYGWIN-PATCHES -a ! -e cygwin ] && ln -s CYGWIN-PATCHES cygwin
-    [ -d CYGWIN-PATCHES ] || mkdir CYGWIN-PATCHES
-}
-
-# Maybe add to mknetrel or pimport.
-patchsrc () {
-    [ -r $patch/$package.patch -a ! -r $src/CYGWIN-PATCHES -a ! -r $src/cygwin ] && dopatchsrc
-}
-
-autoupdate () {
-    for i in bootstrap autogen.sh; do
-       if [ -x ./$i ]; then
-           ./$i || exit 1
-           return 0
-       fi
-    done
-    
-    aclocal
-    rm -rf libltdl
-    libtoolize --force --copy --automake --ltdl
-    autoheader
-    autoconf
-    automake --add-missing
-}
-
-crosscache () {
-       cat <<EOF > config.cache
-
-ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
-ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
-ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=4}
-ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
-ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
-ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
-ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
-ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=12}
-ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
-ac_cv_sizeof_short=${ac_cv_sizeof_short=2}
-ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=4}
-ac_cv_c_long_size_t=${ac_cv_c_long_size_t=no}
-ac_cv_c_long_time_t=${ac_cv_c_long_time_t=yes}
-ac_16bit_type=${ac_16bit_type=short}
-ac_32bit_type=${ac_32bit_type=int}
-ac_64bit_type=${ac_64bit_type=none}
-ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls=no}
-ac_cv_sprintf_count=${ac_cv_sprintf_count=yes}
-ac_cv_spinlocks=${ac_cv_spinlocks=no}
-ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void=yes}
-ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
-ac_cv_func_mkfifo=yes
-
-# Try at preventing to break make rules while crosscompiling.  This
-# used work, but nowadays ./configure thinks it knows better than me.
-
-# But what ./configure doesn't know, is that automake and libtool are
-# broken wrt cross-building, and wrt cc_for_build.  See new
-# workarounds above.
-
-ac_exeext=${ac_exeext=}
-ac_cv_exeext=${ac_cv_exeext=}
-EOF
-}
 
+[ "$cygwin" == "mingw" ] && sub_packages="doc extra"
 
+depends="libfontconfig1 libfreetype6 libguile16 libintl3 libpango1"
+build_depends="mingw-devel gettext-devel guile-devel pango-devel"
 
-#
-# Subpackage stuff -- Maybe move to mknetrel
-#
-
-# Possibly, using file-lists globs is smarter than separate install
-# prefixes.  We'll see what happens when packaging tetex-*.
-
-
-lib_name () {
-    echo lib$base$sover
-}
-
-devel_name () {
-    echo $base-devel
-}
-
-doc_name () {
-    echo $base-doc
-}
+v=$(expr "$ver" : "\(.*\)-[0-9]*")
 
-lib_split () {
-    mkdir -p ./$prefix/bin || exit 1
-    mv $inst/$prefix/bin/*.dll ./$prefix/bin
-    mkdir -p ./$prefix/share || exit 1
-    mv $inst/$prefix/share/$base ./$prefix/share
-    true
-}
-   
-devel_split () {
-    mkdir -p ./$prefix/bin || exit 1
-    mv $inst/$prefix/include ./$prefix/include
-    mkdir -p ./$prefix/lib || exit 1
-    mv $inst/$prefix/lib/*.a ./$prefix/lib
-    mv $inst/$prefix/lib/*.la ./$prefix/lib
-    mkdir -p ./$prefix/share || exit 1
-    mv $inst/$prefix/share/aclocal ./$prefix/share
-    true
-}
+save_PATH="$PATH"
 
-doc_split () {
-    mkdir -p ./$prefix || exit 1
-    mv $inst/$prefix/info ./$prefix
-    true
-}
+# copy and include extra mknetrel stuff
+. $src/$cygwin/mknetrel.extras || . $mknetrel/extras
 
-prebuild () {
-    for i in $sub_packages; do
-       rm -rf $inst-$i
-       mkdir -p $inst-$i || exit 1
-    done
+doc () {
+    # doc works, but take too long to build each time
+    [ "$cygwin" == "mingw" ] && return 1
+    return 0
 }
-    
-domkdist() {
-    #
-    # Fix up installation slightly
-    #
-    cd $inst || exit 1
-    chmod -R a+w .
-    cd usr 2>/dev/null && dousrstuff
-
-
-    # Split off any sub-packages.  The actual splitting is handled by
-    # a package's specific code in extra/.
-
-    # To package `foo' in foo, foo-doc and foo-devel, set
-    # sub_packages='doc devel'.
 
-    # Then provide functions doc_name and devel_name, that return the
-    # full name of the sub-package.  Also provide functions doc_split
-    # and devel_split, that mv part of foo's installation in $inst to
-    # the sub-packages' installation roots $inst-doc and $inst-devel.
+preconfig () {
+    extras_preconfig
 
-    cd $inst || exit 1
-    presplit
-
-    for i in $sub_packages; do
-       subname=$(${i}_name)
-       cd $inst-$i || exit 1
-       ${i}_split || exit 1
-    done
+    [ "$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
+    [ "$cygwin" == "mingw" ] && cd $src && ./autogen.sh --noconfigure
     
-    #
-    # Make tar balls
-    #
-
-    cd $inst || exit 1
-    prepackage
-
-    # The base package
-    echo creating $tarstem.tar.bz2
-    cd $inst || exit 1
-
-    f=$src/cygwin/setup.hint && test -r $f && cp $f $uploads
-    f=$src/cygwin/$base.hint && test -r $f && cp $f $uploads/setup.hint
-    find * -print | sort | tar -T - --no-recursion -cjf $tarstem.tar.bz2
-
-    # Any sub-packages
-    for i in $sub_packages; do
-       subname=$(${i}_name)
-       subload=$uploads/$subname
-       subtarstem=$subload/$subname-$ver
-       mkdir -p $subload || exit 1
-       echo creating $subtarstem.tar.bz2
-       f=$src/cygwin/$subname.hint && test -r $f && cp $f $subload/setup.hint
-       cd $inst-$i
-       find * -print | sort | tar -T - --no-recursion -cjf $subtarstem.tar.bz2
-    done
-
-    # The source package
-    cd $src/.. || exit 1
-    echo creating "$tarstem"-src.tar.bz2
-    find $package_src/* -print -follow | egrep -v '\.cvsignore|\.bak$|\.orig$|\.o$|~$|^.#|CVS|%redact|/tags$' | egrep -v "$src_exclude" | sort | tar -T - --no-recursion -cjf "$tarstem"-src.tar.bz2
-    postpackage
-}
-
-
-# end jcn
-
-
-
-
-needdevoflags () {
-    return 1
-}
-
-
-preconfig () { # aka libtool_woes ()
-
-    # Add to mknetrel?
-    patchsrc 
-
-    ## autoupdate
-
     cd $build || exit 1
-
-    GUILE=1.5.6
-    cat > guile-config <<EOF
-#!/bin/sh
-[ "\$1" == "--version" ] && echo "guile-config - Guile version $GUILE"
+    # cross-compiling: configure for build-host
+    if ! iscygwin; then
+       rm -f config.cache
+       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 \
+           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
+
+    GUILE=$(GUILE_LOAD_PATH=$cygwin_prefix/share/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"
+[ "\$1" == "link" ] && echo "-L$cygwin_prefix/lib -lguile -lgmp"
 exit 0
 EOF
-
-    chmod 755 guile-config
-    PATH=$(pwd):$PATH
-
-    ##opt='-O2 -g' LDFLAGS='"$cygwin_prefix/bin/libpython2.2.dll"
-    rm -f config.cache  
-}
-
-postconfig () {
-    # Configure for build, for generating doc
-    rm -f config.cache
-    (PATH="$old_path" \
-       PATH="$HOME/usr/pkg/guile-1.5.6/bin:$PATH" \
-       CFLAGS="-O2 -g" \
-       $src/configure --prefix=/usr --enable-config=for-build)
+    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"
+       CONFIGOPTS="--enable-relocation $CONFIGOPTS"
+       # 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
+    
+    if [ "$cygwin" == "mingw" ]; then
+       cp /usr/include/FlexLexer.h .
+       mkdir python2.3
+       cp /usr/include/python2.3/Python.h python2.3
+
+       CXX="$(echo $build_cxx | sed 's/ -mwindows//')" \
+           CXX_FOR_TARGET="${build_cxx}" \
+           CC="${build_cc}" \
+           CC_FOR_TARGET="${build_cc}" \
+           GCC_FOR_TARGET="${build_cc}" \
+           RANLIB="${build_ranlib}" \
+           RANLIB_FOR_TARGET="${build_ranlib}" \
+           DLLWRAP="${build_dllwrap}" \
+           AR="${build_ar}" NM="${build_nm}" \
+           LD=$(${build_cc} -print-prog-name=ld) \
+           $src/configure --enable-config=console $CONFIGOPTS
+
+       rm -f config.cache
+        iscygwin || crosscache
+    fi
+
+    :
 }
 
 prebuild () {
-    for i in $sub_packages; do
-       rm -rf $inst-$i
-       mkdir -p $inst-$i || exit 1
-    done
-    
-    # Build for build, generating doc
-    cd $build || exit 1
-    
-    # ugh, footify fix
-    cd $src && ln -s GNUmakefile.in GNUmakefile
-
-    cd $build || exit 1
-    PATH=/bin:/usr/bin:$PATH make conf=for-build all doc html-doc
-    for i in $(find . -path "out-for-build/*.1"); do
-       cp -pv $i $(dirname $(dirname $i))/$(basename $i)
-    done
-
-    addmakeflags LDFLAGS="$cygwin_prefix/bin/libpython2.2.dll" " " 'target=i686-pc-cygwin'
+    extras_prebuild
+
+    # shortcircuit python for mingw
+    if [ "$cygwin" == "mingw" ]; then
+       #sed -e s/-mwindows// < config.make > config-console.make
+       #cp config.hh config-console.hh
+
+       mkdir -p python/out python/out-console
+       touch python/out/midi.lo python/out/midi.so python/out/midi.dll
+       touch python/out-console/midi.lo python/out-console/midi.so python/out-console/midi.dll
+    fi
+
+    # cross-compiling: build for build-host, generate doc
+    if ! iscygwin; then
+       cd $build || 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
+
+       # fake mf and texi
+        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
+
+    if [ "$cygwin" == "mingw" ]; then
+       # fake mf and texi
+        mkdir -p mf/out-console
+       cp -pv mf/out-for-build/* mf/out-console
+       mkdir -p Documentation/user/out-console
+       cp -pv Documentation/user/out-for-build/*{tely,texi} Documentation/user/out-console
+       # fake manual pages, only works without --enable-config
+       mkdir -p scripts/out-console
+       cp scripts/out-for-build/*.1 scripts/out-console
+       mkdir -p lily/out-console
+       cp lily/out-for-build/*.1 lily/out-console
+       make conf=console || exit 1
+    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
 }
 
 preinstall () {
-    addmakeflags LDFLAGS="$cygwin_prefix/bin/libpython2.2.dll" " " 'target=i686-pc-cygwin'
+    extras_preinstall
+    if iscygwin && doc; then
+       addmakeflags webdir="$inst-doc/$packagedocdir" ' ' web-install
+    fi
 }
 
 postinstall () {
-    mkdir -p $inst-doc/$prefix
-    cd $build || exit 1
-    docdir=$prefix/share/doc/$base-$ver
+    if [ "$cygwin" == "mingw" ]; then
+       cp $inst/usr/share/lilypond/$v/python/* $inst/usr/bin
+       install -m755 $build/lily/out/lilypond $inst/usr/bin/lilypond-windows
+       install -m755 $build/lily/out-console/lilypond $inst/usr/bin/
+    fi
     
-    make conf=for-build docdir=$inst-doc/$docdir install-html-doc
-
-
-    ## copy READMEs etc
-
-    cd $src || exit 1
-    install -d -m755 $inst/$docdir
-
-    ## Generic READMEs
-    find . -maxdepth 1 -type f -exec cp -pv \{\} $inst/$docdir \;
+    extras_postinstall
+
+    if [ "$cygwin" == "mingw" ]; then
+       for i in $inst/usr/bin/*; do
+           m=$(file -b $i)
+           if echo "$m" | grep "guile"; then
+               mv $i $i.scm
+           elif echo "$m" | grep "python"; then
+               mv $i $i.py
+           fi
+       done
+    fi
 
-    ## Cygwin readmes
-    cygwin=cygwin
-    cd $src || exit 1
-    install -m644 $cygwin/README $inst/$docdir/README.Cygwin
-    install -m644 $cygwin/changelog $inst/$docdir/changelog.Cygwin
-    install -d -m755 $inst/$prefix/doc/Cygwin
-    install -m644 $cygwin/README $inst/$prefix/doc/Cygwin/$package.README
+    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
-    cp -prv input $inst/$docdir
+    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*')
 
-    cd $inst-doc/$prefix/share/doc/$base-$ver &&
-    ln -s $(find html/Documentation -name '*.ps.gz') .
+    rm -rf $(find $inst/usr/share/lilypond -name '*.pyc')
+    rm -f $inst/usr/share/lilypond/$v/tex/texinfo.tex
 
-    ## Cygwin doesn't adhere to FHS (and why should they?)
-    cd $inst/$prefix/share && tar cf - doc | (cd ..; tar xf -) && rm -rf doc
-    cd $inst-doc/$prefix/share && tar cf - doc | (cd ..; tar xf -) && rm -rf doc
-}
+    if [ "$cygwin" == "mingw" ]; then
+       find $inst -name '*ly' | xargs unix2dos
+    fi
 
-#presplit () {
-#    docdir=$prefix/share/doc/$base-$ver
-#    mkdir -p $inst-doc/$docdir || exit 1
-#}
+    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
+}
 
 doc_split () {
-    mkdir -p ./$prefix || exit 1
-    mv $inst/$prefix/info ./$prefix
-    true
+    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
+}
+
+extra_split () {
+    # should be in devel...
+    mkdir -p ./$prefix/share/lilypond/$v
+    for i in make python tex vim; do
+    #for i in make tex vim; do
+       mv $inst/$prefix/share/lilypond/$v/$i ./$prefix/share/lilypond/$v
+    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/$v/fonts
+    done
 
-#prepackage () {
-#  mv $inst/$prefix/bin/guile-* $inst-devel/$prefix/bin
-#}
+    mkdir -p ./$prefix/share
+    for i in locale omf; do
+       mv $inst/$prefix/share/$i ./$prefix/share
+    done
+}