58b78ffdfae8b154f8113b16f2016400d840d370
[ghc-hetmet.git] / distrib / prep-bin-dist-mingw
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
14 #
15 #export gcc_lib=c:/ghc/ghc-5.02.2/gcc-lib
16
17 #Directory where a (cygwin-free) perl binary resides.
18 export perl_dir=c:/ghc/ghc-5.04
19
20 # The gcc-lib directory of the mingw tree you want to
21 # include with the binary dist.
22 export gcc_lib=f:/mingw/lib/gcc-lib/mingw32/2.95.3-6/
23
24 #
25 # The mingw include, lib, and bin directories.
26 #
27 export mingw_include=f:/mingw/include
28 export mingw_lib=f:/mingw/lib/
29 export mingw_bin=f:/mingw/bin/
30
31 export perl_dir=c:/ghc/ghc-5.04
32 #export mingw_include=c:/ghc/ghc-5.02.2/include/mingw
33
34 # Play safe
35 if ! [ -d bin/i386-unknown-mingw32 ] ; then
36   echo "Doesn't look as if I'm in the toplevel directory of a mingw tree"
37   echo "Usage: cd ghc-<version> ; ../distrib/prep-bin-dist-mingw"
38   exit 1;
39 fi;
40
41 echo "Removing configure script files...not needed"
42 rm -f config.guess config.sub configure configure.in mkdirhier
43 rm -f Makefile-bin.in Makefile.in aclocal.m4 install-sh
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
88 echo "add gcc"
89 cp ${mingw_bin}/gcc.exe .
90
91 echo "copy in perl too"
92 cp ${perl_dir}/perl.exe .
93 cp ${perl_dir}/perl56.dll .
94
95 # For reasons unknown, duplicate copies of misc package files in share/
96 # (leave them be for now.)
97
98 echo "formatting documentation"
99 cp README README.txt
100 mv share doc
101 cp ../ghc/docs/users_guide/users_guide.pdf doc/
102 cp ../hslibs/doc/hslibs.pdf doc/
103 #mkdir doc
104 #mkdir doc/user-guide
105 #cp -Rf html/* doc/user-guide/
106 #cp pdf/set.pdf doc/
107 #rm -rf html/
108 #rm -rf pdf/
109