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

Last change on this file since 24641 was 24641, checked in by pguyot@…, 13 years ago

Add livecheck to my cross-gcc ports.

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