-
Notifications
You must be signed in to change notification settings - Fork 2k
implement mold/1.3.1 recipe #11536
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
Merged
conan-center-bot
merged 46 commits into
conan-io:master
from
AndreyMlashkin:implement_mold
Jul 31, 2022
Merged
implement mold/1.3.1 recipe #11536
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
ccfa8d9
implement mold recipe
AndreyMlashkin bb4efe2
fix linter errors
AndreyMlashkin b84ab67
linter fixes
AndreyMlashkin 5e13937
linter fixes
AndreyMlashkin 3c44d0e
make CI lint happy
AndreyMlashkin 345affb
add test recipe
AndreyMlashkin 3214018
add zlib requirement
AndreyMlashkin ecbf58d
use only gcc version higher than 8
AndreyMlashkin cb6895b
override LD variable
AndreyMlashkin f15efb0
use zlib from conan
AndreyMlashkin 564e8ca
add forgotten patch
AndreyMlashkin 3edc425
make linter happy
AndreyMlashkin d8bb692
increase gcc version requirement
AndreyMlashkin 87d63d6
hardcode zlib patch
AndreyMlashkin 9d31754
remove patches
AndreyMlashkin 9fb1727
add openssl dependency
AndreyMlashkin 81a8eec
remove options
AndreyMlashkin 6e2f452
increase clang version requirements
AndreyMlashkin f8212c1
forbid apple-clang with version less 11
AndreyMlashkin f072b36
disable macos arm builds
AndreyMlashkin e6ca9a9
point LD to mold
AndreyMlashkin 78fc930
Apply suggestions from code review
AndreyMlashkin 238323e
implement review notes
AndreyMlashkin 1d3ef7a
Update recipes/mold/all/test_package/conanfile.py
AndreyMlashkin 5a78673
disable clang 12
AndreyMlashkin 48574c5
add libc to package id
AndreyMlashkin dfbfa07
remove package ID
AndreyMlashkin dfef214
drop gcc 10 support
AndreyMlashkin 984fbaa
Apply suggestions from code review
AndreyMlashkin 60620e3
use xxhash from conan
AndreyMlashkin 1f97773
substitute includes to the right place
AndreyMlashkin 7ef3680
Update recipes/mold/all/conanfile.py
AndreyMlashkin 5e0724d
Apply suggestions from code review
AndreyMlashkin 5ae9068
Update recipes/mold/all/conanfile.py
AndreyMlashkin 1c41a05
use compiler for package id
AndreyMlashkin 46201cc
Update recipes/mold/all/conanfile.py
AndreyMlashkin 3ca4b41
substitute conan mimaloc and tbb as system libs
AndreyMlashkin 2db000b
prohibit debug builds
AndreyMlashkin 5455ee4
Apply suggestions from code review
AndreyMlashkin 4f53c66
vorbid libstdc for mold
AndreyMlashkin 3b25133
add check for compiler to exclude apple-clang
AndreyMlashkin f21c134
use std=c++2a for apple clang
AndreyMlashkin 205d8f7
increase minimal apple-clang requirement
AndreyMlashkin a58ab67
Update recipes/mold/all/conanfile.py
AndreyMlashkin bc81c34
remove zlib
AndreyMlashkin a3151cc
Update recipes/mold/all/conanfile.py
AndreyMlashkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.3.1": | ||
url: "https://github.com/rui314/mold/archive/refs/tags/v1.3.1.tar.gz" | ||
sha256: "d436e2d4c1619a97aca0e28f26c4e79c0242d10ce24e829c1b43cfbdd196fd77" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
from conans import ConanFile, tools, AutoToolsBuildEnvironment | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
required_conan_version = ">=1.45.0" | ||
|
||
class MoldConan(ConanFile): | ||
name = "mold" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/rui314/mold/" | ||
license = "AGPL-3.0" | ||
description = ("mold is a faster drop-in replacement for existing Unix linkers. It is several times faster than the LLVM lld linker") | ||
topics = ("mold", "ld", "linkage", "compilation") | ||
|
||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
generators = "make" | ||
|
||
def validate(self): | ||
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') | ||
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": | ||
raise ConanInvalidConfiguration(f'{self.name} can not be built on {self.settings.os}.') | ||
if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "11": | ||
raise ConanInvalidConfiguration("GCC version 11 or higher required") | ||
if (self.settings.compiler == "clang" or self.settings.compiler == "apple-clang") and tools.Version(self.settings.compiler.version) < "12": | ||
raise ConanInvalidConfiguration("Clang version 12 or higher required") | ||
if self.settings.compiler == "apple-clang" and "armv8" == self.settings.arch : | ||
raise ConanInvalidConfiguration(f'{self.name} is still not supported by Mac M1.') | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
def _get_include_path(self, dependency): | ||
include_path = self.deps_cpp_info[dependency].rootpath | ||
include_path = os.path.join(include_path, "include") | ||
return include_path | ||
|
||
def _patch_sources(self): | ||
if self.settings.compiler == "apple-clang": | ||
tools.replace_in_file("source_subfolder/Makefile", "-std=c++20", "-std=c++2a") | ||
|
||
tools.replace_in_file("source_subfolder/Makefile", "-Ithird-party/xxhash ", "-I{} -I{} -I{} -I{} -I{}".format( | ||
self._get_include_path("zlib"), | ||
self._get_include_path("openssl"), | ||
self._get_include_path("xxhash"), | ||
self._get_include_path("mimalloc"), | ||
self._get_include_path("onetbb") | ||
)) | ||
|
||
tools.replace_in_file("source_subfolder/Makefile", "MOLD_LDFLAGS += -ltbb", "MOLD_LDFLAGS += -L{} -ltbb".format( | ||
self.deps_cpp_info["onetbb"].lib_paths[0])) | ||
|
||
tools.replace_in_file("source_subfolder/Makefile", "MOLD_LDFLAGS += -lmimalloc", "MOLD_LDFLAGS += -L{} -lmimalloc".format( | ||
self.deps_cpp_info["mimalloc"].lib_paths[0])) | ||
|
||
def requirements(self): | ||
AndreyMlashkin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.requires("zlib/1.2.12") | ||
self.requires("openssl/1.1.1q") | ||
self.requires("xxhash/0.8.1") | ||
uilianries marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.requires("onetbb/2021.3.0") | ||
self.requires("mimalloc/2.0.6") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], | ||
destination=self._source_subfolder, strip_root=True) | ||
|
||
def build(self): | ||
self._patch_sources() | ||
with tools.chdir(self._source_subfolder): | ||
autotools = AutoToolsBuildEnvironment(self) | ||
autotools.make(target="mold", args=['SYSTEM_TBB=1', 'SYSTEM_MIMALLOC=1']) | ||
|
||
def package(self): | ||
self.copy("LICENSE", src=self._source_subfolder, dst="licenses") | ||
self.copy("mold", src=self._source_subfolder, dst="bin", keep_path=False) | ||
|
||
AndreyMlashkin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def package_id(self): | ||
del self.info.settings.compiler | ||
|
||
def package_info(self): | ||
bindir = os.path.join(self.package_folder, "bin") | ||
mold_location = os.path.join(bindir, "bindir") | ||
|
||
self.output.info('Appending PATH environment variable: {}'.format(bindir)) | ||
self.env_info.PATH.append(bindir) | ||
self.env_info.LD = mold_location | ||
self.buildenv_info.prepend_path("MOLD_ROOT", bindir) | ||
self.cpp_info.includedirs = [] | ||
|
||
if self.settings.os == "Linux": | ||
self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
from conans import ConanFile, tools | ||
from conan.tools.build import cross_building | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "build_type", "compiler" | ||
|
||
def test(self): | ||
if not cross_building(self): | ||
self.run("mold -v", run_environment=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.3.1": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.