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

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

Fixed man pages to share/man/

  • Property svn:eol-style set to native
File size: 7.3 KB
Line 
1# $Id: Portfile,v 1.2 2004/02/14 05:34:20 pguyot Exp $
2
3PortSystem                      1.0
4name                    sparc-rtems-gcc
5version                 3.2.3
6revision                        1
7
8# Parameters for this port.
9set newlibversion       1.11.0
10set crossgcc-target sparc-rtems
11
12description             gcc cross-compilers for sparc-rtems, with newlib runtime library.
13long_description        gnu compilers collection (c, c++, fortran and objc) for \
14                                        sparc-rtems cross development (SPARC V7 and above CPUs).
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                                --mandir='${prefix}/share/man' \
60                                --target=${crossgcc-target} \
61                                --program-prefix=${crossgcc-target}- \
62                                --program-suffix=-${version} \
63                                --enable-obsolete \
64                                --enable-languages="c,c++,f77,objc" \
65                                --without-included-gettext \
66                                --with-gnu-as --with-gnu-ld \
67                                --with-newlib \
68                                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/
69build.dir       ${workpath}/build
70destroot.args   \
71        --with-gxx-include-dir=${destroot}/${prefix}/${crossgcc-target}/include/c++/${version}/
72
73# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
74# program names as gcc's name (add -${version} with ${version} being the version of gcc).
75# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
76# had, they would actually have the binutils' version suffix (and not gcc's version).
77# So let's tell gcc's Makefile not to do that mistake.
78
79build.args              AR_FOR_TARGET=${crossgcc-target}-ar \
80                                AS_FOR_TARGET=${crossgcc-target}-as \
81                                LD_FOR_TARGET=${crossgcc-target}-ld \
82                                NM_FOR_TARGET=${crossgcc-target}-nm \
83                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib
84
85destroot.args   AR_FOR_TARGET=${crossgcc-target}-ar \
86                                AS_FOR_TARGET=${crossgcc-target}-as \
87                                LD_FOR_TARGET=${crossgcc-target}-ld \
88                                NM_FOR_TARGET=${crossgcc-target}-nm \
89                                RANLIB_FOR_TARGET=${crossgcc-target}-ranlib
90
91pre-patch {
92        # Additional patches for rtems.
93        system "cd ${workpath}/gcc-${version} && \
94                patch -p1 < ${distpath}/gcc-${version}-rtems-20030507a.diff"
95        system "cd ${workpath}/newlib-${newlibversion} && \
96                patch -p1 < ${distpath}/newlib-${newlibversion}-rtems-20030605.diff"
97}
98
99post-patch {
100        namespace eval crossgcc {}
101
102        # Fix the info pages and related stuff.
103        #       
104        # path: path to the doc directory (e.g. gas/doc/)
105        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
106        # name: name of the info page (e.g. as)
107        # suffix: suffix of the souce page (texinfo or texi)
108        proc crossgcc::fixinfo { path makefile name suffix } {
109                global crossgcc-target worksrcpath
110
111                # Fix the source
112                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
113                        ${worksrcpath}/${path}/${name}.${suffix}
114                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
115                        ${worksrcpath}/${path}/${name}.${suffix}
116                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
117                        ${worksrcpath}/${path}/${name}.${suffix}
118               
119                # Fix the Makefile
120                reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \
121                        ${worksrcpath}/${makefile}
122                reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
123                        ${worksrcpath}/${makefile}
124               
125                # Rename the source
126                file rename ${worksrcpath}/${path}/${name}.${suffix} \
127                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
128               
129                # Fix install-info's dir.
130                # (note: this may be effectless if there was no info dir to be fixed)
131                reinplace "s|__TARGET|${crossgcc-target}|g" \
132                        "${worksrcpath}/${makefile}"
133        }
134
135        # Fix the gettext files and related stuff.
136        #       
137        # module: name of the module (e.g. gas)
138        proc crossgcc::fixgettext { module } {
139                global crossgcc-target worksrcpath
140
141                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
142                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
143                                "${worksrcpath}/${module}/Makefile.in"
144                }
145                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
146                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
147                                "${worksrcpath}/${module}/doc/Makefile.in"
148                }
149                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
150                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
151                                "${worksrcpath}/${module}/po/Make-in"
152                }
153        }
154
155        # gcc/doc/cpp.texi
156        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
157
158        # gcc/doc/cppinternals.texi
159        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
160
161        # gcc/doc/gcc.texi
162        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
163
164        # gcc/doc/gccint.texi
165        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
166
167        # gcc/f/g77.texi
168        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
169
170        # gettext stuff.
171        crossgcc::fixgettext gcc
172}
173
174post-destroot {
175        # Stuff I don't want (either because they're in the system
176        # or because they would conflict with other FSF ports)
177        # (it's easier for maintainability purposes to fix things here)
178
179        # aliases for locales (should be on the system)
180        file delete "${destroot}/${prefix}/share/locale/locale.alias"
181       
182        # FSF propaganda (should already be there or would conflict)
183        file delete -force "${destroot}/${prefix}/share/man/man7"
184
185        # (host) libiberty
186        file delete "${destroot}/${prefix}/lib/libiberty.a"
187
188        # aliases for charsets (should already be there)
189        file delete "${destroot}/${prefix}/lib/charset.alias"
190       
191        # For some reason, some man pages are not prefixed while they should have been
192        # (to avoid conflicting).
193        file rename "${destroot}/${prefix}/share/man/man1/cpp.1" \
194                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-cpp.1"
195        file rename "${destroot}/${prefix}/share/man/man1/gcov.1" \
196                "${destroot}/${prefix}/share/man/man1/${crossgcc-target}-gcov.1"
197}
Note: See TracBrowser for help on using the repository browser.