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

Last change on this file was 125286, checked in by mf2k@…, 3 years ago

arm-none-linux-gnueabi-gcc: Add maintainer. Fix patchfile name. (#44962)

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