source: trunk/dports/cross/arm-elf-gcc3/Portfile

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

arm-elf-gcc3: Fix description typo.

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