Ticket #28170: Portfile

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