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

Last change on this file since 20225 was 20225, checked in by blair@…, 14 years ago

Set the svn:keywords property to 'Id' for all Portfile's. This
re-enables the Id keyword substitution that was present in the CVS
repository.

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