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

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

Add livecheck to my cross-gcc ports.

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