source: trunk/dports/cross/i386-elf-gcc/Portfile @ 50984

Last change on this file since 50984 was 50984, checked in by and.damore@…, 10 years ago

Maintainer email change, second batch, mail without @macports.org domain are put in domain:user form.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.1 KB
Line 
1# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $
2
3PortSystem                      1.0
4name                    i386-elf-gcc
5version                 4.3.2
6
7# Parameters for this port.
8set newlibversion       1.16.0
9set crossgcc-target i386-elf
10set default-languages --enable-languages="c,c++,objc"
11
12description             gcc cross-compilers for i386-elf, with newlib runtime library.
13long_description        gnu compilers collection (including c++, fortran and objc) for \
14                                        i386-elf, with newlib runtime library.
15homepage                        http://gcc.gnu.org/
16platforms               darwin
17categories              cross devel
18maintainers             coresystems.de:stepan kallisys.net:pguyot openmaintainer
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     5dfac5da961ecd5f227c3175859a486d \
26                    sha1    787b566ad4f386a9896e2d5703e6ff5e7ccaca58 \
27                    rmd160  0ced28bd2e0d89f081cf88273b5f1530599b52fb \
28                                        newlib-${newlibversion}.tar.gz \
29                    md5     bf8f1f9e3ca83d732c00a79a6ef29bc4 \
30                    sha1    841edec33d19a9e549984982fb92445ee967e265 \
31                    rmd160  fa40ff43e858da3093c9f3b5b203724b9b327696
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                     port:${crossgcc-target}-binutils \
41                    port:gmp \
42                    port:mpfr \
43                    port:gettext
44
45# gcc is .bz2, newlib is .gz.
46# let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
47use_bzip2                       yes
48extract.only            gcc-${version}.tar.bz2
49
50# Extract newlib and create a symlink of newlib/newlib in gcc directory.
51post-extract    {
52        system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
53        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
54}
55
56# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
57# program names as gcc's name (add -${version} with ${version} being the version of gcc).
58# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
59# had, they would actually have the binutils' version suffix (and not gcc's version).
60# So let's tell gcc's Makefile not to do that mistake.
61
62set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
63                                AS_FOR_TARGET=${crossgcc-target}-as \
64                                LD_FOR_TARGET=${crossgcc-target}-ld \
65                                NM_FOR_TARGET=${crossgcc-target}-nm \
66                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
67
68# Build in a different directory, as advised in the README file.
69pre-configure   {
70        file mkdir "${workpath}/build"
71}
72configure.dir   ${workpath}/build
73configure.cmd   ${workpath}/gcc-${version}/configure
74configure.cc    "cc -no-cpp-precomp -I${prefix}/include"
75configure.env   ${environment}
76configure.args  --infodir='${prefix}/share/info' \
77                                --mandir='${prefix}/share/man' \
78                                --target=${crossgcc-target} \
79                                --program-prefix=${crossgcc-target}- \
80                                --program-suffix=-${version} \
81                                --without-included-gettext \
82                                --enable-obsolete \
83                                --with-newlib \
84                                --disable-libgfortran \
85                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
86                                ${default-languages}
87
88build.dir       ${workpath}/build
89
90build.args              ${environment}
91destroot.args   ${environment}
92
93post-patch {
94        namespace eval crossgcc {}
95
96        # Fix the info pages and related stuff.
97        #       
98        # path: path to the doc directory (e.g. gas/doc/)
99        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
100        # name: name of the info page (e.g. as)
101        # suffix: suffix of the souce page (texinfo or texi)
102        proc crossgcc::fixinfo { path makefile name suffix } {
103                global crossgcc-target worksrcpath
104
105                # Fix the source
106                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
107                        ${worksrcpath}/${path}/${name}.${suffix}
108                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
109                        ${worksrcpath}/${path}/${name}.${suffix}
110                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
111                        ${worksrcpath}/${path}/${name}.${suffix}
112               
113                # Fix the Makefile
114                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
115                        ${worksrcpath}/${makefile}
116                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
117                        ${worksrcpath}/${makefile}
118                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
119                        ${worksrcpath}/${makefile}
120                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
121                        ${worksrcpath}/${makefile}
122                reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
123                        ${worksrcpath}/${makefile}
124                reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
125                        ${worksrcpath}/${makefile}
126                reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
127                        ${worksrcpath}/${makefile}
128                reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
129                        ${worksrcpath}/${makefile}
130                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
131                        ${worksrcpath}/${makefile}
132               
133                # Rename the source
134                file rename ${worksrcpath}/${path}/${name}.${suffix} \
135                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
136               
137                # Fix install-info's dir.
138                # (note: this may be effectless if there was no info dir to be fixed)
139                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
140                        "${worksrcpath}/${makefile}"
141        }
142
143        # Fix the gettext files and related stuff.
144        #       
145        # module: name of the module (e.g. gas)
146        proc crossgcc::fixgettext { module } {
147                global crossgcc-target worksrcpath
148
149                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
150                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
151                                "${worksrcpath}/${module}/Makefile.in"
152                        reinplace "s|${module}\.mo|${crossgcc-target}-${module}.mo|g" \
153                                "${worksrcpath}/${module}/Makefile.in"
154                }
155                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
156                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
157                                "${worksrcpath}/${module}/doc/Makefile.in"
158                }
159        }
160
161        # gcc/doc/cpp.texi
162        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
163
164        # gcc/doc/cppinternals.texi
165        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
166
167        # gcc/doc/gcc.texi
168        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
169
170        # gcc/doc/gccint.texi
171        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
172
173        # gcc/fortran/gfortran.texi
174        crossgcc::fixinfo gcc/fortran/ gcc/fortran/Make-lang.in gfortran texi
175
176        # gcc/java/gcj.texi
177        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
178
179        # gcc/doc/gccinstall.info
180        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
181
182        # gettext stuff.
183        crossgcc::fixgettext gcc
184        crossgcc::fixgettext libcpp
185}
186
187pre-destroot {
188        # gcc needs the cross directory structure to be present
189        # in order to fill it during installation.
190        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
191        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
192}
193
194post-destroot {
195        namespace eval crossgcc {}
196
197        # Rename a man page if it exists.
198        #
199        # section: section of the man page (e.g. 1)
200        # manpage: name of the man page (e.g. cpp)
201        proc crossgcc::rename_man_page { section manpage } {
202                global crossgcc-target destroot prefix
203
204                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
205                if { [ file exists ${manpage_path} ] } {
206                        file rename ${manpage_path} \
207                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
208                }
209        }
210
211        # Stuff I don't want (either because they're in the system
212        # or because they would conflict with other FSF ports)
213        # (it's easier for maintainability purposes to fix things here)
214
215        # aliases for locales (should be on the system)
216        file delete "${destroot}/${prefix}/share/locale/locale.alias"
217       
218        # FSF propaganda (should already be there or would conflict)
219        file delete -force "${destroot}/${prefix}/share/man/man7"
220
221        # (host) libiberty
222        file delete "${destroot}/${prefix}/lib/libiberty.a"
223
224        # aliases for charsets (should already be there)
225        file delete "${destroot}/${prefix}/lib/charset.alias"
226       
227        # Remove man pages for tools that are not built as part of cross-gcc
228        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
229        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
230        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
231        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
232       
233        # For some reason, some man pages are not prefixed while they should have been
234        # (to avoid conflicting).
235        crossgcc::rename_man_page 1 cpp
236        crossgcc::rename_man_page 1 gcjh
237        crossgcc::rename_man_page 1 gcov
238        crossgcc::rename_man_page 1 jcf-dump
239        crossgcc::rename_man_page 1 jv-scan
240       
241        # There is a bug in gcc/Makefile::install-driver
242        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
243        # $(target_noncanonical)-gcc-$(version)
244        # and hence the driver isn't installed.
245        xinstall -c "${workpath}/build/gcc/xgcc" \
246                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
247}
248
249livecheck.check regex
250livecheck.url   http://gcc.gnu.org/releases.html
251livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.