Ticket #22395: Portfile

File Portfile, 4.6 KB (added by david.stoffel81@…, 15 years ago)

Newer Portfile

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id: Portfile 60226 2009-11-06 16:27:18Z snc@macports.org $
3
4PortSystem                      1.0
5name                            arm-elf-binutils
6version                         2.20.51.0.2
7
8# Parameters for this port.
9set crossgcc-target arm-elf
10
11description                     FSF Binutils for arm-elf cross development
12long_description        Free Software Foundation development toolchain ("binutils") for \
13                                        arm-elf cross development.
14platforms                       darwin
15categories                      cross devel
16maintainers                     nomaintainer
17homepage                        http://www.gnu.org/software/binutils/binutils.html
18master_sites            ftp://ftp.kernel.org/pub/linux/devel/binutils/ \
19                                        http://ftp.kernel.org/pub/linux/devel/binutils/
20distname                        binutils-${version}
21use_bzip2                       yes
22checksums           md5     b01b185a5eab43190fb83efaeb2ffef9 \
23                    sha1    b9318d75250be2cfc0fbafbd0ed68aa45bd69005 \
24                    rmd160  fd65a60fb0df360f20d0897ba62cb87f57ae6666
25
26depends_lib                     port:gettext
27
28# All cross ports violate the mtree layout.
29destroot.violate_mtree  yes
30
31# Download everything to binutils/
32dist_subdir                     binutils
33
34# Build in a different directory, as advised in the README file.
35pre-configure           { system "cd ${workpath} && mkdir -p build"}
36configure.dir           ${workpath}/build
37configure.cmd           ${worksrcpath}/configure
38configure.cc            "cc -no-cpp-precomp -I${prefix}/include"
39configure.args          --infodir='${prefix}/share/info' --target=${crossgcc-target} \
40                                        --program-prefix=${crossgcc-target}- --mandir='${prefix}/share/man' \
41                                        --disable-werror
42
43build.dir               ${workpath}/build
44                                       
45# We don't want the etc module.
46post-extract {
47        system "rm -rf ${worksrcpath}/etc"
48}
49
50post-patch {
51        namespace eval crossgcc {}
52
53        # Fix the info pages and related stuff.
54        #       
55        # path: path to the doc directory (e.g. gas/doc/)
56        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
57        # name: name of the info page (e.g. as)
58        # suffix: suffix of the souce page (texinfo or texi)
59        proc crossgcc::fixinfo { path makefile name suffix } {
60                global crossgcc-target worksrcpath
61
62                # Fix the source
63                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
64                        ${worksrcpath}/${path}/${name}.${suffix}
65                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
66                        ${worksrcpath}/${path}/${name}.${suffix}
67                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
68                        ${worksrcpath}/${path}/${name}.${suffix}
69               
70                # Fix the Makefile
71                reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \
72                        ${worksrcpath}/${makefile}
73                reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
74                        ${worksrcpath}/${makefile}
75               
76                # Rename the source
77                file rename ${worksrcpath}/${path}/${name}.${suffix} \
78                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
79               
80                # Fix install-info's dir.
81                # (note: this may be effectless if there was no info dir to be fixed)
82                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-dir|g" \
83                        "${worksrcpath}/${makefile}"
84        }
85
86        # Fix the gettext files and related stuff.
87        #       
88        # module: name of the module (e.g. gas)
89        proc crossgcc::fixgettext { module } {
90                global crossgcc-target worksrcpath
91
92                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
93                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
94                                "${worksrcpath}/${module}/Makefile.in"
95                }
96                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
97                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
98                                "${worksrcpath}/${module}/doc/Makefile.in"
99                }
100                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
101                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
102                                "${worksrcpath}/${module}/po/Make-in"
103                }
104        }
105
106        # gas/doc/as.texinfo
107        crossgcc::fixinfo gas/doc/ gas/doc/Makefile.in as texinfo
108
109        # bfd/doc/bfd.texinfo
110        crossgcc::fixinfo bfd/doc/ bfd/doc/Makefile.in bfd texinfo
111
112        # binutils/doc/binutils.texi
113        crossgcc::fixinfo binutils/doc/ binutils/doc/Makefile.in binutils texi
114
115        # gprof/gprof.texi
116        crossgcc::fixinfo gprof/ gprof/Makefile.in gprof texi
117
118        # ld/ld.texinfo
119        crossgcc::fixinfo ld/ ld/Makefile.in ld texinfo
120       
121        # gettext stuff.
122        crossgcc::fixgettext bfd
123        crossgcc::fixgettext binutils
124        crossgcc::fixgettext gas
125        crossgcc::fixgettext gprof
126        crossgcc::fixgettext ld
127        crossgcc::fixgettext opcodes
128}
129
130post-destroot {
131        # Installing (host) libiberty was a mistake.
132        if {${configure.build_arch} == "x86_64"} {
133                file delete "${destroot}${prefix}/lib/x86_64/libiberty.a"
134        } else {
135                file delete "${destroot}${prefix}/lib/libiberty.a"
136        }
137}
138
139livecheck.type  freshmeat
140livecheck.name  binutils