]> git.donarmstrong.com Git - lilypond.git/blob - cygwin/mknetrel
50c682683010f65c32bb3cdfc637360b3c3aa500
[lilypond.git] / cygwin / mknetrel
1 # -*- shell-script -*-
2
3 sub_packages="doc"
4
5 [ "$cygwin" == "mingw" ] && sub_packages="doc extra"
6
7 depends="libfontconfig1 libfreetype6 libguile16 libintl3 libpango1"
8 build_depends="mingw-devel gettext-devel guile-devel pango-devel"
9
10 v=$(expr "$ver" : "\(.*\)-[0-9]*")
11
12 save_PATH="$PATH"
13
14 # copy and include extra mknetrel stuff
15 . $src/$cygwin/mknetrel.extras || . $mknetrel/extras
16
17 doc () {
18     # doc works, but take too long to build each time
19     [ "$cygwin" == "mingw" ] && return 1
20     return 0
21 }
22
23 preconfig () {
24     extras_preconfig
25
26     [ "$cygwin" == "mingw" ] && if grep 'PYTHON_DEVEL(REQUIRED)' $src/configure.in; then
27         sed -i~ -e 's/PYTHON_DEVEL(REQUIRED)/PYTHON_DEVEL(OPTIONAL)/' \
28             $src/configure.in
29     fi
30     [ "$cygwin" == "mingw" ] && cd $src && ./autogen.sh --noconfigure
31     
32     cd $build || exit 1
33     # cross-compiling: configure for build-host
34     if ! iscygwin; then
35         rm -f config.cache
36         export HOST_CC=${HOST_CC:-gcc}
37         export HOST_CXX=${HOST_CXX:-g++}
38         export HOST_PKG_CONFIG=${HOST_PKG_CONFIG:-pkg-config}
39         export HOST_PKG_CONFIG_PATH=${HOST_PKG_CONFIG_PATH:-}
40         export HOST_FREETYPE_CONFIG=${HOST_FREETYPE_CONFIG:-freetype-config}
41         (PATH="$build:$save_PATH" \
42             CFLAGS="-O2 -g" \
43             CPPFLAGS="" \
44             CC=$HOST_CC \
45             CXX=$HOST_CXX \
46             LDFLAGS="" \
47             PKG_CONFIG=$HOST_PKG_CONFIG \
48             PKG_CONFIG_PATH=$HOST_PKG_CONFIG_PATH \
49             FREETYPE_CONFIG=$HOST_FREETYPE_CONFIG \
50             $src/configure --prefix=$prefix --enable-config=for-build)
51     fi
52
53     if [ "$cygwin" == "mingw" ]; then
54         cp /usr/include/FlexLexer.h .
55         mkdir python2.3
56         cp /usr/include/python2.3/Python.h python2.3
57     fi
58
59     GUILE=$($cygwin_prefix/bin/guile-config --version 2>&1 | awk '{print $NF}')
60     cat > $target-guile-config <<EOF
61 [ "\$1" == "--version" ] && echo "$target-guile-config - Guile version $GUILE"
62 [ "\$1" == "compile" ] && echo "-I$cygwin_prefix/include"
63 [ "\$1" == "link" ] && echo "-L$cygwin_prefix/lib -lguile -lgmp"
64 exit 0
65 EOF
66     chmod 755 $target-guile-config
67     export PATH=.:$PATH
68     build_cxx="$build_cxx -I$(pwd)"
69     if [ "$cygwin" == "mingw" ]; then
70         CONFIGOPTS="--without-kpathsea $CONFIGOPTS"
71         CPPFLAGS="-DARGV0_RELOCATION=1 $CPPFLAGS"
72         # There's a problem with inlining the string utils.
73         # The -O2 flag is still passed by default through opt.
74         CONFIGOPTS="--disable-optimising $CONFIGOPTS"
75         ## debugging
76         ##opt='-g'
77     fi
78     :
79 }
80
81 prebuild () {
82     extras_prebuild
83
84     # shortcircuit python for mingw
85     if [ "$cygwin" == "mingw" ]; then
86         mkdir -p python/out
87         touch python/out/midi.lo python/out/midi.so python/out/midi.dll
88     fi
89
90     # cross-compiling: build for build-host, generate doc
91     if ! iscygwin; then
92         cd $build || exit 1
93
94         if doc; then
95             args="all doc web"
96         else
97             args="all"
98         fi
99         (PATH="$build:$save_PATH" \
100             CFLAGS="-O2 -g" \
101             CPPFLAGS="" \
102             CC=$HOST_CC \
103             CXX=$HOST_CXX \
104             LDFLAGS="" \
105             eval make conf=for-build $args) || exit 1
106         
107         mkdir -p mf/out
108         cp -pv mf/out-for-build/* mf/out
109
110         mkdir -p Documentation/user/out
111         cp -pv Documentation/user/out-for-build/*{tely,texi} Documentation/user/out
112     fi
113
114     addmakeflags "target=$target" ' '
115     if [ -f "$cygwin_prefix/bin/libpython2.4.dll" ]; then
116         addmakeflags LDFLAGS="$cygwin_prefix/bin/libpython2.4.dll" ' '
117     fi
118
119     if iscygwin && doc; then
120         addmakeflags all ' ' doc ' ' web ' '
121     fi
122 }
123
124 preinstall () {
125     extras_preinstall
126     if iscygwin && doc; then
127         addmakeflags webdir="$inst-doc/$packagedocdir" ' ' web-install
128     fi
129 }
130
131 postinstall () {
132     extras_postinstall
133
134     cd $build || exit 1
135     if ! iscygwin && doc; then
136         make conf=for-build webdir=$inst-doc/$packagedocdir web-install
137     fi
138
139     # txt files reside elsewhere
140     cd $build/Documentation/topdocs/out
141     install -m644 AUTHORS.txt INSTALL.txt NEWS.txt README.txt $inst/$packagedocdir
142     ## copy examples
143     cd $src || exit 1
144     cp -prv input $inst/$packagedocdir
145     rm -rf $(find $inst/$packagedocdir -name 'CVS')
146     rm -f $(find $inst/$packagedocdir -name 'SCons*')
147     rm -f $(find $inst/$packagedocdir -name 'GNUmakefile*')
148
149     rm -rf $(find $inst/usr/share/lilypond -name '*.pyc')
150     rm -f $inst/usr/share/lilypond/$v/tex/texinfo.tex
151
152     if [ "$cygwin" == "mingw" ]; then
153         find $inst -name '*ly' | xargs unix2dos
154     fi
155
156     install -d -m755 $inst-doc/$infodir/lilypond
157     if doc; then
158         cd $inst-doc/$infodir/lilypond && ln -sf ../../doc/$base-$ver/Documentation/user/out-www/*png .
159     fi
160 }
161
162 doc_split () {
163     extras_doc_split
164     mkdir -p ./$packagedocdir/input
165     mv $inst/$packagedocdir/input/{no-notation,regression,test,tutorial} ./$packagedocdir/input
166     mkdir -p ./$prefix/share/lilypond/$v/fonts
167     mv $inst/$prefix/share/lilypond/$v/fonts/source ./$prefix/share/lilypond/$v/fonts
168 }
169
170 extra_name () {
171     echo lilypond-extra
172 }
173
174 extra_split () {
175     mkdir -p 
176     # should be in devel...
177     mkdir -p ./$prefix/share/lilypond/$v
178     for i in make python tex vim; do
179         mv $inst/$prefix/share/lilypond/$v/$i ./$prefix/share/lilypond/
180     done
181     mkdir -p ./$prefix/share/lilypond/$v/fonts
182     for i in source svg tfm; do
183         mv $inst/$prefix/share/lilypond/$v/fonts/$i ./$prefix/share/lilypond/fonts
184     done
185
186     mkdir -p ./$prefix/share
187     for i in locale omf; do
188         mv $inst/$prefix/share/$i ./$prefix/share
189     done
190 }