+# * - making sure you've initially set BIN_DIST=1 in
+# your build.mk ...
+#
+# User tweakables
+# (settable via environment variables, e.g.,
+# mingw_top=<whatever> ../distrib/prep-bin-dist-mingw
+# )
+#
+# - mingw_top -- location of mingw distribution tree
+# - old_ghc_top -- top of existing GHC binary diste tree
+# (needed just to copy along perl binary.)
+#
+# - gcc_version -- what gcc version your mingw tree uses.
+#
+#
+if [ "x${old_ghc_top}" == "x" ]; then
+ export old_ghc_top=c:/ghc/ghc-6.2.1
+fi
+if [ "x${mingw_top}" == "x" ]; then
+ export mingw_top=c:/mingw3
+fi
+
+# The gcc-lib directory of the mingw tree you want to
+# include with the binary dist.
+if [ "x${gcc_version}" == "x" ]; then
+ # The default (with mingw3)
+ export gcc_lib=$mingw_top/lib/gcc-lib/mingw32/3.2.3
+else
+ export gcc_lib=$mingw_top/lib/gcc-lib/mingw32/${gcc_version}
+fi
+
+#Directory where a (cygwin-free) perl binary resides.
+export perl_dir=$old_ghc_top
+
+#
+# The mingw include, lib, and bin directories; all derived
+# from ${mingw_top}.
+#
+export mingw_include=$mingw_top/include
+export mingw_lib=$mingw_top/lib
+export mingw_bin=$mingw_top/bin
+
+# Check that we're in an OK place before starting to re-org
+# the directory tree..
+if ! [ -d bin/i386-unknown-mingw32 ] ; then
+ echo "Doesn't look as if I'm in the toplevel directory of a mingw tree"
+ echo "Usage: cd ghc-<version> ; ../distrib/prep-bin-dist-mingw"
+ exit 1;
+fi;