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

This commit is contained in:
2024-08-14 23:33:04 +02:00
parent 35b38b8b6e
commit 0c82036300
26 changed files with 646 additions and 174 deletions

View File

@@ -2,34 +2,27 @@
import re
from SCons.Script import *
_REPO_NAME = 'libpng'
_REPO_URL = 'https://git.code.sf.net/p/libpng/code.git'
_TAG_PATTERN = re.compile(r'^v([0-9])+\.([0-9])+\.([0-9])$')
def available(env: Environment) -> bool:
return hasattr(env, 'GitBranch') and hasattr(env, 'GitTags')
def versions(env: Environment, update: bool = False) -> 'list[str]':
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])))
return result
def dependencies(env: Environment, version) -> 'list[dict]':
return {
'zlib': {}
}
def cook(env: Environment, git_ref = 'master') -> dict:
lib_z = env.Cook('zlib')
repo = env.GitBranch(repo_name = 'libpng', remote_url = 'https://git.code.sf.net/p/libpng/code.git', git_ref = git_ref)
def _git_cook(env: Environment, repo: dict) -> dict:
lib_zlib = env.Cook('zlib')
checkout_root = repo['checkout_root']
build_result = env.AutotoolsProject(checkout_root)
build_result = env.CMakeProject(checkout_root, dependencies = [lib_zlib])
lib_name = {
'debug': 'png16d'
}.get(env['BUILD_TYPE'], 'png16')
return {
'CPPPATH': build_result['CPPPATH'],
'LIBS': [env.FindLib('png16', paths=build_result['LIBPATH'])],
'DEPENDENCIES': [lib_z]
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
}
env.GitRecipe(
globals = globals(),
repo_name = 'libpng',
repo_url = 'https://git.code.sf.net/p/libpng/code.git',
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
cook_fn = _git_cook,
dependencies = {
'zlib': {}
}
)