Name:		mingw
Version:	1.0
Release:	1%{?dist}
Summary:	MinGW environment on Linux

%define cross_tool_ver x86-mingw32-build.sh-0.0-20061107-1

# Can't allow strip to remove the archive indices
%define __strip /bin/true 

Group:		Development/Libraries
License:	Distributable
URL:		http://sourceforge.net/projects/mingw/
Source0:	%{cross_tool_ver}.tar.bz2
Source1:        binutils-2.17.50-20070129-1-src.tar.gz
Source2:        gcc-ada-3.4.5-20060117-1-src.tar.gz
Source3:        gcc-core-3.4.5-20060117-1-src.tar.gz
Source4:        gcc-g++-3.4.5-20060117-1-src.tar.gz
Source5:        gcc-g77-3.4.5-20060117-1-src.tar.gz
Source6:        gcc-java-3.4.5-20060117-1-src.tar.gz
Source7:        gcc-objc-3.4.5-20060117-1-src.tar.gz
Source8:        mingw-runtime-3.12-src.tar.gz
Source9:        w32api-3.9-src.tar.gz


BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	perl
#Requires:	

%description
MinGW is a set of include files and import libraries that allow one to use GCC to build
native Windows applications that use vendor-supplied runtime.

%prep
%setup -q -n %{cross_tool_ver}

perl -pi -e  "s(assume WORKING_DIR.+)(assume WORKING_DIR ${RPM_BUILD_DIR}/mingw-3.4.5)" x86-mingw32-build.sh.conf
perl -pi -e  "s(assume PACKAGE_DIR.+)(assume PACKAGE_DIR ${RPM_SOURCE_DIR})" x86-mingw32-build.sh.conf                          
perl -pi -e  "s(assume INSTALL_DIR.+)(assume INSTALL_DIR ${RPM_BUILD_ROOT}/opt/mingw)" x86-mingw32-build.sh.conf

%build
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
sh ./x86-mingw32-build.sh --no-download --use-latest-versions --unattended

%install
# no op

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc x86-mingw32-build.sh.log
/opt/mingw


%changelog
