Added openssl recipe.
This commit is contained in:
parent
9c64f982fd
commit
b7cb5f7c48
@ -127,7 +127,8 @@ def _deps_from_json(env: Environment, deps: dict) -> dict:
|
||||
if 'condition' in dep:
|
||||
if not _safe_eval(dep['condition'], {
|
||||
'compiler_family': env['COMPILER_FAMILY'],
|
||||
'target_os': os.name
|
||||
'target_os': os.name,
|
||||
'getenv': lambda name: env.get(name)
|
||||
}):
|
||||
to_remove.append(key)
|
||||
continue
|
||||
@ -341,7 +342,8 @@ def _build_target(target: _Target):
|
||||
for lib in libs_copy:
|
||||
if isinstance(lib, str) and os.path.isabs(lib):
|
||||
target.kwargs['LIBS'].remove(lib)
|
||||
target.kwargs['source'].append(env.Entry(lib))
|
||||
target.kwargs['LIBS'].append(env.File(lib))
|
||||
pass
|
||||
elif isinstance(lib, _Target):
|
||||
if not lib.target:
|
||||
_build_target(lib)
|
||||
|
@ -9,7 +9,7 @@ _BUILT_STAMPFILE = '.spp_built'
|
||||
|
||||
Import('env')
|
||||
|
||||
def _autotools_project(env: Environment, project_root: str, config_args: 'list[str]' = [], build_args : 'list[str]' = [], install_args : 'list[str]' = []) -> dict:
|
||||
def _autotools_project(env: Environment, project_root: str, config_args: 'list[str]' = [], build_args : 'list[str]' = [], install_args : 'list[str]' = [], configure_script_path: str = 'configure') -> dict:
|
||||
config = env['BUILD_TYPE']
|
||||
build_dir = os.path.join(project_root, f'build_{config}')
|
||||
install_dir = os.path.join(project_root, f'install_{config}')
|
||||
@ -28,14 +28,20 @@ def _autotools_project(env: Environment, project_root: str, config_args: 'list[s
|
||||
env = os.environ.copy()
|
||||
env['CFLAGS'] = cflags
|
||||
|
||||
subprocess.run((os.path.join(project_root, 'configure'), '--prefix', install_dir, *config_args), cwd=build_dir, env=env, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
subprocess.run((os.path.join(project_root, configure_script_path), f'--prefix={install_dir}', *config_args), cwd=build_dir, env=env, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
subprocess.run(('make', f'-j{jobs}', *build_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
subprocess.run(('make', 'install', *install_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||
pathlib.Path(install_dir, _BUILT_STAMPFILE).touch()
|
||||
|
||||
libpath = []
|
||||
for lib_folder in ('lib', 'lib64'):
|
||||
full_path = os.path.join(install_dir, lib_folder)
|
||||
if os.path.exists(full_path):
|
||||
libpath.append(full_path)
|
||||
|
||||
return {
|
||||
'install_dir': install_dir,
|
||||
'LIBPATH': [os.path.join(install_dir, 'lib')],
|
||||
'LIBPATH': libpath,
|
||||
'CPPPATH': [os.path.join(install_dir, 'include')]
|
||||
}
|
||||
|
||||
|
21
recipes/openssl/recipe.py
Normal file
21
recipes/openssl/recipe.py
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
import re
|
||||
from SCons.Script import *
|
||||
|
||||
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.AutotoolsProject(checkout_root, config_args = ['no-shared', 'no-tests', 'no-docs'], configure_script_path='Configure')
|
||||
return {
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': [env.FindLib(libname, paths=build_result['LIBPATH']) for libname in ('ssl', 'crypto')]
|
||||
}
|
||||
|
||||
env.GitRecipe(
|
||||
globals = globals(),
|
||||
repo_name = 'openssl',
|
||||
repo_url = 'https://github.com/openssl/openssl.git',
|
||||
tag_pattern = re.compile(r'^openssl-([0-9]+)\.([0-9]+)\.([0-9]+)$'),
|
||||
tag_fn = lambda version: f'openssl-{version[0]}.{version[1]}.{version[2]}',
|
||||
cook_fn = _git_cook
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user