dev-util/mingw64-runtime: build tools for CHOST and add widl

Non-native USE=tools never made much sense, If a package is
cross-compiling for mingw using e.g. widl, it'll need to be able
to run the tool. This also prevents build failure (bug #644556)
during bootstrap given this won't be trying to link with mingw
(note that can cross-emerge mingw64-runtime for old behavior).

wrt widl, it is provided by wine but that is a heavy dependency and
some upstreams (e.g. vkd3d-proton) default to using *-w64-mingw32-widl
instead -- small tool so may as well install it.

Closes: https://bugs.gentoo.org/644556
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2022-05-12 22:29:29 -04:00
parent 7e1fc3f223
commit 4b7c1923fc
3 changed files with 87 additions and 12 deletions
@@ -33,8 +33,32 @@ pkg_setup() {
die "Invalid configuration, please see: https://wiki.gentoo.org/wiki/Mingw"
}
mingw-foreach_tool() {
use !tools || use headers-only && return
local tool
for tool in gendef genidl widl; do
# not using top-level --with-tools given it skips widl
pushd mingw-w64-tools/${tool} || die
"${@}"
popd >/dev/null || die
done
}
src_configure() {
CHOST=${CTARGET}
# native tools, see #644556
local toolsconf=(
--prefix="${EPREFIX}"/usr
)
# normally only widl is prefixed, but avoids clash with other targets
${MW_CROSS} && toolsconf+=( --program-prefix=${CTARGET}- )
mingw-foreach_tool econf "${toolsconf[@]}"
MW_LDFLAGS=${LDFLAGS} # keep non-stripped for gendef not respecting it
# cross-compiling from here
local CHOST=${CTARGET}
strip-unsupported-flags
# Normally mingw64 does not use dynamic linker.
@@ -62,7 +86,6 @@ src_configure() {
conf+=(
$(use_enable idl)
$(use_with libraries)
$(use_with tools)
)
# prefer tuple to determine if should do 32 or 64bits, but fall
@@ -91,13 +114,15 @@ src_configure() {
src_compile() {
use headers-only || emake -C ../headers install
default
emake
mingw-foreach_tool emake LDFLAGS="${MW_LDFLAGS}"
}
src_install() {
default
mingw-foreach_tool emake DESTDIR="${D}" install
if ${MW_CROSS}; then
# gcc is configured to look at specific hard-coded paths for mingw #419601
dosym usr /usr/${CTARGET}/mingw
@@ -35,8 +35,32 @@ pkg_setup() {
die "Invalid configuration, please see: https://wiki.gentoo.org/wiki/Mingw"
}
mingw-foreach_tool() {
use !tools || use headers-only && return
local tool
for tool in gendef genidl widl; do
# not using top-level --with-tools given it skips widl
pushd mingw-w64-tools/${tool} || die
"${@}"
popd >/dev/null || die
done
}
src_configure() {
CHOST=${CTARGET}
# native tools, see #644556
local toolsconf=(
--prefix="${EPREFIX}"/usr
)
# normally only widl is prefixed, but avoids clash with other targets
${MW_CROSS} && toolsconf+=( --program-prefix=${CTARGET}- )
mingw-foreach_tool econf "${toolsconf[@]}"
MW_LDFLAGS=${LDFLAGS} # keep non-stripped for gendef not respecting it
# cross-compiling from here
local CHOST=${CTARGET}
strip-unsupported-flags
# Normally mingw64 does not use dynamic linker.
@@ -64,7 +88,6 @@ src_configure() {
conf+=(
$(use_enable idl)
$(use_with libraries)
$(use_with tools)
)
# prefer tuple to determine if should do 32 or 64bits, but fall
@@ -93,13 +116,15 @@ src_configure() {
src_compile() {
use headers-only || emake -C ../headers install
default
emake
mingw-foreach_tool emake LDFLAGS="${MW_LDFLAGS}"
}
src_install() {
default
mingw-foreach_tool emake DESTDIR="${D}" install
if ${MW_CROSS}; then
# gcc is configured to look at specific hard-coded paths for mingw #419601
dosym usr /usr/${CTARGET}/mingw
@@ -33,8 +33,32 @@ pkg_setup() {
die "Invalid configuration, please see: https://wiki.gentoo.org/wiki/Mingw"
}
mingw-foreach_tool() {
use !tools || use headers-only && return
local tool
for tool in gendef genidl widl; do
# not using top-level --with-tools given it skips widl
pushd mingw-w64-tools/${tool} || die
"${@}"
popd >/dev/null || die
done
}
src_configure() {
CHOST=${CTARGET}
# native tools, see #644556
local toolsconf=(
--prefix="${EPREFIX}"/usr
)
# normally only widl is prefixed, but avoids clash with other targets
${MW_CROSS} && toolsconf+=( --program-prefix=${CTARGET}- )
mingw-foreach_tool econf "${toolsconf[@]}"
MW_LDFLAGS=${LDFLAGS} # keep non-stripped for gendef not respecting it
# cross-compiling from here
local CHOST=${CTARGET}
strip-unsupported-flags
# Normally mingw64 does not use dynamic linker.
@@ -62,7 +86,6 @@ src_configure() {
conf+=(
$(use_enable idl)
$(use_with libraries)
$(use_with tools)
)
# prefer tuple to determine if should do 32 or 64bits, but fall
@@ -91,13 +114,15 @@ src_configure() {
src_compile() {
use headers-only || emake -C ../headers install
default
emake
mingw-foreach_tool emake LDFLAGS="${MW_LDFLAGS}"
}
src_install() {
default
mingw-foreach_tool emake DESTDIR="${D}" install
if ${MW_CROSS}; then
# gcc is configured to look at specific hard-coded paths for mingw #419601
dosym usr /usr/${CTARGET}/mingw