Fixed SQLite build on Linux.
This commit is contained in:
parent
ba5def01b0
commit
d03b7097f7
@ -9,7 +9,7 @@ _BUILT_STAMPFILE = '.spp_built'
|
|||||||
|
|
||||||
Import('env')
|
Import('env')
|
||||||
|
|
||||||
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:
|
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', skip_steps = ()) -> dict:
|
||||||
config = env['BUILD_TYPE']
|
config = env['BUILD_TYPE']
|
||||||
build_dir = os.path.join(project_root, f'build_{config}')
|
build_dir = os.path.join(project_root, f'build_{config}')
|
||||||
install_dir = os.path.join(project_root, f'install_{config}')
|
install_dir = os.path.join(project_root, f'install_{config}')
|
||||||
@ -32,9 +32,15 @@ def _autotools_project(env: Environment, project_root: str, config_args: 'list[s
|
|||||||
if not os.path.exists(config_script) and os.path.exists(f'{config_script}.ac'):
|
if not os.path.exists(config_script) and os.path.exists(f'{config_script}.ac'):
|
||||||
subprocess.run(('autoreconf', '--install', '--force'), cwd=project_root)
|
subprocess.run(('autoreconf', '--install', '--force'), cwd=project_root)
|
||||||
|
|
||||||
subprocess.run((config_script, f'--prefix={install_dir}', *config_args), cwd=build_dir, env=env, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
if 'configure' not in skip_steps:
|
||||||
subprocess.run(('make', f'-j{jobs}', *build_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
subprocess.run((config_script, f'--prefix={install_dir}', *config_args), cwd=build_dir, env=env, 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)
|
if 'build' not in skip_steps:
|
||||||
|
subprocess.run(('make', f'-j{jobs}', *build_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||||
|
if 'install' not in skip_steps:
|
||||||
|
subprocess.run(('make', 'install', *install_args), cwd=build_dir, stdout=sys.stdout, stderr=sys.stderr, check=True)
|
||||||
|
else:
|
||||||
|
# must still create the install dir for the stamp file
|
||||||
|
os.makedirs(install_dir, exist_ok=True)
|
||||||
pathlib.Path(install_dir, _BUILT_STAMPFILE).touch()
|
pathlib.Path(install_dir, _BUILT_STAMPFILE).touch()
|
||||||
|
|
||||||
libpath = []
|
libpath = []
|
||||||
@ -44,6 +50,7 @@ def _autotools_project(env: Environment, project_root: str, config_args: 'list[s
|
|||||||
libpath.append(full_path)
|
libpath.append(full_path)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'build_dir': build_dir,
|
||||||
'install_dir': install_dir,
|
'install_dir': install_dir,
|
||||||
'LIBPATH': libpath,
|
'LIBPATH': libpath,
|
||||||
'CPPPATH': [os.path.join(install_dir, 'include')]
|
'CPPPATH': [os.path.join(install_dir, 'include')]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
@ -46,11 +47,29 @@ def _git_cook(env: Environment, repo: dict) -> dict:
|
|||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
checkout_root = repo['checkout_root']
|
checkout_root = repo['checkout_root']
|
||||||
build_result = env.AutotoolsProject(checkout_root)
|
build_result = env.AutotoolsProject(checkout_root, skip_steps=('install',))
|
||||||
|
|
||||||
|
# the install script seems borked, do the install manually
|
||||||
|
include_dir = os.path.join(build_result['install_dir'], 'include')
|
||||||
|
lib_dir = os.path.join(build_result['install_dir'], 'lib')
|
||||||
|
os.makedirs(include_dir, exist_ok=True)
|
||||||
|
os.makedirs(lib_dir, exist_ok=True)
|
||||||
|
|
||||||
|
for ext in ('*.a', '*.so'):
|
||||||
|
lib_files = glob.glob(os.path.join(build_result['build_dir'], ext))
|
||||||
|
for lib_file in lib_files:
|
||||||
|
out_path = os.path.join(lib_dir, os.path.basename(lib_file))
|
||||||
|
if not os.path.exists(out_path):
|
||||||
|
shutil.copy(lib_file, out_path)
|
||||||
|
for h_file in ('sqlite3.h',):
|
||||||
|
out_path = os.path.join(include_dir, h_file)
|
||||||
|
if not os.path.exists(out_path):
|
||||||
|
in_path = os.path.join(build_result['build_dir'], h_file)
|
||||||
|
shutil.copy(in_path, out_path)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'LIBPATH': build_result['LIBPATH'],
|
|
||||||
'CPPPATH': build_result['CPPPATH'],
|
'CPPPATH': build_result['CPPPATH'],
|
||||||
'LIBS': ['sqlite3']
|
'LIBS': [env.FindLib('sqlite3', paths=build_result['LIBPATH'])]
|
||||||
}
|
}
|
||||||
|
|
||||||
env.GitRecipe(
|
env.GitRecipe(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user