source: trunk/dports/cross/avr-gcc/Portfile @ 33409

Last change on this file since 33409 was 33409, checked in by pguyot@…, 12 years ago

cross/avr-gcc: fix compilation issue on 10.5 (#13191)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.5 KB
Line 
1# $Id: Portfile 33409 2008-01-26 11:46:33Z pguyot@kallisys.net $
2
3PortSystem                      1.0
4name                    avr-gcc
5version                 4.0.2
6
7# Parameters for this port.
8set crossgcc-target avr
9set default-languages --enable-languages="c,c++"
10
11description             gcc cross-compilers for avr
12long_description        GNU compilers collection (c and c++) for avr.
13homepage                        http://gcc.gnu.org/
14platforms               darwin
15categories              cross devel
16maintainers             pguyot@kallisys.net metamagix@gmail.com
17master_sites            gnu:gcc/gcc-${version}/
18distfiles                       gcc-${version}.tar.bz2
19worksrcdir                      gcc-${version}
20checksums                       md5 a659b8388cac9db2b13e056e574ceeb0 \
21                                        sha1 f1b714c6398393d8f7f4ad5be933b462a95b075d \
22                                        rmd160 70c7e21820da4d29ce6e8e48329d906ee19333aa
23
24# All cross ports violate the mtree layout.
25destroot.violate_mtree  yes
26
27# Download everything to gcc/
28dist_subdir                     gcc
29
30depends_lib                     bin:${crossgcc-target}-ar:${crossgcc-target}-binutils \
31                                        bin:${crossgcc-target}-as:${crossgcc-target}-binutils \
32                                        bin:${crossgcc-target}-ld:${crossgcc-target}-binutils \
33                                        bin:${crossgcc-target}-nm:${crossgcc-target}-binutils \
34                                        bin:${crossgcc-target}-ranlib:${crossgcc-target}-binutils
35depends_build           bin:msgfmt:gettext
36
37# gcc is .bz2.
38use_bzip2                       yes
39# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
40# program names as gcc's name (add -${version} with ${version} being the version of gcc).
41# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
42# had, they would actually have the binutils' version suffix (and not gcc's version).
43# So let's tell gcc's Makefile not to do that mistake.
44
45set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
46                                AS_FOR_TARGET=${crossgcc-target}-as \
47                                LD_FOR_TARGET=${crossgcc-target}-ld \
48                                NM_FOR_TARGET=${crossgcc-target}-nm \
49                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
50
51
52# Build in a different directory, as advised in the README file.
53pre-configure   {
54        file mkdir "${workpath}/build"
55}
56configure.dir   ${workpath}/build
57configure.cmd   ${workpath}/gcc-${version}/configure
58configure.cc    "cc -no-cpp-precomp"
59configure.env   ${environment}
60configure.args  --infodir='${prefix}/share/info' \
61                                --mandir='${prefix}/share/man' \
62                                --target=${crossgcc-target} \
63                                --program-prefix=${crossgcc-target}- \
64                                --with-included-gettext \
65                                --enable-obsolete \
66                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
67                                ${default-languages}
68
69build.dir       ${workpath}/build
70
71build.args              ${environment}
72destroot.args   ${environment}
73
74patchfiles              gcc-config-avr-avr.c.diff \
75                                gcc-config-avr-avr.h.diff \
76                                gcc-config-avr-t-avr.diff
77
78platform darwin 9 {
79        patchfiles-append       gcc-config-rs6000-host-darwin.c.diff
80}
81
82post-patch {
83        namespace eval crossgcc {}
84
85        # Fix the info pages and related stuff.
86        #       
87        # path: path to the doc directory (e.g. gas/doc/)
88        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
89        # name: name of the info page (e.g. as)
90        # suffix: suffix of the souce page (texinfo or texi)
91        proc crossgcc::fixinfo { path makefile name suffix } {
92                global crossgcc-target worksrcpath
93
94                # Fix the source
95                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
96                        ${worksrcpath}/${path}/${name}.${suffix}
97                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
98                        ${worksrcpath}/${path}/${name}.${suffix}
99                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
100                        ${worksrcpath}/${path}/${name}.${suffix}
101               
102                # Fix the Makefile
103                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
104                        ${worksrcpath}/${makefile}
105                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
106                        ${worksrcpath}/${makefile}
107                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
108                        ${worksrcpath}/${makefile}
109                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
110                        ${worksrcpath}/${makefile}
111                reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
112                        ${worksrcpath}/${makefile}
113                reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
114                        ${worksrcpath}/${makefile}
115                reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
116                        ${worksrcpath}/${makefile}
117                reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
118                        ${worksrcpath}/${makefile}
119                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
120                        ${worksrcpath}/${makefile}
121               
122                # Rename the source
123                file rename ${worksrcpath}/${path}/${name}.${suffix} \
124                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
125               
126                # Fix install-info's dir.
127                # (note: this may be effectless if there was no info dir to be fixed)
128                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
129                        "${worksrcpath}/${makefile}"
130        }
131
132        # Fix the gettext files and related stuff.
133        #       
134        # module: name of the module (e.g. gas)
135        proc crossgcc::fixgettext { module } {
136                global crossgcc-target worksrcpath
137
138                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
139                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
140                                "${worksrcpath}/${module}/Makefile.in"
141                }
142                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
143                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
144                                "${worksrcpath}/${module}/doc/Makefile.in"
145                }
146                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
147                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
148                                "${worksrcpath}/${module}/po/Make-in"
149                }
150        }
151
152        # gcc/doc/cpp.texi
153        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
154
155        # gcc/doc/cppinternals.texi
156        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
157
158        # gcc/doc/gcc.texi
159        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
160
161        # gcc/doc/gccint.texi
162        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
163
164        # gcc/f/g77.texi
165        crossgcc::fixinfo gcc/fortran/ gcc/fortran/Make-lang.in gfortran texi
166
167        # gcc/java/gcj.texi
168        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
169
170        # fastjar/fastjar.texi
171        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
172       
173        # gcc/doc/gccinstall.info
174        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
175
176        # gettext stuff.
177        crossgcc::fixgettext gcc
178        crossgcc::fixgettext fastjar
179}
180
181pre-destroot {
182        # gcc needs the cross directory structure to be present
183        # in order to fill it during installation.
184        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
185        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
186}
187
188post-destroot {
189        namespace eval crossgcc {}
190
191        # Rename a man page if it exists.
192        #
193        # section: section of the man page (e.g. 1)
194        # manpage: name of the man page (e.g. cpp)
195        proc crossgcc::rename_man_page { section manpage } {
196                global crossgcc-target destroot prefix
197
198                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
199                if { [ file exists ${manpage_path} ] } {
200                        file rename ${manpage_path} \
201                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
202                }
203        }
204
205        # Stuff I don't want (either because they're in the system
206        # or because they would conflict with other FSF ports)
207        # (it's easier for maintainability purposes to fix things here)
208
209        # aliases for locales (should be on the system)
210        file delete "${destroot}/${prefix}/share/locale/locale.alias"
211       
212        # FSF propaganda (should already be there or would conflict)
213        file delete -force "${destroot}/${prefix}/share/man/man7"
214
215        # (host) libiberty
216        file delete "${destroot}/${prefix}/lib/libiberty.a"
217
218        # aliases for charsets (should already be there)
219        file delete "${destroot}/${prefix}/lib/charset.alias"
220       
221        # Remove man pages for tools that are not built as part of cross-gcc
222        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
223        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
224        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
225        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
226       
227        # For some reason, some man pages are not prefixed while they should have been
228        # (to avoid conflicting).
229        crossgcc::rename_man_page 1 cpp
230        crossgcc::rename_man_page 1 gcjh
231        crossgcc::rename_man_page 1 gcov
232        crossgcc::rename_man_page 1 jcf-dump
233        crossgcc::rename_man_page 1 jv-scan
234       
235        # There is a bug in gcc/Makefile::install-driver
236        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
237        # $(target_noncanonical)-gcc-$(version)
238        # and hence the driver isn't installed.
239        xinstall -c "${workpath}/build/gcc/xgcc" \
240                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
241}
242
243livecheck.check regex
244livecheck.url   http://gcc.gnu.org/releases.html
245livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.