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

Last change on this file since 30687 was 30687, checked in by pguyot@…, 13 years ago

All cross ports violate the layout

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.6 KB
Line 
1# $Id: Portfile 30687 2007-11-04 07:27:28Z pguyot@kallisys.net $
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# All cross ports violate the mtree layout.
37destroot.violate_mtree  yes
38
39# Download everything to gcc/
40dist_subdir                     gcc
41
42# Patches for info's dir.
43patchfiles                      patch-gcc-Makefile.in \
44                                        patch-gcc-f-Make-lang.in
45
46depends_lib                     bin:${crossgcc-target}-ar:${crossgcc-target}-binutils \
47                                        bin:${crossgcc-target}-as:${crossgcc-target}-binutils \
48                                        bin:${crossgcc-target}-ld:${crossgcc-target}-binutils \
49                                        bin:${crossgcc-target}-nm:${crossgcc-target}-binutils \
50                                        bin:${crossgcc-target}-ranlib:${crossgcc-target}-binutils \
51                                        lib:libintl:gettext
52
53# Link newlib to gcc, so gcc will find its include files and this will also build newlib.
54post-extract    {
55        system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}"
56}
57
58# Build in a different directory, as advised in the README file.
59pre-configure   { system "cd ${workpath} && mkdir -p build"}
60configure.dir   ${workpath}/build
61configure.cmd   ${workpath}/gcc-${version}/configure
62configure.cc    "cc -no-cpp-precomp"
63configure.args  --infodir='${prefix}/share/info' \
64                                --mandir='${prefix}/share/man' \
65                                --target=${crossgcc-target} \
66                                --program-prefix=${crossgcc-target}- \
67                                --program-suffix=-${version} \
68                                --enable-obsolete \
69                                --enable-languages="c,c++,f77,objc" \
70                                --without-included-gettext \
71                                --with-gnu-as --with-gnu-ld \
72                                --with-newlib \
73                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/
74build.dir       ${workpath}/build
75destroot.args   \
76        --with-gxx-include-dir=${destroot}/${prefix}/${crossgcc-target}/include/c++/${version}/
77
78# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
79# program names as gcc's name (add -${version} with ${version} being the version of gcc).
80# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
81# had, they would actually have the binutils' version suffix (and not gcc's version).
82# So let's tell gcc's Makefile not to do that mistake.
83
84build.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
90destroot.args   AR_FOR_TARGET=${crossgcc-target}-ar \
91                                AS_FOR_TARGET=${crossgcc-target}-as \
92                                LD_FOR_TARGET=${crossgcc-target}-ld \
93                                NM_FOR_TARGET=${crossgcc-target}-nm \
94                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib
95
96pre-patch {
97        # Additional patches for rtems.
98        system "cd ${workpath}/gcc-${version} && \
99                patch -p1 < ${distpath}/gcc-${version}-rtems-20030507a.diff"
100        system "cd ${workpath}/newlib-${newlibversion} && \
101                patch -p1 < ${distpath}/newlib-${newlibversion}-rtems-20030605.diff"
102}
103
104post-patch {
105        namespace eval crossgcc {}
106
107        # Fix the info pages and related stuff.
108        #       
109        # path: path to the doc directory (e.g. gas/doc/)
110        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
111        # name: name of the info page (e.g. as)
112        # suffix: suffix of the souce page (texinfo or texi)
113        proc crossgcc::fixinfo { path makefile name suffix } {
114                global crossgcc-target worksrcpath
115
116                # Fix the source
117                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
118                        ${worksrcpath}/${path}/${name}.${suffix}
119                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
120                        ${worksrcpath}/${path}/${name}.${suffix}
121                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
122                        ${worksrcpath}/${path}/${name}.${suffix}
123               
124                # Fix the Makefile
125                reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \
126                        ${worksrcpath}/${makefile}
127                reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
128                        ${worksrcpath}/${makefile}
129               
130                # Rename the source
131                file rename ${worksrcpath}/${path}/${name}.${suffix} \
132                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
133               
134                # Fix install-info's dir.
135                # (note: this may be effectless if there was no info dir to be fixed)
136                reinplace "s|__TARGET|${crossgcc-target}|g" \
137                        "${worksrcpath}/${makefile}"
138        }
139
140        # Fix the gettext files and related stuff.
141        #       
142        # module: name of the module (e.g. gas)
143        proc crossgcc::fixgettext { module } {
144                global crossgcc-target worksrcpath
145
146                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
147                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
148                                "${worksrcpath}/${module}/Makefile.in"
149                }
150                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
151                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
152                                "${worksrcpath}/${module}/doc/Makefile.in"
153                }
154                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
155                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
156                                "${worksrcpath}/${module}/po/Make-in"
157                }
158        }
159
160        # gcc/doc/cpp.texi
161        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
162
163        # gcc/doc/cppinternals.texi
164        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
165
166        # gcc/doc/gcc.texi
167        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
168
169        # gcc/doc/gccint.texi
170        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
171
172        # gcc/f/g77.texi
173        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
174
175        # gettext stuff.
176        crossgcc::fixgettext gcc
177}
178
179post-destroot {
180        # Stuff I don't want (either because they're in the system
181        # or because they would conflict with other FSF ports)
182        # (it's easier for maintainability purposes to fix things here)
183
184        # aliases for locales (should be on the system)
185        file delete "${destroot}/${prefix}/share/locale/locale.alias"
186       
187        # FSF propaganda (should already be there or would conflict)
188        file delete -force "${destroot}/${prefix}/share/man/man7"
189
190        # (host) libiberty
191        file delete "${destroot}/${prefix}/lib/libiberty.a"
192
193        # aliases for charsets (should already be there)
194        file delete "${destroot}/${prefix}/lib/charset.alias"
195       
196        # For some reason, some man pages are not prefixed while they should have been
197        # (to avoid conflicting).
198        file rename "${destroot}/${prefix}/share/man/man1/cpp.1" \
199                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-cpp.1"
200        file rename "${destroot}/${prefix}/share/man/man1/gcov.1" \
201                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-gcov.1"
202}
203
204livecheck.check regex
205livecheck.url   http://gcc.gnu.org/releases.html
206livecheck.regex {<tr><td><a href="gcc-.*/">GCC (.*)</a></td>   <td>.*</td></tr>}
Note: See TracBrowser for help on using the repository browser.