Added recipe for SQLite on Windows (still WIP).

This commit is contained in:
Patrick 2025-03-11 09:35:38 +01:00
parent 748f8f229f
commit 5159c80167

View File

@ -1,16 +1,57 @@
import os
import pathlib
import re
import shutil
from SCons.Script import *
_BUILT_STAMPFILE = '.spp_built'
def _git_cook(env: Environment, repo: dict) -> dict:
checkout_root = repo['checkout_root']
build_result = env.AutotoolsProject(checkout_root)
return {
'LIBPATH': build_result['LIBPATH'],
'CPPPATH': build_result['CPPPATH'],
'LIBS': ['backtrace']
}
if os.name == 'nt':
def run_cmd(args):
if env.Execute(' '.join([str(s) for s in args])):
Exit(1)
install_dir = os.path.join(repo['checkout_root'], 'install')
stamp_file = pathlib.Path(install_dir, _BUILT_STAMPFILE)
include_path = os.path.join(install_dir, 'include')
bin_path = os.path.join(install_dir, 'bin')
lib_path = os.path.join(install_dir, 'lib')
if not stamp_file.exists():
os.makedirs(include_path, exist_ok=True)
os.makedirs(bin_path, exist_ok=True)
os.makedirs(lib_path, exist_ok=True)
old_cwd = os.getcwd()
os.chdir(repo['checkout_root'])
run_cmd(['nmake', '/f', 'Makefile.msc', 'sqlite3.dll'])
os.chdir(old_cwd)
include_files = ['sqlite3.h']
bin_files = ['sqlite3.dll']
lib_files = ['sqlite3.def', 'sqlite3.lib']
for file in include_files:
shutil.copy(os.path.join(repo['checkout_root'], file), include_path)
for file in bin_files:
shutil.copy(os.path.join(repo['checkout_root'], file), bin_path)
for file in lib_files:
shutil.copy(os.path.join(repo['checkout_root'], file), lib_path)
stamp_file.touch()
return {
'CPPPATH': [include_path],
'LIBPATH': [lib_path],
'LIBS': ['sqlite3']
}
else:
checkout_root = repo['checkout_root']
build_result = env.AutotoolsProject(checkout_root)
return {
'LIBPATH': build_result['LIBPATH'],
'CPPPATH': build_result['CPPPATH'],
'LIBS': ['sqlite3']
}
env.GitRecipe(
globals = globals(),