Skip to content

Commit

Permalink
(#23481) mingw-builds: added 13.2.0
Browse files Browse the repository at this point in the history
* mingw-builds: added 13.2

* Added version 13.2 in config.yml

* mingw-build: fix mfc instead of mcf typo

* mingw-build: for version <13 del self.options.runtime

* mingw-build: for version <13 del self.options.runtime

* mingw-build: refactoring

* mingw-build: adding configure method to remove options.runtime for version <= 12.2.0

* mingw-build: refactoring
  • Loading branch information
elvisdukaj authored May 21, 2024
1 parent 3b1304c commit a63cb57
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
22 changes: 22 additions & 0 deletions recipes/mingw-builds/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
sources:
"13.2.0":
mcf:
seh:
ucrt:
url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-mcf-seh-ucrt-rt_v11-rev1.7z"
sha256: "9ae11d0b00f4deae7246471193191de62d9e0318917d3577b568e0974c3069bc"
posix:
seh:
ucrt:
url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-posix-seh-ucrt-rt_v11-rev1.7z"
sha256: "475ee72c5ce1bd54a3e3c334bdd3be5e6575334184fd9718013aa362c9819d2f"
msvcrt:
url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-posix-seh-msvcrt-rt_v11-rev1.7z"
sha256: "7d3f84b17b235aa233f0fb5df9765bf79dbea950177a69ff99f8ad1d75b0aa6e"
win32:
seh:
ucrt:
url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z"
sha256: "74ca64c55220edd3196681782fbff653c2b9cb4f427f9e532ab6e9a0823dc997"
msvcrt:
url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-msvcrt-rt_v11-rev1.7z"
sha256: "15b914f38f2f2e2d6f7b9b8425ff22b7e406878b01920190b09ce0dd8259c6aa"
"12.2.0":
posix:
seh:
Expand Down
27 changes: 23 additions & 4 deletions recipes/mingw-builds/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import copy, download, rmdir
from conan.tools.scm import Version


required_conan_version = ">=1.47.0"
Expand All @@ -14,14 +15,27 @@ class MingwConan(ConanFile):
license = "ZPL-2.1", "MIT", "GPL-2.0-or-later"
topics = ("gcc", "gnu", "unix", "mingw32", "binutils")
settings = "os", "arch"
options = {"threads": ["posix", "win32"], "exception": ["seh", "sjlj"]}
default_options = {"threads": "posix", "exception": "seh"}
options = {
"threads": ["posix", "win32", "mcf"],
"exception": ["seh", "sjlj"],
"runtime": ["msvcrt", "ucrt"]
}
default_options = {
"threads": "posix",
"exception": "seh",
"runtime": "ucrt"
}
provides = "mingw-w64"

@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)

def config_options(self):
# Before version 12 (included) the only possible runtime was msvcrt
if Version(self.version) <= Version("12.2.0"):
del self.options.runtime

def validate(self):
valid_os = ["Windows"]
if str(self.settings.os) not in valid_os:
Expand Down Expand Up @@ -52,15 +66,20 @@ def validate(self):
def build_requirements(self):
self.build_requires("7zip/19.00")

def _get_source(self):
if Version(self.version) <= Version("12.2.0"):
return self.conan_data["sources"][self.version][str(self.options.threads)][str(self.options.exception)]
else:
return self.conan_data["sources"][self.version][str(self.options.threads)][str(self.options.exception)][str(self.options.runtime)]

def build(self):
# Source should be downloaded in the build step since it depends on specific options
url = self.conan_data["sources"][self.version][str(self.options.threads)][str(self.options.exception)]
url = self._get_source()
self.output.info(f"Downloading: {url['url']}")
download(self, url["url"], "file.7z", sha256=url["sha256"])
self.run("7z x file.7z")
os.remove('file.7z')


def package(self):
target = "mingw64" if self.settings.arch == "x86_64" else "mingw32"
copy(self, "*", src=target, dst=self.package_folder)
Expand Down
2 changes: 2 additions & 0 deletions recipes/mingw-builds/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"13.2.0":
folder: "all"
"12.2.0":
folder: "all"
"12.1.0":
Expand Down

0 comments on commit a63cb57

Please sign in to comment.