]> git.donarmstrong.com Git - lilypond.git/blob - cygwin/mknetrel
* scripts/mup2ly.py: Cut-n-paste include missing lilylib.
[lilypond.git] / cygwin / mknetrel
1 # -*- shell-script -*-
2
3 # stable LilyPond releases: lilypond-1.4
4 # archive=ftp://lilypond.org/pub/LilyPond/v1.4
5
6 # LilyPond development: lilypond-1.5
7 # archive=ftp://lilypond.org/pub/LilyPond/v1.5
8
9 # Guile specific mknetrel overrides
10 # To use this, do something like:
11 cat >/dev/null <<EOC
12
13    wget -P/var/tmp ftp://lilypond.org/pub/LilyPond/v1.5/lilypond-1.5.68.tar.gz
14    rm -rf /home/mknetrel/netrel/src/lilypond-*
15    mkdir -p /home/mknetrel/netrel/src && cd /home/mknetrel/netrel/src
16    ## TODO: look at pimport
17    tar xzf /var/tmp/lilypond-*
18    mv lilypond-* $(echo lilypond-*)-1
19    cd -
20    ./bin/mknetrel -xXC lilypond
21
22 EOC
23
24
25 BUILD=1
26 # sover=14
27
28 patch=$mknetrel_root/patch
29 iscygwin || (uploads=$here/uploads/$base && mkdir -p $uploads)
30
31 sub_packages="doc"
32 old_path=$PATH
33
34
35
36 ##. $extra/jcn
37
38
39 # -*- shell-script -*-
40
41 # jcn -- unsorted stuff
42
43
44 #
45 # Patching and configuring
46 #
47
48 # Maybe add to mknetrel or pimport.
49 dopatchsrc () {
50     cd $src
51     patch -p1 < $patch/$package.patch
52     [ -d cygwin -a ! -e CYGWIN-PATCHES ] && ln -s cygwin CYGWIN-PATCHES
53     [ -d CYGWIN-PATCHES -a ! -e cygwin ] && ln -s CYGWIN-PATCHES cygwin
54     [ -d CYGWIN-PATCHES ] || mkdir CYGWIN-PATCHES
55 }
56
57 # Maybe add to mknetrel or pimport.
58 patchsrc () {
59     [ -r $patch/$package.patch -a ! -r $src/CYGWIN-PATCHES -a ! -r $src/cygwin ] && dopatchsrc
60 }
61
62 autoupdate () {
63     for i in bootstrap autogen.sh; do
64         if [ -x ./$i ]; then
65             ./$i || exit 1
66             return 0
67         fi
68     done
69     
70     aclocal
71     rm -rf libltdl
72     libtoolize --force --copy --automake --ltdl
73     autoheader
74     autoconf
75     automake --add-missing
76 }
77
78 crosscache () {
79         cat <<EOF > config.cache
80
81 ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
82 ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
83 ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=4}
84 ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
85 ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
86 ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
87 ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
88 ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=12}
89 ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
90 ac_cv_sizeof_short=${ac_cv_sizeof_short=2}
91 ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=4}
92 ac_cv_c_long_size_t=${ac_cv_c_long_size_t=no}
93 ac_cv_c_long_time_t=${ac_cv_c_long_time_t=yes}
94 ac_16bit_type=${ac_16bit_type=short}
95 ac_32bit_type=${ac_32bit_type=int}
96 ac_64bit_type=${ac_64bit_type=none}
97 ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls=no}
98 ac_cv_sprintf_count=${ac_cv_sprintf_count=yes}
99 ac_cv_spinlocks=${ac_cv_spinlocks=no}
100 ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void=yes}
101 ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
102 ac_cv_func_mkfifo=yes
103
104 # Try at preventing to break make rules while crosscompiling.  This
105 # used work, but nowadays ./configure thinks it knows better than me.
106
107 # But what ./configure doesn't know, is that automake and libtool are
108 # broken wrt cross-building, and wrt cc_for_build.  See new
109 # workarounds above.
110
111 ac_exeext=${ac_exeext=}
112 ac_cv_exeext=${ac_cv_exeext=}
113 EOF
114 }
115
116
117
118 #
119 # Subpackage stuff -- Maybe move to mknetrel
120 #
121
122 # Possibly, using file-lists globs is smarter than separate install
123 # prefixes.  We'll see what happens when packaging tetex-*.
124
125
126 lib_name () {
127     echo lib$base$sover
128 }
129
130 devel_name () {
131     echo $base-devel
132 }
133
134 doc_name () {
135     echo $base-doc
136 }
137
138 lib_split () {
139     mkdir -p ./$prefix/bin || exit 1
140     mv $inst/$prefix/bin/*.dll ./$prefix/bin
141     mkdir -p ./$prefix/share || exit 1
142     mv $inst/$prefix/share/$base ./$prefix/share
143     true
144 }
145    
146 devel_split () {
147     mkdir -p ./$prefix/bin || exit 1
148     mv $inst/$prefix/bin/guile-* ./$prefix/bin
149     mv $inst/$prefix/include ./$prefix/include
150     mkdir -p ./$prefix/lib || exit 1
151     mv $inst/$prefix/lib/*.a ./$prefix/lib
152     mv $inst/$prefix/lib/*.la ./$prefix/lib
153     mkdir -p ./$prefix/share || exit 1
154     mv $inst/$prefix/share/aclocal ./$prefix/share
155     true
156 }
157
158 doc_split () {
159     mkdir -p ./$prefix || exit 1
160     mv $inst/$prefix/info ./$prefix
161     true
162 }
163
164 domkdist() {
165     #
166     # Fix up installation slightly
167     #
168     cd $inst || exit 1
169     chmod -R a+w .
170     cd usr 2>/dev/null && dousrstuff
171
172
173     # Split off any sub-packages.  The actual splitting is handled by
174     # a package's specific code in extra/.
175
176     # To package `foo' in foo, foo-doc and foo-devel, set
177     # sub_packages='doc devel'.
178
179     # Then provide functions doc_name and devel_name, that return the
180     # full name of the sub-package.  Also provide functions doc_split
181     # and devel_split, that mv part of foo's installation in $inst to
182     # the sub-packages' installation roots $inst-doc and $inst-devel.
183
184     cd $inst || exit 1
185     presplit
186
187     for i in $sub_packages; do
188         subname=$(${i}_name)
189         rm -rf $inst-$i
190         mkdir -p $inst-$i || exit 1
191         cd $inst-$i
192         ${i}_split || exit 1
193     done
194     
195     #
196     # Make tar balls
197     #
198
199     cd $inst || exit 1
200     prepackage
201
202     # The base package
203     echo creating $tarstem.tar.bz2
204     cd $inst || exit 1
205
206     f=$src/cygwin/setup.hint && test -r $f && cp $f $uploads
207     f=$src/cygwin/$base.hint && test -r $f && cp $f $uploads/setup.hint
208     find * -print | sort | tar -T - --no-recursion -cjf $tarstem.tar.bz2
209
210     # Any sub-packages
211     for i in $sub_packages; do
212         subname=$(${i}_name)
213         subload=$uploads/$subname
214         subtarstem=$subload/$subname-$ver
215         mkdir -p $subload || exit 1
216         echo creating $subtarstem.tar.bz2
217         f=$src/cygwin/$subname.hint && test -r $f && cp $f $subload/setup.hint
218         cd $inst-$i
219         find * -print | sort | tar -T - --no-recursion -cjf $subtarstem.tar.bz2
220     done
221
222     # The source package
223     cd $src/.. || exit 1
224     echo creating "$tarstem"-src.tar.bz2
225     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
226     postpackage
227 }
228
229
230 # end jcn
231
232
233
234
235 needdevoflags () {
236     return 1
237 }
238
239 # do I have a broken setup, do the Guile developers not know how to
240 # write configure.in and Makefile.am, or are automake/libtool broken?
241 preconfig () { # aka libtool_woes ()
242
243     # Add to mknetrel?
244     patchsrc 
245
246     ## autoupdate
247
248     cd $build || exit 1
249
250     GUILE=1.5.6
251     cat > guile-config <<EOF
252 #/bin/sh
253 [ "\$1" == "--version" ] && echo "guile-config - Guile version $GUILE"
254 [ "\$1" == "compile" ] && echo "-I$PREFIX/include"
255 [ "\$1" == "link" ] && echo "-L$PREFIX/lib -lguile"
256 exit 0
257 EOF
258
259     chmod 755 guile-config
260     PATH=$(pwd):$PATH
261     
262     ##opt='-O2 -g' LDFLAGS='"$cygwin_prefix/bin/libpython2.2.dll"
263 }
264
265 postconfig () {
266     # Configure for build, for generating doc
267     rm -f config.cache
268     (PATH="$old_path" \
269         PATH="$HOME/usr/pkg/guile-1.5.6/bin:$PATH" \
270         CFLAGS="-O2 -g" \
271         $src/configure --prefix=/usr --enable-config=for-build)
272 }
273
274 prebuild () {
275     # Build for build, generating doc
276     cd $build || exit 1
277     
278     # ugh, footify fix
279     cd $src && ln -s GNUmakefile.in GNUmakefile
280
281     cd $build || exit 1
282     PATH=/bin:/usr/bin:$PATH make conf=for-build all doc html-doc
283     for i in $(find . -path "out-for-build/*.1"); do
284         cp -pv $i $(dirname $(dirname $i))/$(basename $i)
285     done
286
287     addmakeflags LDFLAGS="$cygwin_prefix/bin/libpython2.2.dll"
288 }
289
290 postinstall () {
291     mkdir -p $inst-doc/$prefix
292     cd $build || exit 1
293     make conf=for-build prefix=$inst-doc/$prefix install-html-doc
294
295
296     ## copy READMEs etc
297
298     cd $src || exit 1
299     docdir=$prefix/share/doc/$name-$version
300     
301     mkdir -p $inst/$docdir
302
303     ## Generic READMEs
304     find . -maxdepth 1 -type f -exec cp -pv \{\} $inst/$docdir \;
305
306     ## Windows readmes
307     cd Documentation/windows || exit 1
308     cp -p README $inst/$docdir/README.Cygwin
309     cp -p changelog $inst/$docdir/changelog.Cygwin
310     mkdir -p $inst/$prefix/doc/Cygwin
311     cp -p README $inst/$prefix/doc/Cygwin/$cygpack.README
312
313     ## copy examples
314     cd $src || exit 1
315     cp -prv input $inst/$docdir
316
317     cd $inst-doc/$prefix/share/doc/$name-$version &&
318     ln -s $(find html/Documentation -name '*.ps.gz') .
319
320     ## Cygwin doesn't adhere to FHS (and why should they?)
321     cd $inst/$prefix && mv share/doc .
322     cd $inst-doc/$prefix && mv share/doc .
323 }
324
325 #presplit () {
326 #    docdir=$prefix/share/doc/$name-$version
327 #    mkdir -p $inst-doc/$docdir || exit 1
328 #}
329
330 doc_split () {
331     mkdir -p ./$prefix || exit 1
332     mv $inst/$prefix/info ./$prefix
333     true
334 }
335
336
337 #prepackage () {
338 #  mv $inst/$prefix/bin/guile-* $inst-devel/$prefix/bin
339 #}