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