bootstrap-toolchain/packages/stage3-bundle/conanfile.py

67 lines
2.3 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
import shutil
from pathlib import Path
from conan import ConanFile
from conan.tools.files import get
from conan.tools.cmake import CMakeToolchain
from conf.utils import get_version, copy_template, copy_dependency_tree
class Stage3(ConanFile):
name = "stage3-bundle"
version = get_version("llvm")
settings = "os", "arch"
exports = ("*.cmake",)
options = {
"stage": [1, 2],
}
default_options = {"stage": 2}
def build_requirements(self):
self.requires(f"toolchain/{get_version('llvm')}@{self.user}/{self.channel}")
self.requires(f"zlib/{get_version('zlib')}@{self.user}/{self.channel}")
self.requires(f"zstd/{get_version('zstd')}@{self.user}/{self.channel}")
self.requires(f"musl/{get_version('musl')}@{self.user}/{self.channel}")
# self.requires(f"cmake-musl/{get_version('cmake')}@{self.user}/{self.channel}")
# self.requires(f"ninja-musl/{get_version('ninja')}@{self.user}/{self.channel}")
self.requires(f"boehmgc/{get_version('boehmgc')}@{self.user}/{self.channel}")
def build(self):
copy_dependency_tree(
self,
[
"toolchain",
"musl",
"zlib",
"zstd",
"boehmgc",
],
self.package_folder,
)
toolchain = f"{self.recipe_folder}/toolchain.cmake"
copy_template(
self,
toolchain,
f"{self.package_folder}/toolchain.cmake",
{"TRIPLE": os.environ["TARGET"], "SYSROOT": self.package_folder},
)