# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup github 1.0
github.setup mirror mingw-w64 7.0.0 v
set mingw_name w64-mingw32
platforms darwin
license ZPL-2.1
categories cross devel
maintainers {mojca @mojca} openmaintainer
description GCC cross-compiler for Windows 64 & 32 bits
long_description Mingw-w64 is an advancement of the original mingw.org project, \
created to support the GCC compiler on Windows systems.
homepage http://mingw-w64.sourceforge.net/
checksums rmd160 6af03b6c706f922c0bfef85aabd53e235c0fb4c2 \
sha256 047869a89b87c92d0397493a56dcc474e5aa19f72c4903427eb230b7bd7de2a3 \
size 12460769
# needs an out-of-source build
configure.dir ${workpath}/build
build.dir ${configure.dir}
post-extract { file mkdir "${build.dir}" }
# create six subports:
# - i686-w64-mingw32-headers
# - i686-w64-mingw32-crt
# - i686-w64-mingw32-winpthreads
# - x86_64-w64-mingw32-headers
# - x86_64-w64-mingw32-crt
# - x86_64-w64-mingw32-winpthreads
foreach arch {i686 x86_64} {
foreach component {crt headers winpthreads} {
subport ${arch}-${mingw_name}-${component} {
set mingw_arch ${arch}
set mingw_comp ${component}
if {${component} eq "winpthreads"} {
set mingw_dir mingw-w64-libraries/${component}
} else {
set mingw_dir mingw-w64-${component}
}
}
}
}
if {${subport} ne ${name}} {
set mingw_target ${mingw_arch}-${mingw_name}
configure.cmd ${worksrcpath}/${mingw_dir}/configure
configure.pre_args-replace --prefix=${prefix} --prefix=${prefix}/${mingw_target}
configure.args-append --host=${mingw_target}
# *-headers subports
if {${mingw_comp} eq "headers"} {
supported_archs noarch
configure.args-append --enable-secure-api
# winpthreads install three files which conflict with placeholders provided by "headers"
#
# a relatively ugly workaround is to copy those three files from "winpthreads" to "headers"
# and then delete them from "winpthreads" again
post-extract {
foreach f {signal time unistd} {
set f_src ${worksrcpath}/mingw-w64-libraries/winpthreads/include/pthread_${f}.h
set f_dest ${worksrcpath}/${mingw_dir}/crt
copy -force ${f_src} ${f_dest}
}
}
# *-crt and *-winpthreads subports
} else {
# We only need a dependency on either of the two GCC compilers:
# - ${mingw_target}-gcc-bootstrap
# - ${mingw_target}-gcc
# to build. The rest of dependencies (*-headers, *-binutils)
# are pulled in by one of those two ports.
#
# Runtime dependency on GCC is not added to avoid dependency cycles,
# but in fact it's GCC that needs CRT at runtime, not the other way around.
if {${mingw_comp} eq "crt"} {
depends_build-append bin:${mingw_target}-gcc:${mingw_target}-gcc-bootstrap
# *-winpthreads
} else {
# winpthreads needs at least stage 2 compiler (or the final one)
# as well as the latest version of crt
depends_build-append path:${mingw_target}/lib/libgcc_s.a:${mingw_target}-gcc-nothreads \
port:${arch}-${mingw_name}-crt
depends_lib-append port:${arch}-${mingw_name}-crt