[afe5cac] | 1 | Name: @target_alias@-gcc-newlib |
---|
| 2 | Summary: gcc and newlib C Library for @target_alias@. |
---|
| 3 | Group: rtems |
---|
| 4 | Release: @Release@ |
---|
| 5 | License: gcc is GPL/LGPL ; newlib no has restrictions on run-time usage |
---|
| 6 | |
---|
| 7 | Autoreqprov: on |
---|
| 8 | Packager: corsepiu@faw.uni-ulm.de and joel@OARcorp.com |
---|
| 9 | |
---|
| 10 | Version: gcc@gcc_version@newlib@newlib_version@ |
---|
| 11 | # gcc 3.x and gcc 2.9 |
---|
[3e1526f0] | 12 | Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.gz |
---|
[afe5cac] | 13 | # Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2 |
---|
| 14 | # gcc 2.95.x |
---|
[3e1526f0] | 15 | # Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2 |
---|
[afe5cac] | 16 | Source1: ftp://sources.redhat.com/pub/newlib/newlib-@newlib_version@.tar.gz |
---|
[df1f734] | 17 | @PATCH1@ |
---|
| 18 | @PATCH3@ |
---|
[9b0bb5a4] | 19 | BuildPreReq: texinfo >= 4.2 |
---|
| 20 | BuildPreReq: @target_alias@-binutils |
---|
[afe5cac] | 21 | # |
---|
| 22 | # The original sources are not included in the source RPM. |
---|
| 23 | # If we included them, then the source RPMs for each target |
---|
| 24 | # would duplicate MBs of source unnecessarily. This is |
---|
| 25 | # a duplication of over 30 MBs of source for each of |
---|
| 26 | # the more than 10 targets it is possible to build. |
---|
| 27 | # |
---|
| 28 | # You can get them yourself from the Internet and copy them to |
---|
| 29 | # your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR). |
---|
| 30 | # Or you can try the ftp options of rpm :-) |
---|
| 31 | # |
---|
| 32 | NoSource: 0 |
---|
| 33 | NoSource: 1 |
---|
| 34 | |
---|
[fa42a76b] | 35 | # Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for |
---|
| 36 | # those targets wanting to support ada. |
---|
| 37 | |
---|
| 38 | %if "@gcc_version@" >= "3.2" |
---|
| 39 | # default to building gnat |
---|
| 40 | %define _gnat %{?gnat:%gnat}%{!?gnat:1} |
---|
| 41 | %else |
---|
| 42 | # default to not building gnat |
---|
| 43 | %define _gnat %{?gnat:%gnat}%{!?gnat:0} |
---|
| 44 | %endif |
---|
| 45 | |
---|
[4aba88a1] | 46 | %define build_cxx 1 |
---|
| 47 | %define build_g77 0 |
---|
| 48 | %define build_objc 0 |
---|
| 49 | %define build_gcj 0 |
---|
| 50 | %define build_gnat 0 |
---|
| 51 | |
---|
[99e797a5] | 52 | %if "@target_alias@" == "arm-rtems" |
---|
| 53 | %define build_gcj 1 |
---|
| 54 | %endif |
---|
| 55 | |
---|
| 56 | %if "@target_alias@" == "c4x-rtems" |
---|
[4aba88a1] | 57 | %define build_cxx 0 |
---|
[513afacb] | 58 | %endif |
---|
| 59 | |
---|
[fa42a76b] | 60 | %if "@target_alias@" == "i386-rtems" |
---|
[f7e1564] | 61 | %define build_gnat %_gnat |
---|
[99e797a5] | 62 | %define build_gcj 1 |
---|
[fa42a76b] | 63 | %endif |
---|
| 64 | |
---|
[513afacb] | 65 | %if "@target_alias@" == "i960-rtems" |
---|
[4aba88a1] | 66 | %define build_cxx 0 |
---|
[513afacb] | 67 | %endif |
---|
| 68 | |
---|
[99e797a5] | 69 | %if "@target_alias@" == "m68k-rtems" |
---|
| 70 | %define build_gcj 1 |
---|
| 71 | %endif |
---|
| 72 | |
---|
| 73 | %if "@target_alias@" == "mips-rtems" |
---|
[2e332a9] | 74 | %define build_gnat %_gnat |
---|
[99e797a5] | 75 | %define build_gcj 1 |
---|
| 76 | %endif |
---|
| 77 | |
---|
[513afacb] | 78 | %if "@target_alias@" == "powerpc-rtems" |
---|
[fa42a76b] | 79 | %define build_gnat %_gnat |
---|
[99e797a5] | 80 | %define build_gcj 1 |
---|
[513afacb] | 81 | %endif |
---|
| 82 | |
---|
| 83 | %if "@target_alias@" == "sparc-rtems" |
---|
[fa42a76b] | 84 | %define build_gnat %_gnat |
---|
[99e797a5] | 85 | %define build_gcj 1 |
---|
[4aba88a1] | 86 | %endif |
---|
| 87 | |
---|
[9b0bb5a4] | 88 | %if %build_gcj |
---|
| 89 | # Building gcj requires bison and zlib |
---|
| 90 | BuildPreReq: bison |
---|
| 91 | %if "%_vendor" == "redhat" |
---|
| 92 | BuildPreReq: zlib-devel |
---|
| 93 | %endif |
---|
| 94 | %endif |
---|
| 95 | |
---|
| 96 | %if %build_gnat |
---|
| 97 | # Building gnat requires gnat |
---|
| 98 | %if "%_vendor" == "redhat" |
---|
| 99 | BuildPreReq: gcc-gnat |
---|
| 100 | %endif |
---|
| 101 | %endif |
---|
| 102 | |
---|
[afe5cac] | 103 | %description |
---|
| 104 | RTEMS is an open source operating system for embedded systems. |
---|
| 105 | |
---|
| 106 | This is gcc's and newlib C Library's sources with patches for RTEMS. |
---|
| 107 | |
---|
| 108 | The original sources are not included in the source RPM. |
---|
| 109 | If we included them, then the source RPMs for each target |
---|
| 110 | would duplicate MBs of source unnecessarily. This is |
---|
| 111 | a duplication of over 30 MBs of source for each of |
---|
| 112 | the more than 10 targets it is possible to build. |
---|
| 113 | |
---|
| 114 | You can get them yourself from the Internet and copy them to |
---|
| 115 | your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR). |
---|
| 116 | Or you can try the ftp options of rpm :-) |
---|
| 117 | |
---|
| 118 | %prep |
---|
| 119 | # untar the sources inside @target_alias@-gcc-newlib |
---|
[6e9746a2] | 120 | %setup -c -T -n %{name} -a0 -a1 |
---|
[afe5cac] | 121 | |
---|
[df1f734] | 122 | @PATCH2@ |
---|
| 123 | @PATCH4@ |
---|
[afe5cac] | 124 | |
---|
[6e9746a2] | 125 | cd gcc-@gcc_version@ |
---|
[d35b77f] | 126 | sed -e 's/\(version_string = \"[^\"]*\)/\1 (OAR Corporation gcc-@gcc_version@-@gcc_patch_version@\/newlib-@newlib_version@-@newlib_patch_version@ @Release@)/' \ |
---|
| 127 | gcc/version.c > gcc/version.c~ |
---|
| 128 | mv gcc/version.c~ gcc/version.c |
---|
| 129 | |
---|
| 130 | # Fix timestamps |
---|
[6e9746a2] | 131 | contrib/gcc_update --touch |
---|
| 132 | cd .. |
---|
| 133 | |
---|
[afe5cac] | 134 | # Copy the C library into gcc's source tree |
---|
| 135 | ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@ |
---|
| 136 | test -d build || mkdir build |
---|
| 137 | |
---|
| 138 | %build |
---|
| 139 | cd build |
---|
| 140 | |
---|
[99e797a5] | 141 | # ALERT: GCJ would be better if we could add this flag and build |
---|
| 142 | # it's libraries but this code isn't ready to be embedded. |
---|
| 143 | # libgcj_flag="--enable-libgcj" |
---|
[afe5cac] | 144 | |
---|
[513afacb] | 145 | languages="c" |
---|
| 146 | %if %build_cxx |
---|
| 147 | languages="$languages,c++" |
---|
| 148 | %endif |
---|
[4aba88a1] | 149 | %if %build_g77 |
---|
| 150 | languages="$languages,g77" |
---|
| 151 | %endif |
---|
| 152 | %if %build_gcj |
---|
[99e797a5] | 153 | languages="$languages,java" |
---|
[4aba88a1] | 154 | %endif |
---|
| 155 | %if %build_objc |
---|
| 156 | languages="$languages,objc" |
---|
| 157 | %endif |
---|
| 158 | %if %build_gnat |
---|
| 159 | languages="$languages,ada" |
---|
| 160 | %endif |
---|
[491b8b2e] | 161 | ../gcc-@gcc_version@/configure \ |
---|
| 162 | --target=@target_alias@ \ |
---|
[afe5cac] | 163 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \ |
---|
[6e9746a2] | 164 | --with-system-zlib --disable-nls \ |
---|
| 165 | --enable-version-specific-runtime-libs \ |
---|
[4aba88a1] | 166 | --enable-threads=rtems --prefix=%{_prefix} \ |
---|
[99e797a5] | 167 | --enable-languages=$languages ${libgcj_flag} |
---|
[4aba88a1] | 168 | %if %build_gnat |
---|
| 169 | cd ../gcc-@gcc_version@/gcc/ada |
---|
| 170 | touch treeprs.ads [es]info.h nmake.ad[bs] |
---|
| 171 | cd ../../../build |
---|
| 172 | %endif |
---|
[afe5cac] | 173 | make all |
---|
[4aba88a1] | 174 | %if %build_gnat |
---|
[fa42a76b] | 175 | # This gnat configuration is crap :( |
---|
| 176 | |
---|
[4aba88a1] | 177 | # This is what is documented, but it doesn't work for me (RC) |
---|
| 178 | # make gnatlib_and_tools |
---|
[513afacb] | 179 | make -C gcc cross-gnattools |
---|
| 180 | make -C gcc ada.all.cross |
---|
[fa42a76b] | 181 | |
---|
| 182 | # This should work, but doesn't. |
---|
| 183 | # make -C gcc gnatlib |
---|
| 184 | |
---|
| 185 | # This is what gcc/ada/Makefile.in contains by default, |
---|
| 186 | # but what we override below |
---|
| 187 | GNATLIBCFLAGS="-g -O2" |
---|
| 188 | # Let gnatlib building find newlib's headers |
---|
| 189 | GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/@target_alias@/newlib/targ-include" |
---|
| 190 | GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-@newlib_version@/newlib/libc/include" |
---|
| 191 | # Without this xgcc doesn't find the target's binutils. |
---|
| 192 | GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/@target_alias@/bin/" |
---|
[4f7ee21] | 193 | %if "@target_alias@" == "mips-rtems" |
---|
| 194 | GNATLIBCFLAGS="$GNATLIBCFLAGS -G0" |
---|
| 195 | %endif |
---|
[fa42a76b] | 196 | make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib |
---|
[4aba88a1] | 197 | %endif |
---|
[afe5cac] | 198 | make info |
---|
| 199 | |
---|
| 200 | %install |
---|
| 201 | cd build |
---|
[fa42a76b] | 202 | # Bug in gcc-2.95.1: It doesn't build this installation directory |
---|
| 203 | # If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc |
---|
| 204 | %if "@gcc_version@" < "3.0" |
---|
| 205 | ../gcc-@gcc_version@/mkinstalldirs \ |
---|
| 206 | $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin |
---|
| 207 | %endif |
---|
[6e9746a2] | 208 | |
---|
[513afacb] | 209 | make prefix=$RPM_BUILD_ROOT%{_prefix} \ |
---|
| 210 | bindir=$RPM_BUILD_ROOT%{_bindir} install |
---|
[afe5cac] | 211 | cd @target_alias@/newlib |
---|
[4aba88a1] | 212 | make prefix=$RPM_BUILD_ROOT%{_prefix} \ |
---|
| 213 | bindir=$RPM_BUILD_ROOT%{_bindir} install-info |
---|
[6e9746a2] | 214 | # cd back to build/ |
---|
| 215 | cd ../.. |
---|
[afe5cac] | 216 | |
---|
[fa42a76b] | 217 | %if %build_gnat |
---|
| 218 | # Install a copy of gcc as gnatgcc |
---|
| 219 | # Enables us to mix different versions of gnat and gnatgcc |
---|
[491b8b2e] | 220 | rm -f $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext} |
---|
| 221 | ln $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gcc%{_exeext} \ |
---|
| 222 | $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext} |
---|
[fa42a76b] | 223 | %endif |
---|
| 224 | |
---|
| 225 | # Bug in gcc-3.x: It puts the build dirs into *.la files |
---|
[d35b77f] | 226 | |
---|
| 227 | # host library |
---|
| 228 | rm -f ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a |
---|
[df1f734] | 229 | |
---|
[fa42a76b] | 230 | %if "@gcc_version@" < "3.0" |
---|
[afe5cac] | 231 | # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets. |
---|
| 232 | # Rename it to target_alias-cpp |
---|
[491b8b2e] | 233 | if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext}; |
---|
[fa42a76b] | 234 | then |
---|
[491b8b2e] | 235 | mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \ |
---|
| 236 | $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp%{_exeext} |
---|
[fa42a76b] | 237 | fi |
---|
| 238 | %endif |
---|
[afe5cac] | 239 | |
---|
| 240 | # gzip info files |
---|
| 241 | gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null |
---|
| 242 | gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null |
---|
| 243 | gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null |
---|
| 244 | |
---|
| 245 | rm -f dirs ; |
---|
[9b0bb5a4] | 246 | echo "%defattr(-,root,root)" >> dirs |
---|
[afe5cac] | 247 | echo "%dir %{_prefix}/lib" >> dirs ; |
---|
| 248 | echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ; |
---|
| 249 | echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ; |
---|
| 250 | |
---|
| 251 | # Collect multilib subdirectories |
---|
[55f4d3d4] | 252 | f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'` |
---|
[6e9746a2] | 253 | |
---|
| 254 | TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@" |
---|
| 255 | for i in $f; do |
---|
| 256 | case $i in |
---|
| 257 | \.) echo "%dir ${TGTDIR}" >> dirs |
---|
| 258 | ;; |
---|
| 259 | *) echo "%dir ${TGTDIR}/$i" >> dirs |
---|
| 260 | ;; |
---|
| 261 | esac |
---|
| 262 | done |
---|
| 263 | |
---|
| 264 | TGTDIR="%{_prefix}/@target_alias@/lib" |
---|
[afe5cac] | 265 | for i in $f; do |
---|
| 266 | case $i in |
---|
| 267 | \.) echo "%dir ${TGTDIR}" >> dirs |
---|
| 268 | ;; |
---|
| 269 | *) echo "%dir ${TGTDIR}/$i" >> dirs |
---|
| 270 | ;; |
---|
| 271 | esac |
---|
| 272 | done |
---|
| 273 | |
---|
| 274 | # Collect files to go into different packages |
---|
| 275 | cp dirs files.gcc |
---|
| 276 | cp dirs files.g77 |
---|
| 277 | cp dirs files.objc |
---|
| 278 | cp dirs files.gcj |
---|
[6e9746a2] | 279 | cp dirs files.g++ |
---|
[afe5cac] | 280 | |
---|
[6e9746a2] | 281 | TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@" |
---|
[afe5cac] | 282 | f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`; |
---|
| 283 | for i in $f; do |
---|
| 284 | case $i in |
---|
[d35b77f] | 285 | *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs |
---|
[afe5cac] | 286 | *f771) ;; |
---|
| 287 | *cc1obj) ;; |
---|
| 288 | *libobjc*) echo "$i" >> files.objc ;; |
---|
| 289 | *include/objc*) ;; |
---|
[6e9746a2] | 290 | *include/g++*);; |
---|
[682c7502] | 291 | *include/c++*);; |
---|
[513afacb] | 292 | *adainclude*);; |
---|
| 293 | *adalib*);; |
---|
| 294 | *gnat1);; |
---|
[afe5cac] | 295 | *jc1) ;; |
---|
| 296 | *jvgenmain) ;; |
---|
[343d4ff] | 297 | *cc1plus) ;; # ignore: explicitly put into rpm elsewhere |
---|
[6e9746a2] | 298 | *libstdc++.a) echo "$i" >> files.g++ ;; |
---|
| 299 | *libsupc++.a) echo "$i" >> files.g++ ;; |
---|
[afe5cac] | 300 | *) echo "$i" >> files.gcc ;; |
---|
| 301 | esac |
---|
| 302 | done |
---|
| 303 | |
---|
[6e9746a2] | 304 | TGTDIR="%{_prefix}/@target_alias@/lib" |
---|
| 305 | f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`; |
---|
| 306 | for i in $f; do |
---|
| 307 | case $i in |
---|
[d35b77f] | 308 | *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs |
---|
| 309 | *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed |
---|
[6e9746a2] | 310 | # all other files belong to gcc |
---|
| 311 | *) echo "$i" >> files.gcc ;; |
---|
| 312 | esac |
---|
| 313 | done |
---|
| 314 | |
---|