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 export perl_dir=$old_ghc_top
50 # The mingw include, lib, and bin directories; all derived
53 export mingw_include=$mingw_top/include
54 export mingw_lib=$mingw_top/lib
55 export mingw_bin=$mingw_top/bin
57 # Check that we're in an OK place before starting to re-org
58 # the directory tree..
59 if ! [ -d bin/i386-unknown-mingw32 ] ; then
60 echo "Doesn't look as if I'm in the toplevel directory of a mingw tree"
61 echo "Usage: cd ghc-<version> ; ../distrib/prep-bin-dist-mingw"
65 echo "Removing configure script files...not needed"
66 rm -f config.guess config.sub configure configure.ac mkdirhier
67 rm -f Makefile-bin.in Makefile.in aclocal.m4 install-sh
71 mv bin/i386-unknown-mingw32/* bin/
72 rmdir bin/i386-unknown-mingw32
76 mv lib/i386-unknown-mingw32/* .
77 rmdir lib/i386-unknown-mingw32
79 mv ghc-asm.prl ghc-asm
80 mv ghc-split.prl ghc-split
82 echo "create gcc-lib/"
84 # A bunch of stuff gets lumped into gcc-lib:
86 # - the gcc-lib/ + gcc-lib/include of the gcc you
87 # intend to ship (normally located as
88 # lib/gcc-lib/mingw/<gcc version>/ in your mingw tree.)
89 # - the contents of mingw/lib/
90 # - ld.exe, as.exe, dlltool.exe, dllwrap.exe from mingw/bin
92 # - ar.exe from mingw/bin to bin/
96 cp $gcc_lib/* gcc-lib/
97 cp $gcc_lib/include/* gcc-lib/include/
98 cp $mingw_lib/* gcc-lib/
99 cp $mingw_bin/as.exe gcc-lib/
100 cp $mingw_bin/ld.exe gcc-lib/
101 cp $mingw_bin/ar.exe bin/
102 # Note: later versions of dlltool.exe depend on a bfd helper DLL.
103 cp $mingw_bin/dllwrap.exe gcc-lib/
104 cp $mingw_bin/dlltool.exe gcc-lib/
105 rm gcc-lib/f771.exe || echo "good - f771.exe not found"
107 echo "extra header files inside of include/"
109 # contains mingw/include
111 cp -Rf $mingw_include/* include/mingw
113 # g++-3/ subdir causes problems with installer tool (+ being a
114 # troublesome character); leave out for now.
115 #rm -rf include/mingw/g++-3/ || echo "g++-3/ not there"
116 rm -rf include/mingw/c++/ || echo "c++/ not there"
119 cp ${mingw_bin}/gcc.exe .
120 #cp ${mingw_bin}/gcc-2.exe gcc.exe
122 echo "copy in perl too"
123 cp ${perl_dir}/perl.exe .
124 cp ${perl_dir}/perl56.dll .
126 # For reasons unknown, duplicate copies of misc package files in share/
127 # (leave them be for now.)
129 echo "formatting documentation"
132 cp ../ghc/docs/users_guide/users_guide.pdf doc/ ||
133 (make -C ../ghc/docs/users_guide/ pdf ; cp ../ghc/docs/users_guide/users_guide.pdf doc/) ||
134 echo "No User Guide PDF doc found"
135 cp ../hslibs/doc/hslibs.pdf doc/ ||
136 (make -C ../hslibs/doc/ pdf ; cp ../hslibs/doc/hslibs.pdf doc/) ||
137 echo "No HSLIBS PDF doc found"