source: trunk/dports/cross/i386-mingw32-gcc/Portfile @ 85585

Last change on this file since 85585 was 85585, checked in by ryandesign@…, 9 years ago

Add depends_skip_archcheck apple-gcc42; see #31584

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.9 KB
Line 
1# $Id: Portfile 85585 2011-10-14 20:17:51Z ryandesign@macports.org $
2PortSystem                      1.0
3
4name                    i386-mingw32-gcc
5version                 3.4.5-20060117-2
6revision                1
7set gnu_version         3.4.5
8maintainers             landonf
9description             Mingw32 cross-compiler for i386-Win32
10long_description        Mingw32 GNU Compiler for i386-Win32. \
11                        Supports C, C++, Objective-C and Java.
12homepage                http://www.mingw.org
13platforms               darwin
14categories              cross devel
15
16# Parameters for this port.
17set crossgcc-target i386-mingw32
18
19master_sites            sourceforge:mingw
20distfiles               gcc-core-${version}-src.tar.gz \
21                        gcc-g%2B%2B-${version}-src.tar.gz \
22                        gcc-g77-${version}-src.tar.gz \
23                        gcc-java-${version}-src.tar.gz \
24                        gcc-objc-${version}-src.tar.gz
25
26checksums               gcc-core-${version}-src.tar.gz \
27                                md5     d0dc9d57d493889bc1ca88b127290b9d \
28                                sha1    75d59049f26dc62f3732d11abbf056efc7bc8e95 \
29                                rmd160  624dd55ac00fba15269f1b3b3bbd6c383cc20827 \
30                        gcc-g%2B%2B-${version}-src.tar.gz \
31                                md5     ca81c8420ab9d1d05ff9c73a9d4f7d63 \
32                                sha1    edafa412d86085cf39f0db1c19a6ea2890d05946 \
33                                rmd160  7e3341c6ef1494462dfd3f682ad4cc6871b73e98 \
34                        gcc-g77-${version}-src.tar.gz \
35                                md5     57d489658743f0d9048e440b312740c8 \
36                                sha1    156baeb2bd0dbbd15ed397b0a609e7e7cdbdab4b \
37                                rmd160  3c0ac52b0c18712a29219803c95399dfce53e461 \
38                        gcc-java-${version}-src.tar.gz \
39                                md5     96b039f4e11bff4d3d8a4e7da6e3998d \
40                                sha1    a9152dd7ffa35fc028fcca369a729ec2bbad55e7 \
41                                rmd160  4971ce8ffa01292567f36983101d4b99901da50d \
42                        gcc-objc-${version}-src.tar.gz \
43                                md5     2bffc1e314f2efb1034b3d3ea1ce2f7d \
44                                sha1    c96f1531d9d73e9279e0b6faf085deec5c2bda7b \
45                                rmd160  a02ad94da674760799ec945c7ff75ed99f9e8c3a
46worksrcdir              gcc-${version}
47
48# Patches for infodir
49patchfiles              patch-gcc-Makefile.in \
50                        patch-fastjar-Makefile.in
51
52depends_lib             port:i386-mingw32-w32api \
53                        port:i386-mingw32-runtime \
54                        port:i386-mingw32-binutils \
55                        port:gettext
56
57# segfault when built with llvm on lion: #30349
58if {${configure.compiler} == "clang" || ${configure.compiler} == "llvm-gcc-4.2"} {
59    configure.compiler gcc-4.2
60    if {![file executable ${configure.cc}]} {
61        depends_build-append port:apple-gcc42
62        depends_skip_archcheck apple-gcc42
63        configure.compiler apple-gcc-4.2
64    }
65}
66
67# Build in a different directory, as advised in the README file.
68pre-configure   { system "cd ${workpath} && mkdir -p build" }
69configure.dir   ${workpath}/build
70configure.cmd   ${workpath}/gcc-${version}/configure
71configure.args  --infodir='${prefix}/share/info' \
72                --mandir='${prefix}/share/man' \
73                --target=${crossgcc-target} \
74                --without-newlib \
75                --disable-nls \
76                --with-gnu-as \
77                --with-gnu-ld \
78                --disable-multilib \
79                --with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${gnu_version}/ \
80                --enable-sjlj-exceptions
81if {$build_arch != ""} {
82    configure.cc_archflags
83    configure.cxx_archflags
84    configure.objc_archflags
85    if {${os.platform} == "darwin"} {
86        configure.args-append --build=${build_arch}-apple-darwin${os.major} \
87                              --host=${build_arch}-apple-darwin${os.major}
88    }
89}
90
91build.dir       ${workpath}/build
92
93post-patch {
94        namespace eval crossgcc {}
95
96        # Fix the info pages and related stuff.
97        #       
98        # path: path to the doc directory (e.g. gas/doc/)
99        # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in)
100        # name: name of the info page (e.g. as)
101        # suffix: suffix of the souce page (texinfo or texi)
102        proc crossgcc::fixinfo { path makefile name suffix } {
103                global crossgcc-target worksrcpath
104
105                # Fix the source
106                reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \
107                        ${worksrcpath}/${path}/${name}.${suffix}
108                reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \
109                        ${worksrcpath}/${path}/${name}.${suffix}
110                reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \
111                        ${worksrcpath}/${path}/${name}.${suffix}
112               
113                # Fix the Makefile
114                reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \
115                        ${worksrcpath}/${makefile}
116                reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \
117                        ${worksrcpath}/${makefile}
118               
119                # Rename the source
120                file rename ${worksrcpath}/${path}/${name}.${suffix} \
121                        ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix}
122               
123                # Fix install-info's dir.
124                # (note: this may be effectless if there was no info dir to be fixed)
125                reinplace "s|__TARGET|${crossgcc-target}|g" \
126                        "${worksrcpath}/${makefile}"
127        }
128
129        # Fix the gettext files and related stuff.
130        #       
131        # module: name of the module (e.g. gas)
132        proc crossgcc::fixgettext { module } {
133                global crossgcc-target worksrcpath
134
135                if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } {
136                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
137                                "${worksrcpath}/${module}/Makefile.in"
138                }
139                if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } {
140                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
141                                "${worksrcpath}/${module}/doc/Makefile.in"
142                }
143                if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } {
144                        reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \
145                                "${worksrcpath}/${module}/po/Make-in"
146                }
147        }
148
149        # gcc/doc/cpp.texi
150        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cpp texi
151
152        # gcc/doc/cppinternals.texi
153        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in cppinternals texi
154
155        # gcc/doc/gcc.texi
156        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gcc texi
157        # XXX: Gross hack
158        # Clean up the mess in gcc/Makefile.in
159        reinplace s|lib${crossgcc-target}-gcc.texi|libgcc.texi|g ${worksrcpath}/gcc/Makefile.in
160
161        # gcc/doc/gccint.texi
162        crossgcc::fixinfo gcc/doc/ gcc/Makefile.in gccint texi
163
164        # gcc/f/g77.texi
165        crossgcc::fixinfo gcc/f/ gcc/f/Make-lang.in g77 texi
166
167        # gcc/java/gcj.texi
168        crossgcc::fixinfo gcc/java/ gcc/java/Make-lang.in gcj texi
169
170        # fastjar/fastjar.texi
171        crossgcc::fixinfo fastjar/ fastjar/Makefile.in fastjar texi
172       
173        # gettext stuff.
174        crossgcc::fixgettext gcc
175        crossgcc::fixgettext fastjar
176
177}
178
179destroot.violate_mtree  yes
180post-destroot {
181        # Stuff I don't want (either because they're in the system
182        # or because they would conflict with other FSF ports)
183        # (it's easier for maintainability purposes to fix things here)
184
185        # aliases for locales (should be on the system)
186        file delete "${destroot}${prefix}/share/locale/locale.alias"
187       
188        # FSF propaganda (should already be there or would conflict)
189        file delete -force "${destroot}${prefix}/share/man/man7"
190
191        # (host) libiberty
192        foreach f [glob -directory "${destroot}${prefix}/lib" libiberty.a */libiberty.a] {
193        file delete $f
194    }
195
196        # aliases for charsets (should already be there)
197        file delete "${destroot}${prefix}/lib/charset.alias"
198       
199        # Remove man pages for tools that are not built as part of cross-gcc
200        file delete "${destroot}${prefix}/share/man/man1/rmic.1"
201        file delete "${destroot}${prefix}/share/man/man1/rmiregistry.1"
202        file delete "${destroot}${prefix}/share/man/man1/jv-convert.1"
203        file delete "${destroot}${prefix}/share/man/man1/gij.1"
204
205        # There is no need for documentation on installing gcc
206        # given that this port just installed gcc.
207        file delete "${destroot}${prefix}/share/info/gccinstall.info"
208}
Note: See TracBrowser for help on using the repository browser.