Ticket #27420: Portfile

File Portfile, 4.8 KB (added by yann.sionneau@…, 13 years ago)

Portfile for lm32-rtems-binutils

Line 
1# $Id$
2
3PortSystem                      1.0
4
5name                            lm32-rtems-binutils
6version                         2.20.90
7
8# Parameters for this port.
9set crossgcc-target lm32-rtems
10set rtemsversion        4.11
11
12description                     FSF Binutils for lm32-rtems cross development
13long_description        Free Software Foundation development toolchain ("binutils") for \
14                                        lm32-rtems cross development tools (for Milkymist & lm32_evr platforms).
15platforms                       darwin
16categories                      cross devel
17maintainers                     gmail.com:yann.sionneau
18homepage                        http://www.gnu.org/software/binutils/binutils.html
19master_sites                    http://www.rtems.com/ftp/pub/rtems/SOURCES/${rtemsversion}/:rtems \
20                                ftp://ftp.rtems.com/pub/rtems/SOURCES/${rtemsversion}/:rtems \
21                                macports:pguyot:rtems
22distname                        binutils-${version}
23distfiles                       binutils-${version}.tar.bz2:rtems
24use_bzip2                       yes
25
26checksums           binutils-${version}.tar.bz2 \
27                        md5     6a8734ea7fe5c46b12a2619881bb7ada \
28                        sha1    ee0124f6e597fc4d5ccc1c423aa470e51a28f20d \
29                        rmd160  462ed7213461cc47f3a5bf5365c422818e7bd577 \
30                    binutils-${version}-rtems${rtemsversion}-20101109.diff \
31                        md5     56baf1342f954895dab21df659e69e77 \
32                        sha1    6c24112556957d4a9b5720ebb98c3a98524c3fc5 \
33                        rmd160  26a0c4f0a0c15de816f0e162dfcc8bddb2044a2e
34patchfiles                      binutils-${version}-rtems${rtemsversion}-20101109.diff:rtems
35patch.pre_args          -p1
36
37depends_lib                     port:gettext
38
39# All cross ports violate the mtree layout.
40destroot.violate_mtree  yes
41
42# Download everything to binutils/
43dist_subdir                     binutils
44
45# Build in a different directory, as advised in the README file.
46pre-configure           { system "cd ${workpath} && mkdir -p build"}
47configure.dir           ${workpath}/build
48configure.cmd           ${worksrcpath}/configure
49configure.args          --infodir='${prefix}/share/info' --target=${crossgcc-target}${rtemsversion} \
50                                        --mandir='${prefix}/share/man' \
51                                        --disable-werror
52build.dir               ${workpath}/build
53
54# We don't want the etc module.
55post-extract {
56        system "rm -rf ${worksrcpath}/etc"
57}
58
59post-patch {
60        namespace eval crossgcc {}
61
62        # Fix the info pages and related stuff.
63        #
64        # path: path to the doc directory (e.g. gas/doc/)
65        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
66        # name: name of the info page (e.g. as)
67        # suffix: suffix of the souce page (texinfo or texi)
68        proc crossgcc::fixinfo { path makefile name suffix } {
69                global crossgcc-target worksrcpath
70
71                # Fix the source
72                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
73                        ${worksrcpath}/${path}/${name}.${suffix}
74                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
75                        ${worksrcpath}/${path}/${name}.${suffix}
76                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
77                        ${worksrcpath}/${path}/${name}.${suffix}
78               
79                # Fix the Makefile
80                reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \
81                        ${worksrcpath}/${makefile}
82                reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
83                        ${worksrcpath}/${makefile}
84               
85                # Rename the source
86                file rename ${worksrcpath}/${path}/${name}.${suffix} \
87                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
88               
89                # Fix install-info's dir.
90                # (note: this may be effectless if there was no info dir to be fixed)
91                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-dir|g" \
92                        "${worksrcpath}/${makefile}"
93        }
94
95        # Fix the gettext files and related stuff.
96        #
97        # module: name of the module (e.g. gas)
98        proc crossgcc::fixgettext { module } {
99                global crossgcc-target worksrcpath
100
101                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
102                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
103                                "${worksrcpath}/${module}/Makefile.in"
104                }
105                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
106                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
107                                "${worksrcpath}/${module}/doc/Makefile.in"
108                }
109                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
110                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
111                                "${worksrcpath}/${module}/po/Make-in"
112                }
113        }
114
115        # gas/doc/as.texinfo
116        crossgcc::fixinfo gas/doc/ gas/doc/Makefile.in as texinfo
117
118        # bfd/doc/bfd.texinfo
119        crossgcc::fixinfo bfd/doc/ bfd/doc/Makefile.in bfd texinfo
120
121        # binutils/doc/binutils.texi
122        crossgcc::fixinfo binutils/doc/ binutils/doc/Makefile.in binutils texi
123
124        # gprof/gprof.texi
125        crossgcc::fixinfo gprof/ gprof/Makefile.in gprof texi
126
127        # ld/ld.texinfo
128        crossgcc::fixinfo ld/ ld/Makefile.in ld texinfo
129       
130        # gettext stuff.
131        crossgcc::fixgettext bfd
132        crossgcc::fixgettext binutils
133        crossgcc::fixgettext gas
134        crossgcc::fixgettext gprof
135        crossgcc::fixgettext ld
136        crossgcc::fixgettext opcodes
137}
138
139post-destroot {
140        # Installing (host) libiberty was a mistake.
141        foreach f [glob -directory "${destroot}${prefix}/lib" libiberty.a */libiberty.a] {
142        file delete $f
143    }
144}
145
146livecheck.type  freshmeat
147livecheck.name  binutils