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

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

Set svn:eol-style to native per current portfile standards

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.2 KB
Line 
1# $Id: Portfile 27058 2007-07-16 22:18:57Z 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             pguyot@kallisys.net
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# Download everything to gcc/
29dist_subdir                     gcc
30
31depends_lib                     bin:${crossgcc-target}-ar:${crossgcc-target}-binutils \
32                                bin:${crossgcc-target}-as:${crossgcc-target}-binutils \
33                                        bin:${crossgcc-target}-ld:${crossgcc-target}-binutils \
34                                        bin:${crossgcc-target}-nm:${crossgcc-target}-binutils \
35                                        bin:${crossgcc-target}-ranlib:${crossgcc-target}-binutils \
36                                        port:${crossgcc-target}-runtime
37depends_build           bin:msgfmt:gettext
38
39use_bzip2                       yes
40
41# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
42# program names as gcc's name (add -${version} with ${version} being the version of gcc).
43# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
44# had, they would actually have the binutils' version suffix (and not gcc's version).
45# So let's tell gcc's Makefile not to do that mistake.
46
47set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
48                                AS_FOR_TARGET=${crossgcc-target}-as \
49                                LD_FOR_TARGET=${crossgcc-target}-ld \
50                                NM_FOR_TARGET=${crossgcc-target}-nm \
51                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
52
53# Build in a different directory, as advised in the README file.
54pre-configure   {
55        file mkdir "${workpath}/build"
56}
57configure.dir   ${workpath}/build
58configure.cmd   ${worksrcpath}/configure
59configure.env   CC="cc -no-cpp-precomp" \
60                                ${environment}
61configure.args  --infodir='${prefix}/share/info' \
62                                --mandir='${prefix}/share/man' \
63                                --target=${crossgcc-target} \
64                                --program-prefix=${crossgcc-target}- \
65                                --program-suffix=-${gccversion} \
66                                --with-included-gettext \
67                                --with-headers=${prefix}/${crossgcc-target}/usr/include \
68                                --with-libs=${prefix}/${crossgcc-target}/usr/lib \
69                                --enable-shared \
70                                --enable-threads \
71                                --disable-checking \
72                                --enable-symvers=gnu \
73                                --enable-__cxa_atexit \
74                                --disable-libssp \
75                                --disable-libstdcxx-pch \
76                                --with-cpu= \
77                                --enable-interwork \
78                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
79                                ${default-languages}
80
81build.dir       ${workpath}/build
82
83build.args              ${environment}
84destroot.args   ${environment}
85
86# Variant to include java tools.
87# I'm not exactly sure what the interest of this variant is except to measure
88# the speed of your Xserve G5 farm. Or your patience if you don't have such
89# a farm.
90variant java {
91        configure.args-delete ${default-languages}
92}
93
94patch {
95        namespace eval crossgcc {}
96
97        # Fix the info pages and related stuff.
98        #       
99        # path: path to the doc directory (e.g. gas/doc/)
100        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
101        # name: name of the info page (e.g. as)
102        # suffix: suffix of the souce page (texinfo or texi)
103        proc crossgcc::fixinfo { path makefile name suffix } {
104                global crossgcc-target worksrcpath
105
106                # Fix the source
107                if { [ file exists ${worksrcpath}/${path}/${name}.${suffix} ] } {
108                        reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
109                                ${worksrcpath}/${path}/${name}.${suffix}
110                        reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
111                                ${worksrcpath}/${path}/${name}.${suffix}
112                        reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
113                                ${worksrcpath}/${path}/${name}.${suffix}
114                        # Rename the source
115                        file rename ${worksrcpath}/${path}/${name}.${suffix} \
116                                ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
117                }
118               
119                # Fix the Makefile
120                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
121                        ${worksrcpath}/${makefile}
122                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
123                        ${worksrcpath}/${makefile}
124                reinplace "s|/${name}.1|/${crossgcc-target}-${name}.1|g" \
125                        ${worksrcpath}/${makefile}
126                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
127                        ${worksrcpath}/${makefile}
128                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|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}.${suffix}| ${crossgcc-target}-${name}.${suffix}|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               
141                # Fix install-info's dir.
142                # (note: this may be effectless if there was no info dir to be fixed)
143                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
144                        "${worksrcpath}/${makefile}"
145        }
146
147        # Fix the gettext files and related stuff.
148        #       
149        # module: name of the module (e.g. gas)
150        proc crossgcc::fixgettext { module } {
151                global crossgcc-target worksrcpath
152
153                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
154                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
155                                "${worksrcpath}/${module}/Makefile.in"
156                }
157                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
158                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
159                                "${worksrcpath}/${module}/doc/Makefile.in"
160                }
161                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
162                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
163                                "${worksrcpath}/${module}/po/Make-in"
164                }
165        }
166
167        # gcc/doc/cpp.texi
168        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
169
170        # gcc/doc/cppinternals.texi
171        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
172
173        # gcc/doc/gcc.texi
174        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
175        crossgcc::fixinfo gcc/cp/ gcc/cp/Make-lang.in gcc texi
176        crossgcc::fixinfo gcc/cp/ gcc/cp/Make-lang.in g++ texi
177
178        # gcc/doc/gccint.texi
179        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
180
181        # gcc/f/g77.texi
182        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
183
184        # gcc/java/gcj.texi
185        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
186
187        # fastjar/fastjar.texi
188        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
189       
190        # gettext stuff.
191        crossgcc::fixgettext gcc
192        crossgcc::fixgettext fastjar
193}
194
195pre-destroot {
196        # gcc needs the cross directory structure to be present
197        # in order to fill it during installation.
198        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
199        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
200}
201
202post-destroot {
203        namespace eval crossgcc {}
204
205        # Rename a man page if it exists.
206        #
207        # section: section of the man page (e.g. 1)
208        # manpage: name of the man page (e.g. cpp)
209        proc crossgcc::rename_man_page { section manpage } {
210                global crossgcc-target destroot prefix
211
212                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
213                if { [ file exists ${manpage_path} ] } {
214                        file rename ${manpage_path} \
215                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
216                }
217        }
218
219        # Stuff I don't want (either because they're in the system
220        # or because they would conflict with other FSF ports)
221        # (it's easier for maintainability purposes to fix things here)
222
223        # aliases for locales (should be on the system)
224        file delete "${destroot}/${prefix}/share/locale/locale.alias"
225       
226        # FSF propaganda (should already be there or would conflict)
227        file delete -force "${destroot}/${prefix}/share/man/man7"
228
229        # (host) libiberty
230        file delete "${destroot}/${prefix}/lib/libiberty.a"
231
232        # aliases for charsets (should already be there)
233        file delete "${destroot}/${prefix}/lib/charset.alias"
234       
235        # Remove man pages for tools that are not built as part of cross-gcc
236        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
237        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
238        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
239        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
240       
241        # For some reason, some man pages are not prefixed while they should have been
242        # (to avoid conflicting).
243        crossgcc::rename_man_page 1 cpp
244        crossgcc::rename_man_page 1 gcjh
245        crossgcc::rename_man_page 1 gcov
246        crossgcc::rename_man_page 1 jcf-dump
247        crossgcc::rename_man_page 1 jv-scan
248       
249        # There is a bug in gcc/Makefile::install-driver
250        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
251        # $(target_noncanonical)-gcc-$(version)
252        # and hence the driver isn't installed.
253        xinstall -c "${workpath}/build/gcc/xgcc" \
254                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
255}
Note: See TracBrowser for help on using the repository browser.