Update to new recipe system (S++ 2.0).

This commit is contained in:
2024-08-14 23:33:04 +02:00
parent 6f83b68788
commit cd727e5a1d
26 changed files with 646 additions and 174 deletions

View File

@@ -1,12 +1,31 @@
import os
import re
from SCons.Script import *
def cook(env: Environment, git_ref: str = 'master') -> dict:
repo = env.GitBranch(repo_name = 'zlib', remote_url = 'https://github.com/madler/zlib.git', git_ref = git_ref)
extracted_root = repo['checkout_root']
build_result = env.CMakeProject(project_root=extracted_root)
_REPO_NAME = 'zlib'
_REPO_URL = 'https://github.com/madler/zlib.git'
_TAG_PATTERN = re.compile(r'^v([0-9]+)\.([0-9]+)(?:\.([0-9]+))?$')
def versions(env: Environment, update: bool = False):
tags = env.GitTags(repo_name = _REPO_NAME, remote_url = _REPO_URL, force_fetch=update)
result = []
for tag in tags:
match = _TAG_PATTERN.match(tag)
if match:
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2] or 0)))
return result
def dependencies(env: Environment, version) -> 'dict':
return {}
def cook(env: Environment, version) -> dict:
git_ref = f'refs/tags/v{version[0]}.{version[1]}'
if version[2] != 0:
git_ref = git_ref + f'.{version[2]}'
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = git_ref)
checkout_root = repo['checkout_root']
build_result = env.CMakeProject(project_root=checkout_root)
return {
'CPPPATH': [os.path.join(build_result['install_dir'], 'install')],
'CPPPATH': [os.path.join(build_result['install_dir'], 'include')],
'LIBS': [env.FindLib('z', paths=build_result['LIBPATH'])]
}