source: trunk/dports/cross/arm-none-linux-gnueabi-gcc/Portfile @ 114328

Last change on this file since 114328 was 114328, checked in by ryandesign@…, 6 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.4 KB
Line 
1# $Id: Portfile 114328 2013-12-05 10:21:52Z ryandesign@macports.org $
2
3PortSystem                      1.0
4name                    arm-none-linux-gnueabi-gcc
5version                 2005q3-2
6
7# Parameters for this port.
8set gccversion          2005q3
9set scratchboxversion   1.0.5
10set crossgcc-target arm-none-linux-gnueabi
11set default-languages --enable-languages="c,c++,objc"
12
13description             gcc 3.x cross-compilers for arm-none-linux-gnueabi.
14long_description        gnu compilers collection version 3.x (including c++ and objc) for \
15                                        arm-none-linux-gnueabi, Nokia Internet Tablet version from Code Sourcery
16homepage                        http://www.codesourcery.com/gnu_toolchains/arm
17platforms               darwin
18categories              cross devel
19maintainers             nomaintainer
20master_sites            macports:pguyot
21distfiles                       gcc-${version}.tar.bz2
22worksrcdir                      gcc-${gccversion}
23checksums                       gcc-${version}.tar.bz2 \
24                                                md5 8fb231e1d8573b9e14e4d518a1c781a2 \
25                                                sha1 99334733b0e0b2befd7f5eb9c6fac407a71f563e \
26                                                rmd160 8d08aa976a84e9058ae95616c25e2c5a00ac9b4c
27
28# All cross ports violate the mtree layout.
29destroot.violate_mtree  yes
30
31# Download everything to gcc/
32dist_subdir                     gcc
33
34depends_lib                     port:${crossgcc-target}-binutils \
35                                        port:${crossgcc-target}-runtime
36depends_build           bin:msgfmt:gettext
37
38use_bzip2                       yes
39
40# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
41# program names as gcc's name (add -${version} with ${version} being the version of gcc).
42# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
43# had, they would actually have the binutils' version suffix (and not gcc's version).
44# So let's tell gcc's Makefile not to do that mistake.
45
46set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
47                                AS_FOR_TARGET=${crossgcc-target}-as \
48                                LD_FOR_TARGET=${crossgcc-target}-ld \
49                                NM_FOR_TARGET=${crossgcc-target}-nm \
50                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
51
52# fix bad yacc code, ticket #28296
53patchfiles      c-parse.in.patch
54
55# Build in a different directory, as advised in the README file.
56pre-configure   {
57        file mkdir "${workpath}/build"
58}
59configure.dir   ${workpath}/build
60configure.cmd   ${worksrcpath}/configure
61configure.env   ${environment}
62configure.args  --infodir='${prefix}/share/info' \
63                                --mandir='${prefix}/share/man' \
64                                --target=${crossgcc-target} \
65                                --program-prefix=${crossgcc-target}- \
66                                --program-suffix=-${gccversion} \
67                                --with-included-gettext \
68                                --with-headers=${prefix}/${crossgcc-target}/usr/include \
69                                --with-libs=${prefix}/${crossgcc-target}/usr/lib \
70                                --enable-shared \
71                                --enable-threads \
72                                --disable-checking \
73                                --enable-symvers=gnu \
74                                --enable-__cxa_atexit \
75                                --disable-libssp \
76                                --disable-libstdcxx-pch \
77                                --with-cpu= \
78                                --enable-interwork \
79                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
80                                ${default-languages}
81configure.cc_archflags
82configure.cxx_archflags
83configure.objc_archflags
84configure.ld_archflags
85if {${os.platform} eq "darwin" && (${build_arch} eq "x86_64" || ${build_arch} eq "ppc64")} {
86    configure.args-append --build=${build_arch}-apple-darwin${os.version} \
87                          --host=${build_arch}-apple-darwin${os.version}
88}
89
90configure.asroot yes
91build.asroot     yes
92
93build.dir       ${workpath}/build
94
95build.args              ${environment}
96destroot.args   ${environment}
97
98# Variant to include java tools.
99# I'm not exactly sure what the interest of this variant is except to measure
100# the speed of your Xserve G5 farm. Or your patience if you don't have such
101# a farm.
102variant java {
103        configure.args-delete ${default-languages}
104}
105
106post-patch {
107        namespace eval crossgcc {}
108
109        # Fix the info pages and related stuff.
110        #       
111        # path: path to the doc directory (e.g. gas/doc/)
112        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
113        # name: name of the info page (e.g. as)
114        # suffix: suffix of the souce page (texinfo or texi)
115        proc crossgcc::fixinfo { path makefile name suffix } {
116                global crossgcc-target worksrcpath
117
118                # Fix the source
119                if { [ file exists ${worksrcpath}/${path}/${name}.${suffix} ] } {
120                        reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
121                                ${worksrcpath}/${path}/${name}.${suffix}
122                        reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
123                                ${worksrcpath}/${path}/${name}.${suffix}
124                        reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
125                                ${worksrcpath}/${path}/${name}.${suffix}
126                        # Rename the source
127                        file rename ${worksrcpath}/${path}/${name}.${suffix} \
128                                ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
129                }
130               
131                # Fix the Makefile
132                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
133                        ${worksrcpath}/${makefile}
134                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
135                        ${worksrcpath}/${makefile}
136                reinplace "s|/${name}.1|/${crossgcc-target}-${name}.1|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                # Fix install-info's dir.
154                # (note: this may be effectless if there was no info dir to be fixed)
155                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
156                        "${worksrcpath}/${makefile}"
157        }
158
159        # Fix the gettext files and related stuff.
160        #       
161        # module: name of the module (e.g. gas)
162        proc crossgcc::fixgettext { module } {
163                global crossgcc-target worksrcpath
164
165                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
166                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
167                                "${worksrcpath}/${module}/Makefile.in"
168                }
169                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
170                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
171                                "${worksrcpath}/${module}/doc/Makefile.in"
172                }
173                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
174                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
175                                "${worksrcpath}/${module}/po/Make-in"
176                }
177        }
178
179        # gcc/doc/cpp.texi
180        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
181
182        # gcc/doc/cppinternals.texi
183        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
184
185        # gcc/doc/gcc.texi
186        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
187        crossgcc::fixinfo gcc/cp/ gcc/cp/Make-lang.in gcc texi
188        crossgcc::fixinfo gcc/cp/ gcc/cp/Make-lang.in g++ texi
189
190        # gcc/doc/gccint.texi
191        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
192
193        # gcc/f/g77.texi
194        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
195
196        # gcc/java/gcj.texi
197        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
198
199        # fastjar/fastjar.texi
200        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
201       
202        # gettext stuff.
203        crossgcc::fixgettext gcc
204        crossgcc::fixgettext fastjar
205}
206
207pre-destroot {
208        # gcc needs the cross directory structure to be present
209        # in order to fill it during installation.
210        file mkdir "${destroot}${prefix}/${crossgcc-target}/bin"
211        file mkdir "${destroot}${prefix}/${crossgcc-target}/lib"
212}
213
214post-destroot {
215        namespace eval crossgcc {}
216
217        # Rename a man page if it exists.
218        #
219        # section: section of the man page (e.g. 1)
220        # manpage: name of the man page (e.g. cpp)
221        proc crossgcc::rename_man_page { section manpage } {
222                global crossgcc-target destroot prefix
223
224                set manpage_path "${destroot}${prefix}/share/man/man${section}/${manpage}.${section}"
225                if { [ file exists ${manpage_path} ] } {
226                        file rename ${manpage_path} \
227                                "${destroot}${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
228                }
229        }
230
231        # Stuff I don't want (either because they're in the system
232        # or because they would conflict with other FSF ports)
233        # (it's easier for maintainability purposes to fix things here)
234
235        # aliases for locales (should be on the system)
236        file delete "${destroot}${prefix}/share/locale/locale.alias"
237       
238        # FSF propaganda (should already be there or would conflict)
239        file delete -force "${destroot}${prefix}/share/man/man7"
240
241        # (host) libiberty
242        foreach f [glob -directory "${destroot}${prefix}/lib" libiberty.a */libiberty.a] {
243        file delete $f
244    }
245
246        # aliases for charsets (should already be there)
247        file delete "${destroot}${prefix}/lib/charset.alias"
248       
249        # Remove man pages for tools that are not built as part of cross-gcc
250        file delete "${destroot}${prefix}/share/man/man1/rmic.1"
251        file delete "${destroot}${prefix}/share/man/man1/rmiregistry.1"
252        file delete "${destroot}${prefix}/share/man/man1/jv-convert.1"
253        file delete "${destroot}${prefix}/share/man/man1/gij.1"
254       
255        # For some reason, some man pages are not prefixed while they should have been
256        # (to avoid conflicting).
257        crossgcc::rename_man_page 1 cpp
258        crossgcc::rename_man_page 1 gcjh
259        crossgcc::rename_man_page 1 gcov
260        crossgcc::rename_man_page 1 jcf-dump
261        crossgcc::rename_man_page 1 jv-scan
262       
263        # There is a bug in gcc/Makefile::install-driver
264        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
265        # $(target_noncanonical)-gcc-$(version)
266        # and hence the driver isn't installed.
267        xinstall -c "${workpath}/build/gcc/xgcc" \
268                "${destroot}${prefix}/bin/${crossgcc-target}-gcc-${version}"
269}
Note: See TracBrowser for help on using the repository browser.