Ticket #37260: i386-elf-gcc-4.7.2.diff

File i386-elf-gcc-4.7.2.diff, 10.6 KB (added by raimue (Rainer Müller), 12 years ago)
  • Portfile

     
    11# $Id$
    22
    3 PortSystem                      1.0
    4 name                    i386-elf-gcc
    5 version                 4.3.2
    6 revision                1
     3PortSystem      1.0
     4PortGroup       crossgcc 1.0
     5PortGroup       compiler_blacklist_versions 1.0
     6
     7crossgcc.setup  i386-elf 4.7.2
     8crossgcc.setup_libc newlib 1.20.0
     9
     10maintainers     coresystems.de:stepan
     11
     12checksums       gcc-${version}.tar.bz2 \
     13                md5     cc308a0891e778cfda7a151ab8a6e762 \
     14                rmd160  fc281ade14b47d2a9c2ced4f7082c74bfbae31c1 \
     15                sha256  8a9283d7010fb9fe5ece3ca507e0af5c19412626384f8a5e9434251ae100b084 \
     16                newlib-${crossgcc.libc_version}.tar.gz \
     17                sha1    65e7bdbeda0cbbf99c8160df573fd04d1cbe00d1 \
     18                rmd160  e36c5337a74633456b47d09594974c7dd7a9cc3e
    719
    8 # Parameters for this port.
    9 set newlibversion       1.16.0
    10 set crossgcc-target i386-elf
    11 set default-languages --enable-languages="c,c++,objc"
    12 
    13 description             gcc cross-compilers for i386-elf, with newlib runtime library.
    14 long_description        gnu compilers collection (including c++, fortran and objc) for \
    15                                         i386-elf, with newlib runtime library.
    16 homepage                        http://gcc.gnu.org/
    17 platforms               darwin
    18 categories              cross devel
    19 maintainers             coresystems.de:stepan
    20 master_sites            gnu:gcc/gcc-${version}/:gcc \
    21                                         ftp://sources.redhat.com/pub/newlib/:newlib \
    22                                         ftp://ftp.mirror.ac.uk/sites/sources.redhat.com/pub/newlib/:newlib
    23 distfiles                       gcc-${version}.tar.bz2:gcc newlib-${newlibversion}.tar.gz:newlib
    24 worksrcdir                      gcc-${version}
    25 checksums                       gcc-${version}.tar.bz2 \
    26                     md5     5dfac5da961ecd5f227c3175859a486d \
    27                     sha1    787b566ad4f386a9896e2d5703e6ff5e7ccaca58 \
    28                     rmd160  0ced28bd2e0d89f081cf88273b5f1530599b52fb \
    29                                         newlib-${newlibversion}.tar.gz \
    30                     md5     bf8f1f9e3ca83d732c00a79a6ef29bc4 \
    31                     sha1    841edec33d19a9e549984982fb92445ee967e265 \
    32                     rmd160  fa40ff43e858da3093c9f3b5b203724b9b327696
    33 patchfiles                      patch-gcc-Makefile.in \
    34                                 Make-lang.in.diff
    35 
    36 # All cross ports violate the mtree layout.
    37 destroot.violate_mtree  yes
    38 
    39 # Download everything to gcc/
    40 dist_subdir                     gcc
    41 
    42 depends_lib                     port:${crossgcc-target}-binutils \
    43                     port:gmp \
    44                     port:mpfr \
    45                     port:gettext
    46 
    47 # gcc is .bz2, newlib is .gz.
    48 # let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
    49 use_bzip2                       yes
    50 extract.only            gcc-${version}.tar.bz2
    51 
    52 # Extract newlib and create a symlink of newlib/newlib in gcc directory.
    53 post-extract    {
    54         system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
    55         system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
    56 }
    57 
    58 # Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
    59 # program names as gcc's name (add -${version} with ${version} being the version of gcc).
    60 # But it won't work because binutils binaries don't have the ${version} suffix, and even if they
    61 # had, they would actually have the binutils' version suffix (and not gcc's version).
    62 # So let's tell gcc's Makefile not to do that mistake.
    63 
    64 set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
    65                                 AS_FOR_TARGET=${crossgcc-target}-as \
    66                                 LD_FOR_TARGET=${crossgcc-target}-ld \
    67                                 NM_FOR_TARGET=${crossgcc-target}-nm \
    68                                 RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
    69 
    70 # Build in a different directory, as advised in the README file.
    71 pre-configure   {
    72         file mkdir "${workpath}/build"
    73 }
    74 configure.dir   ${workpath}/build
    75 configure.cmd   ${workpath}/gcc-${version}/configure
    76 configure.env   ${environment}
    77 configure.cflags-append -std=gnu89
    78 configure.args  --infodir='${prefix}/share/info' \
    79                                 --mandir='${prefix}/share/man' \
    80                                 --target=${crossgcc-target} \
    81                                 --program-prefix=${crossgcc-target}- \
    82                                 --program-suffix=-${version} \
    83                                 --without-included-gettext \
    84                                 --enable-obsolete \
    85                                 --with-newlib \
    86                                 --disable-libgfortran \
    87                                 --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
    88                                 ${default-languages}
    89 configure.cc_archflags
    90 configure.cxx_archflags
    91 configure.objc_archflags
    92 configure.ld_archflags
    93 if {${os.platform} == "darwin" && ($build_arch == "x86_64" || $build_arch == "ppc64")} {
    94     configure.args-append --build=${build_arch}-apple-${os.platform}${os.version}
    95 }
    96 
    97 build.dir       ${workpath}/build
    98 
    99 build.args              ${environment}
    100 destroot.args   ${environment}
    101 
    102 post-patch {
    103         namespace eval crossgcc {}
    104 
    105         # Fix the info pages and related stuff.
    106         #       
    107         # path: path to the doc directory (e.g. gas/doc/)
    108         # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
    109         # name: name of the info page (e.g. as)
    110         # suffix: suffix of the souce page (texinfo or texi)
    111         proc crossgcc::fixinfo { path makefile name suffix } {
    112                 global crossgcc-target worksrcpath
    113 
    114                 # Fix the source
    115                 reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
    116                         ${worksrcpath}/${path}/${name}.${suffix}
    117                 reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
    118                         ${worksrcpath}/${path}/${name}.${suffix}
    119                 reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
    120                         ${worksrcpath}/${path}/${name}.${suffix}
    121                
    122                 # Fix the Makefile
    123                 reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
    124                         ${worksrcpath}/${makefile}
    125                 reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
    126                         ${worksrcpath}/${makefile}
    127                 reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
    128                         ${worksrcpath}/${makefile}
    129                 reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
    130                         ${worksrcpath}/${makefile}
    131                 reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
    132                         ${worksrcpath}/${makefile}
    133                 reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
    134                         ${worksrcpath}/${makefile}
    135                 reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
    136                         ${worksrcpath}/${makefile}
    137                 reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
    138                         ${worksrcpath}/${makefile}
    139                 reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
    140                         ${worksrcpath}/${makefile}
    141                
    142                 # Rename the source
    143                 file rename ${worksrcpath}/${path}/${name}.${suffix} \
    144                         ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
    145                
    146                 # Fix install-info's dir.
    147                 # (note: this may be effectless if there was no info dir to be fixed)
    148                 reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
    149                         "${worksrcpath}/${makefile}"
    150         }
    151 
    152         # Fix the gettext files and related stuff.
    153         #       
    154         # module: name of the module (e.g. gas)
    155         proc crossgcc::fixgettext { module } {
    156                 global crossgcc-target worksrcpath
    157 
    158                 if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
    159                         reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
    160                                 "${worksrcpath}/${module}/Makefile.in"
    161                         reinplace "s|${module}\.mo|${crossgcc-target}-${module}.mo|g" \
    162                                 "${worksrcpath}/${module}/Makefile.in"
    163                 }
    164                 if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
    165                         reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
    166                                 "${worksrcpath}/${module}/doc/Makefile.in"
    167                 }
    168         }
    169 
    170         # gcc/doc/cpp.texi
    171         crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
    172 
    173         # gcc/doc/cppinternals.texi
    174         crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
    175 
    176         # gcc/doc/gcc.texi
    177         crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
    178 
    179         # gcc/doc/gccint.texi
    180         crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
    181 
    182         # gcc/fortran/gfortran.texi
    183         crossgcc::fixinfo gcc/fortran/ gcc/fortran/Make-lang.in gfortran texi
    184 
    185         # gcc/java/gcj.texi
    186         crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
    187 
    188         # gcc/doc/gccinstall.info
    189         crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
    190 
    191         # gettext stuff.
    192         crossgcc::fixgettext gcc
    193         crossgcc::fixgettext libcpp
    194 }
    195 
    196 pre-destroot {
    197         # gcc needs the cross directory structure to be present
    198         # in order to fill it during installation.
    199         file mkdir "${destroot}${prefix}/${crossgcc-target}/bin"
    200         file mkdir "${destroot}${prefix}/${crossgcc-target}/lib"
    201 }
    202 
    203 post-destroot {
    204         namespace eval crossgcc {}
    205 
    206         # Rename a man page if it exists.
    207         #
    208         # section: section of the man page (e.g. 1)
    209         # manpage: name of the man page (e.g. cpp)
    210         proc crossgcc::rename_man_page { section manpage } {
    211                 global crossgcc-target destroot prefix
    212 
    213                 set manpage_path "${destroot}${prefix}/share/man/man${section}/${manpage}.${section}"
    214                 if { [ file exists ${manpage_path} ] } {
    215                         file rename ${manpage_path} \
    216                                 "${destroot}${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
    217                 }
    218         }
    219 
    220         # Stuff I don't want (either because they're in the system
    221         # or because they would conflict with other FSF ports)
    222         # (it's easier for maintainability purposes to fix things here)
    223 
    224         # aliases for locales (should be on the system)
    225         file delete "${destroot}${prefix}/share/locale/locale.alias"
    226        
    227         # FSF propaganda (should already be there or would conflict)
    228         file delete -force "${destroot}${prefix}/share/man/man7"
    229 
    230         # (host) libiberty
    231         foreach f [glob -directory "${destroot}${prefix}/lib" libiberty.a */libiberty.a] {
    232         file delete $f
    233     }
    234 
    235         # aliases for charsets (should already be there)
    236         file delete "${destroot}${prefix}/lib/charset.alias"
    237        
    238         # Remove man pages for tools that are not built as part of cross-gcc
    239         file delete "${destroot}${prefix}/share/man/man1/rmic.1"
    240         file delete "${destroot}${prefix}/share/man/man1/rmiregistry.1"
    241         file delete "${destroot}${prefix}/share/man/man1/jv-convert.1"
    242         file delete "${destroot}${prefix}/share/man/man1/gij.1"
    243        
    244         # For some reason, some man pages are not prefixed while they should have been
    245         # (to avoid conflicting).
    246         crossgcc::rename_man_page 1 cpp
    247         crossgcc::rename_man_page 1 gcjh
    248         crossgcc::rename_man_page 1 gcov
    249         crossgcc::rename_man_page 1 jcf-dump
    250         crossgcc::rename_man_page 1 jv-scan
    251        
    252         # There is a bug in gcc/Makefile::install-driver
    253         # For cross compilers, $(GCC_INSTALL_NAME) is equal to
    254         # $(target_noncanonical)-gcc-$(version)
    255         # and hence the driver isn't installed.
    256         xinstall -c "${workpath}/build/gcc/xgcc" \
    257                 "${destroot}${prefix}/bin/${crossgcc-target}-gcc-${version}"
    258 }
    259 
    260 livecheck.type  regex
    261 livecheck.url   http://gcc.gnu.org/releases.html
    262 livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
     20# fatal error: error in backend: ran out of registers during register allocation
     21compiler.blacklist {clang == 421.11.66}