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