source: trunk/dports/cross/m68k-elf-gcc/Portfile @ 71533

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

In the interest that all portfiles exemplify correct portfile writing techniques, remove slash before ${prefix} which is not needed because ${prefix} already begins with a slash

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.5 KB
Line 
1# $Id: Portfile 71533 2010-09-15 20:26:12Z ryandesign@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             nomaintainer
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.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                                --with-included-gettext \
84                                --enable-obsolete \
85                                --with-newlib \
86                                --enable-multilib \
87                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
88                                ${default-languages}
89
90build.dir       ${workpath}/build
91
92build.args              ${environment}
93destroot.args   ${environment}
94
95# Variant to include java tools.
96# I'm not exactly sure what the interest of this variant is except to measure
97# the speed of your Xserve G5 farm. Or your patience if you don't have such
98# a farm.
99variant java {
100        configure.args-delete ${default-languages}
101}
102
103post-patch {
104        namespace eval crossgcc {}
105
106        # Fix the info pages and related stuff.
107        #       
108        # path: path to the doc directory (e.g. gas/doc/)
109        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
110        # name: name of the info page (e.g. as)
111        # suffix: suffix of the souce page (texinfo or texi)
112        proc crossgcc::fixinfo { path makefile name suffix } {
113                global crossgcc-target worksrcpath
114
115                # Fix the source
116                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
117                        ${worksrcpath}/${path}/${name}.${suffix}
118                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
119                        ${worksrcpath}/${path}/${name}.${suffix}
120                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
121                        ${worksrcpath}/${path}/${name}.${suffix}
122               
123                # Fix the Makefile
124                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
125                        ${worksrcpath}/${makefile}
126                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
127                        ${worksrcpath}/${makefile}
128                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
129                        ${worksrcpath}/${makefile}
130                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
131                        ${worksrcpath}/${makefile}
132                reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
133                        ${worksrcpath}/${makefile}
134                reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
135                        ${worksrcpath}/${makefile}
136                reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
137                        ${worksrcpath}/${makefile}
138                reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
139                        ${worksrcpath}/${makefile}
140                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
141                        ${worksrcpath}/${makefile}
142               
143                # Rename the source
144                file rename ${worksrcpath}/${path}/${name}.${suffix} \
145                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
146               
147                # Fix install-info's dir.
148                # (note: this may be effectless if there was no info dir to be fixed)
149                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
150                        "${worksrcpath}/${makefile}"
151        }
152
153        # Fix the gettext files and related stuff.
154        #       
155        # module: name of the module (e.g. gas)
156        proc crossgcc::fixgettext { module } {
157                global crossgcc-target worksrcpath
158
159                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
160                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
161                                "${worksrcpath}/${module}/Makefile.in"
162                }
163                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
164                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
165                                "${worksrcpath}/${module}/doc/Makefile.in"
166                }
167                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
168                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
169                                "${worksrcpath}/${module}/po/Make-in"
170                }
171        }
172
173        # gcc/doc/cpp.texi
174        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
175
176        # gcc/doc/cppinternals.texi
177        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
178
179        # gcc/doc/gcc.texi
180        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
181
182        # gcc/doc/gccint.texi
183        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
184
185        # gcc/f/g77.texi
186        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
187
188        # gcc/java/gcj.texi
189        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
190
191        # fastjar/fastjar.texi
192        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
193       
194        # gcc/doc/gccinstall.info
195        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
196
197        # gettext stuff.
198        crossgcc::fixgettext gcc
199        crossgcc::fixgettext fastjar
200}
201
202pre-destroot {
203        # gcc needs the cross directory structure to be present
204        # in order to fill it during installation.
205        file mkdir "${destroot}${prefix}/${crossgcc-target}/bin"
206        file mkdir "${destroot}${prefix}/${crossgcc-target}/lib"
207}
208
209post-destroot {
210        namespace eval crossgcc {}
211
212        # Rename a man page if it exists.
213        #
214        # section: section of the man page (e.g. 1)
215        # manpage: name of the man page (e.g. cpp)
216        proc crossgcc::rename_man_page { section manpage } {
217                global crossgcc-target destroot prefix
218
219                set manpage_path "${destroot}${prefix}/share/man/man${section}/${manpage}.${section}"
220                if { [ file exists ${manpage_path} ] } {
221                        file rename ${manpage_path} \
222                                "${destroot}${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
223                }
224        }
225
226        # Stuff I don't want (either because they're in the system
227        # or because they would conflict with other FSF ports)
228        # (it's easier for maintainability purposes to fix things here)
229
230        # aliases for locales (should be on the system)
231        file delete "${destroot}${prefix}/share/locale/locale.alias"
232       
233        # FSF propaganda (should already be there or would conflict)
234        file delete -force "${destroot}${prefix}/share/man/man7"
235
236        # (host) libiberty
237        file delete "${destroot}${prefix}/lib/libiberty.a"
238
239        # aliases for charsets (should already be there)
240        file delete "${destroot}${prefix}/lib/charset.alias"
241       
242        # Remove man pages for tools that are not built as part of cross-gcc
243        file delete "${destroot}${prefix}/share/man/man1/rmic.1"
244        file delete "${destroot}${prefix}/share/man/man1/rmiregistry.1"
245        file delete "${destroot}${prefix}/share/man/man1/jv-convert.1"
246        file delete "${destroot}${prefix}/share/man/man1/gij.1"
247       
248        # For some reason, some man pages are not prefixed while they should have been
249        # (to avoid conflicting).
250        crossgcc::rename_man_page 1 cpp
251        crossgcc::rename_man_page 1 gcjh
252        crossgcc::rename_man_page 1 gcov
253        crossgcc::rename_man_page 1 jcf-dump
254        crossgcc::rename_man_page 1 jv-scan
255       
256        # There is a bug in gcc/Makefile::install-driver
257        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
258        # $(target_noncanonical)-gcc-$(version)
259        # and hence the driver isn't installed.
260        xinstall -c "${workpath}/build/gcc/xgcc" \
261                "${destroot}${prefix}/bin/${crossgcc-target}-gcc-${version}"
262}
263
264livecheck.type  regex
265livecheck.url   http://gcc.gnu.org/releases.html
266livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.