source: trunk/dports/cross/mips-elf-gcc/Portfile @ 6122

Last change on this file since 6122 was 6122, checked in by pguyot (Paul Guyot), 17 years ago

New port: x-mips-elf and x-m68k-elf with newlib runtime.
You will need your own crt0.o.

Requested by Michel Lynch.

  • Property svn:eol-style set to native
File size: 7.5 KB
Line 
1# $Id: Portfile,v 1.1 2004/03/30 20:51:21 pguyot Exp $
2
3PortSystem                      1.0
4name                    mips-elf-gcc
5version                 3.3.2
6revision                        1
7
8# Parameters for this port.
9set newlibversion       1.11.0
10set crossgcc-target mips-elf
11
12description             gcc cross-compilers for mips-elf, with newlib runtime library.
13long_description        gnu compilers collection (including c++, fortran and java) for \
14                                        mips-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.gz:gcc newlib-${newlibversion}.tar.gz:newlib
23worksrcdir                      gcc-${version}
24checksums                       gcc-${version}.tar.gz md5 60ab4d3431786a81be6522cc04bc1827 \
25                                        newlib-${newlibversion}.tar.gz md5 74de7de0c9624cd757df63f2ed17a9b4
26
27# Download everything to gcc/
28dist_subdir                     gcc
29
30# Patches for info's dir
31patchfiles                      patch-gcc-Makefile.in \
32                                        patch-gcc-f-Make-lang.in \
33                                        patch-gcc-java-Make-lang.in \
34                                        patch-fastjar-Makefile.in
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
41
42# Link newlib to gcc, so gcc will find its include files and this will also build newlib.
43post-extract    {
44        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}"
45}
46
47# Build in a different directory, as advised in the README file.
48pre-configure   { system "cd ${workpath} && mkdir -p build"}
49configure.dir   ${workpath}/build
50configure.cmd   ${workpath}/gcc-${version}/configure
51configure.env   CC="cc -no-cpp-precomp"
52configure.args  --infodir='${prefix}/share/info' \
53                                --mandir='${prefix}/share/man' \
54                                --target=${crossgcc-target} \
55                                --program-prefix=${crossgcc-target}- \
56                                --program-suffix=-${version} \
57                                --enable-obsolete \
58                                --with-gnu-as --with-gnu-ld \
59                                --with-newlib \
60                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/
61build.dir       ${workpath}/build
62destroot.args   \
63        --with-gxx-include-dir=${destroot}/${prefix}/${crossgcc-target}/include/c++/${version}/
64
65# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
66# program names as gcc's name (add -${version} with ${version} being the version of gcc).
67# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
68# had, they would actually have the binutils' version suffix (and not gcc's version).
69# So let's tell gcc's Makefile it not to do that.
70
71build.args              AR_FOR_TARGET=${crossgcc-target}-ar \
72                                AS_FOR_TARGET=${crossgcc-target}-as \
73                                LD_FOR_TARGET=${crossgcc-target}-ld \
74                                NM_FOR_TARGET=${crossgcc-target}-nm \
75                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib
76
77destroot.args   AR_FOR_TARGET=${crossgcc-target}-ar \
78                                AS_FOR_TARGET=${crossgcc-target}-as \
79                                LD_FOR_TARGET=${crossgcc-target}-ld \
80                                NM_FOR_TARGET=${crossgcc-target}-nm \
81                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib
82
83post-patch {
84        namespace eval crossgcc {}
85
86        # Fix the info pages and related stuff.
87        #       
88        # path: path to the doc directory (e.g. gas/doc/)
89        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
90        # name: name of the info page (e.g. as)
91        # suffix: suffix of the souce page (texinfo or texi)
92        proc crossgcc::fixinfo { path makefile name suffix } {
93                global crossgcc-target worksrcpath
94
95                # Fix the source
96                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
97                        ${worksrcpath}/${path}/${name}.${suffix}
98                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
99                        ${worksrcpath}/${path}/${name}.${suffix}
100                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
101                        ${worksrcpath}/${path}/${name}.${suffix}
102               
103                # Fix the Makefile
104                reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \
105                        ${worksrcpath}/${makefile}
106                reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
107                        ${worksrcpath}/${makefile}
108               
109                # Rename the source
110                file rename ${worksrcpath}/${path}/${name}.${suffix} \
111                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
112               
113                # Fix install-info's dir.
114                # (note: this may be effectless if there was no info dir to be fixed)
115                reinplace "s|__TARGET|${crossgcc-target}|g" \
116                        "${worksrcpath}/${makefile}"
117        }
118
119        # Fix the gettext files and related stuff.
120        #       
121        # module: name of the module (e.g. gas)
122        proc crossgcc::fixgettext { module } {
123                global crossgcc-target worksrcpath
124
125                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
126                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
127                                "${worksrcpath}/${module}/Makefile.in"
128                }
129                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
130                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
131                                "${worksrcpath}/${module}/doc/Makefile.in"
132                }
133                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
134                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
135                                "${worksrcpath}/${module}/po/Make-in"
136                }
137        }
138
139        # gcc/doc/cpp.texi
140        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
141
142        # gcc/doc/cppinternals.texi
143        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
144
145        # gcc/doc/gcc.texi
146        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
147
148        # gcc/doc/gccint.texi
149        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
150
151        # gcc/f/g77.texi
152        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
153
154        # gcc/java/gcj.texi
155        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
156
157        # fastjar/fastjar.texi
158        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
159       
160        # gettext stuff.
161        crossgcc::fixgettext gcc
162        crossgcc::fixgettext fastjar
163}
164
165post-destroot {
166        # Stuff I don't want (either because they're in the system
167        # or because they would conflict with other FSF ports)
168        # (it's easier for maintainability purposes to fix things here)
169
170        # aliases for locales (should be on the system)
171        file delete "${destroot}/${prefix}/share/locale/locale.alias"
172       
173        # FSF propaganda (should already be there or would conflict)
174        file delete -force "${destroot}/${prefix}/share/man/man7"
175
176        # (host) libiberty
177        file delete "${destroot}/${prefix}/lib/libiberty.a"
178
179        # aliases for charsets (should already be there)
180        file delete "${destroot}/${prefix}/lib/charset.alias"
181       
182        # Remove man pages for tools that are not built as part of cross-gcc
183        file delete "${destroot}/${prefix}/share/man/man1/rmic.1"
184        file delete "${destroot}/${prefix}/share/man/man1/rmiregistry.1"
185        file delete "${destroot}/${prefix}/share/man/man1/jv-convert.1"
186        file delete "${destroot}/${prefix}/share/man/man1/gij.1"
187       
188        # For some reason, some man pages are not prefixed while they should have been
189        # (to avoid conflicting).
190        file rename "${destroot}/${prefix}/share/man/man1/cpp.1" \
191                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-cpp.1"
192        file rename "${destroot}/${prefix}/share/man/man1/gcjh.1" \
193                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-gcjh.1"
194        file rename "${destroot}/${prefix}/share/man/man1/gcov.1" \
195                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-gcov.1"
196        file rename "${destroot}/${prefix}/share/man/man1/jcf-dump.1" \
197                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-jcf-dump.1"
198        file rename "${destroot}/${prefix}/share/man/man1/jv-scan.1" \
199                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-jv-scan.1"
200}
Note: See TracBrowser for help on using the repository browser.