source: trunk/dports/cross/arm-elf-gcc3/Portfile @ 78994

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

arm-elf-gcc, arm-elf-gcc3: disable universal variant

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.7 KB
Line 
1# $Id: Portfile 78994 2011-05-29 07:14:56Z ryandesign@macports.org $
2
3PortSystem                      1.0
4name                    arm-elf-gcc3
5version                 3.4.6
6revision                        2
7
8# Parameters for this port.
9set newlibversion       1.15.0
10set crossgcc-target arm-elf
11set default-languages --enable-languages="c,c++,objc"
12
13# Remark: this port is incompatible with other versions of arm-elf-gcc.
14# If it's a problem, contact me. I'll see what I can do.
15
16description             gcc 3.x cross-compilers for arm-elf, with newlib runtime library.
17long_description        gnu compilers collection version 3.x (including c++, fortran and objc) for \
18                                        arm-elf, with newlib runtime library.
19homepage                        http://gcc.gnu.org/
20platforms               darwin
21categories              cross devel
22maintainers             nomaintainer
23master_sites            gnu:gcc/gcc-${version}/:gcc \
24                                        ftp://sources.redhat.com/pub/newlib/:newlib
25distfiles                       gcc-${version}.tar.bz2:gcc newlib-${newlibversion}.tar.gz:newlib
26worksrcdir                      gcc-${version}
27checksums                       gcc-${version}.tar.bz2 \
28                                                md5 4a21ac777d4b5617283ce488b808da7b \
29                                                sha1 97b290fdc572c8e490b3b39f243e69bacad23c2b \
30                                                rmd160 b15003368cedc7964f6ceaee0c39ddc43a46c442 \
31                                        newlib-${newlibversion}.tar.gz \
32                                                md5 4020004b1b7a56ca4cf7f6d35b40a4cb \
33                                                sha1 f6860b36e48fb831a30bab491230bbc7ce2669a2 \
34                                                rmd160 e57cbb5b3f007ec26a4ec62f5652e23523357001
35patchfiles                      patch-gcc-Makefile.in
36
37# All cross ports violate the mtree layout.
38destroot.violate_mtree  yes
39
40# Download everything to gcc/
41dist_subdir                     gcc
42
43depends_lib                     bin:${crossgcc-target}-ar:${crossgcc-target}-binutils \
44                                        bin:${crossgcc-target}-as:${crossgcc-target}-binutils \
45                                        bin:${crossgcc-target}-ld:${crossgcc-target}-binutils \
46                                        bin:${crossgcc-target}-nm:${crossgcc-target}-binutils \
47                                        bin:${crossgcc-target}-ranlib:${crossgcc-target}-binutils
48depends_build           bin:msgfmt:gettext
49
50# arm-elf-binutils is not universal
51universal_variant       no
52
53# gcc is .bz2, newlib is .gz.
54# let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
55use_bzip2                       yes
56extract.only            gcc-${version}.tar.bz2
57
58# Extract newlib and create a symlink of newlib/newlib in gcc directory.
59post-extract    {
60        system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
61        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
62}
63
64# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
65# program names as gcc's name (add -${version} with ${version} being the version of gcc).
66# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
67# had, they would actually have the binutils' version suffix (and not gcc's version).
68# So let's tell gcc's Makefile not to do that mistake.
69
70set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
71                                AS_FOR_TARGET=${crossgcc-target}-as \
72                                LD_FOR_TARGET=${crossgcc-target}-ld \
73                                NM_FOR_TARGET=${crossgcc-target}-nm \
74                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
75
76# Build in a different directory, as advised in the README file.
77pre-configure   {
78        file mkdir "${workpath}/build"
79}
80configure.dir   ${workpath}/build
81configure.cmd   ${workpath}/gcc-${version}/configure
82configure.env   ${environment}
83configure.args  --infodir='${prefix}/share/info' \
84                                --mandir='${prefix}/share/man' \
85                                --target=${crossgcc-target} \
86                                --program-prefix=${crossgcc-target}- \
87                                --program-suffix=-${version} \
88                                --with-included-gettext \
89                                --enable-obsolete \
90                                --with-newlib \
91                                --enable-multilib \
92                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
93                                ${default-languages}
94
95build.dir       ${workpath}/build
96
97build.args              ${environment}
98destroot.args   ${environment}
99
100# Variant to include java tools.
101# I'm not exactly sure what the interest of this variant is except to measure
102# the speed of your Xserve G5 farm. Or your patience if you don't have such
103# a farm.
104variant java {
105        configure.args-delete ${default-languages}
106}
107
108post-patch {
109        namespace eval crossgcc {}
110
111        # Fix the info pages and related stuff.
112        #       
113        # path: path to the doc directory (e.g. gas/doc/)
114        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
115        # name: name of the info page (e.g. as)
116        # suffix: suffix of the souce page (texinfo or texi)
117        proc crossgcc::fixinfo { path makefile name suffix } {
118                global crossgcc-target worksrcpath
119
120                # Fix the source
121                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
122                        ${worksrcpath}/${path}/${name}.${suffix}
123                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
124                        ${worksrcpath}/${path}/${name}.${suffix}
125                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
126                        ${worksrcpath}/${path}/${name}.${suffix}
127               
128                # Fix the Makefile
129                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
130                        ${worksrcpath}/${makefile}
131                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
132                        ${worksrcpath}/${makefile}
133                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
134                        ${worksrcpath}/${makefile}
135                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
136                        ${worksrcpath}/${makefile}
137                reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
138                        ${worksrcpath}/${makefile}
139                reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
140                        ${worksrcpath}/${makefile}
141                reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
142                        ${worksrcpath}/${makefile}
143                reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
144                        ${worksrcpath}/${makefile}
145                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
146                        ${worksrcpath}/${makefile}
147               
148                # Rename the source
149                file rename ${worksrcpath}/${path}/${name}.${suffix} \
150                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
151               
152                # Fix install-info's dir.
153                # (note: this may be effectless if there was no info dir to be fixed)
154                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
155                        "${worksrcpath}/${makefile}"
156        }
157
158        # Fix the gettext files and related stuff.
159        #       
160        # module: name of the module (e.g. gas)
161        proc crossgcc::fixgettext { module } {
162                global crossgcc-target worksrcpath
163
164                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
165                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
166                                "${worksrcpath}/${module}/Makefile.in"
167                }
168                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
169                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
170                                "${worksrcpath}/${module}/doc/Makefile.in"
171                }
172                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
173                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
174                                "${worksrcpath}/${module}/po/Make-in"
175                }
176        }
177
178        # gcc/doc/cpp.texi
179        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
180
181        # gcc/doc/cppinternals.texi
182        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
183
184        # gcc/doc/gcc.texi
185        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
186
187        # gcc/doc/gccint.texi
188        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
189
190        # gcc/f/g77.texi
191        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
192
193        # gcc/java/gcj.texi
194        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
195
196        # fastjar/fastjar.texi
197        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
198       
199        # gcc/doc/gccinstall.info
200        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
201
202        # gettext stuff.
203        crossgcc::fixgettext gcc
204        crossgcc::fixgettext fastjar
205}
206
207pre-destroot {
208        # gcc needs the cross directory structure to be present
209        # in order to fill it during installation.
210        file mkdir "${destroot}${prefix}/${crossgcc-target}/bin"
211        file mkdir "${destroot}${prefix}/${crossgcc-target}/lib"
212}
213
214post-destroot {
215        namespace eval crossgcc {}
216
217        # Rename a man page if it exists.
218        #
219        # section: section of the man page (e.g. 1)
220        # manpage: name of the man page (e.g. cpp)
221        proc crossgcc::rename_man_page { section manpage } {
222                global crossgcc-target destroot prefix
223
224                set manpage_path "${destroot}${prefix}/share/man/man${section}/${manpage}.${section}"
225                if { [ file exists ${manpage_path} ] } {
226                        file rename ${manpage_path} \
227                                "${destroot}${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
228                }
229        }
230
231        # Stuff I don't want (either because they're in the system
232        # or because they would conflict with other FSF ports)
233        # (it's easier for maintainability purposes to fix things here)
234
235        # aliases for locales (should be on the system)
236        file delete "${destroot}${prefix}/share/locale/locale.alias"
237       
238        # FSF propaganda (should already be there or would conflict)
239        file delete -force "${destroot}${prefix}/share/man/man7"
240
241        # (host) libiberty
242        foreach f [glob -directory "${destroot}${prefix}/lib" libiberty.a */libiberty.a] {
243        file delete $f
244    }
245
246        # aliases for charsets (should already be there)
247        file delete "${destroot}${prefix}/lib/charset.alias"
248       
249        # Remove man pages for tools that are not built as part of cross-gcc
250        file delete "${destroot}${prefix}/share/man/man1/rmic.1"
251        file delete "${destroot}${prefix}/share/man/man1/rmiregistry.1"
252        file delete "${destroot}${prefix}/share/man/man1/jv-convert.1"
253        file delete "${destroot}${prefix}/share/man/man1/gij.1"
254       
255        # For some reason, some man pages are not prefixed while they should have been
256        # (to avoid conflicting).
257        crossgcc::rename_man_page 1 cpp
258        crossgcc::rename_man_page 1 gcjh
259        crossgcc::rename_man_page 1 gcov
260        crossgcc::rename_man_page 1 jcf-dump
261        crossgcc::rename_man_page 1 jv-scan
262       
263        # There is a bug in gcc/Makefile::install-driver
264        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
265        # $(target_noncanonical)-gcc-$(version)
266        # and hence the driver isn't installed.
267        xinstall -c "${workpath}/build/gcc/xgcc" \
268                "${destroot}${prefix}/bin/${crossgcc-target}-gcc-${version}"
269}
270
271livecheck.type  regex
272livecheck.url   http://gcc.gnu.org/releases.html
273livecheck.regex {<tr><td><a href="gcc-3.*/">GCC (3.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.