From dac2c5e3a655f2f6e8356bd40173d65405bf22b0 Mon Sep 17 00:00:00 2001
From: root <Kedar Sovani kedars@marvell.com>
Date: Wed, 17 Dec 2008 10:01:14 +0530
Subject: [PATCH] Manage the packaging of various files.

Signed-off-by: Kedar Sovani <kedars@marvell.com>
---
 gcc43.spec |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 deletions(-)

diff --git a/gcc43.spec b/gcc43.spec
index c7575df..bbf00e1 100644
--- a/gcc43.spec
+++ b/gcc43.spec
@@ -3,6 +3,8 @@
 %define gcc_version 4.3.2
 # Note, gcc_release must be integer, if you want to add suffixes to
 # %{release}, append them after %{gcc_release} on Release: line.
+%define build_objc 1
+
 %define gcc_release 7
 %define _unpackaged_files_terminate_build 0
 %define multilib_64_archs sparc64 ppc64 s390x x86_64
@@ -14,6 +16,11 @@
 %endif
 %define build_java 1
 %define run_tests 1
+%ifarch %{arm}
+%define build_java 0
+%define build_objc 0
+%define run_tests 0
+%endif
 # If you don't have already a usable gcc-java and libgcj for your arch,
 # do on some arch which has it rpmbuild -bc --with java_tar gcc41.spec
 # which creates libjava-classes-%{version}-%{release}.tar.bz2
@@ -35,7 +42,7 @@
 Summary: Various compilers (C, C++, Objective-C, Java, ...)
 Name: gcc
 Version: %{gcc_version}
-Release: %{gcc_release}.fa2
+Release: %{gcc_release}.fa3
 # libgcc, libgfortran, libmudflap and crtstuff have an exception which allows
 # linking it into any kind of programs or shared libraries without
 # restrictions.
@@ -978,7 +985,9 @@ mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgcj_bc.so $FULLLPATH/
 mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libstdc++.*a $FULLLPATH/
 mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libsupc++.*a .
 mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgfortran.*a .
+%if %{build_objc}
 mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libobjc.*a .
+%endif
 mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgomp.*a .
 mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libmudflap{,th}.*a $FULLLPATH/
 
@@ -1001,7 +1010,9 @@ ln -sf ../lib64/libgcj_bc.so 64/libgcj_bc.so
 %endif
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libsupc++.*a 64/
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libgfortran.*a 64/
+%if %{build_objc}
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libobjc.*a 64/
+%endif
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libgomp.*a 64/
 ln -sf lib32/libstdc++.a libstdc++.a
 ln -sf ../lib64/libstdc++.a 64/libstdc++.a
@@ -1028,7 +1039,9 @@ ln -sf ../`echo ../../../../lib64/libgij.so.9.* | sed s~/../lib64/~/~` 32/libgij
 %endif
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libsupc++.*a 32/
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libgfortran.*a 32/
+%if %{build_objc}
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libobjc.*a 32/
+%endif
 mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libgomp.*a 32/
 %endif
 %ifarch sparc64 ppc64
@@ -1061,7 +1074,9 @@ popd
 chmod 755 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgfortran.so.3.*
 chmod 755 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgomp.so.1.*
 chmod 755 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libmudflap{,th}.so.0.*
+%if %{build_objc}
 chmod 755 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libobjc.so.2.*
+%endif
 
 %if %{build_ada}
 chmod 755 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgnarl*so*
@@ -1141,6 +1156,20 @@ chmod 755 $RPM_BUILD_ROOT%{_prefix}/share/java/gcj-endorsed \
 touch $RPM_BUILD_ROOT%{_prefix}/%{_lib}/gcj-%{version}/classmap.db
 %endif
 
+%if ! %{build_java}
+rm -f  %{_mandir}/man1/gc-analyze.1.gz
+rm -f  %{_mandir}/man1/gcj-dbtool.1.gz
+rm -f  %{_mandir}/man1/gcj.1.gz
+rm -f  %{_mandir}/man1/gij.1.gz
+rm -f  %{_mandir}/man1/grmic.1.gz
+rm -f  %{_mandir}/man1/jcf-dump.1.gz
+rm -f  %{_mandir}/man1/jv-convert.1.gz
+rm -f  %{_mandir}/man7/fsf-funding.7.gz
+rm -f  %{_mandir}/man7/gfdl.7.gz
+rm -f  %{_mandir}/man7/gpl.7.gz
+rm -f  /usr/share/info/gcj.info.gz
+%endif
+
 install -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/protoize.1
 echo '.so man1/protoize.1' > $RPM_BUILD_ROOT%{_mandir}/man1/unprotoize.1
 chmod 644 $RPM_BUILD_ROOT%{_mandir}/man1/unprotoize.1
@@ -1279,7 +1308,9 @@ fi
 %ifarch ppc64
 %{_prefix}/bin/ppc-%{_vendor}-%{_target_os}-gcc
 %endif
+%ifnarch %{arm}
 %{_prefix}/bin/%{gcc_target_platform}-gcc
+%endif
 %{_mandir}/man1/gcc.1*
 %{_mandir}/man1/gcov.1*
 %{_mandir}/man1/protoize.1*
@@ -1319,6 +1350,25 @@ fi
 %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/mm3dnow.h
 %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/cpuid.h
 %endif
+%ifarch %{arm}
+%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include-fixed
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include-fixed/README
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include-fixed/libdevmapper.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include-fixed/X11/Xw32defs.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include-fixed/nss3/secport.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include-fixed/openssl/bn.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include-fixed/linux/a.out.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/arm_neon.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/mmintrin.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/ssp/ssp.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/ssp/stdio.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/ssp/string.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/ssp/unistd.h
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/stdfix.h
+/usr/bin/gccbug
+%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/install-tools
+%endif
+
 %ifarch ia64
 %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/ia64intrin.h
 %endif
@@ -1398,7 +1448,9 @@ fi
 
 %files c++
 %defattr(-,root,root)
+%ifnarch %{arm}
 %{_prefix}/bin/%{gcc_target_platform}-*++
+%endif
 %{_prefix}/bin/g++
 %{_prefix}/bin/c++
 %{_mandir}/man1/g++.1*
@@ -1461,6 +1513,7 @@ fi
 %endif
 %doc rpm.doc/changelogs/libstdc++-v3/ChangeLog* libstdc++-v3/README* libstdc++-v3/doc/html/
 
+%if %{build_objc}
 %files objc
 %defattr(-,root,root)
 %dir %{_prefix}/lib/gcc
@@ -1497,6 +1550,7 @@ fi
 %files -n libobjc
 %defattr(-,root,root)
 %{_prefix}/%{_lib}/libobjc.so.2*
+%endif
 
 %files gfortran
 %defattr(-,root,root)
-- 
1.5.3.3

