3 # Running 'binary-dist' gives us a tree which isn't quite right
4 # for the purposes of creating a mingw/win32 install tree.
5 # This script rejigs that tree. The resulting tree is ready for
6 # packaging up in whatever form convenient (MSI installer / tar bundle/ ..)
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
15 # * - making sure you've initially set BIN_DIST=1 in
19 # (settable via environment variables, e.g.,
20 # mingw_top=<whatever> ../distrib/prep-bin-dist-mingw
23 # - mingw_top -- location of mingw distribution tree
24 # - old_ghc_top -- top of existing GHC binary diste tree
25 # (needed just to copy along perl binary.)
27 # - gcc_version -- what gcc version your mingw tree uses.
30 if [ "x${old_ghc_top}" == "x" ]; then
31 export old_ghc_top=c:/ghc/ghc-6.2.1
33 if [ "x${mingw_top}" == "x" ]; then
34 export mingw_top=c:/mingw3
37 # The gcc-lib directory of the mingw tree you want to
38 # include with the binary dist.
39 if [ "x${gcc_version}" == "x" ]; then
40 # The default (with mingw3)
41 export gcc_lib=$mingw_top/lib/gcc-lib/mingw32/3.2.3
43 export gcc_lib=$mingw_top/lib/gcc-lib/mingw32/${gcc_version}
46 #Directory where a (cygwin-free) perl binary resides.
47 if [ "x${perl_dir}" == "x" ]; then
48 export perl_dir=$old_ghc_top
52 # The mingw include, lib, and bin directories; all derived
55 if [ "x${mingw_include}" == "x" ]; then
56 export mingw_include=$mingw_top/include
58 if [ "x${mingw_lib}" == "x" ]; then
59 export mingw_lib=$mingw_top/lib
61 if [ "x${mingw_bin}" == "x" ]; then
62 export mingw_bin=$mingw_top/bin
65 # Check that we're in an OK place before starting to re-org
66 # the directory tree..
67 if ! [ -d bin/i386-unknown-mingw32 ] ; then
68 echo "Doesn't look as if I'm in the toplevel directory of a mingw tree"
69 echo "Usage: cd ghc-<version> ; ../distrib/prep-bin-dist-mingw"
73 echo "Removing configure script files...not needed"
74 rm -f config.guess config.sub configure configure.ac mkdirhier
75 rm -f Makefile-bin.in Makefile.in aclocal.m4 install-sh
79 mv bin/i386-unknown-mingw32/* bin/
80 rmdir bin/i386-unknown-mingw32
84 mv lib/i386-unknown-mingw32/* .
85 rmdir lib/i386-unknown-mingw32
87 mv ghc-asm.prl ghc-asm
88 mv ghc-split.prl ghc-split
90 echo "create gcc-lib/"
92 # A bunch of stuff gets lumped into gcc-lib:
94 # - the gcc-lib/ + gcc-lib/include of the gcc you
95 # intend to ship (normally located as
96 # lib/gcc-lib/mingw/<gcc version>/ in your mingw tree.)
97 # - the contents of mingw/lib/
98 # - ld.exe, as.exe, dlltool.exe, dllwrap.exe from mingw/bin
100 # - ar.exe from mingw/bin to bin/
103 mkdir gcc-lib/include
104 cp $gcc_lib/* gcc-lib/
105 cp $gcc_lib/include/* gcc-lib/include/
106 cp $mingw_lib/* gcc-lib/
107 cp $mingw_bin/as.exe gcc-lib/
108 cp $mingw_bin/ld.exe gcc-lib/
109 cp $mingw_bin/ar.exe bin/
110 # Note: later versions of dlltool.exe depend on a bfd helper DLL.
111 cp $mingw_bin/dllwrap.exe gcc-lib/
112 cp $mingw_bin/dlltool.exe gcc-lib/
113 rm gcc-lib/f771.exe || echo "good - f771.exe not found"
115 echo "extra header files inside of include/"
117 # contains mingw/include
119 cp -Rf $mingw_include/* include/mingw
121 # g++-3/ subdir causes problems with installer tool (+ being a
122 # troublesome character); leave out for now.
123 #rm -rf include/mingw/g++-3/ || echo "g++-3/ not there"
124 rm -rf include/mingw/c++/ || echo "c++/ not there"
125 rm -rf include/mingw/ddk/ || echo "ddk/ not there"
126 rm -rf include/mingw/gnu/ || echo "gnu/ not there"
127 rm -rf include/mingw/javax/ || echo "javax/ not there"
128 rm -rf include/mingw/java/ || echo "java/ not there"
129 rm -rf include/mingw/gcj/ || echo "gcj/ not there"
132 cp ${mingw_bin}/gcc.exe .
133 #cp ${mingw_bin}/gcc-2.exe gcc.exe
135 echo "copy in perl too"
136 cp ${perl_dir}/perl.exe .
137 cp ${perl_dir}/perl56.dll .
139 # For reasons unknown, duplicate copies of misc package files in share/
140 # (leave them be for now.)
142 echo "formatting documentation"
146 # Leave out pdf users_guide documentation for now; problematic to build with the versions
147 # of 'xsltproc' and 'fop' I've been able to lay my hands on.
148 #cp ../ghc/docs/users_guide/users_guide.pdf doc/ ||
149 # (make -C ../ghc/docs/users_guide/ pdf ; cp ../ghc/docs/users_guide/users_guide.pdf doc/) ||
150 # echo "No User Guide PDF doc found"
151 #cp ../hslibs/doc/hslibs.pdf doc/ ||
152 # (make -C ../hslibs/doc/ pdf ; cp ../hslibs/doc/hslibs.pdf doc/) ||
153 # echo "No HSLIBS PDF doc found"