[project @ 2003-08-18 14:54:40 by panne]
[ghc.git] / distrib / prep-bin-dist-mingw-args
1 #!/bin/sh
2 #
3 # Running 'binary-dist' gives us a tree which
4 # isn't quite right for the purposes of creating
5 # a mingw/win32 install tree.  This script rejigs
6 # the tree.
7 #
8 # To use:
9 #
10 #   foo$ cd <top of fptools build tree>
11 #   foo$ make binary-dist Project=Ghc 
12 #   foo$ cd ghc-<version>
13 #   foo$ ../distrib/prep-bin-dist-mingw-args <perl-dir> <mingw-top> <mingw-gcc-lib>
14 #
15
16 # Directory where a (cygwin-free) perl binary resides.
17 export perl_dir=$1
18
19 # Top of the MinGW32 compiler directory
20 export mingw_top=$2
21
22 # The gcc-lib directory of the mingw tree you want to
23 # include with the binary dist.
24 export gcc_lib=$mingw_top/$3
25
26 #
27 # The mingw include, lib, and bin directories.
28 #
29 export mingw_include=$mingw_top/include
30 export mingw_lib=$mingw_top/lib
31 export mingw_bin=$mingw_top/bin
32
33 # Play safe
34 if ! [ -d bin/i386-unknown-mingw32 ] ; then
35   echo "Doesn't look as if I'm in the toplevel directory of a mingw tree"
36   echo "Usage: cd ghc-<version> ; ../distrib/prep-bin-dist-mingw"
37   exit 1;
38 fi;
39
40 echo "Removing configure script files...not needed"
41 rm -f config.guess config.sub configure configure.ac mkdirhier
42 rm -f Makefile-bin.in Makefile.in aclocal.m4 install-sh
43 rm -rf autom4te.cache
44
45 echo "rejig bin/"
46 mv bin/i386-unknown-mingw32/* bin/
47 rmdir bin/i386-unknown-mingw32
48 strip bin/ghc.exe
49
50 echo "rejig lib/"
51 mv lib/i386-unknown-mingw32/* .
52 rmdir lib/i386-unknown-mingw32
53 rmdir lib
54 mv ghc-asm.prl ghc-asm
55 mv ghc-split.prl ghc-split
56
57 echo "create gcc-lib/"
58 #
59 # A bunch of stuff gets lumped into gcc-lib:
60 #
61 #  - the gcc-lib/ + gcc-lib/include of the gcc you
62 #    intend to ship (normally located as 
63 #     lib/gcc-lib/mingw/<gcc version>/ in your mingw tree.)
64 #  - the contents of mingw/lib/ 
65 #  - ld.exe, as.exe, dlltool.exe, dllwrap.exe from mingw/bin
66 #
67 mkdir gcc-lib
68 cp $gcc_lib/* gcc-lib/
69 cp $gcc_lib/include/* gcc-lib/
70 cp $mingw_lib/* gcc-lib/
71 cp $mingw_bin/as.exe gcc-lib/
72 cp $mingw_bin/ld.exe gcc-lib/
73 # Note: later versions of dlltool.exe depend on a bfd helper DLL.
74 cp $mingw_bin/dllwrap.exe gcc-lib/
75 cp $mingw_bin/dlltool.exe gcc-lib/
76
77
78 echo "extra header files inside of include/"
79 #
80 # contains mingw/include
81 mkdir include/mingw
82 cp -Rf $mingw_include/* include/mingw
83 #
84 # g++-3/ subdir causes problems with installer tool (+ being a 
85 # troublesome character); leave out for now.
86 #rm -rf include/mingw/g++-3/ || echo "g++-3/ not there"
87 rm -rf include/mingw/c++ || echo "c++/ not there"
88
89 echo "add gcc"
90 # cp ${mingw_bin}/gcc.exe .
91 cp ${mingw_bin}/gcc-2.exe gcc.exe
92
93 echo "copy in perl too"
94 cp ${perl_dir}/perl.exe .
95 cp ${perl_dir}/perl56.dll .
96
97 # For reasons unknown, duplicate copies of misc package files in share/
98 # (leave them be for now.)
99
100 echo "formatting documentation"
101 cp README README.txt
102 mv share doc
103 cp ../ghc/docs/users_guide/users_guide.pdf doc/ || echo "No User Guide PDF doc found"
104 cp ../hslibs/doc/hslibs.pdf doc/ || echo "No HSLIBS PDF doc found"
105