Introduce arch_name to name build dir base on arch name instead of config.
This commit is contained in:
parent
734c1ea6fc
commit
0c0eac69c4
|
@ -161,6 +161,7 @@ def run_kiwix_build(
|
||||||
command.append("--hide-progress")
|
command.append("--hide-progress")
|
||||||
command.append("--fast-clone")
|
command.append("--fast-clone")
|
||||||
command.append("--assume-packages-installed")
|
command.append("--assume-packages-installed")
|
||||||
|
command.append("--use-target-arch-name")
|
||||||
command.extend(["--config", config])
|
command.extend(["--config", config])
|
||||||
if build_deps_only:
|
if build_deps_only:
|
||||||
command.append("--build-deps-only")
|
command.append("--build-deps-only")
|
||||||
|
|
|
@ -125,6 +125,18 @@ def parse_args():
|
||||||
"to develop with the cloned sources."
|
"to develop with the cloned sources."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
subgroup.add_argument(
|
||||||
|
"--use-target-arch-name",
|
||||||
|
action="store_true",
|
||||||
|
help=(
|
||||||
|
"Name the build directory using the arch name instead of the config name.\n"
|
||||||
|
"Different configs may create binary for the same arch so this option is "
|
||||||
|
"not recommended when working with several config on the same computer.\n"
|
||||||
|
"However, when generating dependencies for other it is better to have a "
|
||||||
|
"directory named using the target instead of the used config.\n"
|
||||||
|
"Intended to be used in CI only."
|
||||||
|
),
|
||||||
|
)
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
if not options.android_arch:
|
if not options.android_arch:
|
||||||
|
|
|
@ -76,9 +76,12 @@ class NeutralEnv:
|
||||||
|
|
||||||
class BuildEnv:
|
class BuildEnv:
|
||||||
def __init__(self, configInfo):
|
def __init__(self, configInfo):
|
||||||
build_dir = "BUILD_{}".format(configInfo.name)
|
|
||||||
self.configInfo = configInfo
|
self.configInfo = configInfo
|
||||||
self.base_build_dir = pj(option("working_dir"), option("build_dir"))
|
self.base_build_dir = pj(option("working_dir"), option("build_dir"))
|
||||||
|
build_dir = (
|
||||||
|
configInfo.arch_name if option("use_target_arch_name") else configInfo.name
|
||||||
|
)
|
||||||
|
build_dir = f"BUILD_{build_dir}"
|
||||||
self.build_dir = pj(self.base_build_dir, build_dir)
|
self.build_dir = pj(self.base_build_dir, build_dir)
|
||||||
self.install_dir = pj(self.build_dir, "INSTALL")
|
self.install_dir = pj(self.build_dir, "INSTALL")
|
||||||
self.toolchain_dir = pj(self.build_dir, "TOOLCHAINS")
|
self.toolchain_dir = pj(self.build_dir, "TOOLCHAINS")
|
||||||
|
|
|
@ -147,6 +147,10 @@ class Android(MetaConfigInfo):
|
||||||
name = "android"
|
name = "android"
|
||||||
compatible_hosts = ["fedora", "debian"]
|
compatible_hosts = ["fedora", "debian"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def arch_name(self):
|
||||||
|
return "multi-linux-android"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def subConfigNames(self):
|
def subConfigNames(self):
|
||||||
return ["android_{}".format(arch) for arch in option("android_arch")]
|
return ["android_{}".format(arch) for arch in option("android_arch")]
|
||||||
|
|
|
@ -27,6 +27,10 @@ class ConfigInfo(metaclass=_MetaConfig):
|
||||||
mixed = False
|
mixed = False
|
||||||
libdir = None
|
libdir = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def arch_name(self):
|
||||||
|
return self.arch_full
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_config(cls, name, targets=None):
|
def get_config(cls, name, targets=None):
|
||||||
if name not in cls.all_running_configs:
|
if name not in cls.all_running_configs:
|
||||||
|
|
|
@ -4,6 +4,7 @@ from kiwixbuild._global import option, neutralEnv
|
||||||
|
|
||||||
class FlatpakConfigInfo(ConfigInfo):
|
class FlatpakConfigInfo(ConfigInfo):
|
||||||
name = "flatpak"
|
name = "flatpak"
|
||||||
|
arch_name = "flatpak"
|
||||||
build = "flatpak"
|
build = "flatpak"
|
||||||
static = ""
|
static = ""
|
||||||
toolchain_names = ["org.kde", "io.qt.qtwebengine"]
|
toolchain_names = ["org.kde", "io.qt.qtwebengine"]
|
||||||
|
|
|
@ -24,6 +24,10 @@ class AppleConfigInfo(ConfigInfo):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._root_path = None
|
self._root_path = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def arch_name(self):
|
||||||
|
return self.target
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def root_path(self):
|
def root_path(self):
|
||||||
if self._root_path is None:
|
if self._root_path is None:
|
||||||
|
@ -209,6 +213,10 @@ class IOS(MetaConfigInfo):
|
||||||
name = "iOS_multi"
|
name = "iOS_multi"
|
||||||
compatible_hosts = ["Darwin"]
|
compatible_hosts = ["Darwin"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def arch_name(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def subConfigNames(self):
|
def subConfigNames(self):
|
||||||
return ["iOS_{}".format(arch) for arch in option("ios_arch")]
|
return ["iOS_{}".format(arch) for arch in option("ios_arch")]
|
||||||
|
@ -225,6 +233,10 @@ class AppleStaticAll(MetaConfigInfo):
|
||||||
name = "apple_all_static"
|
name = "apple_all_static"
|
||||||
compatible_hosts = ["Darwin"]
|
compatible_hosts = ["Darwin"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def arch_name(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def subConfigNames(self):
|
def subConfigNames(self):
|
||||||
return AppleXCFramework.subConfigNames
|
return AppleXCFramework.subConfigNames
|
||||||
|
|
|
@ -3,6 +3,9 @@ from .base import ConfigInfo, MixedMixin
|
||||||
from kiwixbuild.utils import pj
|
from kiwixbuild.utils import pj
|
||||||
from kiwixbuild._global import option, neutralEnv
|
from kiwixbuild._global import option, neutralEnv
|
||||||
from kiwixbuild.configs.ios import MIN_MACOS_VERSION
|
from kiwixbuild.configs.ios import MIN_MACOS_VERSION
|
||||||
|
import sysconfig
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class NativeConfigInfo(ConfigInfo):
|
class NativeConfigInfo(ConfigInfo):
|
||||||
|
@ -16,6 +19,12 @@ class NativeConfigInfo(ConfigInfo):
|
||||||
env["CFLAGS"] += f"-mmacosx-version-min={MIN_MACOS_VERSION}"
|
env["CFLAGS"] += f"-mmacosx-version-min={MIN_MACOS_VERSION}"
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
@property
|
||||||
|
def arch_name(self):
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
return f"{platform.machine()}-apple-darwin"
|
||||||
|
return sysconfig.get_platform()
|
||||||
|
|
||||||
|
|
||||||
class NativeDyn(NativeConfigInfo):
|
class NativeDyn(NativeConfigInfo):
|
||||||
name = "native_dyn"
|
name = "native_dyn"
|
||||||
|
|
|
@ -3,6 +3,7 @@ from .base import ConfigInfo
|
||||||
|
|
||||||
class NeutralConfigInfo(ConfigInfo):
|
class NeutralConfigInfo(ConfigInfo):
|
||||||
name = "neutral"
|
name = "neutral"
|
||||||
|
arch_name = "neutral"
|
||||||
static = ""
|
static = ""
|
||||||
compatible_hosts = ["fedora", "debian", "Darwin"]
|
compatible_hosts = ["fedora", "debian", "Darwin"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue