Index: scripts/cpukit/.cvsignore
===================================================================
--- scripts/cpukit/.cvsignore	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
+++ scripts/cpukit/.cvsignore	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
@@ -0,0 +1,4 @@
+*.spec
+Makefile
+Makefile.in
+rtems.spec
Index: scripts/cpukit/Makefile.am
===================================================================
--- scripts/cpukit/Makefile.am	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
+++ scripts/cpukit/Makefile.am	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
@@ -0,0 +1,66 @@
+##
+## $Id$
+##
+
+
+MKSPEC = $(SHELL) ./mkspec
+
+MKSPEC_DEPS = mkspec rtems-cpukit.spec.in \
+    $(top_builddir)/setup.cache
+
+c4x-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . c4x-rtems > $@
+RPM_SPECS_DATA = c4x-rtems-cpukit.spec
+
+hppa1.1-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . hppa1.1-rtems > $@
+RPM_SPECS_DATA += hppa1.1-rtems-cpukit.spec
+
+h8300-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . h8300-rtems > $@
+RPM_SPECS_DATA += h8300-rtems-cpukit.spec
+
+i386-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . i386-rtems > $@
+RPM_SPECS_DATA += i386-rtems-cpukit.spec
+
+i960-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . i960-rtems > $@
+RPM_SPECS_DATA += i960-rtems-cpukit.spec
+
+m68k-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . m68k-rtems > $@
+RPM_SPECS_DATA += m68k-rtems-cpukit.spec
+
+mips64orion-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . mips64orion-rtems > $@
+RPM_SPECS_DATA += mips64orion-rtems-cpukit.spec
+
+mips-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . mips-rtems > $@
+RPM_SPECS_DATA += mips-rtems-cpukit.spec
+
+powerpc-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . powerpc-rtems > $@
+RPM_SPECS_DATA += powerpc-rtems-cpukit.spec
+
+sh-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . sh-rtems > $@
+RPM_SPECS_DATA += sh-rtems-cpukit.spec
+
+sh-rtemself-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . sh-rtemself > $@
+RPM_SPECS_DATA += sh-rtemself-cpukit.spec
+
+sparc-rtems-cpukit.spec: $(MKSPEC_DEPS)
+	$(MKSPEC) -cfg $(top_builddir)/setup.cache -o . sparc-rtems > $@
+RPM_SPECS_DATA += sparc-rtems-cpukit.spec
+
+TEMPLATES = rtems-cpukit.spec.in
+
+noinst_DATA = $(TEMPLATES)
+
+EXTRA_DIST = $(TEMPLATES)
+
+CLEANFILES = $(RPM_SPECS_DATA)
+include $(top_srcdir)/../automake/local.am
Index: scripts/cpukit/mkspec.in
===================================================================
--- scripts/cpukit/mkspec.in	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
+++ scripts/cpukit/mkspec.in	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
@@ -0,0 +1,57 @@
+#!/bin/sh 
+#
+
+RTEMS_DIR=`dirname $0`/@top_srcdir@
+RTEMS_VERSION=@VERSION@
+RPM_VERSION=`echo ${RTEMS_VERSION} | tr - _`
+
+CFG=../setup.cache
+dst=@RPM_SPECSdir@
+exe_ext=@EXEEXT@
+
+usage()
+{
+  echo "$0 [options] <target_alias>"
+  echo "  options:"
+  echo "    -cfg <setup.cache>"
+  echo "    -o <rpm-spec-dir>"
+  exit 1 ;
+}
+
+while test $# -ge 3; do
+case $1 in
+-cfg) 
+  shift
+  CFG=$1
+  shift
+  ;;
+-o)
+  shift
+  dst=$1
+  shift
+  ;;
+-*)
+  echo "invalid option $1";
+  usage
+  ;;
+esac
+done
+
+if test ! $# -eq 1;
+then
+  echo "Invalid number of arguments" >&2
+  usage >&2
+fi
+
+# target to build for
+target_alias=$1
+
+. ./$CFG
+
+sed -e "s%@Release\@%${rtems_rpm_release}%g" \
+    -e "s%@rtems_version\@%${RTEMS_VERSION}%g" \
+    -e "s%@rpm_version\@%${RPM_VERSION}%g" \
+    -e "s,@rpm_build_root\@,${rpm_build_root},g" \
+    -e "s%@target_alias\@%${target_alias}%g" \
+    -e "s%@exe_ext\@%${exe_ext}%g" \
+< ${RTEMS_DIR}/cpukit/rtems-cpukit.spec.in
Index: scripts/cpukit/rtems-cpukit.spec.in
===================================================================
--- scripts/cpukit/rtems-cpukit.spec.in	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
+++ scripts/cpukit/rtems-cpukit.spec.in	(revision 620c972cf16a22dd3cb92e7ae127e915869df79b)
@@ -0,0 +1,75 @@
+#
+# spec file for package rtems-cpukit
+# 
+# Copyright  (c)  2002 Ralf Corsepius, Ulm, Germany
+#
+# please send bugfixes or comments to joel@OARcorp.com
+#
+
+%define _prefix	/opt/rtems
+
+Vendor:       OAR Corporation
+Distribution: Linux
+Name:         @target_alias@-cpukit
+Release:      @Release@
+License:      Various, Open Source.
+Group:        rtems
+
+Autoreqprov:  on
+Packager:     	corsepiu@faw.uni-ulm.de and joel@OARcorp.com
+BuildPreReq:    @target_alias@-binutils
+BuildPreReq:    @target_alias@-gcc 
+Requires:     	@target_alias@-binutils
+Requires:     	@target_alias@-gcc 
+
+Version:      @rpm_version@
+Summary:      A free operating system for embedded systems
+Source:       rtems-@rtems_version@.tar.gz
+
+#
+# The original sources are not included in the source RPM.
+# If we included them, then the source RPMs for each target
+# would duplicate MBs of source unnecessarily.  This is 
+# a duplication of over 30 MBs of source for each of
+# the more than 10 targets it is possible to build.
+#
+# You can get them yourself from the Internet and copy them to
+# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
+# Or you can try the ftp options of rpm :-)
+#
+NoSource:      0
+# We claim to be relocatible, but in fact we are not
+Prefix:		%{_prefix}
+Buildroot:    %{_tmppath}/%{name}-%{version}-root
+
+%description
+RTEMS is a free operating system for embedded systems.
+
+This package contains the cpukit for cpu @target_alias@.
+
+Authors:
+--------
+    Joel Sherrill (joel@oarcorp.com)
+    ...
+
+%prep
+%setup -c -T -n %{name}-%{version} -a0
+test -d build || mkdir build
+%build
+cd build
+# rtems does not support building inside the source tree
+  ../rtems-@rtems_version@/cpukit/configure \
+  --build=`../rtems-@rtems_version@/config.guess` \
+  --prefix=%{_prefix} \
+  --host=@target_alias@ --target=@target_alias@ \
+  --exec-prefix=%{_prefix}/@target_alias@ \
+  --enable-multilib
+  make RTEMS_BSP=
+%install
+cd build
+  make RTEMS_BSP= DESTDIR=${RPM_BUILD_ROOT} install
+
+%files
+%{_prefix}/@target_alias@
+# ignore
+# %{_mandir}
