Index: scripts/ChangeLog
===================================================================
--- scripts/ChangeLog	(revision a923a82d2d63b29165b249bae6ad46bb045290b2)
+++ scripts/ChangeLog	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -1,2 +1,13 @@
+2002-06-15	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* mkgcc3newlibspec.in: Remove SETUP (bogus).
+	* gcc3newlib/target-c++.add: New.
+	* gcc3newlib/Makefile.am: Add target-c++.add.
+	* gcc3newlib/base-g77.add: Adapt to gcc-3.1.
+	Reflect having split out c++. Various minor fixes.
+	* gcc3newlib/base-gcc.add: Ditto.
+	* gcc3newlib/gccnewlib.add: Ditto.
+	* gcc3newlib/target-gcc.add: Ditto.
+
 2002-04-20	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: scripts/gcc3newlib/Makefile.am
===================================================================
--- scripts/gcc3newlib/Makefile.am	(revision a923a82d2d63b29165b249bae6ad46bb045290b2)
+++ scripts/gcc3newlib/Makefile.am	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -9,5 +9,6 @@
     base-g77.add target-g77.add \
     base-gcj.add target-gcj.add \
-    target-objc.add
+    target-objc.add \
+    target-c++.add
 
 gccnewlib.spec.in: $(SUBPACKAGES)
@@ -16,5 +17,6 @@
 CLEANFILES = gccnewlib.spec.in
 
-gccnewlib_c_only.spec.in: gccnewlib.add base-gcc.add target-gcc.add
+gccnewlib_c_only.spec.in: gccnewlib.add base-gcc.add target-gcc.add \
+	target-c++.add
 	cat $^ \
 	| sed -e "s%@GCCLANGS@%\'--enable-languages=c,c++\'%g" > $@
Index: scripts/gcc3newlib/base-g77.add
===================================================================
--- scripts/gcc3newlib/base-g77.add	(revision a923a82d2d63b29165b249bae6ad46bb045290b2)
+++ scripts/gcc3newlib/base-g77.add	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -19,5 +19,5 @@
 %dir %{_prefix}/man
 %dir %{_prefix}/man/man1
-%doc %{_prefix}/man/man1/@target_alias@-g77.1
+%doc %{_prefix}/man/man1/@target_alias@-g77.1*
 
 %post -n rtems-base-g77
Index: scripts/gcc3newlib/base-gcc.add
===================================================================
--- scripts/gcc3newlib/base-gcc.add	(revision a923a82d2d63b29165b249bae6ad46bb045290b2)
+++ scripts/gcc3newlib/base-gcc.add	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -21,20 +21,14 @@
 %doc %{_prefix}/info/libm.info*.gz
 
-%dir %{_prefix}/bin
-%{_prefix}/bin/gcov@exe_ext@
-%{_prefix}/bin/gccbug@exe_ext@
-
 %dir %{_prefix}/man
 %dir %{_prefix}/man/man1
-%doc %{_prefix}/man/man1/cpp.1
-%doc %{_prefix}/man/man1/gcov.1
-# %doc %{_prefix}/man/man1/cccp.1
+%doc %{_prefix}/man/man1/cpp.1*
+%doc %{_prefix}/man/man1/gcov.1*
 %dir %{_prefix}/man/man7
-%doc %{_prefix}/man/man7/fsf-funding.7
-%doc %{_prefix}/man/man7/gfdl.7
-%doc %{_prefix}/man/man7/gpl.7
+%doc %{_prefix}/man/man7/fsf-funding.7*
+%doc %{_prefix}/man/man7/gfdl.7*
+%doc %{_prefix}/man/man7/gpl.7*
 
 %dir %{_prefix}/include
-%{_prefix}/include/g++-v3
 
 %post -n rtems-base-gcc
Index: scripts/gcc3newlib/gccnewlib.add
===================================================================
--- scripts/gcc3newlib/gccnewlib.add	(revision a923a82d2d63b29165b249bae6ad46bb045290b2)
+++ scripts/gcc3newlib/gccnewlib.add	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -61,5 +61,5 @@
 %prep
 # untar the sources inside @target_alias@-gcc-newlib
-%setup -c -n %{name} @SETUP@
+%setup -c -T -n %{name} -a0 -a1
 
 @PATCH2@
@@ -67,5 +67,8 @@
 
   # Fix timestamps
-  gcc-@gcc_version@/contrib/gcc_update --touch
+  cd gcc-@gcc_version@
+    contrib/gcc_update --touch
+  cd ..
+
   # Copy the C library into gcc's source tree
   ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@
@@ -82,6 +85,7 @@
   ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
     --with-gnu-as --with-gnu-ld --with-newlib --verbose \
+    --with-system-zlib --disable-nls \
+    --enable-version-specific-runtime-libs \
     --enable-threads=rtems --prefix=%{_prefix} @GCCLANGS@
-
   make all
   make info
@@ -94,17 +98,16 @@
 #    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
 #
-  
+
   make prefix=$RPM_BUILD_ROOT%{_prefix} install
   cd @target_alias@/newlib
   make prefix=$RPM_BUILD_ROOT%{_prefix} install-info
+  # cd back to build/
+  cd ../..
 
   # Bug in gcc-3.0.x: It puts the build dirs into *.la files
   files=`find ${RPM_BUILD_ROOT}%{_prefix}/@target_alias@/lib -name '*.la'`
-  for i in $files; do
+  test -n "$files" && for i in $files; do
     rm -f $i
   done
-
-  # cd back to build/
-  cd ../..
 
   # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
@@ -127,6 +130,17 @@
 
   # Collect multilib subdirectories
+  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
+
   TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
-  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
+  for i in $f; do
+    case $i in
+    \.) echo "%dir ${TGTDIR}" >> dirs
+      ;;
+    *)  echo "%dir ${TGTDIR}/$i" >> dirs
+      ;;
+    esac
+  done
+
+  TGTDIR="%{_prefix}/@target_alias@/lib"
   for i in $f; do
     case $i in
@@ -143,15 +157,32 @@
   cp dirs files.objc
   cp dirs files.gcj
+  cp dirs files.g++
 
+  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
   f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
   for i in $f; do
     case $i in
+    *lib*.la);; # ignore: gcc produces bogus libtool libs
     *f771) ;;
     *cc1obj) ;;
     *libobjc*) echo "$i" >> files.objc ;;
     *include/objc*) ;;
+    *include/g++*);;
     *jc1) ;;
     *jvgenmain) ;;
+    *libstdc++.a) echo "$i" >> files.g++ ;;
+    *libsupc++.a) echo "$i" >> files.g++ ;;
     *) echo "$i" >> files.gcc ;;
+    esac
+  done
+
+  TGTDIR="%{_prefix}/@target_alias@/lib"
+  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
+  for i in $f; do
+    case $i in
+    *lib*.la);; # ignore - gcc produces bogus libtool libs
+    *libiberty.a) ;; # ignore - GPL'ed
+# all other files belong to gcc
+    *) echo "$i" >> files.gcc ;; 
     esac
   done
@@ -161,3 +192,2 @@
   test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \
     rm -rf $RPM_BUILD_ROOT
-
Index: scripts/gcc3newlib/target-c++.add
===================================================================
--- scripts/gcc3newlib/target-c++.add	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
+++ scripts/gcc3newlib/target-c++.add	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -0,0 +1,25 @@
+# ==============================================================
+# @target_alias@-c++
+# ==============================================================
+%package -n @target_alias@-c++
+Provides:	@target_alias@-c++
+Summary:      gcc/g++ compiler (c++) for @target_alias@
+Group: rtems
+Requires: rtems-base-gcc @target_alias@-gcc
+
+%description -n @target_alias@-c++
+RTEMS is an open source operating system for embedded systems.
+
+This is the gcc/g++ compiler for @target_alias@
+
+%files -n @target_alias@-c++ -f build/files.g++
+%doc %{_prefix}/man/man1/@target_alias@-g++.1*
+
+%dir %{_prefix}/bin
+%{_prefix}/bin/@target_alias@-c++@exe_ext@
+%{_prefix}/bin/@target_alias@-g++@exe_ext@
+%{_prefix}/bin/@target_alias@-c++filt@exe_ext@
+
+%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/cc1plus@exe_ext@
+%dir %{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/include
+%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/include/g++
Index: scripts/gcc3newlib/target-gcc.add
===================================================================
--- scripts/gcc3newlib/target-gcc.add	(revision a923a82d2d63b29165b249bae6ad46bb045290b2)
+++ scripts/gcc3newlib/target-gcc.add	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -14,17 +14,11 @@
 
 %files -n @target_alias@-gcc -f build/files.gcc
-%doc %{_prefix}/man/man1/@target_alias@-gcc.1
-%doc %{_prefix}/man/man1/@target_alias@-g++.1
+%doc %{_prefix}/man/man1/@target_alias@-gcc.1*
 
 %{_prefix}/bin/@target_alias@-cpp@exe_ext@
-%{_prefix}/bin/@target_alias@-c++@exe_ext@
-%{_prefix}/bin/@target_alias@-g++@exe_ext@
 %{_prefix}/bin/@target_alias@-gcc@exe_ext@
-%{_prefix}/bin/@target_alias@-c++filt@exe_ext@
-# %{_prefix}/bin/@target_alias@-protoize@exe_ext@
-# %{_prefix}/bin/@target_alias@-unprotoize@exe_ext@
+%{_prefix}/bin/@target_alias@-gcov@exe_ext@
+%{_prefix}/bin/@target_alias@-gccbug@exe_ext@
+%{_prefix}/@target_alias@/include
 
 %dir %{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/include
-
-%{_prefix}/@target_alias@
-
Index: scripts/mkgcc3newlibspec.in
===================================================================
--- scripts/mkgcc3newlibspec.in	(revision a923a82d2d63b29165b249bae6ad46bb045290b2)
+++ scripts/mkgcc3newlibspec.in	(revision 6e9746a29c23951d259095145c1c60148cacec1a)
@@ -63,5 +63,4 @@
 PATCH1="Patch${patchn}: gcc-${gcc3_version}-rtems-${gcc3_patch_version}.diff"
 PATCH2="%patch${patchn} -p0"
-SETUP="${SETUP} -a${patchn}"
 fi
 
@@ -70,5 +69,4 @@
 PATCH3="Patch${patchn}: newlib-${gcc3newlib_version}-rtems-${gcc3newlib_patch_version}.diff"
 PATCH4="%patch${patchn} -p0"
-SETUP="${SETUP} -a${patchn}"
 fi
 
@@ -78,5 +76,4 @@
     -e "s,@PATCH3\@,${PATCH3}," \
     -e "s,@PATCH4\@,${PATCH4}," \
-    -e "s,@SETUP\@,${SETUP}," \
     -e "s%@Release\@%${gcc3newlib_rpm_release}%g" \
     -e "s%@target_alias\@%${target_alias}%g" \
