source: trunk/dports/cross/m68k-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.5 KB
Line 
1# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $
2
3PortSystem                      1.0
4name                    m68k-elf-gcc
5version                 3.4.6
6revision                        1
7
8# Parameters for this port.
9set newlibversion       1.15.0
10set crossgcc-target m68k-elf
11set default-languages --enable-languages="c,c++,f77,objc"
12
13description             gcc cross-compilers for m68k-elf, with newlib runtime library.
14long_description        gnu compilers collection (including c++, fortran and objc) for \
15                                        m68k-elf, with newlib runtime library.
16homepage                        http://gcc.gnu.org/
17platforms               darwin
18categories              cross devel
19maintainers             kallisys.net:pguyot
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 4a21ac777d4b5617283ce488b808da7b \
27                                                sha1 97b290fdc572c8e490b3b39f243e69bacad23c2b \
28                                                rmd160 b15003368cedc7964f6ceaee0c39ddc43a46c442 \
29                                        newlib-${newlibversion}.tar.gz \
30                                                md5 4020004b1b7a56ca4cf7f6d35b40a4cb \
31                                                sha1 f6860b36e48fb831a30bab491230bbc7ce2669a2 \
32                                                rmd160 e57cbb5b3f007ec26a4ec62f5652e23523357001
33patchfiles                      patch-gcc-Makefile.in
34
35# All cross ports violate the mtree layout.
36destroot.violate_mtree  yes
37
38# Download everything to gcc/
39dist_subdir                     gcc
40
41depends_lib                     bin:${crossgcc-target}-ar:${crossgcc-target}-binutils \
42                                        bin:${crossgcc-target}-as:${crossgcc-target}-binutils \
43                                        bin:${crossgcc-target}-ld:${crossgcc-target}-binutils \
44                                        bin:${crossgcc-target}-nm:${crossgcc-target}-binutils \
45                                        bin:${crossgcc-target}-ranlib:${crossgcc-target}-binutils
46depends_build           bin:msgfmt:gettext
47
48# gcc is .bz2, newlib is .gz.
49# let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
50use_bzip2                       yes
51extract.only            gcc-${version}.tar.bz2
52
53# Extract newlib and create a symlink of newlib/newlib in gcc directory.
54post-extract    {
55        system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
56        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
57}
58
59# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
60# program names as gcc's name (add -${version} with ${version} being the version of gcc).
61# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
62# had, they would actually have the binutils' version suffix (and not gcc's version).
63# So let's tell gcc's Makefile not to do that mistake.
64
65set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
66                                AS_FOR_TARGET=${crossgcc-target}-as \
67                                LD_FOR_TARGET=${crossgcc-target}-ld \
68                                NM_FOR_TARGET=${crossgcc-target}-nm \
69                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
70
71# Build in a different directory, as advised in the README file.
72pre-configure   {
73        file mkdir "${workpath}/build"
74}
75configure.dir   ${workpath}/build
76configure.cmd   ${workpath}/gcc-${version}/configure
77configure.cc    "cc -no-cpp-precomp"
78configure.env   ${environment}
79configure.args  --infodir='${prefix}/share/info' \
80                                --mandir='${prefix}/share/man' \
81                                --target=${crossgcc-target} \
82                                --program-prefix=${crossgcc-target}- \
83                                --program-suffix=-${version} \
84                                --with-included-gettext \
85                                --enable-obsolete \
86                                --with-newlib \
87                                --enable-multilib \
88                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
89                                ${default-languages}
90
91build.dir       ${workpath}/build
92
93build.args              ${environment}
94destroot.args   ${environment}
95
96# Variant to include java tools.
97# I'm not exactly sure what the interest of this variant is except to measure
98# the speed of your Xserve G5 farm. Or your patience if you don't have such
99# a farm.
100variant java {
101        configure.args-delete ${default-languages}
102}
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                }
164                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
165                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
166                                "${worksrcpath}/${module}/doc/Makefile.in"
167                }
168                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
169                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
170                                "${worksrcpath}/${module}/po/Make-in"
171                }
172        }
173
174        # gcc/doc/cpp.texi
175        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
176
177        # gcc/doc/cppinternals.texi
178        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
179
180        # gcc/doc/gcc.texi
181        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
182
183        # gcc/doc/gccint.texi
184        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
185
186        # gcc/f/g77.texi
187        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
188
189        # gcc/java/gcj.texi
190        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
191
192        # fastjar/fastjar.texi
193        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
194       
195        # gcc/doc/gccinstall.info
196        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
197
198        # gettext stuff.
199        crossgcc::fixgettext gcc
200        crossgcc::fixgettext fastjar
201}
202
203pre-destroot {
204        # gcc needs the cross directory structure to be present
205        # in order to fill it during installation.
206        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
207        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
208}
209
210post-destroot {
211        namespace eval crossgcc {}
212
213        # Rename a man page if it exists.
214        #
215        # section: section of the man page (e.g. 1)
216        # manpage: name of the man page (e.g. cpp)
217        proc crossgcc::rename_man_page { section manpage } {
218                global crossgcc-target destroot prefix
219
220                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
221                if { [ file exists ${manpage_path} ] } {
222                        file rename ${manpage_path} \
223                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
224                }
225        }
226
227        # Stuff I don't want (either because they're in the system
228        # or because they would conflict with other FSF ports)
229        # (it's easier for maintainability purposes to fix things here)
230
231        # aliases for locales (should be on the system)
232        file delete "${destroot}/${prefix}/share/locale/locale.alias"
233       
234        # FSF propaganda (should already be there or would conflict)
235        file delete -force "${destroot}/${prefix}/share/man/man7"
236
237        # (host) libiberty
238        file delete "${destroot}/${prefix}/lib/libiberty.a"
239
240        # aliases for charsets (should already be there)
241        file delete "${destroot}/${prefix}/lib/charset.alias"
242       
243        # Remove man pages for tools that are not built as part of cross-gcc
244        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
245        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
246        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
247        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
248       
249        # For some reason, some man pages are not prefixed while they should have been
250        # (to avoid conflicting).
251        crossgcc::rename_man_page 1 cpp
252        crossgcc::rename_man_page 1 gcjh
253        crossgcc::rename_man_page 1 gcov
254        crossgcc::rename_man_page 1 jcf-dump
255        crossgcc::rename_man_page 1 jv-scan
256       
257        # There is a bug in gcc/Makefile::install-driver
258        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
259        # $(target_noncanonical)-gcc-$(version)
260        # and hence the driver isn't installed.
261        xinstall -c "${workpath}/build/gcc/xgcc" \
262                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
263}
264
265livecheck.check regex
266livecheck.url   http://gcc.gnu.org/releases.html
267livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.