source: trunk/dports/cross/i960-rtems-gcc/Portfile

Last change on this file was 114325, checked in by ryandesign@…, 4 years ago

use eq and ne instead of == and != when comparing ${os.platform} and ${os.subplatform}

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