source: trunk/dports/cross/arm-elf-gcc/Portfile @ 49864

Last change on this file since 49864 was 49864, checked in by ryandesign@…, 11 years ago

pguyot's ports: remove references to DP; closes #18037 (maintainer timeout)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.9 KB
Line 
1# $Id: Portfile 49864 2009-04-19 10:12:39Z ryandesign@macports.org $
2
3PortSystem                      1.0
4
5name                    arm-elf-gcc
6version                 4.3.2
7
8# Parameters for this port.
9set newlibversion       1.16.0
10set crossgcc-target arm-elf
11set default-languages --enable-languages="c,c++,objc"
12
13description             gcc cross-compilers for arm-elf, with newlib runtime library.
14long_description        gnu compilers collection (including c++, fortran and objc) for \
15                                        arm-elf, with newlib runtime library.
16homepage                        http://gcc.gnu.org/
17platforms               darwin
18categories              cross devel
19maintainers             pguyot@kallisys.net openmaintainer
20master_sites            gnu:gcc/gcc-${version}/:gcc \
21                                        ftp://sources.redhat.com/pub/newlib/:newlib \
22                                        ftp://ftp.mirror.ac.uk/sites/sources.redhat.com/pub/newlib/:newlib
23distfiles                       gcc-${version}.tar.bz2:gcc newlib-${newlibversion}.tar.gz:newlib
24worksrcdir                      gcc-${version}
25checksums                       gcc-${version}.tar.bz2 \
26                    md5     5dfac5da961ecd5f227c3175859a486d \
27                    sha1    787b566ad4f386a9896e2d5703e6ff5e7ccaca58 \
28                    rmd160  0ced28bd2e0d89f081cf88273b5f1530599b52fb \
29                                        newlib-${newlibversion}.tar.gz \
30                                                md5 bf8f1f9e3ca83d732c00a79a6ef29bc4 \
31                                                sha1 841edec33d19a9e549984982fb92445ee967e265 \
32                                                rmd160 fa40ff43e858da3093c9f3b5b203724b9b327696
33patchfiles                      patch-gcc-config-arm-t-arm-elf.diff \
34                                        patch-newlib-libc-configure.diff
35
36# All cross ports violate the mtree layout.
37destroot.violate_mtree  yes
38
39# Download everything to gcc/
40dist_subdir                     gcc
41
42depends_lib                     port:${crossgcc-target}-binutils \
43                    port:gmp \
44                    port:mpfr \
45                    port:gettext
46
47# gcc is .bz2, newlib is .gz.
48# let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
49use_bzip2                       yes
50extract.only            gcc-${version}.tar.bz2
51
52# Extract newlib and create a symlink of newlib/newlib in gcc directory.
53post-extract    {
54        system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
55        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
56}
57
58# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
59# program names as gcc's name (add -${version} with ${version} being the version of gcc).
60# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
61# had, they would actually have the binutils' version suffix (and not gcc's version).
62# So let's tell gcc's Makefile not to do that mistake.
63
64set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
65                                AS_FOR_TARGET=${crossgcc-target}-as \
66                                LD_FOR_TARGET=${crossgcc-target}-ld \
67                                NM_FOR_TARGET=${crossgcc-target}-nm \
68                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
69
70proc multilibpatch_enable { options dirnames exceptions matches } {
71        global worksrcpath
72        system "echo 'MULTILIB_OPTIONS += ${options}' >> ${worksrcpath}/gcc/config/arm/t-arm-elf"
73        system "echo 'MULTILIB_DIRNAMES += ${dirnames}' >> ${worksrcpath}/gcc/config/arm/t-arm-elf"
74        system "echo 'MULTILIB_EXCEPTIONS += ${exceptions}' >> ${worksrcpath}/gcc/config/arm/t-arm-elf"
75        system "echo 'MULTILIB_MATCHES += ${matches}' >> ${worksrcpath}/gcc/config/arm/t-arm-elf"
76}
77
78variant be description {big endian multilib support} {
79        post-patch {
80                multilibpatch_enable \
81                        "mlittle-endian/mbig-endian" \
82                        "le be" \
83                        "" \
84                        "mbig-endian=mbe mlittle-endian=mle"
85        }
86}
87
88variant ep9312 description {ep9312 multilib support} {
89        post-patch {
90                multilibpatch_enable \
91                        "mcpu=ep9312" \
92                        "ep9312" \
93                        "*mthumb/*mcpu=ep9312* *mcpu=ep9312*/*mhard-float*" \
94                        ""
95        }
96}
97
98variant fpu description {fpu multilib support} {
99        post-patch {
100                multilibpatch_enable \
101                        "mhard-float/msoft-float" \
102                        "fpu soft" \
103                        "*mthumb/*mhard-float*" \
104                        ""
105        }
106        configure.args-append   --enable-fpu
107}
108
109variant interwork description {thumb interwork multilib support} {
110        post-patch {
111                multilibpatch_enable \
112                        "mno-thumb-interwork/mthumb-interwork" \
113                        "normal interwork" \
114                        "" \
115                        ""
116        }
117        configure.args-append   --enable-interwork
118}
119
120variant under description {leading underscore multilib support} {
121        post-patch {
122                multilibpatch_enable \
123                        "fno-leading-underscore/fleading-underscore" \
124                        "elf under" \
125                        "" \
126                        ""
127        }
128        configure.args-append   --enable-underscore
129}
130
131variant nofmult description {no fpu multiplication multilib support} {
132        post-patch {
133                multilibpatch_enable \
134                        "mcpu=arm7" \
135                        "nofmult" \
136                        "*mthumb*/*mcpu=arm7*" \
137                        ""
138        }
139        configure.args-append   --enable-nofmult
140}
141
142# Build in a different directory, as advised in the README file.
143pre-configure   {
144        file mkdir "${workpath}/build"
145}
146configure.dir   ${workpath}/build
147configure.cmd   ${workpath}/gcc-${version}/configure
148configure.cc    "cc -no-cpp-precomp -I${prefix}/include"
149configure.env   ${environment}
150configure.args  --infodir='${prefix}/share/info' \
151                                --mandir='${prefix}/share/man' \
152                                --target=${crossgcc-target} \
153                                --program-prefix=${crossgcc-target}- \
154                                --program-suffix=-${version} \
155                                --without-included-gettext \
156                                --enable-obsolete \
157                                --with-newlib \
158                                --enable-multilib \
159                                --enable-biendian \
160                                --disable-libgfortran \
161                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
162                                ${default-languages}
163
164build.dir       ${workpath}/build
165
166build.args              ${environment}
167destroot.args   ${environment}
168
169post-patch {
170        namespace eval crossgcc {}
171
172        # Fix the info pages and related stuff.
173        #       
174        # path: path to the doc directory (e.g. gas/doc/)
175        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
176        # name: name of the info page (e.g. as)
177        # suffix: suffix of the souce page (texinfo or texi)
178        proc crossgcc::fixinfo { path makefile name suffix } {
179                global crossgcc-target worksrcpath
180
181                # Fix the source
182                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
183                        ${worksrcpath}/${path}/${name}.${suffix}
184                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
185                        ${worksrcpath}/${path}/${name}.${suffix}
186                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
187                        ${worksrcpath}/${path}/${name}.${suffix}
188               
189                # Fix the Makefile
190                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
191                        ${worksrcpath}/${makefile}
192                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
193                        ${worksrcpath}/${makefile}
194                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
195                        ${worksrcpath}/${makefile}
196                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
197                        ${worksrcpath}/${makefile}
198                reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
199                        ${worksrcpath}/${makefile}
200                reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
201                        ${worksrcpath}/${makefile}
202                reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
203                        ${worksrcpath}/${makefile}
204                reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
205                        ${worksrcpath}/${makefile}
206                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
207                        ${worksrcpath}/${makefile}
208               
209                # Rename the source
210                file rename ${worksrcpath}/${path}/${name}.${suffix} \
211                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
212               
213                # Fix install-info's dir.
214                # (note: this may be effectless if there was no info dir to be fixed)
215                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
216                        "${worksrcpath}/${makefile}"
217        }
218
219        # Fix the gettext files and related stuff.
220        #       
221        # module: name of the module (e.g. gas)
222        proc crossgcc::fixgettext { module } {
223                global crossgcc-target worksrcpath
224
225                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
226                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
227                                "${worksrcpath}/${module}/Makefile.in"
228                        reinplace "s|${module}\.mo|${crossgcc-target}-${module}.mo|g" \
229                                "${worksrcpath}/${module}/Makefile.in"
230                }
231                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
232                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
233                                "${worksrcpath}/${module}/doc/Makefile.in"
234                }
235        }
236
237        # gcc/doc/cpp.texi
238        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
239
240        # gcc/doc/cppinternals.texi
241        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
242
243        # gcc/doc/gcc.texi
244        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
245
246        # gcc/doc/gccint.texi
247        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
248
249        # gcc/fortran/gfortran.texi
250        crossgcc::fixinfo gcc/fortran/ gcc/fortran/Make-lang.in gfortran texi
251
252        # gcc/java/gcj.texi
253        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
254
255        # gcc/doc/gccinstall.info
256        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
257
258        # gettext stuff.
259        crossgcc::fixgettext gcc
260        crossgcc::fixgettext libcpp
261}
262
263pre-destroot {
264        # gcc needs the cross directory structure to be present
265        # in order to fill it during installation.
266        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
267        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
268}
269
270post-destroot {
271        namespace eval crossgcc {}
272
273        # Rename a man page if it exists.
274        #
275        # section: section of the man page (e.g. 1)
276        # manpage: name of the man page (e.g. cpp)
277        proc crossgcc::rename_man_page { section manpage } {
278                global crossgcc-target destroot prefix
279
280                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
281                if { [ file exists ${manpage_path} ] } {
282                        file rename ${manpage_path} \
283                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
284                }
285        }
286
287        # Stuff I don't want (either because they're in the system
288        # or because they would conflict with other FSF ports)
289        # (it's easier for maintainability purposes to fix things here)
290
291        # aliases for locales (should be on the system)
292        file delete "${destroot}/${prefix}/share/locale/locale.alias"
293       
294        # FSF propaganda (should already be there or would conflict)
295        file delete -force "${destroot}/${prefix}/share/man/man7"
296
297        # (host) libiberty
298        file delete "${destroot}/${prefix}/lib/libiberty.a"
299
300        # aliases for charsets (should already be there)
301        file delete "${destroot}/${prefix}/lib/charset.alias"
302       
303        # Remove man pages for tools that are not built as part of cross-gcc
304        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
305        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
306        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
307        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
308       
309        # For some reason, some man pages are not prefixed while they should have been
310        # (to avoid conflicting).
311        crossgcc::rename_man_page 1 cpp
312        crossgcc::rename_man_page 1 gcjh
313        crossgcc::rename_man_page 1 gcov
314        crossgcc::rename_man_page 1 jcf-dump
315        crossgcc::rename_man_page 1 jv-scan
316       
317        # There is a bug in gcc/Makefile::install-driver
318        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
319        # $(target_noncanonical)-gcc-$(version)
320        # and hence the driver isn't installed.
321        xinstall -c "${workpath}/build/gcc/xgcc" \
322                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
323}
324
325livecheck.check regex
326livecheck.url   http://gcc.gnu.org/releases.html
327livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.