Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mold: add version 2.36.0 #26555

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions recipes/mold/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"2.36.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.36.0.tar.gz"
sha256: "3f57fe75535500ecce7a80fa1ba33675830b7d7deb1e5ee9a737e2bc43cdb1c7"
"2.34.1":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.34.1.tar.gz"
sha256: "a8cf638045b4a4b2697d0bcc77fd96eae93d54d57ad3021bf03b0333a727a59d"
Expand Down
45 changes: 9 additions & 36 deletions recipes/mold/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from conan.tools.scm import Version
from conan.tools.env import VirtualBuildEnv

required_conan_version = ">=1.47.0"
required_conan_version = ">2.0"


class MoldConan(ConanFile):
Expand All @@ -30,20 +30,6 @@ class MoldConan(ConanFile):
"with_mimalloc": False,
}

@property
def _min_cppstd(self):
return 20

@property
def _compilers_minimum_version(self):
return {
"gcc": "11",
"clang": "12",
"apple-clang": "14",
"Visual Studio": "16",
"msvc": "192",
}

def configure(self):
if Version(self.version) < "2.0.0":
self.license = "AGPL-3.0"
Expand All @@ -65,30 +51,22 @@ def requirements(self):
def package_id(self):
del self.info.settings.compiler

def validate(self):
# mold has required C+20 since 1.4.1. However, C++20 features are used for the first time in 2.34.0.
def validate_build(self):
# perform these checks in validate_build() - since the compiler is removed from the package_id,
# this lets the compatibility plugin consider the executable built with other compilers
if Version(self.version) >= "2.34.0":
# validate the minimum cpp standard supported. For C++ projects only
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

# TODO most of these checks should run on validate_build, but the conan-center hooks are broken and fail the PR because they
# think we're raising on the build() method
if self.settings.build_type == "Debug":
raise ConanInvalidConfiguration('Mold is a build tool, specify mold:build_type=Release in your build profile, see https://github.com/conan-io/conan-center-index/pull/11536#issuecomment-1195607330')
# mold has required C+20 since 1.4.1. However, C++20 features are used for the first time in 2.34.0.
check_min_cppstd(self, 20)
if self.settings.compiler in ["gcc", "clang", "intel-cc"] and self.settings.compiler.libcxx != "libstdc++11":
raise ConanInvalidConfiguration('Mold can only be built with libstdc++11; specify mold:compiler.libcxx=libstdc++11 in your build profile')
if self.settings.os == "Windows":
if self.settings.compiler == "msvc":
raise ConanInvalidConfiguration(f'{self.name} can not be built on {self.settings.os}.')
if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "10":
raise ConanInvalidConfiguration("GCC version 10 or higher required")
if self.settings.compiler in ('clang', 'apple-clang') and Version(self.settings.compiler.version) < "12":
raise ConanInvalidConfiguration("Clang version 12 or higher required")
if Version(self.version) >= "2.34.0" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14":
raise ConanInvalidConfiguration("Apple-Clang version 14 or higher required due to C++20 features")
if self.settings.compiler == "apple-clang" and "armv8" == self.settings.arch :
raise ConanInvalidConfiguration(f'{self.name} is still not supported by Mac M1.')
if Version(self.version) == "2.33.0" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14":
Expand Down Expand Up @@ -141,8 +119,3 @@ def package_info(self):
self.conf_info.define("user.mold:path", mold_executable)
self.buildenv_info.define_path("MOLD_ROOT", bindir)
self.buildenv_info.define("LD", mold_executable)

# For legacy Conan 1.x consumers only:
self.env_info.PATH.append(bindir)
self.env_info.MOLD_ROOT = bindir
self.env_info.LD = mold_executable
8 changes: 3 additions & 5 deletions recipes/mold/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

class MoldTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "VirtualBuildEnv"
test_type = "explicit"

def build_requirements(self):
self.tool_requires(self.tested_reference_str)
def requirements(self):
self.requires(self.tested_reference_str)

def test(self):
if can_run(self):
self.run("mold -v")
self.run("mold -v", env="conanrun")
2 changes: 2 additions & 0 deletions recipes/mold/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.36.0":
folder: all
"2.34.1":
folder: all
"2.33.0":
Expand Down