| 1 | # $Id$ |
|---|
| 2 | |
|---|
| 3 | PortSystem 1.0 |
|---|
| 4 | name avr-binutils |
|---|
| 5 | version 2.20 |
|---|
| 6 | |
|---|
| 7 | # Parameters for this port. |
|---|
| 8 | set crossgcc-target avr |
|---|
| 9 | |
|---|
| 10 | description FSF Binutils for avr cross development |
|---|
| 11 | long_description Free Software Foundation development toolchain ("binutils") for \ |
|---|
| 12 | avr cross development. |
|---|
| 13 | platforms darwin |
|---|
| 14 | categories cross devel |
|---|
| 15 | maintainers gmail.com:metamagix |
|---|
| 16 | homepage http://www.gnu.org/software/binutils/binutils.html |
|---|
| 17 | master_sites http://ftp.gnu.org/gnu/binutils/ \ |
|---|
| 18 | ftp://ftp.kernel.org/pub/linux/devel/binutils/ \ |
|---|
| 19 | http://ftp.kernel.org/pub/linux/devel/binutils/ |
|---|
| 20 | distname binutils-${version} |
|---|
| 21 | use_bzip2 yes |
|---|
| 22 | checksums md5 ee2d3e996e9a2d669808713360fa96f8 \ |
|---|
| 23 | sha1 747e7b4d94bce46587236dc5f428e5b412a590dc \ |
|---|
| 24 | rmd160 284074e2453e517d036ffce2c0f3d56439e2e5c0 |
|---|
| 25 | |
|---|
| 26 | depends_lib port:gettext |
|---|
| 27 | |
|---|
| 28 | # All cross ports violate the mtree layout. |
|---|
| 29 | destroot.violate_mtree yes |
|---|
| 30 | |
|---|
| 31 | # Download everything to binutils/ |
|---|
| 32 | dist_subdir binutils |
|---|
| 33 | |
|---|
| 34 | # Build in a different directory, as advised in the README file. |
|---|
| 35 | pre-configure { system "cd ${workpath} && mkdir -p build"} |
|---|
| 36 | configure.dir ${workpath}/build |
|---|
| 37 | configure.cmd ${worksrcpath}/configure |
|---|
| 38 | configure.cc "cc -no-cpp-precomp" |
|---|
| 39 | |
|---|
| 40 | # using --disable-werror because of |
|---|
| 41 | # "strings.c:419: warning: 'stat64' is deprecated (declared at /usr/include/sys/stat.h:465)" |
|---|
| 42 | # don't know how to fix this proper... |
|---|
| 43 | configure.args --disable-werror \ |
|---|
| 44 | --infodir='${prefix}/share/info' \ |
|---|
| 45 | --disable-nls \ |
|---|
| 46 | --disable-install-libiberty \ |
|---|
| 47 | --target=${crossgcc-target} \ |
|---|
| 48 | --program-prefix=${crossgcc-target}- \ |
|---|
| 49 | --mandir='${prefix}/share/man' |
|---|
| 50 | |
|---|
| 51 | if {$build_arch != "" && ${os.platform} == "darwin"} { |
|---|
| 52 | configure.args-append --build=${build_arch}-apple-darwin${os.major} \ |
|---|
| 53 | --host=${build_arch}-apple-darwin${os.major} |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | build.dir ${workpath}/build |
|---|
| 57 | |
|---|
| 58 | # We don't want the etc module. |
|---|
| 59 | post-extract { |
|---|
| 60 | system "rm -rf ${worksrcpath}/etc" |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | post-patch { |
|---|
| 64 | namespace eval crossgcc {} |
|---|
| 65 | |
|---|
| 66 | # Fix the info pages and related stuff. |
|---|
| 67 | # |
|---|
| 68 | # path: path to the doc directory (e.g. gas/doc/) |
|---|
| 69 | # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in) |
|---|
| 70 | # name: name of the info page (e.g. as) |
|---|
| 71 | # suffix: suffix of the souce page (texinfo or texi) |
|---|
| 72 | proc crossgcc::fixinfo { path makefile name suffix } { |
|---|
| 73 | global crossgcc-target worksrcpath |
|---|
| 74 | |
|---|
| 75 | # Fix the source |
|---|
| 76 | reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \ |
|---|
| 77 | ${worksrcpath}/${path}/${name}.${suffix} |
|---|
| 78 | reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \ |
|---|
| 79 | ${worksrcpath}/${path}/${name}.${suffix} |
|---|
| 80 | reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \ |
|---|
| 81 | ${worksrcpath}/${path}/${name}.${suffix} |
|---|
| 82 | |
|---|
| 83 | # Fix the Makefile |
|---|
| 84 | reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \ |
|---|
| 85 | ${worksrcpath}/${makefile} |
|---|
| 86 | reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \ |
|---|
| 87 | ${worksrcpath}/${makefile} |
|---|
| 88 | |
|---|
| 89 | # Rename the source |
|---|
| 90 | file rename ${worksrcpath}/${path}/${name}.${suffix} \ |
|---|
| 91 | ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix} |
|---|
| 92 | |
|---|
| 93 | # Fix install-info's dir. |
|---|
| 94 | # (note: this may be effectless if there was no info dir to be fixed) |
|---|
| 95 | reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-dir|g" \ |
|---|
| 96 | "${worksrcpath}/${makefile}" |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | # Fix the gettext files and related stuff. |
|---|
| 100 | # |
|---|
| 101 | # module: name of the module (e.g. gas) |
|---|
| 102 | proc crossgcc::fixgettext { module } { |
|---|
| 103 | global crossgcc-target worksrcpath |
|---|
| 104 | |
|---|
| 105 | if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } { |
|---|
| 106 | reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \ |
|---|
| 107 | "${worksrcpath}/${module}/Makefile.in" |
|---|
| 108 | } |
|---|
| 109 | if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } { |
|---|
| 110 | reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \ |
|---|
| 111 | "${worksrcpath}/${module}/doc/Makefile.in" |
|---|
| 112 | } |
|---|
| 113 | if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } { |
|---|
| 114 | reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \ |
|---|
| 115 | "${worksrcpath}/${module}/po/Make-in" |
|---|
| 116 | } |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | # gas/doc/as.texinfo |
|---|
| 120 | crossgcc::fixinfo gas/doc/ gas/doc/Makefile.in as texinfo |
|---|
| 121 | |
|---|
| 122 | # bfd/doc/bfd.texinfo |
|---|
| 123 | crossgcc::fixinfo bfd/doc/ bfd/doc/Makefile.in bfd texinfo |
|---|
| 124 | |
|---|
| 125 | # binutils/doc/binutils.texi |
|---|
| 126 | crossgcc::fixinfo binutils/doc/ binutils/doc/Makefile.in binutils texi |
|---|
| 127 | |
|---|
| 128 | # gprof/gprof.texi |
|---|
| 129 | crossgcc::fixinfo gprof/ gprof/Makefile.in gprof texi |
|---|
| 130 | |
|---|
| 131 | # ld/ld.texinfo |
|---|
| 132 | crossgcc::fixinfo ld/ ld/Makefile.in ld texinfo |
|---|
| 133 | |
|---|
| 134 | # gettext stuff. |
|---|
| 135 | crossgcc::fixgettext bfd |
|---|
| 136 | crossgcc::fixgettext binutils |
|---|
| 137 | crossgcc::fixgettext gas |
|---|
| 138 | crossgcc::fixgettext gprof |
|---|
| 139 | crossgcc::fixgettext ld |
|---|
| 140 | crossgcc::fixgettext opcodes |
|---|
| 141 | } |
|---|
| 142 | |
|---|