Skip to content

Commit

Permalink
dev-util/mingw64-runtime: bump up to 9.0.0
Browse files Browse the repository at this point in the history
Reported-by: Mike Lothian
Closes: https://bugs.gentoo.org/799212
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information
Sergei Trofimovich committed Jul 5, 2021
1 parent 4dbdfc5 commit 607450d
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-util/mingw64-runtime/Manifest
@@ -1,2 +1,3 @@
DIST mingw-w64-v7.0.0.tar.bz2 9071231 BLAKE2B da00794ec456ede5913a565248c79255407c058469cb7338cf81b8d03c1e39f4189016b01734b786c0ad8f18166a24fdb95ca72edc954f31151e5d3aa2b2a899 SHA512 30e5b2824a24eeb99ab519e3fc134cc9a7f04ee8b853bc8d66a13d1ab74144bf78b93e162bfe6de2a5e61f63c0e620a933b260b02d019cd68cc4b78bd36c67fd
DIST mingw-w64-v8.0.0.tar.bz2 9370799 BLAKE2B ec65191722f6f2ddbb93488ea4c4c21e22fb5ef777ef293d65d13de1057d96c9105a4a4936999d4babbd8fdfc52ed14675f1c5fbc630524df28805e0f66b1a2b SHA512 cefcc86ac3e6337c88ed224ab4692abbd5eb543ce78fb6c5462198a85f36c9274a0a1df0a0bebd182137fd527c15831f9237c782711a85f32e77d9104b28359e
DIST mingw-w64-v9.0.0.tar.bz2 9537758 BLAKE2B 298b97f50c7632972aee2c75e90de0776f64c1dd5aaeb52d4e4be10a8e0365efee82c93179990cc090cc7b9f83525a7abf51a5d069b7a3e39abb37fdb733a70c SHA512 6691331a2ab521d22c1d32bebe0ed049bd62a7a7722cff38e7792b4e42c6b8df4356084afff6c916b487b3ebddc4372b398ab7cd0c7f4ff6991a70fe64177386
119 changes: 119 additions & 0 deletions dev-util/mingw64-runtime/mingw64-runtime-9.0.0.ebuild
@@ -0,0 +1,119 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} == ${CHOST} ]] ; then
if [[ ${CATEGORY} == cross-* ]] ; then
export CTARGET=${CATEGORY#cross-}
fi
fi

inherit autotools flag-o-matic toolchain-funcs

DESCRIPTION="Free Win64 runtime and import library definitions"
HOMEPAGE="http://mingw-w64.sourceforge.net/"
SRC_URI="mirror://sourceforge/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
# USE=libraries needs working stage2 compiler: bug #665512
IUSE="headers-only idl libraries tools"
RESTRICT="strip"

S="${WORKDIR}/mingw-w64-v${PV}"

PATCHES=(
"${FILESDIR}"/${PN}-7.0.0-fortify-only-ssp.patch
"${FILESDIR}"/${PN}-8.0.0-__rdtsc.patch
)

is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
just_headers() {
use headers-only
}
alt_prefix() {
is_crosscompile && echo /usr/${CTARGET}
}
crt_with() {
just_headers && echo --without-$1 || echo --with-$1
}
crt_use_enable() {
just_headers && echo --without-$2 || use_enable "$@"
}
crt_use_with() {
just_headers && echo --without-$2 || use_with "$@"
}

pkg_setup() {
if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
die "Invalid configuration"
fi
}

src_configure() {
CHOST=${CTARGET} strip-unsupported-flags
# Normally mingw-64 does not use dynamic linker.
# But at configure time it uses $LDFLAGS.
# When default -Wl,--hash-style=gnu is passed
# __CTORS_LIST__ / __DTORS_LIST__ is mis-detected
# for target ld and binaries crash at shutdown.
filter-ldflags '-Wl,--hash-style=*'

if ! just_headers; then
mkdir "${WORKDIR}/headers"
pushd "${WORKDIR}/headers" > /dev/null
CHOST=${CTARGET} "${S}/configure" \
--prefix="${T}/tmproot" \
--with-headers \
--without-crt \
|| die
popd > /dev/null
append-cppflags "-I${T}/tmproot/include"
fi

# By default configure tries to set --sysroot=${prefix}. We disable
# this behaviour with --with-sysroot=no to use gcc's sysroot default.
# That way we can cross-build mingw64-runtime with cross-emerge.
local prefix="${EPREFIX}"$(alt_prefix)/usr
CHOST=${CTARGET} econf \
--with-sysroot=no \
--prefix="${prefix}" \
--libdir="${prefix}"/lib \
--with-headers \
--enable-sdk \
$(crt_with crt) \
$(crt_use_enable idl idl) \
$(crt_use_with libraries libraries) \
$(crt_use_with tools tools) \
$(
$(tc-getCPP ${CTARGET}) ${CPPFLAGS} -dM - < /dev/null | grep -q __MINGW64__ \
&& echo --disable-lib32 --enable-lib64 \
|| echo --enable-lib32 --disable-lib64
)
}

src_compile() {
if ! just_headers; then
emake -C "${WORKDIR}/headers" install
fi
default
}

src_install() {
default

if is_crosscompile ; then
# gcc is configured to look at specific hard-coded paths for mingw #419601
dosym usr /usr/${CTARGET}/mingw
dosym usr /usr/${CTARGET}/${CTARGET}
dosym usr/include /usr/${CTARGET}/sys-include
fi

rm -rf "${ED}/usr/share"
}

0 comments on commit 607450d

Please sign in to comment.