1 | # $Id: Portfile nomaintainer@macports.org $ |
---|
2 | PortSystem 1.0 |
---|
3 | |
---|
4 | name x86_64-pc-mingw32-binutils |
---|
5 | version 2.18 |
---|
6 | maintainers nomaintainer@macports.org |
---|
7 | description Mingw32 Binutils for x86_64-pc-mingw32 cross development |
---|
8 | long_description Mingw32 development toolchain ("binutils") \ |
---|
9 | for x86_64-pc-mingw32 (Windows) cross development. |
---|
10 | homepage http://www.gnu.org/software/binutils/binutils.html |
---|
11 | categories cross devel |
---|
12 | |
---|
13 | # |
---|
14 | # Referencing: |
---|
15 | # http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-doc/howto-build/mingw-w64-howto-build.txt?revision=99&view=markup |
---|
16 | # |
---|
17 | |
---|
18 | depends_lib port:gmp \ |
---|
19 | port:mpfr \ |
---|
20 | port:libiconv |
---|
21 | |
---|
22 | # Parameters for this port. |
---|
23 | set crossgcc-target x86_64-pc-mingw32 |
---|
24 | |
---|
25 | platforms darwin |
---|
26 | master_sites gnu:binutils |
---|
27 | distname binutils-${version} |
---|
28 | use_bzip2 yes |
---|
29 | checksums md5 9d22ee4dafa3a194457caf4706f9cf01 \ |
---|
30 | sha1 fdec92e9dfc6c32155869f3910f47041c78e2277 \ |
---|
31 | rmd160 78d07475667c55ecbf9068dbb90362a3445b2a99 |
---|
32 | |
---|
33 | # Build in a different directory, as advised in the README file. |
---|
34 | pre-configure { system "cd ${workpath} && mkdir -p build"} |
---|
35 | configure.dir ${workpath}/build |
---|
36 | configure.cmd ${worksrcpath}/configure |
---|
37 | #configure.cc "cc -no-cpp-precomp" |
---|
38 | configure.args --infodir='${prefix}/share/info' \ |
---|
39 | --target=${crossgcc-target} \ |
---|
40 | --mandir='${prefix}/share/man' \ |
---|
41 | --prefix=${prefix} \ |
---|
42 | --with-sysroot=${prefix} \ |
---|
43 | --with-local-prefix=${prefix} \ |
---|
44 | --with-gmp=${prefix} \ |
---|
45 | --with-mpfr=${prefix} \ |
---|
46 | --disable-nls |
---|
47 | # --program-prefix=${crossgcc-target}- \ |
---|
48 | # --with-mpfr=${prefix} --with-gmp=${prefix} |
---|
49 | build.dir ${workpath}/build |
---|
50 | |
---|
51 | # We don't want the etc module. |
---|
52 | post-extract { |
---|
53 | system "rm -rf ${worksrcpath}/etc" |
---|
54 | } |
---|
55 | |
---|
56 | post-patch { |
---|
57 | namespace eval crossgcc {} |
---|
58 | |
---|
59 | # Fix the info pages and related stuff. |
---|
60 | # |
---|
61 | # path: path to the doc directory (e.g. gas/doc/) |
---|
62 | # makefile: path to Makefile.in (e.g. gas/doc/Makefile.in) |
---|
63 | # name: name of the info page (e.g. as) |
---|
64 | # suffix: suffix of the souce page (texinfo or texi) |
---|
65 | proc crossgcc::fixinfo { path makefile name suffix } { |
---|
66 | global crossgcc-target worksrcpath |
---|
67 | |
---|
68 | # Fix the source |
---|
69 | reinplace "s|setfilename ${name}.info|setfilename ${crossgcc-target}-${name}.info|g" \ |
---|
70 | ${worksrcpath}/${path}/${name}.${suffix} |
---|
71 | reinplace "s|(${name})|(${crossgcc-target}-${name})|g" \ |
---|
72 | ${worksrcpath}/${path}/${name}.${suffix} |
---|
73 | reinplace "s|@file{${name}}|@file{${crossgcc-target}-${name}}|g" \ |
---|
74 | ${worksrcpath}/${path}/${name}.${suffix} |
---|
75 | |
---|
76 | # Fix the Makefile |
---|
77 | reinplace "s|${name}.info|${crossgcc-target}-${name}.info|g" \ |
---|
78 | ${worksrcpath}/${makefile} |
---|
79 | reinplace "s|${name}.${suffix}|${crossgcc-target}-${name}.${suffix}|g" \ |
---|
80 | ${worksrcpath}/${makefile} |
---|
81 | |
---|
82 | # Rename the source |
---|
83 | file rename ${worksrcpath}/${path}/${name}.${suffix} \ |
---|
84 | ${worksrcpath}/${path}/${crossgcc-target}-${name}.${suffix} |
---|
85 | |
---|
86 | # Fix install-info's dir. |
---|
87 | # (note: this may be effectless if there was no info dir to be fixed) |
---|
88 | reinplace "s|__TARGET|${crossgcc-target}|g" \ |
---|
89 | "${worksrcpath}/${makefile}" |
---|
90 | } |
---|
91 | |
---|
92 | # Fix the gettext files and related stuff. |
---|
93 | # |
---|
94 | # module: name of the module (e.g. gas) |
---|
95 | proc crossgcc::fixgettext { module } { |
---|
96 | global crossgcc-target worksrcpath |
---|
97 | |
---|
98 | if { [ file exists "${worksrcpath}/${module}/Makefile.in" ] } { |
---|
99 | reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \ |
---|
100 | "${worksrcpath}/${module}/Makefile.in" |
---|
101 | } |
---|
102 | if { [ file exists "${worksrcpath}/${module}/doc/Makefile.in" ] } { |
---|
103 | reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \ |
---|
104 | "${worksrcpath}/${module}/doc/Makefile.in" |
---|
105 | } |
---|
106 | if { [ file exists "${worksrcpath}/${module}/po/Make-in" ] } { |
---|
107 | reinplace "s|@PACKAGE@|${crossgcc-target}-@PACKAGE@|g" \ |
---|
108 | "${worksrcpath}/${module}/po/Make-in" |
---|
109 | } |
---|
110 | } |
---|
111 | |
---|
112 | # gas/doc/as.texinfo |
---|
113 | crossgcc::fixinfo gas/doc/ gas/doc/Makefile.in as texinfo |
---|
114 | |
---|
115 | # bfd/doc/bfd.texinfo |
---|
116 | crossgcc::fixinfo bfd/doc/ bfd/doc/Makefile.in bfd texinfo |
---|
117 | |
---|
118 | # binutils/doc/binutils.texi |
---|
119 | crossgcc::fixinfo binutils/doc/ binutils/doc/Makefile.in binutils texi |
---|
120 | |
---|
121 | # gprof/gprof.texi |
---|
122 | crossgcc::fixinfo gprof/ gprof/Makefile.in gprof texi |
---|
123 | |
---|
124 | # ld/ld.texinfo |
---|
125 | crossgcc::fixinfo ld/ ld/Makefile.in ld texinfo |
---|
126 | |
---|
127 | # gettext stuff. |
---|
128 | crossgcc::fixgettext bfd |
---|
129 | crossgcc::fixgettext binutils |
---|
130 | crossgcc::fixgettext gas |
---|
131 | crossgcc::fixgettext gprof |
---|
132 | crossgcc::fixgettext ld |
---|
133 | crossgcc::fixgettext opcodes |
---|
134 | } |
---|
135 | |
---|
136 | post-destroot { |
---|
137 | # Installing (host) libiberty was a mistake. |
---|
138 | file delete "${destroot}/${prefix}/lib/libiberty.a" |
---|
139 | file delete -force "${destroot}/${prefix}/${crossgcc-target}" |
---|
140 | } |
---|
141 | |
---|