]> git.donarmstrong.com Git - lilypond.git/blob - cygwin/mknetrel
3e9b6e05517dc25d5a51dcdd959dac7ac4ca180e
[lilypond.git] / cygwin / mknetrel
1 # -*- shell-script -*-
2 # cygwin/mknetrel - LilyPond mknetrel overrides
3
4 # This script should be used to package LilyPond for Cygwin.
5 # It can be used to build LilyPond on Cygwin, but also on GNU/Linux.
6 #
7 # See http://lilypond.org/web/devel/packaging.html for more information,
8 # report bugs to bug-lilypond@gnu.org.
9 #
10 #
11 # Get mknetrel from here:
12 #
13 #   cvs -d:pserver:anoncvs@sources.redhat.com:/cvs/cygwin-apps co mknetrel
14 #
15 # To build the package do:
16 cat >/dev/null <<EOC
17
18    wget -P/var/tmp ftp://lilypond.org/pub/LilyPond/v1.9/lilypond-1.9.8.tar.gz
19    rm -rf /netrel/src/lilypond-*
20    mkdir -p /netrel/src && cd /home/netrel/src
21    tar xzf /var/tmp/lilypond-*
22    mv lilypond-1.9.8 lilypond-1.9.8-1
23    cd -
24    export ABI=1.5
25    ./bin/mknetrel -xX lilypond
26
27 EOC
28
29 sub_packages="doc"
30 old_path=$PATH
31
32 patch=$mknetrel_root/patch
33
34 # for cross-compiling LilyPond:
35 if !iscygwin; then
36     uploads=$here/uploads/$base && mkdir -p $uploads/
37     tarstem=$uploads/$package
38 fi
39
40 # copy and include extra mknetrel stuff
41 extras="doc patch auto cross split"
42 for i in $extras; do
43     f=mknetrel.$i
44     [ -r $extra/$f ] && cp -pv $extra/$f $src/cygwin/$f
45     . $src/cygwin/$f
46 done
47
48
49 needdevoflags () {
50     return 1
51 }
52
53 preconfig () {
54
55     patchsrc 
56     rm -f config.cache
57
58     # for cross-compiling LilyPond:
59     if !iscygwin; then
60         cd $build || exit 1
61         GUILE=1.6.4
62         cat > guile-config <<EOF
63 [ "\$1" == "--version" ] && echo "guile-config - Guile version $GUILE"
64 [ "\$1" == "compile" ] && echo "-I$cygwin_prefix/include"
65 [ "\$1" == "link" ] && echo "-L$cygwin_prefix/lib -lguile"
66 exit 0
67 EOF
68         chmod 755 guile-config
69         PATH=$(pwd):$PATH
70     fi
71 }
72
73 postconfig () {
74     # cross-compiling: configure for build-host
75     if !iscygwin; then
76         rm -f config.cache
77         export HOST_CC=gcc
78         export HOST_CXX=g++
79         if [ "$ABI" != "1.5" ]; then
80             HOST_CC=gcc-2.95
81             HOST_CXX=g++-2.95
82             (cd $src && ln -s GNUmakefile.in GNUmakefile)
83         fi
84         (PATH="$old_path" \
85             PATH="$HOME/usr/pkg/guile-1.6/bin:$PATH" \
86             CFLAGS="-O2 -g" \
87             CC=$HOST_CC \
88             CXX=$HOST_CXX \
89             $src/configure --prefix=/usr --enable-config=for-build)
90     fi
91 }
92
93 prebuild () {
94     for i in $sub_packages; do
95         rm -rf $inst-$i
96         mkdir -p $inst-$i || exit 1
97     done
98     
99     # cross-compiling: build for build-host, generate doc
100     if !iscygwin; then
101         cd $build || exit 1
102
103         PATH=/bin:/usr/bin:$PATH \
104             PYTHONPATH=$build/python/out-for-build:$PYTHONPATH \
105             make conf=for-build all doc web || exit 1
106         
107         # as of 1.9.9, this should no longer be necessary:
108         for i in $(find . -path ".*out-for-build/*.1"); do
109             o=$(dirname $(dirname $i))/out
110             mkdir -p $o
111             cp -pv $i $o/$(basename $i)
112         done
113
114         mkdir -p mf/out
115         cp -pv mf/out-for-build/* mf/out
116     fi
117     
118     addmakeflags MAKE_PFA_FILES=1 ' ' LDFLAGS="$cygwin_prefix/bin/libpython2.3.dll" ' ' 'target=i686-pc-cygwin'
119 }
120
121 preinstall () {
122
123     # cross-compiling: fix manual pages
124     if !iscygwin; then
125         # as of 1.9.9, this should no longer be necessary:
126         cd $build || exit 1
127         cp -v scripts/out-for-build/midi2ly.1 scripts/out
128         cp -v lily/out-for-build/lilypond.1 lily/out
129     fi
130     
131     addmakeflags MAKE_PFA_FILES=1 ' ' LDFLAGS="$cygwin_prefix/bin/libpython2.3.dll" ' ' 'target=i686-pc-cygwin'
132 }
133
134 postinstall () {
135     fixdoc
136     
137     mkdir -p $inst-doc/$docprefix
138     cd $build || exit 1
139     
140     make conf=for-build webdir=$inst-doc/$packagedocdir web-install
141
142     ## copy READMEs etc
143
144     cd $src || exit 1
145     install -d -m755 $inst/$packagedocdir
146
147     ## Generic READMEs
148     find . -maxdepth 1 -type f -exec cp -pv \{\} $inst/$packagedocdir \;
149
150     ## Cygwin readmes
151     cygwin=cygwin
152     cd $src || exit 1
153     install -d -m755 $inst/$cygdocdir
154     install -m644 $cygwin/changelog $inst/$cygdocdir/changelog.Cygwin
155
156     cd $build || exit 1
157     install -m644 $cygwin/out/README $inst/$packagedocdir/README.Cygwin
158     install -m644 $cygwin/out/README $inst/$cygdocdir/$package.README
159
160     ## copy examples
161     cd $src || exit 1
162     cp -prv input $inst/$packagedocdir
163
164     cd $inst-doc/$packagedocdir &&
165     ln -s $(find html/Documentation -name '*.ps.gz') .
166 }