source: trunk/dports/cross/mips-elf-gcc/Portfile @ 69904

Last change on this file since 69904 was 69904, checked in by jmr@…, 9 years ago

multiple ports: remove adding of -no-cpp-precomp, which has done nothing since gcc 3.3

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