fix compile cl

This commit is contained in:
Matthieu Gautier 2024-04-30 16:26:38 +02:00
parent a459cd750d
commit 5bc4f6935e
2 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,6 @@
from .base import Dependency, ReleaseDownload, MakeBuilder
from kiwixbuild.utils import Remotefile
from kiwixbuild.utils import Remotefile, win_to_posix_path
from kiwixbuild._global import neutralEnv
@ -17,9 +17,9 @@ class Xapian(Dependency):
@property
def configure_options(self):
if neutralEnv("distname") == "Windows":
compile_script = self.source_path / "compile"
compile_script = win_to_posix_path(self.source_path / "compile")
return [
'CC="cl -nologo"',
f'CC="{compile_script} cl -nologo"',
f'CXX="{compile_script} cl -nologo"',
"CXXFLAGS=-EHsc",
"AR=lib",

View File

@ -322,15 +322,19 @@ def extract_archive(archive_path: Path, dest_dir: Path, topdir=None, name=None):
archive.close()
def win_to_posix_path(p: Path or str) -> str:
if isinstance(p, Path):
return str(PurePosixPath(p)).replace("C:/", "/c/")
return p
def run_command(command, cwd, context, *, env=None, input=None, force_posix_path=False):
os.makedirs(cwd, exist_ok=True)
if env is None:
env = DefaultEnv()
log = None
if force_posix_path:
transform_path = lambda v: (
str(PurePosixPath(v)).replace("C:/", "/c/") if isinstance(v, Path) else v
)
transform_path = win_to_posix_path
else:
transform_path = lambda v: v
command = [str(transform_path(v)) for v in command]