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_lib}" == "x" ]; then
40 if [ "x${gcc_version}" == "x" ]; then
41 # The default (with mingw3)
42 export gcc_lib=$mingw_top/lib/gcc-lib/mingw32/3.2.3
44 export gcc_lib=$mingw_top/lib/gcc-lib/mingw32/${gcc_version}
47 if [ "x${gcc_libexec}" == "x" ]; then
48 if [ "x${gcc_version}" == "x" ]; then
49 # The default (with mingw3)
50 export gcc_libexec=$mingw_top/lib/gcc-lib/mingw32/3.2.3
52 if [ -d $mingw_top/lib/gcc-lib/mingw32/${gcc_version} ]; then
53 export gcc_libexec=$mingw_top/lib/gcc-lib/mingw32/${gcc_version}
54 elif [ -d $mingw_top/libexec/gcc/mingw32/${gcc_version} ]; then
55 export gcc_libexec=$mingw_top/libexec/gcc/mingw32/${gcc_version}
57 echo "WARNING: Unable to determine location of your gcc 'libexec' directory"
58 export gcc_libexec=$mingw_top/lib/gcc-lib/mingw32/${gcc_version}
63 #Directory where a (cygwin-free) perl binary resides.
64 if [ "x${perl_dir}" == "x" ]; then
65 export perl_dir=$old_ghc_top
69 # The mingw include, lib, and bin directories; all derived
72 if [ "x${mingw_include}" == "x" ]; then
73 export mingw_include=$mingw_top/include
75 if [ "x${mingw_lib}" == "x" ]; then
76 export mingw_lib=$mingw_top/lib
78 if [ "x${mingw_bin}" == "x" ]; then
79 export mingw_bin=$mingw_top/bin
82 # Check that we're in an OK place before starting to re-org
83 # the directory tree..
84 if ! [ -d bin/i386-unknown-mingw32 ] ; then
85 echo "Doesn't look as if I'm in the toplevel directory of a mingw tree"
86 echo "Usage: cd ghc-<version> ; ../distrib/prep-bin-dist-mingw"
90 echo "Removing configure script files...not needed"
91 rm -f config.guess config.sub configure configure.ac mkdirhier
92 rm -f Makefile-bin.in Makefile.in aclocal.m4 install-sh
96 mv bin/i386-unknown-mingw32/* bin/
97 rmdir bin/i386-unknown-mingw32
101 mv lib/i386-unknown-mingw32/include/* include/
102 rmdir lib/i386-unknown-mingw32/include
103 mv lib/i386-unknown-mingw32/* .
104 rmdir lib/i386-unknown-mingw32
106 mv ghc-asm.prl ghc-asm
107 mv ghc-split.prl ghc-split
109 echo "create gcc-lib/"
111 # A bunch of stuff gets lumped into gcc-lib:
113 # - the gcc-lib/ + gcc-lib/include of the gcc you
114 # intend to ship (normally located as
115 # lib/gcc-lib/mingw/<gcc version>/ in your mingw tree.)
116 # - the contents of mingw/lib/
117 # - ld.exe, as.exe, dlltool.exe, dllwrap.exe from mingw/bin
119 # - ar.exe from mingw/bin to bin/
122 mkdir gcc-lib/include
123 cp $gcc_lib/* gcc-lib/
124 cp $gcc_libexec/* gcc-lib/
125 cp $gcc_lib/include/* gcc-lib/include/
126 cp $mingw_lib/* gcc-lib/
127 cp $mingw_bin/as.exe gcc-lib/
128 cp $mingw_bin/ld.exe gcc-lib/
129 cp $mingw_bin/ar.exe bin/
130 # Note: later versions of dlltool.exe depend on a bfd helper DLL.
131 cp $mingw_bin/dllwrap.exe gcc-lib/
132 cp $mingw_bin/dlltool.exe gcc-lib/
133 # Remove worthy, but unused tools
134 rm gcc-lib/f771.exe || echo "good - f771.exe not found"
135 rm gcc-lib/gnat1.exe || echo "good - gnat1.exe not found"
136 rm gcc-lib/jc1.exe || echo "good - jc1.exe not found"
137 rm gcc-lib/libgcj* || echo "good - libgcj libs not found"
138 rm gcc-lib/jvgenmain.exe || echo "good - jvgenmain.exe not found"
140 echo "extra header files inside of include/"
142 # contains mingw/include
144 cp -Rf $mingw_include/* include/mingw
146 # g++-3/ subdir causes problems with installer tool (+ being a
147 # troublesome character); leave out for now.
148 #rm -rf include/mingw/g++-3/ || echo "g++-3/ not there"
149 rm -rf include/mingw/c++/ || echo "c++/ not there"
150 rm -rf include/mingw/ddk/ || echo "ddk/ not there"
151 rm -rf include/mingw/gnu/ || echo "gnu/ not there"
152 rm -rf include/mingw/javax/ || echo "javax/ not there"
153 rm -rf include/mingw/java/ || echo "java/ not there"
154 rm -rf include/mingw/gcj/ || echo "gcj/ not there"
157 cp ${mingw_bin}/gcc.exe .
158 #cp ${mingw_bin}/gcc-2.exe gcc.exe
160 echo "copy in perl too"
161 cp ${perl_dir}/perl.exe .
162 cp ${perl_dir}/perl56.dll .
164 # For reasons unknown, duplicate copies of misc package files in share/
165 # (leave them be for now.)
167 echo "formatting documentation"
171 # Leave out pdf users_guide documentation for now; problematic to build with the versions
172 # of 'xsltproc' and 'fop' I've been able to lay my hands on.
173 #cp ../ghc/docs/users_guide/users_guide.pdf doc/ ||
174 # (make -C ../ghc/docs/users_guide/ pdf ; cp ../ghc/docs/users_guide/users_guide.pdf doc/) ||
175 # echo "No User Guide PDF doc found"
176 #cp ../hslibs/doc/hslibs.pdf doc/ ||
177 # (make -C ../hslibs/doc/ pdf ; cp ../hslibs/doc/hslibs.pdf doc/) ||
178 # echo "No HSLIBS PDF doc found"