Index: contrib/cygwin/ChangeLog
===================================================================
--- contrib/cygwin/ChangeLog	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/ChangeLog	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,8 @@
+2001-08-31	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* Makefile.am, .cvsignore, configure.in, i386-cygwin-binutils.spec.in,
+	i386-cygwin-gcc.spec.in, i386-cygwin-libs.spec.in,
+	i386-cygwin-w32api.spec.in, i386-cygwin-mingw.spec.in, setup, setup.def:
+	New files that support building RPMs for Linux hosted cross compilers
+	targeting Cygwin.
+	
Index: contrib/cygwin/Makefile.am
===================================================================
--- contrib/cygwin/Makefile.am	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/Makefile.am	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,24 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+RPM_SPECS_DATA = \
+    i386-cygwin-binutils.spec \
+    i386-cygwin-libs.spec \
+    i386-cygwin-mingw.spec \
+    i386-cygwin-w32api.spec \
+    i386-cygwin-gcc.spec
+
+CONFIGURE_DEPENDENCIES = setup.cache
+setup.cache: setup.def
+	cp setup.def $@
+
+DISTCLEANFILES = setup.cache
+
+noinst_SCRIPTS = setup
+noinst_DATA = setup.def
+
+EXTRA_DIST = $(noinst_SCRIPTS) $(noinst_DATA) .cvsignore
+
Index: contrib/cygwin/configure.in
===================================================================
--- contrib/cygwin/configure.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/configure.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,78 @@
+## $Id$
+
+AC_INIT(setup)
+
+AM_INIT_AUTOMAKE(cygwin-rpmsscripts,20010426,no)
+
+test -f ./setup.cache || cp ${srcdir}/setup.def ./setup.cache
+. ./setup.cache
+
+# Some linux distributions use /usr/src/packages
+# redhat uses /usr/src/redhat
+# others might use /usr/src
+AC_MSG_CHECKING(for rpm SPECS directory)
+if test -d /usr/src/packages/SPECS;
+then
+  RPM_SPECSdir=/usr/src/packages/SPECS;
+elif test -d /usr/src/redhat/SPECS;
+then
+  RPM_SPECSdir=/usr/src/redhat/SPECS;
+elif test -d /usr/src/SPECS;
+then
+  RPM_SPECSdir=/usr/src/SPECS;
+elif test -d /usr/local/src/redhat/SPECS;
+then
+  RPM_SPECSdir=/usr/local/src/redhat/SPECS;
+fi
+if test x"$RPM_SPECSdir" = x"" ; then
+AC_MSG_ERROR(not found)
+fi
+AC_MSG_RESULT($RPM_SPECSdir)
+AC_SUBST(RPM_SPECSdir)
+
+BINUTILS_VERS="${binutils_version}"
+AC_SUBST(BINUTILS_VERS)
+BINUTILS_RPMVERS=`echo ${binutils_version} | tr '-' '_'`
+AC_SUBST(BINUTILS_RPMVERS)
+BINUTILS_RPMREL="${binutils_rpm_release}"
+AC_SUBST(BINUTILS_RPMREL)
+
+MINGW_VERS="${mingw_version}"
+AC_SUBST(MINGW_VERS)
+MINGW_RPMVERS=`echo ${mingw_version} | tr '-' '_'`
+AC_SUBST(MINGW_RPMVERS)
+MINGW_RPMREL="${mingw_rpm_release}"
+AC_SUBST(MINGW_RPMREL)
+
+W32API_VERS="${w32api_version}"
+AC_SUBST(W32API_VERS)
+W32API_RPMVERS=`echo ${w32api_version} | tr '-' '_'`
+AC_SUBST(W32API_RPMVERS)
+W32API_RPMREL="${w32api_rpm_release}"
+AC_SUBST(W32API_RPMREL)
+
+CYGWIN_VERS="${cygwin_version}"
+AC_SUBST(CYGWIN_VERS)
+CYGWIN_RPMVERS=`echo ${cygwin_version} | tr '-' '_'`
+AC_SUBST(CYGWIN_RPMVERS)
+CYGWIN_RPMREL="${cygwin_rpm_release}"
+AC_SUBST(CYGWIN_RPMREL)
+
+GCC_VERS="${gcc_version}"
+AC_SUBST(GCC_VERS)
+GCC_RPMVERS=`echo ${gcc_version} | tr '-' '_'`
+AC_SUBST(GCC_RPMVERS)
+GCC_RPMREL="${gcc_rpm_release}"
+AC_SUBST(GCC_RPMREL)
+
+RPM_BUILD_ROOT="$rpm_build_root/%{name}-root"
+AC_SUBST(RPM_BUILD_ROOT)
+
+AC_OUTPUT(
+Makefile
+i386-cygwin-binutils.spec
+i386-cygwin-libs.spec
+i386-cygwin-w32api.spec
+i386-cygwin-gcc.spec
+i386-cygwin-mingw.spec
+)
Index: contrib/cygwin/i386-cygwin-binutils.spec.in
===================================================================
--- contrib/cygwin/i386-cygwin-binutils.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/i386-cygwin-binutils.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,86 @@
+#
+# spec file for binutils package targetting cygwin
+# 
+
+%define binutils_version @BINUTILS_VERS@
+%define binutils_rpmvers @BINUTILS_RPMVERS@
+
+Vendor:       OAR Corporation
+Distribution: Linux
+Name:         i386-cygwin-binutils
+Summary:      binutils for target i386-cygwin
+Group:        cygwin
+Release:      @BINUTILS_RPMREL@
+Summary:      binutils for i386-cygwin
+License:      GPL/LGPL
+Autoreqprov:  	off
+Packager:     	corsepiu@faw.uni-ulm.de
+Prefix:		/opt/cygwin
+BuildRoot:	@RPM_BUILD_ROOT@
+
+Version:      	%binutils_rpmvers
+Source0:	ftp://sourceware.cygnus.com/pub/cygwin/latest/binutils/binutils-%{binutils_version}-src.tar.gz
+NoSource: 	0
+%description
+
+Cross binutils for target cygwin
+
+%prep
+# untar the sources inside i386-cygwin-binutils
+%setup -c -n i386-cygwin-binutils -a 0
+
+%build
+  test -d build || mkdir build
+  cd build
+  ../binutils-%{binutils_version}/configure --target=i386-cygwin \
+    --disable-nls --disable-win32-registry \
+    --verbose --prefix=%{prefix}
+
+  make all
+
+%install
+  cd build
+  make prefix=$RPM_BUILD_ROOT%{prefix} install
+
+# A bug in binutils: binutils does not install share/locale
+# however it uses it
+  ../binutils-%{binutils_version}/mkinstalldirs \
+    $RPM_BUILD_ROOT%{prefix}/share/locale
+
+# We don't want info files
+  rm -rf $RPM_BUILD_ROOT%{prefix}/info
+
+# c++filt now comes from gcc
+  rm -f $RPM_BUILD_ROOT%{prefix}/bin/i386-cygwin-c++filt
+
+%clean
+# let rpm --clean remove BuildRoot iff using the default BuildRoot
+  test "$RPM_BUILD_ROOT" = "@RPM_BUILD_ROOT@" && \
+    rm -rf $RPM_BUILD_ROOT
+
+%files
+
+%dir %{prefix}/man
+%dir %{prefix}/man/man1
+%doc %{prefix}/man/man1/i386-cygwin-*.1*
+
+%dir %{prefix}/include
+%{prefix}/include/*.h
+
+%dir %{prefix}/lib
+%{prefix}/lib/libbfd*
+%{prefix}/lib/libiberty*
+%{prefix}/lib/libopcodes*
+
+%dir %{prefix}/share
+%dir %{prefix}/share/locale
+
+%dir %{prefix}/bin
+%{prefix}/bin/*
+
+%dir %{prefix}/i386-cygwin
+%dir %{prefix}/i386-cygwin/bin
+%{prefix}/i386-cygwin/bin/*
+
+%dir %{prefix}/i386-cygwin/lib
+%{prefix}/i386-cygwin/lib/ldscripts
Index: contrib/cygwin/i386-cygwin-gcc.spec.in
===================================================================
--- contrib/cygwin/i386-cygwin-gcc.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/i386-cygwin-gcc.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,99 @@
+#
+# spec file for building gcc for cygwin
+# 
+
+%define gcc_version @GCC_VERS@
+%define gcc_rpmvers @GCC_RPMVERS@
+
+Vendor:       	OAR Corporation
+Distribution: 	Linux
+Name:         	i386-cygwin-gcc
+Summary:      	i386-cygwin gcc.
+Requires: 	i386-cygwin-binutils
+Requires:	i386-cygwin-libs
+Group:	      	cygwin
+Release:      	@GCC_RPMREL@
+License:      	gcc is GPL/LGPL
+Prefix:	      	/opt/cygwin
+Autoreqprov:  	on
+Packager:     	corsepiu@faw.uni-ulm.de
+Version:        %gcc_rpmvers
+
+Source0: 	ftp://sourceware.cygnus.com/pub/cygwin/latest/gcc/gcc-%{gcc_version}-src.tar.gz
+NoSource:	0
+
+BuildRoot:	@RPM_BUILD_ROOT@
+
+%description
+Cross gcc for target cygwin
+
+%prep
+# untar the sources inside i386-cygwin-gcc
+%setup -c -n %{name} -a 0 
+
+  test -d build || mkdir build
+
+%build
+  cd build
+
+  ../gcc-%{gcc_version}/configure --target=i386-cygwin \
+    --with-gnu-as --with-gnu-ld --verbose \
+    --disable-nls --disable-win32-registry \
+    --with-newlib --enable-languages=c,c++ \
+    --prefix=%{prefix} 
+
+  make all
+# We don't want info files
+#  make info
+
+%install
+  cd build
+  # Bug in gcc-2.95.1: It doesn't build this installation directory
+  # If it doesn't find it, gcc doesn't install i386-cygwin/bin/gcc
+  ../gcc-%{gcc_version}/mkinstalldirs \
+    $RPM_BUILD_ROOT%{prefix}/i386-cygwin/bin
+
+  make prefix=$RPM_BUILD_ROOT%{prefix} install
+  # cd back to build/
+  cd ../..
+
+  # We don't want info files
+  rm -rf $RPM_BUILD_ROOT%{prefix}/info
+
+  # libiberty comes from cygwin-libs
+  rm -f $RPM_BUILD_ROOT%{prefix}/i386-cygwin/lib/libiberty.a
+
+%clean
+# let rpm --clean remove BuildRoot iff using the default BuildRoot
+  test "$RPM_BUILD_ROOT" = "@RPM_BUILD_ROOT@" && \
+    rm -rf $RPM_BUILD_ROOT
+
+%files
+
+%dir %{prefix}/bin
+%{prefix}/bin/cpp
+%{prefix}/bin/gcov
+
+%dir %{prefix}/man
+%dir %{prefix}/man/man1
+%doc %{prefix}/man/man1/cccp.1*
+%doc %{prefix}/man/man1/i386-cygwin-gcc.1*
+%doc %{prefix}/man/man1/i386-cygwin-g++.1*
+
+%dir %{prefix}/include
+
+%{prefix}/include/g++-3
+%{prefix}/bin/i386-cygwin-c++
+%{prefix}/bin/i386-cygwin-c++filt
+%{prefix}/bin/i386-cygwin-g++
+%{prefix}/bin/i386-cygwin-gcc
+%{prefix}/bin/i386-cygwin-protoize
+%{prefix}/bin/i386-cygwin-unprotoize
+
+# %dir %{prefix}/lib/gcc-lib/i386-cygwin/%{gcc_version}/include
+
+%{prefix}/i386-cygwin
+%dir %{prefix}/lib
+%dir %{prefix}/lib/gcc-lib
+%dir %{prefix}/lib/gcc-lib/i386-cygwin
+%{prefix}/lib/gcc-lib/i386-cygwin/gcc-%{gcc_version}
Index: contrib/cygwin/i386-cygwin-libs.spec.in
===================================================================
--- contrib/cygwin/i386-cygwin-libs.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/i386-cygwin-libs.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,49 @@
+#
+# spec file for package i386-cygwin-libs
+# 
+
+%define cygwin_version @CYGWIN_VERS@
+%define cygwin_rpmvers @CYGWIN_RPMVERS@
+
+Vendor:       Ralf Corsepius
+Distribution: Linux
+Name:         i386-cygwin-libs
+Release:      @CYGWIN_RPMREL@
+Copyright:    Red Hat Inc.
+Group:        Development/Libraries
+Provides:     i386-cygwin-libs
+
+Autoreqprov:  	off
+Packager:     	corsepiu@faw.uni-ulm.de
+Prefix:		/opt/cygwin
+BuildRoot:	@RPM_BUILD_ROOT@
+
+Version:      	%cygwin_rpmvers
+Summary:      	cygwin
+
+Source0:	ftp://sourceware.cygnus.com/pub/cygwin/latest/cygwin/cygwin-%{cygwin_version}.tar.gz
+NoSource:	0
+
+%description
+Cygwin libs
+
+%prep
+%setup -c
+
+%build
+  rm -rf usr/bin
+  rm -rf usr/info
+  mv usr i386-cygwin
+
+%install
+  mkdir -p $RPM_BUILD_ROOT%{prefix}
+  cp -a i386-cygwin $RPM_BUILD_ROOT%{prefix}
+
+%clean
+# let rpm --clean remove BuildRoot iff using the default BuildRoot
+  test "$RPM_BUILD_ROOT" = "@RPM_BUILD_ROOT@" && \
+    rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%{prefix}/i386-cygwin
Index: contrib/cygwin/i386-cygwin-mingw.spec.in
===================================================================
--- contrib/cygwin/i386-cygwin-mingw.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/i386-cygwin-mingw.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,47 @@
+#
+# spec file for package i386-cygwin-mingw
+# 
+
+%define mingw_version @MINGW_VERS@
+%define mingw_rpmvers @MINGW_RPMVERS@
+
+Vendor:       Ralf Corsepius
+Distribution: Linux
+Name:         i386-cygwin-mingw
+Release:      @MINGW_RPMREL@
+Copyright:    Red Hat Inc.
+Group:        Development/Libraries
+Provides:     i386-cygwin-mingw
+
+Autoreqprov:  	off
+Packager:     	corsepiu@faw.uni-ulm.de
+Prefix:		/opt/cygwin
+BuildRoot:	@RPM_BUILD_ROOT@
+
+Version:      	%mingw_rpmvers
+Summary:      	Cygwin's mingw libs
+
+Source0:	ftp://sourceware.cygnus.com/pub/cygwin/latest/mingw/mingw-%{mingw_version}.tar.gz
+NoSource:	0
+
+%description
+Cygwin's mingw libs
+
+%prep
+%setup -c
+
+%build
+  rm -r usr/bin
+  mv usr i386-cygwin
+
+%install
+  mkdir -p $RPM_BUILD_ROOT%{prefix}
+  cp -a i386-cygwin $RPM_BUILD_ROOT%{prefix}
+
+%clean
+# let rpm --clean remove BuildRoot iff using the default BuildRoot
+  test "$RPM_BUILD_ROOT" = "@RPM_BUILD_ROOT@" && \
+    rm -rf $RPM_BUILD_ROOT
+
+%files
+%{prefix}/i386-cygwin
Index: contrib/cygwin/i386-cygwin-w32api.spec.in
===================================================================
--- contrib/cygwin/i386-cygwin-w32api.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/i386-cygwin-w32api.spec.in	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,47 @@
+#
+# spec file for package i386-cygwin-w32api
+# 
+
+%define w32api_version @W32API_VERS@
+%define w32api_rpmvers @W32API_RPMVERS@
+
+Vendor:       Ralf Corsepius
+Distribution: Linux
+Name:         i386-cygwin-w32api
+Release:      @W32API_RPMREL@
+Copyright:    Red Hat Inc.
+Group:        Development/Libraries
+Provides:     i386-cygwin-w32api
+
+Autoreqprov:  	off
+Packager:     	corsepiu@faw.uni-ulm.de
+Prefix:		/opt/cygwin
+BuildRoot:	@RPM_BUILD_ROOT@
+
+Version:        %w32api_rpmvers
+Summary:      	Cygwin's w32api libs
+Source0:	ftp://sourceware.cygnus.com/pub/cygwin/latest/w32api/w32api-%{w32api_version}.tar.gz
+
+NoSource:	0
+
+%description
+Cygwin's w32api libs
+
+%prep
+%setup -c
+
+%build
+  rm -rf usr/bin
+  mv usr i386-cygwin
+
+%install
+  mkdir -p $RPM_BUILD_ROOT%{prefix}
+  cp -a i386-cygwin $RPM_BUILD_ROOT%{prefix}
+
+%clean
+# let rpm --clean remove BuildRoot iff using the default BuildRoot
+  test "$RPM_BUILD_ROOT" = "@RPM_BUILD_ROOT@" && \
+    rm -rf $RPM_BUILD_ROOT
+
+%files
+%{prefix}/i386-cygwin
Index: contrib/cygwin/setup
===================================================================
--- contrib/cygwin/setup	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/setup	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,111 @@
+#!/bin/bash
+
+CFG=setup.cache
+
+# RTEMS tools setup
+
+if test ! -f ./$CFG;
+then
+ echo -n "restoring default setup.cache .." 
+ cp ./setup.def ./$CFG
+ echo " done"
+fi
+
+echo -n "loading setup from ./$CFG .."
+. ./$CFG
+echo " done"
+echo
+
+menu_setup()
+{
+while true;
+do
+  echo
+  echo "       Source packages setup"
+  echo
+  echo "0 binutils version        : $binutils_version"
+  echo "1 binutils rpm release    : $binutils_rpm_release"
+  echo "2 cygwin version          : $cygwin_version"
+  echo "3 cygwin rpm release      : $cygwin_rpm_release"
+  echo "4 mingw version           : $mingw_version"
+  echo "5 mingw rpm release       : $mingw_rpm_release"
+  echo "6 w32api version          : $w32api_version"
+  echo "7 w32api rpm release      : $w32api_rpm_release"
+  echo "8 gcc version             : $gcc_version"
+  echo "9 gcc rpm release         : $gcc_rpm_release"
+  echo "a rpm build root          : $rpm_build_root"
+  echo
+
+  echo -n "[0-9a] or any other key to quit >"
+  read sel
+  case $sel in
+  0) echo -n "BINUTILS source >"
+     read binutils_version ;;
+  1) echo -n "BINUTILS rpm release >"
+     read binutils_rpm_release ;;
+  2) echo -n "CYGWIN source >"
+     read cygwin_version ;;
+  3) echo -n "CYGWIN rpm release >"
+     read cygwin_rpm_release ;;
+  4) echo -n "MINGW source >"
+     read mingw_version ;;
+  5) echo -n "MINGW rpm release >"
+     read mingw_rpm_release ;;
+  6) echo -n "W32API source >"
+     read w32api_version ;;
+  7) echo -n "W32API rpm release >"
+     read w32api_rpm_release ;;
+  8) echo -n "GCC source >"
+     read gcc_version ;;
+  9) echo -n "GCC RPM release >"
+     read gcc_rpm_release ;;
+  a) echo -n "RPM build root >"
+     read rpm_build_root ;;
+  *) 
+     return 0 ;;
+  esac
+done
+}
+
+
+save_setup()
+{
+echo -n "saving setup to $CFG .."
+
+echo "# RTEMS tools setup" > $CFG
+
+echo "binutils_version=$binutils_version" >> $CFG
+echo "binutils_patch_version=$binutils_patch_version" >> $CFG
+echo "binutils_rpm_release=$binutils_rpm_release" >> $CFG
+
+echo "mingw_version=$mingw_version" >> $CFG
+echo "mingw_patch_version=$mingw_patch_version" >> $CFG
+echo "mingw_rpm_release=$mingw_rpm_release" >> $CFG
+
+echo "cygwin_version=$cygwin_version" >> $CFG
+echo "cygwin_patch_version=$cygwin_patch_version" >> $CFG
+echo "cygwin_rpm_release=$cygwin_rpm_release" >> $CFG
+
+echo "w32api_version=$w32api_version" >> $CFG
+echo "w32api_patch_version=$w32api_patch_version" >> $CFG
+echo "w32api_rpm_release=$w32api_rpm_release" >> $CFG
+
+echo "gcc_version=$gcc_version" >> $CFG
+echo "gcc_patch_version=$gcc_patch_version" >> $CFG
+echo "gcc_rpm_release=$gcc_rpm_release" >> $CFG
+
+echo "rpm_build_root=$rpm_build_root" >> $CFG
+
+echo " done"
+test -f Makefile || ./configure
+}
+
+menu_setup
+
+echo
+echo -n "Save setup [y|n] >"
+read sel
+case $sel in
+''|y*|Y*) save_setup ;;
+*) ;;
+esac
Index: contrib/cygwin/setup.def
===================================================================
--- contrib/cygwin/setup.def	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
+++ contrib/cygwin/setup.def	(revision 93688eba9ad2dbf655a5a98da1ff45dffb0aa782)
@@ -0,0 +1,16 @@
+#
+# Cygwin cross tools setup
+#
+# $Id$
+#
+binutils_version=20001221-1
+binutils_rpm_release=1
+mingw_version=20010130-1
+mingw_rpm_release=1
+w32api_version=20010130-1
+w32api_rpm_release=1
+cygwin_version=1.1.8-2
+cygwin_rpm_release=1
+gcc_version=2.95.2-9
+gcc_rpm_release=1
+rpm_build_root=/var/tmp
