From 7f49b9978387b34586265986466bfd48cdc3b26d Mon Sep 17 00:00:00 2001
From: Rick Farina <zerochaos@gentoo.org>
Date: Thu, 19 Mar 2020 12:38:25 -0400
Subject: media-libs/portmidi: fix bug #706272

Package-Manager: Portage-2.3.94, Repoman-2.3.21
Signed-off-by: Rick Farina <zerochaos@gentoo.org>
---
 .../portmidi/files/portmidi-217-python.patch       | 25 -----------
 .../portmidi/files/portmidi-217-r3-python.patch    | 51 ----------------------
 .../portmidi/files/portmidi-217-r4-python.patch    | 49 +++++++++++++++++++++
 media-libs/portmidi/portmidi-217-r3.ebuild         |  5 ++-
 4 files changed, 52 insertions(+), 78 deletions(-)
 delete mode 100644 media-libs/portmidi/files/portmidi-217-python.patch
 delete mode 100644 media-libs/portmidi/files/portmidi-217-r3-python.patch
 create mode 100644 media-libs/portmidi/files/portmidi-217-r4-python.patch

(limited to 'media-libs')

diff --git a/media-libs/portmidi/files/portmidi-217-python.patch b/media-libs/portmidi/files/portmidi-217-python.patch
deleted file mode 100644
index 5682c3344358..000000000000
--- a/media-libs/portmidi/files/portmidi-217-python.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- portmidi/pm_python/setup.py
-+++ portmidi/pm_python/setup.py
-@@ -15,12 +15,10 @@
- 
- 
- DESCRIPTION = open('README_PYTHON.txt').read()
--CHANGES = open('CHANGES.txt').read()
--TODO = open('TODO.txt').read()
- 
- EXTRAS = {}
- 
--long_description = DESCRIPTION + CHANGES + TODO
-+long_description = DESCRIPTION
- #import sys
- #if "checkdocs" in sys.argv:
- #    print long_description
-@@ -173,7 +171,8 @@
-     EXTENSION = dict(
-         ext_modules=[ 
-             Extension("pyportmidi._pyportmidi", [os.path.join("pyportmidi", "_pyportmidi.pyx")],
-                       library_dirs=["./linux"],
-+                      include_dirs=["../pm_common", "../porttime"],
-                       libraries = ["portmidi", "asound", "pthread"]
-                       )
-         ]
diff --git a/media-libs/portmidi/files/portmidi-217-r3-python.patch b/media-libs/portmidi/files/portmidi-217-r3-python.patch
deleted file mode 100644
index d4024710fa39..000000000000
--- a/media-libs/portmidi/files/portmidi-217-r3-python.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-diff --git a/pm_python/setup.py b/pm_python/setup.py
-index 14ab1c7..5b1e7c0 100644
---- a/pm_python/setup.py
-+++ b/pm_python/setup.py
-@@ -15,12 +15,10 @@ except ImportError:
- 
- 
- DESCRIPTION = open('README_PYTHON.txt').read()
--CHANGES = open('CHANGES.txt').read()
--TODO = open('TODO.txt').read()
- 
- EXTRAS = {}
- 
--long_description = DESCRIPTION + CHANGES + TODO
-+long_description = DESCRIPTION
- #import sys
- #if "checkdocs" in sys.argv:
- #    print long_description
-@@ -142,7 +140,7 @@ PACKAGEDATA.update(EXTRAS)
- 
- 
- if sys.platform == 'win32':
--    print "Found Win32 platform"
-+    print("Found Win32 platform")
-     EXTENSION = dict(
-         ext_modules=[ 
-             Extension("pyportmidi._pyportmidi", [os.path.join("pyportmidi", "_pyportmidi.pyx")],
-@@ -154,7 +152,7 @@ if sys.platform == 'win32':
-         ]
-     )
- elif sys.platform == 'darwin':
--    print "Found darwin (OS X) platform"
-+    print("Found darwin (OS X) platform")
-     library_dirs = ["/usr/local/lib"]
-     include_dirs = ["/usr/local/include"]
-     EXTENSION = dict(
-@@ -169,11 +167,12 @@ elif sys.platform == 'darwin':
-         ]
-     )
- else:
--    print "Assuming Linux platform"
-+    print("Assuming Linux platform")
-     EXTENSION = dict(
-         ext_modules=[ 
-             Extension("pyportmidi._pyportmidi", [os.path.join("pyportmidi", "_pyportmidi.pyx")],
--                      library_dirs=["./linux"],
-+                      library_dirs=["../../portmidi*build"],
-+                      include_dirs=["../pm_common", "../porttime"],
-                       libraries = ["portmidi", "asound", "pthread"]
-                       )
-         ]
diff --git a/media-libs/portmidi/files/portmidi-217-r4-python.patch b/media-libs/portmidi/files/portmidi-217-r4-python.patch
new file mode 100644
index 000000000000..23ef6c3add1e
--- /dev/null
+++ b/media-libs/portmidi/files/portmidi-217-r4-python.patch
@@ -0,0 +1,49 @@
+diff -Naur portmidi-a/pm_python/setup.py portmidi-b/pm_python/setup.py
+--- portmidi-a/pm_python/setup.py	2010-09-26 15:32:44.000000000 -0400
++++ portmidi-b/pm_python/setup.py	2020-03-19 12:34:34.398365103 -0400
+@@ -15,12 +15,10 @@
+ 
+ 
+ DESCRIPTION = open('README_PYTHON.txt').read()
+-CHANGES = open('CHANGES.txt').read()
+-TODO = open('TODO.txt').read()
+ 
+ EXTRAS = {}
+ 
+-long_description = DESCRIPTION + CHANGES + TODO
++long_description = DESCRIPTION
+ #import sys
+ #if "checkdocs" in sys.argv:
+ #    print long_description
+@@ -142,7 +140,7 @@
+ 
+ 
+ if sys.platform == 'win32':
+-    print "Found Win32 platform"
++    print("Found Win32 platform")
+     EXTENSION = dict(
+         ext_modules=[ 
+             Extension("pyportmidi._pyportmidi", [os.path.join("pyportmidi", "_pyportmidi.pyx")],
+@@ -154,7 +152,7 @@
+         ]
+     )
+ elif sys.platform == 'darwin':
+-    print "Found darwin (OS X) platform"
++    print("Found darwin (OS X) platform")
+     library_dirs = ["/usr/local/lib"]
+     include_dirs = ["/usr/local/include"]
+     EXTENSION = dict(
+@@ -169,11 +167,11 @@
+         ]
+     )
+ else:
+-    print "Assuming Linux platform"
++    print("Assuming Linux platform")
+     EXTENSION = dict(
+         ext_modules=[ 
+             Extension("pyportmidi._pyportmidi", [os.path.join("pyportmidi", "_pyportmidi.pyx")],
+-                      library_dirs=["./linux"],
++                      include_dirs=["../pm_common", "../porttime"],
+                       libraries = ["portmidi", "asound", "pthread"]
+                       )
+         ]
diff --git a/media-libs/portmidi/portmidi-217-r3.ebuild b/media-libs/portmidi/portmidi-217-r3.ebuild
index 00f5c0691159..eb76338eb2ff 100644
--- a/media-libs/portmidi/portmidi-217-r3.ebuild
+++ b/media-libs/portmidi/portmidi-217-r3.ebuild
@@ -7,7 +7,7 @@ PYTHON_COMPAT=( python3_{6,7,8} )
 DISTUTILS_OPTIONAL=1
 # ninja: error: build.ninja:521: multiple rules generate pm_java/pmdefaults.jar [-w dupbuild=err]
 CMAKE_MAKEFILE_GENERATOR="emake"
-inherit cmake desktop xdg distutils-r1 java-pkg-opt-2
+inherit cmake desktop xdg distutils-r1 java-pkg-opt-2 flag-o-matic
 
 DESCRIPTION="Library for real time MIDI input and output"
 HOMEPAGE="http://portmedia.sourceforge.net/"
@@ -50,7 +50,7 @@ PATCHES=(
 	"${FILESDIR}"/${P}-cmake.patch
 
 	# add include directories and remove references to missing files
-	"${FILESDIR}"/${PF}-python.patch
+	"${FILESDIR}"/${P}-r4-python.patch
 )
 
 pkg_setup() {
@@ -97,6 +97,7 @@ src_compile() {
 	if use python ; then
 		sed -i -e "/library_dirs=.*linux/s#./linux#${CMAKE_BUILD_DIR}#" pm_python/setup.py || die
 		pushd pm_python > /dev/null
+		append-ldflags -L"${BUILD_DIR}"
 		distutils-r1_src_compile
 		popd > /dev/null
 	fi
-- 
cgit v1.2.3-65-gdbad