]> git.donarmstrong.com Git - lilypond.git/blob - cygwin/mknetrel
efb4a25cf6b03a9e0c33f24402f483bdf5707bda
[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 # To build the package, do:
11 cat >/dev/null <<EOC
12
13    cd /
14    cvs -d:pserver:anoncvs@sources.redhat.com:/cvs/cygwin-apps co -d netrel mknetrel
15    wget -P/var/tmp ftp://lilypond.org/pub/LilyPond/v1.9/lilypond-1.9.9.tar.gz
16    mkdir -p /netrel/src && cd /netrel/src
17    rm -rf /netrel/src/lilypond-*
18    tar xzf /var/tmp/lilypond-*
19    mv lilypond-1.9.9 lilypond-1.9.9-1
20    cp lilypond-1.9.9-1/cygwin/mknetrel /netrel/extra/lilypond
21    /netrel/bin/mknetrel -xX lilypond
22
23 EOC
24
25 sub_packages="doc"
26 old_path=$PATH
27
28 patch=$mknetrel_root/patch
29
30 # for cross-compiling LilyPond:
31 if ! iscygwin; then
32     uploads=$here/uploads/$base && mkdir -p $uploads/
33     tarstem=$uploads/$package
34 fi
35
36 # copy and include extra mknetrel stuff
37 extras="doc patch auto cross split"
38 for i in $extras; do
39     f=mknetrel.$i
40     [ -r $extra/$f ] && cp -pv $extra/$f $src/cygwin/$f
41     . $src/cygwin/$f
42 done
43
44
45 needdevoflags () {
46     return 1
47 }
48
49 preconfig () {
50
51     patchsrc 
52     rm -f config.cache
53
54     # for cross-compiling LilyPond, fake a guile-config
55     if ! iscygwin; then
56         cd $build || exit 1
57         GUILE=1.6.4
58         cat > guile-config <<EOF
59 [ "\$1" == "--version" ] && echo "guile-config - Guile version $GUILE"
60 [ "\$1" == "compile" ] && echo "-I$cygwin_root/usr/include"
61 [ "\$1" == "link" ] && echo "-L$cygwin_root/usr/lib -lguile"
62 exit 0
63 EOF
64         chmod 755 guile-config
65         PATH=$(pwd):$PATH
66     fi
67 }
68
69 postconfig () {
70     # cross-compiling: configure for build-host
71     if ! iscygwin; then
72         rm -f config.cache
73         export HOST_CC=gcc
74         export HOST_CXX=g++
75         (PATH="$old_path" \
76             PATH="$HOME/usr/pkg/guile-1.6/bin:$PATH" \
77             CFLAGS="-O2 -g" \
78             CC=$HOST_CC \
79             CXX=$HOST_CXX \
80             $src/configure --prefix=/usr --enable-config=for-build)
81     fi
82 }
83
84 prebuild () {
85     for i in $sub_packages; do
86         rm -rf $inst-$i
87         mkdir -p $inst-$i || exit 1
88     done
89     
90     # cross-compiling: build for build-host, generate doc
91     if ! iscygwin; then
92         cd $build || exit 1
93
94         PATH=/bin:/usr/bin:$PATH \
95             make conf=for-build all doc web || exit 1
96         
97         mkdir -p mf/out
98         cp -pv mf/out-for-build/* mf/out
99
100         mkdir -p Documentation/user/out
101         cp -pv Documentation/user/out-for-build/*{tely,texi} Documentation/user/out
102     fi
103
104     # set LDFLAGS to find the python library
105     # EXTRABUILDARGS="LDFLAGS=$cygwin_root/usr/bin/libpython2.3.dll"
106
107     addmakeflags LDFLAGS="$cygwin_root/usr/bin/libpython2.3.dll" ' ' "target=i686-pc-cygwin" ' '
108
109     if iscygwin; then
110         # EXTRABUILDARGS="$EXTRABUILDARGS all doc web"
111         addmakeflags all ' ' doc ' ' web ' '
112     fi
113 }
114
115 preinstall () {
116
117     # set LDFLAGS to find the python library
118     # addmakeflags LDFLAGS="$cygwin_root/usr/bin/libpython2.3.dll" ' ' "target=i686-pc-cygwin"
119 #    if ! iscygwin; then
120 #       EXTRAINSTALLARGS="target=i686-pc-cygwin"
121 #    else
122     if iscygwin; then
123         #EXTRAINSTALLARGS="web-install target=i686-pc-cygwin"
124         addmakeflags webdir="$inst-doc/$packagedocdir" ' ' web-install
125     fi
126 }
127
128 postinstall () {
129     fixdoc
130     
131     mkdir -p $inst-doc/$docprefix
132     cd $build || exit 1
133     
134     if ! iscygwin; then
135         make conf=for-build webdir=$inst-doc/$packagedocdir web-install
136     fi
137
138     ## copy READMEs etc
139
140     cd $src || exit 1
141     install -d -m755 $inst/$packagedocdir
142
143     install -m644  COPYING ChangeLog DEDICATION THANKS VERSION $inst/$packagedocdir
144
145     # txt files reside elsewhere
146     cd $build/Documentation/topdocs/out
147     install -m644 AUTHORS.txt INSTALL.txt NEWS.txt README.txt $inst/$packagedocdir
148
149     ## Cygwin readmes
150     cygwin=cygwin
151     cd $src || exit 1
152     install -d -m755 $inst/$cygdocdir
153     install -m644 $cygwin/changelog $inst/$cygdocdir/changelog.Cygwin
154
155     cd $build || exit 1
156     install -m644 $cygwin/out/README $inst/$packagedocdir/README.Cygwin
157     install -m644 $cygwin/out/README $inst/$cygdocdir/$package.README
158
159     ## copy examples
160     cd $src || exit 1
161     cp -prv input $inst/$packagedocdir
162        cd $inst/$packagedocdir
163        rm -rf $(find -name 'CVS')
164
165     #cd $inst-doc/$packagedocdir &&
166     #ln -s $(find html/Documentation -name '*.ps.gz') .
167
168     install -d -m755 $inst-doc/$infodir/lilypond
169     cd $inst-doc/$infodir/lilypond && ln -sf ../../doc/$base-$ver/Documentation/user/out-www/*png .
170 }