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

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