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

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

revbump due to the upgrade to MPFR 3.0.0 (libmpfr.1.dylib changed
to libmpfr.4.dylib), see #25258.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.4 KB
Line 
1# $Id: Portfile 68933 2010-06-18 09:03:47Z vinc17@macports.org $
2
3PortSystem                      1.0
4name                    i386-elf-gcc
5version                 4.3.2
6revision                1
7
8# Parameters for this port.
9set newlibversion       1.16.0
10set crossgcc-target i386-elf
11set default-languages --enable-languages="c,c++,objc"
12
13description             gcc cross-compilers for i386-elf, with newlib runtime library.
14long_description        gnu compilers collection (including c++, fortran and objc) for \
15                                        i386-elf, with newlib runtime library.
16homepage                        http://gcc.gnu.org/
17platforms               darwin
18categories              cross devel
19maintainers             coresystems.de:stepan
20master_sites            gnu:gcc/gcc-${version}/:gcc \
21                                        ftp://sources.redhat.com/pub/newlib/:newlib \
22                                        ftp://ftp.mirror.ac.uk/sites/sources.redhat.com/pub/newlib/:newlib
23distfiles                       gcc-${version}.tar.bz2:gcc newlib-${newlibversion}.tar.gz:newlib
24worksrcdir                      gcc-${version}
25checksums                       gcc-${version}.tar.bz2 \
26                    md5     5dfac5da961ecd5f227c3175859a486d \
27                    sha1    787b566ad4f386a9896e2d5703e6ff5e7ccaca58 \
28                    rmd160  0ced28bd2e0d89f081cf88273b5f1530599b52fb \
29                                        newlib-${newlibversion}.tar.gz \
30                    md5     bf8f1f9e3ca83d732c00a79a6ef29bc4 \
31                    sha1    841edec33d19a9e549984982fb92445ee967e265 \
32                    rmd160  fa40ff43e858da3093c9f3b5b203724b9b327696
33patchfiles                      patch-gcc-Makefile.in \
34                                Make-lang.in.diff
35
36# All cross ports violate the mtree layout.
37destroot.violate_mtree  yes
38
39# Download everything to gcc/
40dist_subdir                     gcc
41
42depends_lib                     port:${crossgcc-target}-binutils \
43                    port:gmp \
44                    port:mpfr \
45                    port: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.cc    "cc -no-cpp-precomp -I${prefix}/include"
77configure.env   ${environment}
78configure.args  --infodir='${prefix}/share/info' \
79                                --mandir='${prefix}/share/man' \
80                                --target=${crossgcc-target} \
81                                --program-prefix=${crossgcc-target}- \
82                                --program-suffix=-${version} \
83                                --without-included-gettext \
84                                --enable-obsolete \
85                                --with-newlib \
86                                --disable-libgfortran \
87                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
88                                ${default-languages}
89configure.cc_archflags
90configure.cxx_archflags
91configure.objc_archflags
92if {[info exists configure.ld_archflags]} {
93    configure.ld_archflags
94}
95if {${os.platform} == "darwin" && ($build_arch == "x86_64" || $build_arch == "ppc64")} {
96    configure.args-append --build=${build_arch}-apple-darwin${os.major}
97}
98
99build.dir       ${workpath}/build
100
101build.args              ${environment}
102destroot.args   ${environment}
103
104post-patch {
105        namespace eval crossgcc {}
106
107        # Fix the info pages and related stuff.
108        #       
109        # path: path to the doc directory (e.g. gas/doc/)
110        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
111        # name: name of the info page (e.g. as)
112        # suffix: suffix of the souce page (texinfo or texi)
113        proc crossgcc::fixinfo { path makefile name suffix } {
114                global crossgcc-target worksrcpath
115
116                # Fix the source
117                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
118                        ${worksrcpath}/${path}/${name}.${suffix}
119                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
120                        ${worksrcpath}/${path}/${name}.${suffix}
121                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
122                        ${worksrcpath}/${path}/${name}.${suffix}
123               
124                # Fix the 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}.info|${crossgcc-target}-${name}.info|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}.pod|${crossgcc-target}-${name}.pod|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                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
142                        ${worksrcpath}/${makefile}
143               
144                # Rename the source
145                file rename ${worksrcpath}/${path}/${name}.${suffix} \
146                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
147               
148                # Fix install-info's dir.
149                # (note: this may be effectless if there was no info dir to be fixed)
150                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
151                        "${worksrcpath}/${makefile}"
152        }
153
154        # Fix the gettext files and related stuff.
155        #       
156        # module: name of the module (e.g. gas)
157        proc crossgcc::fixgettext { module } {
158                global crossgcc-target worksrcpath
159
160                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
161                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
162                                "${worksrcpath}/${module}/Makefile.in"
163                        reinplace "s|${module}\.mo|${crossgcc-target}-${module}.mo|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        }
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/fortran/gfortran.texi
185        crossgcc::fixinfo gcc/fortran/ gcc/fortran/Make-lang.in gfortran texi
186
187        # gcc/java/gcj.texi
188        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
189
190        # gcc/doc/gccinstall.info
191        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
192
193        # gettext stuff.
194        crossgcc::fixgettext gcc
195        crossgcc::fixgettext libcpp
196}
197
198pre-destroot {
199        # gcc needs the cross directory structure to be present
200        # in order to fill it during installation.
201        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
202        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
203}
204
205post-destroot {
206        namespace eval crossgcc {}
207
208        # Rename a man page if it exists.
209        #
210        # section: section of the man page (e.g. 1)
211        # manpage: name of the man page (e.g. cpp)
212        proc crossgcc::rename_man_page { section manpage } {
213                global crossgcc-target destroot prefix
214
215                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
216                if { [ file exists ${manpage_path} ] } {
217                        file rename ${manpage_path} \
218                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
219                }
220        }
221
222        # Stuff I don't want (either because they're in the system
223        # or because they would conflict with other FSF ports)
224        # (it's easier for maintainability purposes to fix things here)
225
226        # aliases for locales (should be on the system)
227        file delete "${destroot}/${prefix}/share/locale/locale.alias"
228       
229        # FSF propaganda (should already be there or would conflict)
230        file delete -force "${destroot}/${prefix}/share/man/man7"
231
232        # (host) libiberty
233        file delete "${destroot}/${prefix}/lib/libiberty.a"
234
235        # aliases for charsets (should already be there)
236        file delete "${destroot}/${prefix}/lib/charset.alias"
237       
238        # Remove man pages for tools that are not built as part of cross-gcc
239        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
240        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
241        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
242        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
243       
244        # For some reason, some man pages are not prefixed while they should have been
245        # (to avoid conflicting).
246        crossgcc::rename_man_page 1 cpp
247        crossgcc::rename_man_page 1 gcjh
248        crossgcc::rename_man_page 1 gcov
249        crossgcc::rename_man_page 1 jcf-dump
250        crossgcc::rename_man_page 1 jv-scan
251       
252        # There is a bug in gcc/Makefile::install-driver
253        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
254        # $(target_noncanonical)-gcc-$(version)
255        # and hence the driver isn't installed.
256        xinstall -c "${workpath}/build/gcc/xgcc" \
257                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
258}
259
260livecheck.type  regex
261livecheck.url   http://gcc.gnu.org/releases.html
262livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.