source: trunk/dports/cross/sparc-rtems-gcc/Portfile @ 5320

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

New ports: rtems gcc.
These are based on FreeBSD ports:

  • gcc 3.2.3 (instead of 3.3.2 which is the latest)
  • official RTEMS patches
  • no Java support (actually, Java is half-compiled on FreeBSD, and since

this is broken, I have completely disabled it to save compilation time -- the
arm one with multi-libs takes more than two hours. I don't even know if it's
supposed to work with official RTEMS patches).

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