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