bootstrap-toolchain/packages/boehmgc/conanfile.py

94 lines
3.1 KiB
Python

# Toolchain builder for the Serene programming language
#
# Copyright (c) 2019-2023 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from pathlib import Path
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
from conan.tools.files import get, copy
from conf.base.zstd import ZstdBase
from conf.utils import get_version, with_musl_toolchain, copy_dependency_tree
class BoehmGC(ConanFile):
name = "boehmgc"
settings = "os", "arch", "build_type", "compiler"
version = get_version("boehmgc")
options = {
"stage": [1, 2],
}
default_options = {"stage": 2}
def source(self):
get(
self,
f"https://github.com/ivmai/bdwgc/archive/v{self.version}.tar.gz",
)
def build_requirements(self):
self.requires(f"toolchain/{get_version('llvm')}@{self.user}/{self.channel}")
self.requires(f"musl/{get_version('musl')}@{self.user}/{self.channel}")
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_SHARED_LIBS"] = False
with_musl_toolchain(self, tc, "TARGET")
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def create_sysroot(self):
sysroot = Path(self.build_folder) / "sysroot"
sysroot.mkdir()
copy_dependency_tree(self, ["toolchain", "musl"], sysroot)
def build(self):
self.create_sysroot()
sysroot = f"{self.build_folder}/sysroot"
cmake = CMake(self)
cmake.configure(
{
"CMAKE_INSTALL_PREFIX": self.package_folder,
"build_cord": "ON",
"enable_atomic_uncollectable": "ON",
"enable_cplusplus": "OFF",
"enable_disclaim": "ON",
"enable_docs": "ON",
"enable_dynamic_loading": "ON",
"enable_gc_assertions": "ON",
"enable_handle_fork": "ON",
"enable_java_finalization": "OFF",
"enable_munmap": "ON",
"enable_parallel_mark": "ON",
"enable_thread_local_alloc": "ON",
"enable_threads": "ON",
"enable_threads_discovery": "ON",
"enable_throw_bad_alloc_library": "ON",
"install_headers": "ON",
"BUILD_SHARED_LIBS": "OFF",
"CMAKE_POSITION_INDEPENDENT_CODE": "ON",
"CMAKE_SYSROOT": sysroot,
},
build_script_folder=f"bdwgc-{self.version}/",
)
cmake.build()
cmake.install()