[df49c60] | 1 | # |
---|
| 2 | # spec file for building gcc for rtems |
---|
| 3 | # |
---|
[01ec6c0] | 4 | # Copyright (c) 1999,2000,2001 OARCorp, Huntsville, AL |
---|
[df49c60] | 5 | # |
---|
| 6 | # please send bugfixes or comments to joel@OARcorp.com |
---|
| 7 | # |
---|
| 8 | |
---|
[4b3af7a4] | 9 | %define _prefix @prefix@ |
---|
| 10 | |
---|
[df49c60] | 11 | Vendor: OAR Corporation |
---|
| 12 | Distribution: Linux |
---|
| 13 | Name: @target_alias@-gcc-newlib |
---|
| 14 | Summary: gcc and newlib C Library for @target_alias@. |
---|
| 15 | Group: rtems |
---|
| 16 | Release: @Release@ |
---|
| 17 | License: gcc is GPL/LGPL ; newlib no has restrictions on run-time usage |
---|
| 18 | |
---|
| 19 | Autoreqprov: on |
---|
| 20 | Packager: corsepiu@faw.uni-ulm.de and joel@OARcorp.com |
---|
| 21 | |
---|
| 22 | Version: gcc@gcc_version@newlib@newlib_version@ |
---|
[1cd0db4] | 23 | # gcc 3.x and gcc 2.9 |
---|
| 24 | # Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2 |
---|
[a8bd1de] | 25 | # gcc 2.95.x |
---|
[1cd0db4] | 26 | Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-everything-@gcc_version@.tar.gz |
---|
[4b3af7a4] | 27 | Source1: ftp://sources.redhat.com/pub/newlib/newlib-@newlib_version@.tar.gz |
---|
[df49c60] | 28 | Patch0: gcc-@gcc_version@-rtems-@gcc_patch_version@.diff |
---|
| 29 | Patch1: newlib-@newlib_version@-rtems-@newlib_patch_version@.diff |
---|
[4b3af7a4] | 30 | Buildroot: %{_tmppath}/%{name} |
---|
[df49c60] | 31 | |
---|
| 32 | # |
---|
| 33 | # The original sources are not included in the source RPM. |
---|
| 34 | # If we included them, then the source RPMs for each target |
---|
| 35 | # would duplicate MBs of source unnecessarily. This is |
---|
| 36 | # a duplication of over 30 MBs of source for each of |
---|
| 37 | # the more than 10 targets it is possible to build. |
---|
| 38 | # |
---|
| 39 | # You can get them yourself from the Internet and copy them to |
---|
| 40 | # your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR). |
---|
| 41 | # Or you can try the ftp options of rpm :-) |
---|
| 42 | # |
---|
| 43 | NoSource: 0 |
---|
| 44 | NoSource: 1 |
---|
| 45 | |
---|
| 46 | %description |
---|
| 47 | RTEMS is an open source operating system for embedded systems. |
---|
| 48 | |
---|
| 49 | This is gcc's and newlib C Library's sources with patches for RTEMS. |
---|
| 50 | |
---|
| 51 | The original sources are not included in the source RPM. |
---|
| 52 | If we included them, then the source RPMs for each target |
---|
| 53 | would duplicate MBs of source unnecessarily. This is |
---|
| 54 | a duplication of over 30 MBs of source for each of |
---|
| 55 | the more than 10 targets it is possible to build. |
---|
| 56 | |
---|
| 57 | You can get them yourself from the Internet and copy them to |
---|
| 58 | your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR). |
---|
| 59 | Or you can try the ftp options of rpm :-) |
---|
| 60 | |
---|
| 61 | %prep |
---|
| 62 | # untar the sources inside @target_alias@-gcc-newlib |
---|
[4b3af7a4] | 63 | %setup -c -n %{name} -a 0 -a 1 |
---|
[df49c60] | 64 | |
---|
| 65 | %patch0 -p0 |
---|
| 66 | %patch1 -p0 |
---|
| 67 | |
---|
| 68 | # Copy the C library into gcc's source tree |
---|
| 69 | ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@ |
---|
| 70 | test -d build || mkdir build |
---|
| 71 | |
---|
| 72 | %build |
---|
| 73 | cd build |
---|
| 74 | |
---|
[4b3af7a4] | 75 | # HACK: This should be %{target} != %{build}, but SuSE's rpm screws it. |
---|
| 76 | %if "%{target_os}" != "%{build_os}" |
---|
| 77 | CONFIGURE_ARGS="--build=%{_build} --host=%{_target}" |
---|
| 78 | %endif |
---|
| 79 | |
---|
| 80 | ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \ |
---|
[df49c60] | 81 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \ |
---|
[4b3af7a4] | 82 | --enable-threads --prefix=%{_prefix} @GCCLANGS@ |
---|
[df49c60] | 83 | |
---|
| 84 | make all |
---|
| 85 | make info |
---|
| 86 | |
---|
| 87 | %install |
---|
| 88 | cd build |
---|
| 89 | # Bug in gcc-2.95.1: It doesn't build this installation directory |
---|
| 90 | # If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc |
---|
| 91 | ../gcc-@gcc_version@/mkinstalldirs \ |
---|
[4b3af7a4] | 92 | $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin |
---|
[df49c60] | 93 | |
---|
[4b3af7a4] | 94 | make prefix=$RPM_BUILD_ROOT%{_prefix} install |
---|
[df49c60] | 95 | cd @target_alias@/newlib |
---|
[4b3af7a4] | 96 | make prefix=$RPM_BUILD_ROOT%{_prefix} install-info |
---|
[df49c60] | 97 | |
---|
| 98 | # cd back to build/ |
---|
| 99 | cd ../.. |
---|
| 100 | |
---|
[01ec6c0] | 101 | # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets. |
---|
| 102 | # Rename it to target_alias-cpp |
---|
[4b3af7a4] | 103 | if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@; |
---|
[01ec6c0] | 104 | then |
---|
[4b3af7a4] | 105 | mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@ \ |
---|
| 106 | $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp@exe_ext@ |
---|
[01ec6c0] | 107 | fi |
---|
| 108 | |
---|
[df49c60] | 109 | # gzip info files |
---|
[4b3af7a4] | 110 | gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null |
---|
| 111 | gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null |
---|
| 112 | gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null |
---|
[df49c60] | 113 | |
---|
| 114 | rm -f dirs ; |
---|
[4b3af7a4] | 115 | echo "%dir %{_prefix}/lib" >> dirs ; |
---|
| 116 | echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ; |
---|
| 117 | echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ; |
---|
[df49c60] | 118 | |
---|
| 119 | # Collect multilib subdirectories |
---|
[4b3af7a4] | 120 | TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@" |
---|
[df49c60] | 121 | f=`gcc/xgcc --print-multi-lib | sed -e 's,;.*$,,'` |
---|
| 122 | for i in $f; do |
---|
| 123 | case $i in |
---|
| 124 | \.) echo "%dir ${TGTDIR}" >> dirs |
---|
| 125 | ;; |
---|
| 126 | *) echo "%dir ${TGTDIR}/$i" >> dirs |
---|
| 127 | ;; |
---|
| 128 | esac |
---|
| 129 | done |
---|
| 130 | |
---|
| 131 | # Collect files to go into different packages |
---|
| 132 | cp dirs files.chill |
---|
| 133 | cp dirs files.gcc |
---|
| 134 | cp dirs files.g77 |
---|
| 135 | cp dirs files.objc |
---|
| 136 | cp dirs files.gcj |
---|
| 137 | |
---|
| 138 | f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`; |
---|
| 139 | for i in $f; do |
---|
| 140 | case $i in |
---|
| 141 | *chill*) echo "$i" >> files.chill ;; |
---|
| 142 | *f771) ;; |
---|
| 143 | *cc1obj) ;; |
---|
| 144 | *libobjc*) echo "$i" >> files.objc ;; |
---|
| 145 | *include/objc*) ;; |
---|
| 146 | *jc1) ;; |
---|
| 147 | *jvgenmain) ;; |
---|
| 148 | *) echo "$i" >> files.gcc ;; |
---|
| 149 | esac |
---|
| 150 | done |
---|
| 151 | |
---|
| 152 | %clean |
---|
| 153 | # let rpm --clean remove BuildRoot iif using the default BuildRoot |
---|
[4b3af7a4] | 154 | test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \ |
---|
[df49c60] | 155 | rm -rf $RPM_BUILD_ROOT |
---|
| 156 | |
---|