pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/py-pysam: fix @rpath handling on Darwin



Module Name:	pkgsrc-wip
Committed By:	Brook Milligan <brook%nmsu.edu@localhost>
Pushed By:	brook
Date:		Mon Jun 7 17:33:33 2021 -0600
Changeset:	913416d5e784fe94d8d5d2839df6828017660973

Modified Files:
	py-pysam/Makefile
	py-pysam/distinfo
Added Files:
	py-pysam/patches/patch-cy__build.py

Log Message:
wip/py-pysam: fix @rpath handling on Darwin

On Darwin, the shared libraries are linked with -rpath @loader_path
and -install_name @rpath/... .  This leave relative paths in the
libraries.  Instead, avoid using -rpath and use the correct absolute
path for -install_name.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=913416d5e784fe94d8d5d2839df6828017660973

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 py-pysam/Makefile                   |  2 ++
 py-pysam/distinfo                   |  1 +
 py-pysam/patches/patch-cy__build.py | 31 +++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+)

diffs:
diff --git a/py-pysam/Makefile b/py-pysam/Makefile
index e21c0957af..118fec2f4a 100644
--- a/py-pysam/Makefile
+++ b/py-pysam/Makefile
@@ -18,6 +18,8 @@ USE_TOOLS+=	gmake
 
 EGG_NAME=	${GITHUB_PROJECT}-${PKGVERSION_NOREV}
 
+MAKE_ENV+=	PYSITELIB=${PYSITELIB}
+
 MAKE_ENV+=	HTSLIB_MODE=external
 MAKE_ENV+=	HTSLIB_INCLUDE_DIR=${BUILDLINK_PREFIX.htslib}/include
 MAKE_ENV+=	HTSLIB_LIBRARY_DIR=${BUILDLINK_PREFIX.htslib}/lib
diff --git a/py-pysam/distinfo b/py-pysam/distinfo
index 449fc0a4e9..30b39b41ad 100644
--- a/py-pysam/distinfo
+++ b/py-pysam/distinfo
@@ -4,4 +4,5 @@ SHA1 (pysam/v0.16.0.1.tar.gz) = 928f058c9c2df814a8698bfa88f27a9bd256748c
 RMD160 (pysam/v0.16.0.1.tar.gz) = 7a980c0bd6edac6bdd9103db0fc6f540b0db6619
 SHA512 (pysam/v0.16.0.1.tar.gz) = 5cebb9f3bc8dc6186a629e91423a3c8cb802af6529b943fcd880e056661ec6ee2a00de789cf144c9e40b9d1ef2459c0e06ce27a1b9eab8e2875d2087f275af28
 Size (pysam/v0.16.0.1.tar.gz) = 3294073 bytes
+SHA1 (patch-cy__build.py) = 1bb61fc7fcdfbb9305150ff437ba614f57b3756e
 SHA1 (patch-setup.py) = 368c4b99c1f8103d34096145f7badd9310736554
diff --git a/py-pysam/patches/patch-cy__build.py b/py-pysam/patches/patch-cy__build.py
new file mode 100644
index 0000000000..c0ca677cb9
--- /dev/null
+++ b/py-pysam/patches/patch-cy__build.py
@@ -0,0 +1,31 @@
+$NetBSD$
+
+On Darwin, set LC_ID_DYLIB to ${PREFIX}/${PYSITELIB}/pysam/...
+to ensure libraries are found at runtime.  Avoid use of @rpath.
+
+--- cy_build.py.orig	2018-02-07 21:01:12.000000000 +0000
++++ cy_build.py
+@@ -60,20 +60,16 @@ class cy_build_ext(build_ext):
+             ext.library_dirs.append(os.path.join(self.build_lib, "pysam"))
+ 
+         if sys.platform == 'darwin':
+-            # The idea is to give shared libraries an install name of the form
+-            # `@rpath/<library-name.so>`, and to set the rpath equal to
+-            # @loader_path. This will allow Python packages to find the library
+-            # in the expected place, while still giving enough flexibility to
+-            # external applications to link against the library.
++            # Set LC_ID_DYLIB to ${PREFIX}/${PYSITELIB}/pysam/... to ensure
++            # libraries are found at runtime.  Avoid use of @rpath.
+             relative_module_path = ext.name.replace(".", os.sep) + get_config_vars()["SO"]
+             library_path = os.path.join(
+-                "@rpath", os.path.basename(relative_module_path)
++                os.environ["PREFIX"], os.environ["PYSITELIB"], "pysam", os.path.basename(relative_module_path)
+             )
+ 
+             if not ext.extra_link_args:
+                 ext.extra_link_args = []
+             ext.extra_link_args += ['-dynamiclib',
+-                                    '-rpath', '@loader_path',
+                                     '-Wl,-headerpad_max_install_names',
+                                     '-Wl,-install_name,%s' % library_path,
+                                     '-Wl,-x']


Home | Main Index | Thread Index | Old Index