Skip to content

Commit abadbf2

Browse files
author
jwiltse
committed
Add lib64 dir as a lib directory with -L if it exists
1 parent 89a6201 commit abadbf2

3 files changed

Lines changed: 31 additions & 16 deletions

File tree

src/portable_python/__init__.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,20 @@ def deps(self):
507507
return self.setup.folders.deps
508508

509509
@property
510-
def deps_lib(self):
510+
def deps_lib_dir(self):
511511
return self.deps / "lib"
512512

513+
@property
514+
def deps_lib64_dir(self):
515+
return self.deps / "lib64"
516+
517+
@property
518+
def deps_lib_dirs(self):
519+
lib_dirs = [self.deps_lib_dir]
520+
if self.deps_lib64_dir.exists():
521+
lib_dirs.append(self.deps_lib64_dir)
522+
return lib_dirs
523+
513524
def xenv_CPATH(self):
514525
folder = self.deps / "include"
515526
if folder.exists():
@@ -522,7 +533,7 @@ def xenv_CPATH(self):
522533

523534
def xenv_LDFLAGS(self):
524535
if self.modules.selected:
525-
yield f"-L{self.deps_lib}"
536+
yield from (f"-L{lib_dir}" for lib_dir in self.deps_lib_dirs)
526537

527538
def xenv_PATH(self):
528539
yield f"{self.deps}/bin"
@@ -536,7 +547,7 @@ def xenv_LD_LIBRARY_PATH(self):
536547
def xenv_PKG_CONFIG_PATH(self):
537548
yield from os.environ.get("PKG_CONFIG_PATH", "").split(":")
538549
if self.modules.selected:
539-
yield f"{self.deps_lib}/pkgconfig"
550+
yield f"{self.deps_lib_dir}/pkgconfig"
540551

541552
def _do_run(self, program, *args, fatal=True, env=None):
542553
return runez.run(program, *args, passthrough=self._log_handler, stdout=None, stderr=None, fatal=fatal, env=env)
@@ -747,10 +758,12 @@ def _prepare(self):
747758
# Some libs get funky permissions for some reason
748759
super()._prepare()
749760
self.setup.ensure_clean_folder(self.install_folder)
750-
for path in runez.ls_dir(self.deps_lib):
751-
if not path.name.endswith(".la"):
752-
expected = 0o755 if path.is_dir() else 0o644
753-
current = path.stat().st_mode & 0o777
754-
if current != expected:
755-
LOG.info("Corrected permissions for %s (was %s)", runez.short(path), oct(current))
756-
path.chmod(expected)
761+
762+
for lib_dir in self.deps_lib_dirs:
763+
for path in runez.ls_dir(lib_dir):
764+
if not path.name.endswith(".la"):
765+
expected = 0o755 if path.is_dir() else 0o644
766+
current = path.stat().st_mode & 0o777
767+
if current != expected:
768+
LOG.info("Corrected permissions for %s (was %s)", runez.short(path), oct(current))
769+
path.chmod(expected)

src/portable_python/cpython.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def url(self):
107107
return f"https://www.python.org/ftp/python/{self.version.main}/Python-{self.version}.tar.xz"
108108

109109
def xenv_LDFLAGS_NODIST(self):
110-
yield f"-L{self.deps_lib}"
110+
yield from (f"-L{lib_dir}" for lib_dir in self.deps_lib_dirs)
111111
if PPG.target.is_linux:
112112
yield "-Wl,-z,origin"
113113
# rpath intentionally long to give 'patchelf' some room
@@ -139,7 +139,7 @@ def c_configure_args(self):
139139

140140
if not self.has_configure_opt("--with-system-ffi"):
141141
if self.active_module(LibFFI):
142-
yield f"LIBFFI_INCLUDEDIR={self.deps_lib}"
142+
yield f"LIBFFI_INCLUDEDIR={self.deps_lib_dir}"
143143
yield "--with-system-ffi=no"
144144

145145
else:
@@ -163,7 +163,9 @@ def c_configure_args(self):
163163
# TODO: this doesn't seem to be enough, on macos cpython's ./configure still picks up the shared macos tcl/tk libs
164164
version = Version(tkinter.version)
165165
yield f"--with-tcltk-includes=-I{self.deps}/include"
166-
yield f"--with-tcltk-libs=-L{self.deps_lib} -ltcl{version.mm} -ltk{version.mm}"
166+
167+
lib_dir_flags = " ".join(f"-L{lib_dir}" for lib_dir in self.deps_lib_dirs)
168+
yield f"--with-tcltk-libs={lib_dir_flags} -ltcl{version.mm} -ltk{version.mm}"
167169

168170
@runez.cached_property
169171
def prefix_lib_folder(self):

src/portable_python/external/tkinter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def xenv_CFLAGS(self):
5353
def c_configure_args(self):
5454
yield "--enable-shared=no"
5555
yield "--enable-threads"
56-
yield f"--with-tcl={self.deps_lib}"
56+
yield f"--with-tcl={self.deps_lib_dir}"
5757
yield "--without-x"
5858
if PPG.target.is_macos: # pragma: no cover, tcl/tk is "best effort"
5959
yield "--enable-aqua=yes"
@@ -89,8 +89,8 @@ def xenv_CFLAGS(self):
8989
def c_configure_args(self):
9090
yield "--enable-shared=no"
9191
yield "--enable-threads"
92-
yield f"--with-tcl={self.deps_lib}"
93-
yield f"--with-tk={self.deps_lib}"
92+
yield f"--with-tcl={self.deps_lib_dir}"
93+
yield f"--with-tk={self.deps_lib_dir}"
9494
yield "--without-x"
9595

9696
def _do_linux_compile(self):

0 commit comments

Comments
 (0)