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

Last change on this file was 114328, checked in by ryandesign@…, 4 years ago

use eq and ne instead of == and != when comparing ${os.arch}, ${configure.build_arch}, ${build_arch}, and some port-specific variables for referring to architectures

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.8 KB
Line 
1# $Id: Portfile 114328 2013-12-05 10:21:52Z ryandesign@macports.org $
2
3PortSystem                      1.0
4
5name                    m68k-elf-gcc
6version                 3.4.6
7revision                        1
8
9# Parameters for this port.
10set newlibversion       1.15.0
11set crossgcc-target m68k-elf
12set default-languages --enable-languages="c,c++,f77,objc"
13
14description             gcc cross-compilers for m68k-elf, with newlib runtime library.
15long_description        gnu compilers collection (including c++, fortran and objc) for \
16                                        m68k-elf, with newlib runtime library.
17homepage                        http://gcc.gnu.org/
18platforms               darwin
19categories              cross devel
20license                 {GPL-2+ Permissive}
21maintainers             nomaintainer
22master_sites            gnu:gcc/gcc-${version}/:gcc \
23                                        ftp://sources.redhat.com/pub/newlib/:newlib \
24                                        ftp://ftp.mirror.ac.uk/sites/sources.redhat.com/pub/newlib/:newlib
25distfiles                       gcc-${version}.tar.bz2:gcc newlib-${newlibversion}.tar.gz:newlib
26worksrcdir                      gcc-${version}
27checksums                       gcc-${version}.tar.bz2 \
28                                                md5 4a21ac777d4b5617283ce488b808da7b \
29                                                sha1 97b290fdc572c8e490b3b39f243e69bacad23c2b \
30                                                rmd160 b15003368cedc7964f6ceaee0c39ddc43a46c442 \
31                                        newlib-${newlibversion}.tar.gz \
32                                                md5 4020004b1b7a56ca4cf7f6d35b40a4cb \
33                                                sha1 f6860b36e48fb831a30bab491230bbc7ce2669a2 \
34                                                rmd160 e57cbb5b3f007ec26a4ec62f5652e23523357001
35patchfiles                      patch-gcc-Makefile.in
36
37# All cross ports violate the mtree layout.
38destroot.violate_mtree  yes
39
40# Download everything to gcc/
41dist_subdir                     gcc
42
43depends_lib                     port:${crossgcc-target}-binutils
44depends_build           port:gettext
45
46# gcc is .bz2, newlib is .gz.
47# let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
48use_bzip2                       yes
49extract.only            gcc-${version}.tar.bz2
50
51# Extract newlib and create a symlink of newlib/newlib in gcc directory.
52post-extract    {
53        system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
54        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
55}
56
57# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
58# program names as gcc's name (add -${version} with ${version} being the version of gcc).
59# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
60# had, they would actually have the binutils' version suffix (and not gcc's version).
61# So let's tell gcc's Makefile not to do that mistake.
62
63set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
64                                AS_FOR_TARGET=${crossgcc-target}-as \
65                                LD_FOR_TARGET=${crossgcc-target}-ld \
66                                NM_FOR_TARGET=${crossgcc-target}-nm \
67                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
68
69# ticket #36574, cf. #31892
70compiler.blacklist  *clang* *llvm-gcc-4.2
71
72# Build in a different directory, as advised in the README file.
73pre-configure   {
74        file mkdir "${workpath}/build"
75}
76configure.dir   ${workpath}/build
77configure.cmd   ${workpath}/gcc-${version}/configure
78configure.env   ${environment}
79configure.cflags-append -DLIBICONV_PLUG
80configure.args  --infodir='${prefix}/share/info' \
81                                --mandir='${prefix}/share/man' \
82                                --target=${crossgcc-target} \
83                                --program-prefix=${crossgcc-target}- \
84                                --program-suffix=-${version} \
85                                --with-included-gettext \
86                                --enable-obsolete \
87                                --with-newlib \
88                                --enable-multilib \
89                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
90                                ${default-languages}
91configure.cc_archflags
92configure.cxx_archflags
93configure.objc_archflags
94configure.ld_archflags
95if {${os.platform} eq "darwin" && (${build_arch} eq "x86_64" || ${build_arch} eq "ppc64")} {
96    configure.args-append --build=${build_arch}-apple-${os.platform}${os.version} \
97                          --host=${build_arch}-apple-${os.platform}${os.version}
98}
99
100build.dir       ${workpath}/build
101
102build.args              ${environment}
103destroot.args   ${environment}
104
105# Variant to include java tools.
106# I'm not exactly sure what the interest of this variant is except to measure
107# the speed of your Xserve G5 farm. Or your patience if you don't have such
108# a farm.
109variant java {
110        configure.args-delete ${default-languages}
111}
112
113post-patch {
114        namespace eval crossgcc {}
115
116        # Fix the info pages and related stuff.
117        #       
118        # path: path to the doc directory (e.g. gas/doc/)
119        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
120        # name: name of the info page (e.g. as)
121        # suffix: suffix of the souce page (texinfo or texi)
122        proc crossgcc::fixinfo { path makefile name suffix } {
123                global crossgcc-target worksrcpath
124
125                # Fix the source
126                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
127                        ${worksrcpath}/${path}/${name}.${suffix}
128                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
129                        ${worksrcpath}/${path}/${name}.${suffix}
130                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
131                        ${worksrcpath}/${path}/${name}.${suffix}
132               
133                # Fix the Makefile
134                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
135                        ${worksrcpath}/${makefile}
136                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
137                        ${worksrcpath}/${makefile}
138                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
139                        ${worksrcpath}/${makefile}
140                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
141                        ${worksrcpath}/${makefile}
142                reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
143                        ${worksrcpath}/${makefile}
144                reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
145                        ${worksrcpath}/${makefile}
146                reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
147                        ${worksrcpath}/${makefile}
148                reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
149                        ${worksrcpath}/${makefile}
150                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
151                        ${worksrcpath}/${makefile}
152               
153                # Rename the source
154                file rename ${worksrcpath}/${path}/${name}.${suffix} \
155                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
156               
157                # Fix install-info's dir.
158                # (note: this may be effectless if there was no info dir to be fixed)
159                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
160                        "${worksrcpath}/${makefile}"
161        }
162
163        # Fix the gettext files and related stuff.
164        #       
165        # module: name of the module (e.g. gas)
166        proc crossgcc::fixgettext { module } {
167                global crossgcc-target worksrcpath
168
169                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
170                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
171                                "${worksrcpath}/${module}/Makefile.in"
172                }
173                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
174                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
175                                "${worksrcpath}/${module}/doc/Makefile.in"
176                }
177                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
178                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
179                                "${worksrcpath}/${module}/po/Make-in"
180                }
181        }
182
183        # gcc/doc/cpp.texi
184        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
185
186        # gcc/doc/cppinternals.texi
187        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
188
189        # gcc/doc/gcc.texi
190        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
191
192        # gcc/doc/gccint.texi
193        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
194
195        # gcc/f/g77.texi
196        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
197
198        # gcc/java/gcj.texi
199        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
200
201        # fastjar/fastjar.texi
202        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
203       
204        # gcc/doc/gccinstall.info
205        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
206
207        # gettext stuff.
208        crossgcc::fixgettext gcc
209        crossgcc::fixgettext fastjar
210}
211
212pre-destroot {
213        # gcc needs the cross directory structure to be present
214        # in order to fill it during installation.
215        file mkdir "${destroot}${prefix}/${crossgcc-target}/bin"
216        file mkdir "${destroot}${prefix}/${crossgcc-target}/lib"
217}
218
219post-destroot {
220        namespace eval crossgcc {}
221
222        # Rename a man page if it exists.
223        #
224        # section: section of the man page (e.g. 1)
225        # manpage: name of the man page (e.g. cpp)
226        proc crossgcc::rename_man_page { section manpage } {
227                global crossgcc-target destroot prefix
228
229                set manpage_path "${destroot}${prefix}/share/man/man${section}/${manpage}.${section}"
230                if { [ file exists ${manpage_path} ] } {
231                        file rename ${manpage_path} \
232                                "${destroot}${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
233                }
234        }
235
236        # Stuff I don't want (either because they're in the system
237        # or because they would conflict with other FSF ports)
238        # (it's easier for maintainability purposes to fix things here)
239
240        # aliases for locales (should be on the system)
241        file delete "${destroot}${prefix}/share/locale/locale.alias"
242       
243        # FSF propaganda (should already be there or would conflict)
244        file delete -force "${destroot}${prefix}/share/man/man7"
245
246        # (host) libiberty
247        foreach f [glob -directory "${destroot}${prefix}/lib" libiberty.a */libiberty.a] {
248        file delete $f
249    }
250
251        # aliases for charsets (should already be there)
252        file delete "${destroot}${prefix}/lib/charset.alias"
253       
254        # Remove man pages for tools that are not built as part of cross-gcc
255        file delete "${destroot}${prefix}/share/man/man1/rmic.1"
256        file delete "${destroot}${prefix}/share/man/man1/rmiregistry.1"
257        file delete "${destroot}${prefix}/share/man/man1/jv-convert.1"
258        file delete "${destroot}${prefix}/share/man/man1/gij.1"
259       
260        # For some reason, some man pages are not prefixed while they should have been
261        # (to avoid conflicting).
262        crossgcc::rename_man_page 1 cpp
263        crossgcc::rename_man_page 1 gcjh
264        crossgcc::rename_man_page 1 gcov
265        crossgcc::rename_man_page 1 jcf-dump
266        crossgcc::rename_man_page 1 jv-scan
267       
268        # There is a bug in gcc/Makefile::install-driver
269        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
270        # $(target_noncanonical)-gcc-$(version)
271        # and hence the driver isn't installed.
272        xinstall -c "${workpath}/build/gcc/xgcc" \
273                "${destroot}${prefix}/bin/${crossgcc-target}-gcc-${version}"
274}
275
276livecheck.type  regex
277livecheck.url   http://gcc.gnu.org/releases.html
278livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.