Skip to content

Commit 81a04b3

Browse files
committed
Minimize the expat build
1 parent 7cb243a commit 81a04b3

File tree

1 file changed

+13
-8
lines changed
  • graalpython/com.oracle.graal.python.cext

1 file changed

+13
-8
lines changed

graalpython/com.oracle.graal.python.cext/setup.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,17 +339,22 @@ def build(self, extracted_dir=None):
339339
src_path = os.path.join(extracted_dir, self.package_name + "-" + self.version)
340340

341341
cmake_args = [
342-
f"cmake -S '{src_path}' -B '{src_path}'",
342+
"cmake",
343+
"--log-level=ERROR",
343344
f"-DCMAKE_C_COMPILER='{get_config_var('CC')}'",
344-
f"-DCMAKE_INSTALL_PREFIX='{src_path}/install'",
345-
f"-DCMAKE_INSTALL_LIBDIR='{os.path.abspath(self.lib_install_dir)}'",
346-
f"-DCMAKE_INSTALL_INCLUDEDIR='{os.path.abspath(self.include_install_dir)}'",
345+
"-DEXPAT_BUILD_TOOLS=OFF",
346+
"-DEXPAT_BUILD_EXAMPLES=OFF",
347+
"-DEXPAT_BUILD_TESTS=OFF",
348+
f"-S '{src_path}'",
349+
f"-B '{src_path}'",
347350
]
348351
system(' '.join(cmake_args), msg="Could not configure expat")
349-
system(f"make -C '{src_path}' install", msg="Could not build expat")
350-
# Touch the headers to avoid mx thinking it has to rebuild the C API every time
351-
for f in glob.glob(f"{os.path.abspath(self.include_install_dir)}/expat*.h"):
352-
os.utime(f)
352+
system(f"make -C '{src_path}'", msg="Could not build expat")
353+
# Install manually to avoid pulling in unnecessary files
354+
for f in glob.glob(f"{src_path}/*.so*"):
355+
shutil.copy(f, self.lib_install_dir, follow_symlinks=False)
356+
for f in [f"{src_path}/lib/expat.h", f"{src_path}/lib/expat_external.h"]:
357+
shutil.copy(f, self.include_install_dir)
353358
return self.lib_install_dir
354359

355360
def install(self, build_dir=None):

0 commit comments

Comments
 (0)