]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/make-cygwin-cross.sh
1c21c94fe59b0972d19ed21d8ea33894585f2cda
[lilypond.git] / buildscripts / make-cygwin-cross.sh
1 #!@BASH@
2 # make-cygwin-cross
3 #
4 # Build and install cross-development tools for cygwin package 
5 # (binutils, compiler, flex, bison).
6 # Using this cross-development enviroment, build and install
7 # native cygwin packages (guile, lilypond).
8 #
9 # Besides being a handy script for me, currently this mainly serves
10 # as documentation for cross-building lilypond.
11 #
12 # To use this script, you need
13 #
14 #  * all development tools to build a native LilyPond, see INSTALL.txt
15 #
16 #  * RPM distribution of the cygwin pre-release sources, from:
17 #
18 #      http://appel.dyndns.org/lilypond/gnu-windows/redhat/SRPMS/
19 #
20 #    The tarballs were fetched from:
21 #
22 #      ftp://sourceware.cygnus.com/pub/cygwin/private/cygwin-net-485/
23 #
24
25 ################
26 # config section
27 ################
28
29 TARGET_OS=cygwin
30 #TARGET_OS=mingw32
31
32 if [ $TARGET_OS = cygwin ]; then
33         ROOT=/usr/src/cygwin-net-485
34         TARGET_ARCH=i686
35         TARGET_VENDOR=pc
36 else
37         ROOT=/usr/src/mingw-net-485
38         TARGET_ARCH=i386
39         TARGET_VENDOR=pc
40 fi
41 TARGET_PLATFORM=$TARGET_ARCH-$TARGET_VENDOR-$TARGET_OS
42
43 ARCH=`uname -m`
44 OS=`uname -s | tr '[A-Z]' '[a-z]'`
45 VENDOR=gnu
46 PLATFORM=$ARCH-$VENDOR-$OS
47
48 #CROSS_TARGET_PLATFORM=$ARCH-x-$TARGET_PLATFORM
49 CROSS_TARGET_PLATFORM=$PLATFORM-x-$TARGET_PLATFORM
50 cto=$OS-x-cygwin
51 tp=i686-cygwin
52
53 PREFIX=$ROOT/usr
54 NATIVE_ROOT=/Cygnus
55 NATIVE_PREFIX=$NATIVE_ROOT/usr
56 CROSS_ROOT=$NATIVE_ROOT/$cto
57 CROSS_PREFIX=$CROSS_ROOT/usr
58
59 # urg
60 DEVEL=/home/fred
61 distdir=$DEVEL/WWW/lilypond/gnu-windows/lily-w32
62 #distdir=/tmp
63
64 CYGWIN_SOURCE=$DEVEL/sourceware.cygnus.com/pub/cygwin/private/cygwin-net-485
65 cygwin_dirs=`/bin/ls -d1 $CYGWIN_SOURCE/*`
66 cygwin_source_path=`echo $CYGWIN_SOURCE $cygwin_dirs | sed s'/\$/:/g'`
67 SOURCE_PATH=$DEVEL/usr/src/releases:$DEVEL/usr/src/redhat/SRPMS:$cygwin_source_path
68
69 cygwin_binary=cygwin-20000301.tar.gz
70 mingw_binary=bin-crtdll-2000-02-03.tar.gz
71
72 #CYGWIN_DLL=cygwin1-net-485.dll
73 CYGWIN_DLL=cygwin1.dll
74 MINWG_DLL=mingwc10-net-485.dll
75
76
77 ################
78 # cross packages
79 ################
80
81 cross_rpm="
82 binutils-19990818
83 gcc-2.95.2
84 bison
85 flex
86 "
87
88 # binutils installs ok, but forgets these two
89 binutils_after_rpm='
90 cd $CROSS_PREFIX/$TARGET_PLATFORM/bin \;
91 ln -f ../../bin/$TARGET_PLATFORM-objdump objdump \;
92 ln -f ../../bin/$TARGET_PLATFORM-objcopy objcopy \;
93 mv -f ld ld-in-path-breaks-libtool
94 '
95 # burp.  gcc doesn't install any of these
96 gcc_after_rpm='
97 cd $CROSS_PREFIX/$TARGET_PLATFORM/bin \;
98 ln -f ../../bin/$TARGET_PLATFORM-gcc cc \;
99 ln -f ../../bin/$TARGET_PLATFORM-gcc gcc \;
100 ln -f ../../bin/$TARGET_PLATFORM-c++ c++ \;
101 ln -f ../../bin/$TARGET_PLATFORM-g++ g++
102 '
103
104 guile_after_rpm='cp -f $NATIVE_PREFIX/bin/*guile-config $CROSS_PREFIX/$TARGET_PLATFORM/bin'
105
106 lilypond_version=@TOPLEVEL_VERSION@
107
108 native_rpm="
109 rx-1.5
110 zlib-1.1.3
111 db-2.7.7
112 guile-1.3.4
113 bash-2.03
114 rpm-3.0.4
115 lilypond-$lilypond_version
116 "
117
118 #######################
119 # end of config section
120 #######################
121
122 ###########
123 # functions
124 ###########
125
126 expand ()
127 {(
128
129         set -
130         string=`eval echo $\`eval echo "${1}${2}"\``
131         eval echo $string
132 )
133 }
134
135 find_path ()
136 {(
137         set -
138         expr=$1
139         source_path=${2:-$SOURCE_PATH}
140         path_list=`echo $source_path | sed 's/:/ /g'`
141
142         found=
143         for i in $path_list; do
144                 found=`/bin/ls -d1 $i/$expr 2>/dev/null | head -1`
145                 if [ "$found" != "" ] && [ -e $found ]; then
146                         break
147                 fi
148         done
149         echo $found
150 )
151 }
152
153 build ()
154 {(
155         package=$1
156         name=`echo $package | sed 's/-.*//'`
157
158         if [ $type = "cross" ]; then
159                 target_platform=$CROSS_TARGET_PLATFORM
160                 a=$cto
161         else
162                 target_platform=$TARGET_PLATFORM
163                 a=$tp
164         fi
165
166         ##rpm_package=`find_path $name*.rpm "$topdir/RPMS/$cto:$topdir/RPMS/$tp"`
167         rpm_package=`find_path $package*.rpm "$topdir/RPMS/$cto:$topdir/RPMS/$tp"`
168         if [ "$rpm_package" != "" ]; then
169                 echo "$rpm_package: package exists"
170                 #echo "$rpm_package: refreshing installation only"
171                 echo "$rpm_package: just updating rpm database"
172                 rpm -ivv --justdb --ignoreos --ignorearch --nodeps --force\
173                         --dbpath $NATIVE_ROOT/var/lib/rpm \
174                         $topdir/RPMS/$a/$name*.rpm
175                 exit 0
176         fi
177
178         cd $topdir
179         found=`find_path $package*src.rpm`
180         if [ "$found" != "" ]; then
181                 rpm --root $NATIVE_ROOT -ivv $found || exit 1
182                 rpm --target=$target_platform -ba SPECS/$name*.spec || exit 1
183         else
184                 tarball=`/bin/ls -d1 SOURCES/$package*tar.gz 2>/dev/null | head -1`
185                 if [ "$name.spec" != "" ] && [ "$tarball" != "" ]; then
186                         rpm --target=$target_platform -ba SPECS/$name.spec || exit 1
187                 else
188                         found=`find_path $package*tar.gz`
189                         if [ "$found" != "" ]; then
190                                 rpm --target=$target_platform -ta $found || exit 1
191                         else
192                                 echo "$package: no such rpm or tarball"
193                                 exit 1
194                         fi
195                 fi
196         fi
197         name=`echo $package | sed 's/-.*//'`
198
199         rpm -ivv --ignoreos --ignorearch --nodeps --force\
200                 --dbpath $NATIVE_ROOT/var/lib/rpm \
201                 $topdir/RPMS/$a/$name*.rpm
202         #urg
203         name_after_rpm="`expand $name _after_rpm`"
204         `eval $name_after_rpm` || exit 1
205 )
206 }
207
208 ##################
209 # end of functions
210 ##################
211
212 #######
213 # setup
214 #######
215
216 set -x
217 mkdir -p $ROOT
218 if [ ! -d $PREFIX/bin ]; then
219         mkdir -p $PREFIX
220         cd $PREFIX
221
222         ## is this still necessary?
223         mkdir -p include lib
224         mkdir -p $TARGET_PLATFORM
225         cd $TARGET_PLATFORM && ln -s ../include .
226
227         mkdir -p $CROSS_PREFIX/$TARGET_PLATFORM
228         cd $CROSS_PREFIX/$TARGET_PLATFORM
229         ln -s $NATIVE_PREFIX/{include,lib} .
230         #ln -s $NATIVE_PREFIX/{include,lib} .
231         #ln -s $NATIVE_PREFIX/include .
232         #ln -s $CROSS_PREFIX/bin .
233         
234         cd $ROOT
235         found=`find_path $cygwin_binary`
236         if [ "$found" = "" ]; then
237                 echo "$cygwin_binary: no such tarball"
238                 exit 1
239         fi
240         tar xzf $found
241         # urg, bug in gcc's cross-make configuration
242         mkdir -p $PREFIX/lib/gcc-lib/$TARGET_PLATFORM/2.95.2
243         mkdir -p $CROSS_PREFIX/lib/gcc-lib/$TARGET_PLATFORM/2.95.2
244 else
245         echo "$PREFIX: already exists"
246         echo "$cygwin_binary: skipping"
247 fi
248
249 # mingw
250 if [ ! -d $PREFIX/$TARGET_PLATFORM ]; then
251         cd $PREFIX
252         found=`find_path $mingw_binary`
253         if [ "$found" = "" ]; then
254                 echo "$mingw_binary: no such tarball"
255                 exit 1
256         fi
257         tar xzf $found
258
259         mkdir -p $PREFIX/lib/gcc-lib/$TARGET_PLATFORM/2.95.2
260         rm -f include
261         mkdir -p $PREFIX/i386-mingw32/include
262         ln -s $PREFIX/i386-mingw32 $TARGET_PLATFORM
263         ln -s $PREFIX/$TARGET_PLATFORM/include .
264 fi
265
266 rm -f $NATIVE_ROOT
267 if [ ! -e $NATIVE_ROOT ]; then
268         ln -s $ROOT $NATIVE_ROOT || exit 1
269 fi
270
271 #mv $PREFIX/bin/cygwin1.dll $PREFIX/bin/$CYGWIN_DLL
272 #mv $PREFIX/bin/mingwc10.dll $PREFIX/bin/$MINGW_DLL
273
274 mkdir -p $ROOT/var/redhat
275 mkdir -p $PREFIX/src/redhat
276
277 native_config_site='$PREFIX/share/native-config.site'
278
279 ncs=`eval echo $native_config_site`
280 rm -f $ncs
281 mkdir -p `dirname $ncs`
282 cat > $ncs <<EOF
283 ac_cv_c_bigendian=no
284 ac_cv_sizeof_char_p=4
285 ac_cv_sizeof_int=4
286 ac_cv_sizeof_long=4
287 ac_cv_sizeof_float=4
288 ac_cv_sizeof_double=8
289 ac_cv_sys_restartable_syscalls=no
290 ac_cv_sprintf_count=yes
291 ac_cv_spinlocks=no
292 db_cv_sprintf_count=yes
293 db_cv_spinlocks=no
294 ac_cv_func_getpgrp_void=yes
295 ac_cv_func_setvbuf_reversed=no
296 ac_cv_lib_intl=no
297 # urg, lots of stuff goes wrong when configuring bash??
298 ac_cv_exeext=.exe
299 ac_cv_header_libintl_h=no
300 ac_cv_header_termcap_h=no
301 ac_cv_func_mkfifo=yes
302 bash_cv_dup2_broken=no
303 bash_cv_opendir_not_robust=no
304 bash_cv_pgrp_pipe=no
305 bash_cv_printf_declared=yes
306 bash_cv_sbrk_declared=yes
307 bash_cv_signal_vintage=posix
308 bash_cv_speed_t_in_sys_types=no
309 bash_cv_struct_timeval=yes
310 bash_cv_struct_winsize_header=ioctl_h
311 bash_cv_sys_errlist=yes
312 bash_cv_sys_named_pipes=missing
313 bash_cv_func_strcoll_broken=no
314 bash_cv_must_reinstall_sighandlers=no
315 bash_cv_getcwd_calls_popen=no
316 bash_cv_func_sigsetjmp=missing
317 bash_cv_job_control_missing=present
318 bash_cv_sys_restartable_syscalls=no
319 bash_cv_getenv_redef=yes
320 bash_cv_sys_siglist=no
321 bash_cv_type_rlimit=long
322 bash_cv_ulimit_maxfds=no
323 bash_cv_decl_under_sys_siglist=no
324 bash_cv_under_sys_siglist=no
325 EOF
326
327 #URG, stupid RPM
328 rpm_ct=$ARCH-$TARGET_OS
329 cross_rpm_dir=$CROSS_PREFIX/lib/rpm/$rpm_ct
330 cross_rpm_link=/usr/lib/rpm/$rpm_ct
331 mkdir -p $cross_rpm_dir
332 rm -f $cross_rpm_link
333 ln -s $cross_rpm_dir $cross_rpm_link
334
335 native_rpm_dir=$NATIVE_PREFIX/lib/rpm/$tp
336 native_rpm_link=/usr/lib/rpm/$tp
337 mkdir -p $native_rpm_dir
338 rm -f $native_rpm_link
339 ln -s $native_rpm_dir $native_rpm_link
340
341 cross_macros=$cross_rpm_dir/macros
342 native_macros=$native_rpm_dir/macros
343
344 base_macros=$NATIVE_PREFIX/lib/rpm/base-macros
345 rm -f $base_macros
346 cat > $base_macros <<EOF
347 %native_prefix  /Cygnus/usr
348
349 %_topdir        %{native_prefix}/src/redhat
350 %_sourcedir     %{native_prefix}/src/redhat/SOURCES
351 %_builddir      %{native_prefix}/src/redhat/BUILD
352 %_srcrpmdir     %{native_prefix}/src/redhat/SRPMS
353 %_rpmdir        %{native_prefix}/src/redhat/RPMS
354
355 #%DocDir                %{native_prefix}/doc
356 %DocDir         /Cygnus/usr/doc
357 %_docdir        /Cygnus/usr/doc
358 %_defaultdocdir /Cygnus/usr/doc
359
360 %cygwin_dll     %{native_prefix}/bin/cygwin1.dll
361
362 %__install      /bin/install
363
364 %cflags         %{optflags}
365 %cppflags       %{nil}
366
367 %sourcedir      .
368 EOF
369
370 cp -f $base_macros $cross_macros
371 cat >> $cross_macros <<EOF
372
373 %cross_prefix   /Cygnus/$cto/usr
374 %root           /Cygnus/$cto
375 %_rootbindir    /Cygnus/$cto/bin
376 #_usr           /Cygnus/$cto/usr
377 %_prefix        /Cygnus/$cto/usr
378 %prefix         /Cygnus/$cto/usr
379
380 %_rpmfilename   $cto/%%{NAME}-%%{VERSION}-%%{RELEASE}.$cto.rpm
381
382 %config_site    %{nil}
383
384 %cppflags       %{nil}
385 %cflags         %{nil}
386 %ldflags        %{nil}
387 %_target_platform $TARGET_PLATFORM
388
389 #% configure    \
390 #  %{?__libtoolize:[ -f configure.in ] \&\& %{__libtoolize} --copy --force}; \
391 %configure      \
392   CPPFLAGS="%{cppflags}" CFLAGS="%{cflags}" LDFLAGS="%{ldflags}" CONFIG_SITE=%{config_site} \
393   %{sourcedir}/configure \
394   --host=%{_host} --target=%{_target_platform} --prefix=%{cross_prefix} -v
395 EOF
396
397 cp -f $base_macros $native_macros
398 cat >> $native_macros <<EOF
399
400 %root           /Cygnus
401 %_rootbindir    /Cygnus/bin
402 #_usr           /Cygnus/usr
403 %_prefix        /Cygnus/usr
404 %prefix         /Cygnus/usr
405
406 %config_site    %{_prefix}/share/native-config.site
407 # won't work: scripts and stuff are .exe too
408 #%program_suffix .exe
409 %program_suffix %{nil}
410
411 #%_arch         i686-cygwin
412 #%_vendor       pc
413 #%_os           cygwin
414
415 %_rpmfilename   %%{ARCH}-$TARGET_OS/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}-$TARGET_OS.rpm
416
417 %__find_provides        %{native_prefix}/lib/rpm/cygwin.prov
418 %__find_requires        %{native_prefix}/lib/rpm/cygwin.req
419 %__fix_suffixes         %{native_prefix}/bin/fix-suffixes
420 %fix_suffixes   %{__fix_suffixes} \$RPM_BUILD_ROOT%{_rootbindir}/* \$RPM_BUILD_ROOT%{native_prefix}/bin/*
421
422 %cppflags       -I%{native_prefix}/include
423 %cflags         %{optflags} %{cppflags}
424 %ldflags        -L%{native_prefix}/lib %{cygwin_dll}
425
426 #%configure     \
427 #  %{?__libtoolize:[ -f configure.in ] \&\& %{__libtoolize} --copy --force}; \
428
429 %configure      \
430   CPPFLAGS="%{cppflags}" CFLAGS="%{cflags}" LDFLAGS="%{ldflags}" CONFIG_SITE=%{config_site} \
431   %{sourcedir}/configure --host=%{_host} --target=%{_target_platform} \
432   --prefix=%{native_prefix} --program-prefix=
433 #  --prefix=%{native_prefix} --program-suffix=%{program_suffix}
434 EOF
435
436 rm -f $NATIVE_PREFIX/lib/rpm/cygwin.prov
437 cat > $NATIVE_PREFIX/lib/rpm/cygwin.prov <<EOF
438 #!/bin/sh
439 while read f ; do
440        f=\`echo \$f | tr '[:upper:]' '[:lower:]'\`
441        case \$f in
442        *.dll)  basename \$f
443                ;;
444        esac
445 done | sort -u
446 EOF
447 chmod 755 $NATIVE_PREFIX/lib/rpm/cygwin.prov
448
449 rm -f $NATIVE_PREFIX/lib/rpm/cygwin.req
450 cat > $NATIVE_PREFIX/lib/rpm/cygwin.req <<EOF
451 #!/bin/sh
452
453 while read f ; do
454        case \$f in
455        *.dll|*.exe)    objdump -p \$f | grep "DLL Name:" | cut -f3 -d" " | tr '[:upper:]' '[:lower:]'
456                        ;;
457        esac
458 done | sort -u
459
460 EOF
461 chmod 755 $NATIVE_PREFIX/lib/rpm/cygwin.req
462
463 rm -f $NATIVE_PREFIX/bin/fix-suffixes
464 cat > $NATIVE_PREFIX/bin/fix-suffixes <<EOF
465 #!/bin/sh
466 ## duh, rename executables,
467 ## for people that use a dumb shell instead of bash
468
469
470 if [ \$# -le 0 ]; then
471         echo "Usage: fix-suffixes [FILE]..."
472         exit 2
473 fi
474
475 fix_extension ()
476 {
477         path=\$1
478         ext=\$2
479         expr="\$3"
480         dir=\`dirname \$path\`
481         file=\`basename \$path\`
482         base=\`basename \$file \$ext\`
483         if [ \$base\$ext != \$file ]; then
484                 type="\`file \$path\`"
485                 if expr "\$type" : "\$expr"; then
486                         mv -f \$path \$dir/\$base\$ext
487                 fi
488         fi
489 }
490
491 for i in \`/bin/ls -d1 \$*\`; do
492         fix_extension \$i .exe '.*Windows.*\(executable\).*'
493         fix_extension \$i .py '.*\(python\).*'
494 done
495
496 EOF
497 chmod 755 $NATIVE_PREFIX/bin/fix-suffixes
498 set -x
499 type=rpm
500 rm -rf $NATIVE_ROOT/var/lib/rpm
501 mkdir -p $NATIVE_ROOT/var/lib/rpm
502 rpm --root $NATIVE_ROOT --initdb
503
504 topdir=$NATIVE_PREFIX/src/redhat
505 mkdir -p $topdir/{BUILD,RPMS/{$tp,$cto},SOURCES,SPECS,SRPMS}
506
507 ##############
508 # end of setup
509 ##############
510
511 OLDPATH=$PATH
512 # building x-gcc requires to have x-ar in path
513 # x-gcc will find $prefix/x/bin/as by itself
514 PATH=$CROSS_PREFIX/bin:$PATH
515
516 mkdir -p $PREFIX/src
517 cd $PREFIX/src
518 type=cross
519 for i in $cross_rpm; do
520         if build $i; then
521                 true
522         else
523                 echo "$i: rpm build failed"
524                 exit 1
525         fi
526 done
527
528 PATH=$CROSS_PREFIX/$TARGET_PLATFORM/bin:$PATH
529
530 cd $PREFIX/src
531 type=native
532 for i in $native_rpm; do
533         if build $i; then
534                 true
535         else
536                 echo "$i: rpm build failed"
537                 exit 1
538         fi
539 done
540
541 ##############
542 # Distribution
543 ##############
544
545 PATH=$OLDPATH
546
547 mkdir -p $distdir
548
549 cat > $distdir/setup.sh <<EOF
550 #!/bin/bash
551 set -x
552 ROOT=/Cygnus
553 PREFIX=\$ROOT/usr
554 # gunzip rpm.gz || exit 1
555 #dll=\$ROOT/net-485
556 #mkdir -p \$dll
557 #gzip -dc cygwin.dll.gz > \$dll/cygwin1.dll
558 ## this won't work: must be done outside of cygwin
559 #old_dll=\`which cygwin1.dll\`
560 #mv -f \$old_dll \$old_dll.orig\$\$
561 #gunzip cygwin1.dll.gz
562 #cp -f cygwin1.dll \$old_dll
563 echo > rpmrc
564 # mkdir -p \$ROOT/var/lib
565 # mkdir -p \$ROOT/bin
566 rem # touch \$ROOT/bin/rpm \$ROOT/bin/rpm.exe
567 echo > \$ROOT/bin/rpm; echo > \$ROOT/bin/rpm.exe
568 ./rpm --root \$ROOT --rcfile rpmrc --initdb
569 ./rpm --root \$ROOT --rcfile rpmrc --nodeps --ignorearch --ignoreos -Uhv \\
570         RPMS/$tp/rpm-*.$tp.rpm \\
571         RPMS/$tp/*.$tp.rpm
572 done
573 EOF
574
575 cat > $distdir/setup.bat <<EOF
576 del dll olddll
577 rem # old_dll=\`which cygwin1.dll\`
578 rem # urg, should dist bash too, then we don't need usertools!
579 rem # but this gets ugly, we could really use:
580 rem # 
581 rem #     cp, cygpath, gunzip, mv, mkdir, touch
582 rem #  
583 rem # ie, fileutils, gzip, (cygpath?)
584 rem #  
585 rem #   cp -f \`which bash\` /bin;
586 rem #   mkdir -p /bin;
587 rem #   cp -f bash /bin/bash.exe;
588 rem #   cp -f /bin/bash /bin/sh.exe;
589 mkdir \\bin
590 copy bash \\bin\\bash.exe
591 copy bash \\bin\\sh.exe
592 mkdir \\Cygnus
593 mkdir \\Cygnus\\bin
594 mkdir \\Cygnus\\var
595 mkdir \\Cygnus\\var\\lib
596 bash -c '
597         dll=\`type -p cygwin1.dll\`;
598         wdll=\`./cygpath -w \$dll\`;
599         echo cygwin1.dll \$wdll > newdll; echo \$wdll \$wdll.orig\$\$ > olddll'
600 if not errorlevel 0 goto nobash
601 rem # mv -f \$old_dll \$old_dll.orig\$\$
602 rem # gunzip cygwin1.dll.gz
603 rem # cp -f cygwin1.dll \$old_dll
604 copy < olddll 
605 copy < newdll 
606 bash setup.sh
607 if not errorlevel 0 goto nobash
608 goto :exit
609 :nobash
610 @echo "setup.bat: can't find bash"
611 rem # @echo "setup.bat: please install usertools from"
612 rem # @echo "setup.bat: http://sourceware.cygnus.com/cygwin/"
613 :exit
614 EOF
615
616 cat > $distdir/lilypond.sh <<EOF
617 #!/bin/bash
618 ROOT=/Cygnus
619 PREFIX=\$ROOT/usr
620 \$ROOT/bin/lilypond \$*
621 EOF
622
623 cat > $distdir/midi2ly.sh <<EOF
624 #!/bin/bash
625 ROOT=/Cygnus
626 PREFIX=\$ROOT/usr
627 \$ROOT/bin/midi2ly \$*
628 EOF
629
630 cat > $distdir/lilypond.bat <<EOF
631 bash lilypond.sh %1 %2 %3 %4 %5 %6 %7 %8 %9
632 EOF
633
634 cat > $distdir/midi2ly.bat <<EOF
635 bash midi2ly.sh %1 %2 %3 %4 %5 %6 %7 %8 %9
636 EOF
637
638 cd $distdir
639 rm -f $CYGWIN_DLL.gz
640 cp -f $PREFIX/bin/$CYGWIN_DLL .
641 rm -f rpm.gz
642 cp -f `/bin/ls -d1 $ROOT/bin/rpm* |head -1` rpm
643
644 rm -f bash.gz
645 cp -f `/bin/ls -d1 $ROOT/bin/bash* |head -1` bash
646
647 rm -f cygpath.gz
648 cp -f `/bin/ls -d1 $PREFIX/bin/cygpath* |head -1` cygpath
649
650 distbase=`basename $distdir`
651 rm -f RPMS
652 ln -s ../redhat/RPMS .
653
654 www=`dirname $distdir`
655 cd $www
656 for i in bash-2 guile-1 rpm-3 lilypond-$lilypond_version; do
657         rpm=`find_path $i*.rpm $distbase/RPMS/$tp`
658         dist_rpms="$dist_rpms $rpm"
659 done
660
661 rm -f $www/setup.zip
662 cd $www && zip setup.zip lily-w32 $distbase/* $dist_rpms
663
664 # make small zip dist available
665 #
666 zipdir=$www/zip
667 mkdir -p $zipdir
668
669 rm -f $zipdir/$CYGWIN_DLL.zip
670 cd $ROOT/bin && zip $zipdir/$CYGWIN_DLL.zip $CYGWIN_DLL
671
672 for i in bash-2 guile-1 rpm-3 lilypond-$lilypond_version; do
673         found=`find_path $i*.rpm $distdir/RPMS/$tp`
674         if [ "$found" = "" ]; then
675                 echo "$i: no such .rpm"
676         else
677                 base=`basename $found`
678                 package=`echo $base | sed "s/\.$tp.rpm//"`
679                 dir=/tmp/$i-rpm2zip
680                 rm -rf $dir
681                 mkdir -p $dir
682                 cd $dir || exit 1
683                 rpm2cpio $found | cpio -id
684                 zip -ry $zipdir/$package.zip .
685                 rm -rf $dir
686         fi
687 done
688
689 cd $distdir
690 gzip -f $CYGWIN_DLL
691 gzip -f rpm
692 gzip -f bash
693 gzip -f cygpath
694