Changeset 90722 for trunk/dports/cross


Ignore:
Timestamp:
Mar 13, 2012, 6:45:34 PM (8 years ago)
Author:
g5pw@…
Message:

avr-gcc Portfile

  • Added modeline
  • Updated to use crossgcc portgroup
  • Adopted by g5pw
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/cross/avr-gcc/Portfile

    r89852 r90722  
     1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=portfile:et:sw=4:ts=4:sts=4
    12# $Id$
    23
    34PortSystem              1.0
     5PortGroup                               crossgcc 1.0
    46
    57name                    avr-gcc
    6 version                 4.6.2
    7 platforms               darwin
    8 categories              cross devel
    9 maintainers             nomaintainer
     8crossgcc.setup          avr 4.6.2
     9
     10maintainers             g5pw
    1011license                 {GPL-3+ Permissive}
    11 description             GNU cross compilers for Atmel AVR
    12 long_description        GNU compilers collection (c and c++) for Atmel AVR 8bit microcontrollers..
    13 homepage                http://gcc.gnu.org/
    14 master_sites            gnu:gcc/gcc-${version}/
     12
    1513distfiles               gcc-${version}.tar.bz2
    16 use_bzip2               yes
    17 worksrcdir              gcc-${version}
    18 checksums               md5 028115c4fbfb6cfd75d6369f4a90d87e                                    \
    19                         sha256 60b05463dfe18d40d68fb8a71b25b408a01f86cc6ceaf5e6b22238b6b0f450c2 \
    20                         rmd160 e7041933b39629f9524848dcf81a1a4c02a225c6
    2114
    22 # Parameters for this port.
    23 set crossgcc-target     avr
    24 set default-languages   --enable-languages="c,c++"
    25 
    26 # All cross ports violate the mtree layout.
    27 destroot.violate_mtree  yes
     15checksums               rmd160  e7041933b39629f9524848dcf81a1a4c02a225c6 \
     16                        sha256  60b05463dfe18d40d68fb8a71b25b408a01f86cc6ceaf5e6b22238b6b0f450c2
    2817
    2918# Download everything to gcc/
    3019dist_subdir             gcc
    3120
    32 depends_lib             bin:${crossgcc-target}-ar:${crossgcc-target}-binutils \
    33                         bin:${crossgcc-target}-as:${crossgcc-target}-binutils \
    34                         bin:${crossgcc-target}-ld:${crossgcc-target}-binutils \
    35                         bin:${crossgcc-target}-nm:${crossgcc-target}-binutils \
    36                         bin:${crossgcc-target}-ranlib:${crossgcc-target}-binutils \
    37                         port:gmp port:mpfr port:libiconv port:libmpc port:ppl
    38 
    39 depends_build           bin:msgfmt:gettext
    40 
    41 # Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
    42 # program names as gcc's name (add -${version} with ${version} being the version of gcc).
    43 # But it won't work because binutils binaries don't have the ${version} suffix, and even if they
    44 # had, they would actually have the binutils' version suffix (and not gcc's version).
    45 # So let's tell gcc's Makefile not to do that mistake.
    46 
    47 set environment [list   AR_FOR_TARGET=${crossgcc-target}-ar \
    48                         AS_FOR_TARGET=${crossgcc-target}-as \
    49                         LD_FOR_TARGET=${crossgcc-target}-ld \
    50                         NM_FOR_TARGET=${crossgcc-target}-nm \
    51                         RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
    52 
    53 
    54 # Build in a different directory, as advised in the README file.
    55 pre-configure {
    56     file mkdir "${workpath}/build"
    57 }
    5821
    5922patchfiles-append       patch-lto-plugin-osx.diff
    6023
    61 configure.dir           ${workpath}/build
    62 configure.cmd           ${workpath}/gcc-${version}/configure
    63 # configure.cc           "cc -no-cpp-precomp"
    64 configure.env           ${environment}
    65 configure.args          --infodir='${prefix}/share/info'       \
    66                         --mandir='${prefix}/share/man'         \
    67                         --target=${crossgcc-target}            \
    68                         --program-prefix=${crossgcc-target}-   \
    69                         --with-included-gettext                \
     24configure.args-delete   --enable-languages="c,objc,c++,obj-c++"
     25
     26configure.args-append   --with-included-gettext                \
    7027                        --enable-obsolete                      \
    71                         --disable-nls                          \
    7228                        --enable-lto                           \
    73                         --with-plugin-ld=${crossgcc-target}-ld \
    7429                        --disable-libquadmath                  \
    75                         --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
    76                         ${default-languages}
     30                        --enable-languages="c,c++"
    7731
    7832if {$build_arch != "" && ${os.platform} == "darwin"} {
    79     configure.cc_archflags
    80     configure.cxx_archflags
    81     configure.objc_archflags
    8233    configure.args-append --build=${build_arch}-apple-darwin${os.major} \
    8334                          --host=${build_arch}-apple-darwin${os.major}
    8435}
    85 
    86 build.dir               ${workpath}/build
    87 
    88 build.args              ${environment}
    89 destroot.args           ${environment}
    90 
    91 # left as a reference; this was for gcc-4.0.2
    92 # don't know if this is still needed for gcc-4.6.2
    93 #platform darwin 9 {
    94 #    patchfiles-append   gcc-config-rs6000-host-darwin.c.diff
    95 #}
    96 
    97 post-patch {
    98     namespace eval crossgcc {}
    99 
    100     # Fix the info pages and related stuff.
    101     #
    102     # path: path to the doc directory (e.g. gas/doc/)
    103     # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
    104     # name: name of the info page (e.g. as)
    105     # suffix: suffix of the souce page (texinfo or texi)
    106     proc crossgcc::fixinfo { path makefile name suffix } {
    107         global crossgcc-target worksrcpath
    108 
    109         # Fix the source
    110         reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
    111             ${worksrcpath}/${path}/${name}.${suffix}
    112         reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
    113             ${worksrcpath}/${path}/${name}.${suffix}
    114         reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
    115             ${worksrcpath}/${path}/${name}.${suffix}
    116 
    117         # Fix the Makefile
    118         reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
    119             ${worksrcpath}/${makefile}
    120         reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
    121             ${worksrcpath}/${makefile}
    122         reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
    123             ${worksrcpath}/${makefile}
    124         reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
    125             ${worksrcpath}/${makefile}
    126         reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
    127             ${worksrcpath}/${makefile}
    128         reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
    129             ${worksrcpath}/${makefile}
    130         reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
    131             ${worksrcpath}/${makefile}
    132         reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
    133             ${worksrcpath}/${makefile}
    134         reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
    135             ${worksrcpath}/${makefile}
    136 
    137         # Rename the source
    138         file rename ${worksrcpath}/${path}/${name}.${suffix} \
    139             ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
    140 
    141         # Fix install-info's dir.
    142         # (note: this may be effectless if there was no info dir to be fixed)
    143         reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
    144             "${worksrcpath}/${makefile}"
    145     }
    146 
    147     # Fix the gettext files and related stuff.
    148     #
    149     # module: name of the module (e.g. gas)
    150     proc crossgcc::fixgettext { module } {
    151         global crossgcc-target worksrcpath
    152 
    153         if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
    154             reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
    155                 "${worksrcpath}/${module}/Makefile.in"
    156         }
    157         if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
    158             reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
    159                 "${worksrcpath}/${module}/doc/Makefile.in"
    160         }
    161         if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
    162             reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
    163                 "${worksrcpath}/${module}/po/Make-in"
    164         }
    165     }
    166 
    167     # gcc/doc/cpp.texi
    168     crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
    169 
    170     # gcc/doc/cppinternals.texi
    171     crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
    172 
    173     # gcc/doc/gcc.texi
    174     crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
    175 
    176     # gcc/doc/gccint.texi
    177     crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
    178 
    179     # libquadmath/libquadmath.texi
    180     crossgcc::fixinfo libquadmath libquadmath/Makefile.in libquadmath texi
    181 
    182     # gcc/f/g77.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     # fastjar/fastjar.texi
    189     #crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
    190 
    191     # gcc/doc/gccinstall.info
    192     crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
    193 
    194     # gettext stuff.
    195     crossgcc::fixgettext gcc
    196     crossgcc::fixgettext fastjar
    197 }
    198 
    199 pre-destroot {
    200     # gcc needs the cross directory structure to be present
    201     # in order to fill it during installation.
    202     file mkdir "${destroot}${prefix}/${crossgcc-target}/bin"
    203     file mkdir "${destroot}${prefix}/${crossgcc-target}/lib"
    204 }
    205 
    206 post-destroot {
    207     namespace eval crossgcc {}
    208 
    209     # Rename a man page if it exists.
    210     #
    211     # section: section of the man page (e.g. 1)
    212     # manpage: name of the man page (e.g. cpp)
    213     proc crossgcc::rename_man_page { section manpage } {
    214         global crossgcc-target destroot prefix
    215 
    216         set manpage_path "${destroot}${prefix}/share/man/man${section}/${manpage}.${section}"
    217         if { [ file exists ${manpage_path} ] } {
    218             file rename ${manpage_path} \
    219                 "${destroot}${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
    220         }
    221     }
    222 
    223     # Stuff I don't want (either because they're in the system
    224     # or because they would conflict with other FSF ports)
    225     # (it's easier for maintainability purposes to fix things here)
    226 
    227     # aliases for locales (should be on the system)
    228     file delete "${destroot}${prefix}/share/locale/locale.alias"
    229 
    230     # FSF propaganda (should already be there or would conflict)
    231     file delete -force "${destroot}${prefix}/share/man/man7"
    232 
    233     # (host) libiberty
    234     file delete "${destroot}${prefix}/lib/${build_arch}/libiberty.a"
    235 
    236     # aliases for charsets (should already be there)
    237     file delete "${destroot}${prefix}/lib/charset.alias"
    238 
    239     # Remove man pages for tools that are not built as part of cross-gcc
    240     file delete "${destroot}${prefix}/share/man/man1/rmic.1"
    241     file delete "${destroot}${prefix}/share/man/man1/rmiregistry.1"
    242     file delete "${destroot}${prefix}/share/man/man1/jv-convert.1"
    243     file delete "${destroot}${prefix}/share/man/man1/gij.1"
    244 
    245     # For some reason, some man pages are not prefixed while they should have been
    246     # (to avoid conflicting).
    247     crossgcc::rename_man_page 1 cpp
    248     crossgcc::rename_man_page 1 gcjh
    249     crossgcc::rename_man_page 1 gcov
    250     crossgcc::rename_man_page 1 jcf-dump
    251     crossgcc::rename_man_page 1 jv-scan
    252 
    253     # There is a bug in gcc/Makefile::install-driver
    254     # For cross compilers, $(GCC_INSTALL_NAME) is equal to
    255     # $(target_noncanonical)-gcc-$(version)
    256     # and hence the driver isn't installed.
    257     xinstall -c "${workpath}/build/gcc/xgcc" \
    258         "${destroot}${prefix}/bin/${crossgcc-target}-gcc-${version}"
    259 }
    260 
    261 livecheck.type  regex
    262 livecheck.url   http://gcc.gnu.org/releases.html
    263 livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracChangeset for help on using the changeset viewer.