#!/bin/sh

# Builds the gcc-mingw-w64-bootstrap package, required to build
# mingw-w64. This script is intended to be run from the directory
# in which you extracted the source (ie. not run within the debian
# directory but from the debian directory's parent).
#
# By default this will use dpkg-buildpackage but you can specify an
# alternate build command on the command line:
#	./debian/bootstrap pdebuild
# After the build the environment is restored to produce the full
# build.

# Clean up (required to make sure we don't have anything left over
# from the full build).
fakeroot debian/rules clean

# Set the links up.
ln -sf control.bootstrap debian/control
ln -sf rules.bootstrap debian/rules.variant

# Build.
if [ -z "$1" ]; then
    dpkg-buildpackage
else
    $*
fi

# Clean up...
fakeroot debian/rules clean
ln -sf control.full debian/control
ln -sf rules.full debian/rules.variant
