aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-11-03 08:25:00 +0200
committerTimo Teräs <timo.teras@iki.fi>2016-11-03 08:25:41 +0200
commit4e5b5562adeaa22a6ea6715b85efcc757d96e220 (patch)
treecbb1d3daf6e3047e36958f0c8a61361f644d7727 /main
parent6b5de6bfe288a6dbd51dce104669c519f836ae51 (diff)
downloadaports-4e5b5562adeaa22a6ea6715b85efcc757d96e220.tar.bz2
aports-4e5b5562adeaa22a6ea6715b85efcc757d96e220.tar.xz
main/python3: add slightly improved musl find_library fix
ref #5264
Diffstat (limited to 'main')
-rw-r--r--main/python3/APKBUILD15
-rw-r--r--main/python3/musl-find_library.patch45
2 files changed, 55 insertions, 5 deletions
diff --git a/main/python3/APKBUILD b/main/python3/APKBUILD
index e1ecbe57bf..cf98fabd93 100644
--- a/main/python3/APKBUILD
+++ b/main/python3/APKBUILD
@@ -4,7 +4,7 @@
pkgname=python3
pkgver=3.5.2
_basever="${pkgver%.*}"
-pkgrel=4
+pkgrel=5
pkgdesc="A high-level scripting language"
url="http://www.python.org"
arch="all"
@@ -15,7 +15,9 @@ depends=""
makedepends="expat-dev libressl-dev zlib-dev ncurses-dev bzip2-dev xz-dev
sqlite-dev libffi-dev tcl-dev linux-headers gdbm-dev readline-dev
tk tk-dev"
-source="http://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz"
+source="http://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz
+ musl-find_library.patch
+ "
builddir="$srcdir/Python-$pkgver"
prepare() {
@@ -89,6 +91,9 @@ tkinter() {
mv "$pkgdir"/$libdir/_tkinter.*.so "$subpkgdir"/$libdir/
}
-md5sums="8906efbacfcdc7c3c9198aeefafd159e Python-3.5.2.tar.xz"
-sha256sums="0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40 Python-3.5.2.tar.xz"
-sha512sums="c07c3366f1c81e214241444bb9da6db9d11da32ad66bfa29cdad5a3b2e34e4d870bda6d4ce3c3910b582942e91f1d8c8a1c1a7b9464cc147b83c9e0007012742 Python-3.5.2.tar.xz"
+md5sums="8906efbacfcdc7c3c9198aeefafd159e Python-3.5.2.tar.xz
+3810fc5ba451204525698ef80cce675e musl-find_library.patch"
+sha256sums="0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40 Python-3.5.2.tar.xz
+611b8915611e6e04d17eb322d3feef6f14e7d97e2072bca0dfdc3bcb29ad7b38 musl-find_library.patch"
+sha512sums="c07c3366f1c81e214241444bb9da6db9d11da32ad66bfa29cdad5a3b2e34e4d870bda6d4ce3c3910b582942e91f1d8c8a1c1a7b9464cc147b83c9e0007012742 Python-3.5.2.tar.xz
+ff55054b563e154a84d408a5875dac8381decd2bdfb4bb3147bf313e1e9e36162cce0ce74d6e607348a8fe9e01f0b3fe4c8c60c2de81a2055f0f6518408de59b musl-find_library.patch"
diff --git a/main/python3/musl-find_library.patch b/main/python3/musl-find_library.patch
new file mode 100644
index 0000000000..dbaf0286e5
--- /dev/null
+++ b/main/python3/musl-find_library.patch
@@ -0,0 +1,45 @@
+diff -ru Python-3.5.2.orig/Lib/ctypes/util.py Python-3.5.2/Lib/ctypes/util.py
+--- Python-3.5.2.orig/Lib/ctypes/util.py 2016-06-26 00:38:35.000000000 +0300
++++ Python-3.5.2/Lib/ctypes/util.py 2016-11-03 08:21:50.046469019 +0200
+@@ -204,6 +204,41 @@
+ def find_library(name, is64 = False):
+ return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+
++ elif True:
++
++ # Patched for Alpine Linux / musl - search manually system paths
++ def _is_elf(filepath):
++ try:
++ with open(filepath, 'rb') as fh:
++ return fh.read(4) == b'\x7fELF'
++ except:
++ return False
++
++ def _find_libfile(name):
++ from glob import glob
++ # special case for libm, libcrypt and libpthread and musl
++ if name in ['m', 'crypt', 'pthread']:
++ name = 'c'
++ elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
++ name = 'libc.so'
++ # search in standard locations
++ paths = ['/lib', '/usr/lib', '/usr/local/lib']
++ if 'LD_LIBRARY_PATH' in os.environ:
++ paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
++ for d in paths:
++ f = os.path.join(d, name)
++ if _is_elf(f):
++ return os.path.basename(f)
++
++ prefix = os.path.join(d, 'lib'+name)
++ for suffix in ['.so', '.so.*']:
++ for f in glob('{0}{1}'.format(prefix, suffix)):
++ if _is_elf(f):
++ return os.path.basename(f)
++
++ def find_library(name):
++ return _find_libfile(name)
++
+ else:
+
+ def _findSoname_ldconfig(name):