mirror of
https://github.com/XTXMarkets/ternfs.git
synced 2026-05-12 23:30:25 -05:00
88ef789476
This moves the docker invocation from the two individual build.py scripts to a single location in build.sh. With these changes you can now build entirely in docker (alpine or ubuntu) as previously, or you can build entirely without docker (debug or release, for example). To build without docker you obviously will need all dependencies installed (cmake, ninja, clang, go, etc) on your machine. This has the unfortunate consequence of moving more logic into build.sh, probably shifting it to the point where it should be a python script instead, although that would then impact CI and so on. I think ideally it may be better to merge all three scripts into a single python script, which would also simplify ci.py (it can just call functions rather than shelling out), but this is a minimal change for now. It may also be better to just have four release variants and make the native/alpine/ubuntu distinction be purely about how they are built, but that depends how the build is utilised.
28 lines
916 B
Python
Executable File
28 lines
916 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# Copyright 2025 XTX Markets Technologies Limited
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('build_variant')
|
|
parser.add_argument('--cmake-build-type', help='CMake build type (default: same as build variant)')
|
|
parser.add_argument('--static', action='store_true', help='Static build')
|
|
args, ninja_args = parser.parse_known_intermixed_args()
|
|
|
|
cmake_build_type = args.cmake_build_type or args.build_variant
|
|
|
|
cpp_dir = Path(__file__).resolve().parent
|
|
|
|
build_dir = cpp_dir / 'build' / args.build_variant
|
|
build_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
os.chdir(str(build_dir))
|
|
subprocess.run(['cmake', '-G', 'Ninja', f'-DCMAKE_BUILD_TYPE={cmake_build_type}', f'-DTERN_STATIC_BUILD={args.static}', '../..'], check=True)
|
|
subprocess.run(['ninja'] + ninja_args, check=True)
|