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

Last change on this file since 49864 was 49864, checked in by ryandesign@…, 10 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: 9.6 KB
Line 
1# $Id: Portfile 49864 2009-04-19 10:12:39Z 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             pguyot@kallisys.net
23master_sites            gnu:gcc/gcc-${version}/ \
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# gcc is .bz2, newlib is .gz.
51# let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
52use_bzip2                       yes
53extract.only            gcc-${version}.tar.bz2
54
55# Extract newlib and create a symlink of newlib/newlib in gcc directory.
56post-extract    {
57        system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
58        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
59}
60
61# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
62# program names as gcc's name (add -${version} with ${version} being the version of gcc).
63# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
64# had, they would actually have the binutils' version suffix (and not gcc's version).
65# So let's tell gcc's Makefile not to do that mistake.
66
67set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
68                                AS_FOR_TARGET=${crossgcc-target}-as \
69                                LD_FOR_TARGET=${crossgcc-target}-ld \
70                                NM_FOR_TARGET=${crossgcc-target}-nm \
71                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
72
73# Build in a different directory, as advised in the README file.
74pre-configure   {
75        file mkdir "${workpath}/build"
76}
77configure.dir   ${workpath}/build
78configure.cmd   ${workpath}/gcc-${version}/configure
79configure.cc   "cc -no-cpp-precomp"
80configure.env   ${environment}
81configure.args  --infodir='${prefix}/share/info' \
82                                --mandir='${prefix}/share/man' \
83                                --target=${crossgcc-target} \
84                                --program-prefix=${crossgcc-target}- \
85                                --program-suffix=-${version} \
86                                --with-included-gettext \
87                                --enable-obsolete \
88                                --with-newlib \
89                                --enable-multilib \
90                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
91                                ${default-languages}
92
93build.dir       ${workpath}/build
94
95build.args              ${environment}
96destroot.args   ${environment}
97
98# Variant to include java tools.
99# I'm not exactly sure what the interest of this variant is except to measure
100# the speed of your Xserve G5 farm. Or your patience if you don't have such
101# a farm.
102variant java {
103        configure.args-delete ${default-languages}
104}
105
106post-patch {
107        namespace eval crossgcc {}
108
109        # Fix the info pages and related stuff.
110        #       
111        # path: path to the doc directory (e.g. gas/doc/)
112        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
113        # name: name of the info page (e.g. as)
114        # suffix: suffix of the souce page (texinfo or texi)
115        proc crossgcc::fixinfo { path makefile name suffix } {
116                global crossgcc-target worksrcpath
117
118                # Fix the source
119                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
120                        ${worksrcpath}/${path}/${name}.${suffix}
121                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
122                        ${worksrcpath}/${path}/${name}.${suffix}
123                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
124                        ${worksrcpath}/${path}/${name}.${suffix}
125               
126                # Fix the Makefile
127                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
128                        ${worksrcpath}/${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}.pod| ${crossgcc-target}-${name}.pod|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}.${suffix}| ${crossgcc-target}-${name}.${suffix}|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               
146                # Rename the source
147                file rename ${worksrcpath}/${path}/${name}.${suffix} \
148                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
149               
150                # Fix install-info's dir.
151                # (note: this may be effectless if there was no info dir to be fixed)
152                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
153                        "${worksrcpath}/${makefile}"
154        }
155
156        # Fix the gettext files and related stuff.
157        #       
158        # module: name of the module (e.g. gas)
159        proc crossgcc::fixgettext { module } {
160                global crossgcc-target worksrcpath
161
162                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
163                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
164                                "${worksrcpath}/${module}/Makefile.in"
165                }
166                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
167                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
168                                "${worksrcpath}/${module}/doc/Makefile.in"
169                }
170                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
171                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
172                                "${worksrcpath}/${module}/po/Make-in"
173                }
174        }
175
176        # gcc/doc/cpp.texi
177        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
178
179        # gcc/doc/cppinternals.texi
180        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
181
182        # gcc/doc/gcc.texi
183        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
184
185        # gcc/doc/gccint.texi
186        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
187
188        # gcc/f/g77.texi
189        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
190
191        # gcc/java/gcj.texi
192        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
193
194        # fastjar/fastjar.texi
195        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
196       
197        # gcc/doc/gccinstall.info
198        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
199
200        # gettext stuff.
201        crossgcc::fixgettext gcc
202        crossgcc::fixgettext fastjar
203}
204
205pre-destroot {
206        # gcc needs the cross directory structure to be present
207        # in order to fill it during installation.
208        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
209        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
210}
211
212post-destroot {
213        namespace eval crossgcc {}
214
215        # Rename a man page if it exists.
216        #
217        # section: section of the man page (e.g. 1)
218        # manpage: name of the man page (e.g. cpp)
219        proc crossgcc::rename_man_page { section manpage } {
220                global crossgcc-target destroot prefix
221
222                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
223                if { [ file exists ${manpage_path} ] } {
224                        file rename ${manpage_path} \
225                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
226                }
227        }
228
229        # Stuff I don't want (either because they're in the system
230        # or because they would conflict with other FSF ports)
231        # (it's easier for maintainability purposes to fix things here)
232
233        # aliases for locales (should be on the system)
234        file delete "${destroot}/${prefix}/share/locale/locale.alias"
235       
236        # FSF propaganda (should already be there or would conflict)
237        file delete -force "${destroot}/${prefix}/share/man/man7"
238
239        # (host) libiberty
240        file delete "${destroot}/${prefix}/lib/libiberty.a"
241
242        # aliases for charsets (should already be there)
243        file delete "${destroot}/${prefix}/lib/charset.alias"
244       
245        # Remove man pages for tools that are not built as part of cross-gcc
246        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
247        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
248        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
249        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
250       
251        # For some reason, some man pages are not prefixed while they should have been
252        # (to avoid conflicting).
253        crossgcc::rename_man_page 1 cpp
254        crossgcc::rename_man_page 1 gcjh
255        crossgcc::rename_man_page 1 gcov
256        crossgcc::rename_man_page 1 jcf-dump
257        crossgcc::rename_man_page 1 jv-scan
258       
259        # There is a bug in gcc/Makefile::install-driver
260        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
261        # $(target_noncanonical)-gcc-$(version)
262        # and hence the driver isn't installed.
263        xinstall -c "${workpath}/build/gcc/xgcc" \
264                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
265}
266
267livecheck.check regex
268livecheck.url   http://gcc.gnu.org/releases.html
269livecheck.regex {<tr><td><a href="gcc-3.*/">GCC (3.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.