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

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

All cross ports violate the layout

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.4 KB
Line 
1# $Id: Portfile 30687 2007-11-04 07:27:28Z 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
78patch {
79        namespace eval crossgcc {}
80
81        # Fix the info pages and related stuff.
82        #       
83        # path: path to the doc directory (e.g. gas/doc/)
84        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
85        # name: name of the info page (e.g. as)
86        # suffix: suffix of the souce page (texinfo or texi)
87        proc crossgcc::fixinfo { path makefile name suffix } {
88                global crossgcc-target worksrcpath
89
90                # Fix the source
91                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
92                        ${worksrcpath}/${path}/${name}.${suffix}
93                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
94                        ${worksrcpath}/${path}/${name}.${suffix}
95                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
96                        ${worksrcpath}/${path}/${name}.${suffix}
97               
98                # Fix the Makefile
99                reinplace "s| ${name}.info| ${crossgcc-target}-${name}.info|g" \
100                        ${worksrcpath}/${makefile}
101                reinplace "s|/${name}.info|/${crossgcc-target}-${name}.info|g" \
102                        ${worksrcpath}/${makefile}
103                reinplace "s|^${name}.info|${crossgcc-target}-${name}.info|g" \
104                        ${worksrcpath}/${makefile}
105                reinplace "s| ${name}.pod| ${crossgcc-target}-${name}.pod|g" \
106                        ${worksrcpath}/${makefile}
107                reinplace "s|/${name}.pod|/${crossgcc-target}-${name}.pod|g" \
108                        ${worksrcpath}/${makefile}
109                reinplace "s|^${name}.pod|${crossgcc-target}-${name}.pod|g" \
110                        ${worksrcpath}/${makefile}
111                reinplace "s| ${name}.${suffix}| ${crossgcc-target}-${name}.${suffix}|g" \
112                        ${worksrcpath}/${makefile}
113                reinplace "s|/${name}.${suffix}|/${crossgcc-target}-${name}.${suffix}|g" \
114                        ${worksrcpath}/${makefile}
115                reinplace "s|^${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
116                        ${worksrcpath}/${makefile}
117               
118                # Rename the source
119                file rename ${worksrcpath}/${path}/${name}.${suffix} \
120                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
121               
122                # Fix install-info's dir.
123                # (note: this may be effectless if there was no info dir to be fixed)
124                reinplace "s|--info-dir=\$(DESTDIR)\$(infodir)|--dir-file=\$(DESTDIR)\$(infodir)/${crossgcc-target}-gcc-dir|g" \
125                        "${worksrcpath}/${makefile}"
126        }
127
128        # Fix the gettext files and related stuff.
129        #       
130        # module: name of the module (e.g. gas)
131        proc crossgcc::fixgettext { module } {
132                global crossgcc-target worksrcpath
133
134                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
135                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
136                                "${worksrcpath}/${module}/Makefile.in"
137                }
138                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
139                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
140                                "${worksrcpath}/${module}/doc/Makefile.in"
141                }
142                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
143                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
144                                "${worksrcpath}/${module}/po/Make-in"
145                }
146        }
147
148        # gcc/doc/cpp.texi
149        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
150
151        # gcc/doc/cppinternals.texi
152        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
153
154        # gcc/doc/gcc.texi
155        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
156
157        # gcc/doc/gccint.texi
158        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
159
160        # gcc/f/g77.texi
161        crossgcc::fixinfo gcc/fortran/ gcc/fortran/Make-lang.in gfortran texi
162
163        # gcc/java/gcj.texi
164        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
165
166        # fastjar/fastjar.texi
167        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
168       
169        # gcc/doc/gccinstall.info
170        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccinstall info
171
172        # gettext stuff.
173        crossgcc::fixgettext gcc
174        crossgcc::fixgettext fastjar
175}
176
177pre-destroot {
178        # gcc needs the cross directory structure to be present
179        # in order to fill it during installation.
180        file mkdir "${destroot}/${prefix}/${crossgcc-target}/bin"
181        file mkdir "${destroot}/${prefix}/${crossgcc-target}/lib"
182}
183
184post-destroot {
185        namespace eval crossgcc {}
186
187        # Rename a man page if it exists.
188        #
189        # section: section of the man page (e.g. 1)
190        # manpage: name of the man page (e.g. cpp)
191        proc crossgcc::rename_man_page { section manpage } {
192                global crossgcc-target destroot prefix
193
194                set manpage_path "${destroot}/${prefix}/share/man/man${section}/${manpage}.${section}"
195                if { [ file exists ${manpage_path} ] } {
196                        file rename ${manpage_path} \
197                                "${destroot}/${prefix}/share/man/man${section}/${crossgcc-target}-${manpage}.${section}"
198                }
199        }
200
201        # Stuff I don't want (either because they're in the system
202        # or because they would conflict with other FSF ports)
203        # (it's easier for maintainability purposes to fix things here)
204
205        # aliases for locales (should be on the system)
206        file delete "${destroot}/${prefix}/share/locale/locale.alias"
207       
208        # FSF propaganda (should already be there or would conflict)
209        file delete -force "${destroot}/${prefix}/share/man/man7"
210
211        # (host) libiberty
212        file delete "${destroot}/${prefix}/lib/libiberty.a"
213
214        # aliases for charsets (should already be there)
215        file delete "${destroot}/${prefix}/lib/charset.alias"
216       
217        # Remove man pages for tools that are not built as part of cross-gcc
218        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
219        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
220        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
221        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
222       
223        # For some reason, some man pages are not prefixed while they should have been
224        # (to avoid conflicting).
225        crossgcc::rename_man_page 1 cpp
226        crossgcc::rename_man_page 1 gcjh
227        crossgcc::rename_man_page 1 gcov
228        crossgcc::rename_man_page 1 jcf-dump
229        crossgcc::rename_man_page 1 jv-scan
230       
231        # There is a bug in gcc/Makefile::install-driver
232        # For cross compilers, $(GCC_INSTALL_NAME) is equal to
233        # $(target_noncanonical)-gcc-$(version)
234        # and hence the driver isn't installed.
235        xinstall -c "${workpath}/build/gcc/xgcc" \
236                "${destroot}/${prefix}/bin/${crossgcc-target}-gcc-${version}"
237}
238
239livecheck.check regex
240livecheck.url   http://gcc.gnu.org/releases.html
241livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.