media-libs/portmidi: -r3 python3
authorMiroslav Šulc <fordfrog@gentoo.org>
Tue, 17 Dec 2019 21:05:50 +0000 (22:05 +0100)
committerMiroslav Šulc <fordfrog@gentoo.org>
Tue, 17 Dec 2019 21:06:24 +0000 (22:06 +0100)
1) eapi7
2) dropped python2, added python3
3) organized deps, lifted min java up to 1.8

Closes: https://bugs.gentoo.org/550820
Package-Manager: Portage-2.3.82, Repoman-2.3.20
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
media-libs/portmidi/files/portmidi-217-r3-python.patch [new file with mode: 0644]
media-libs/portmidi/portmidi-217-r3.ebuild [new file with mode: 0644]

diff --git a/media-libs/portmidi/files/portmidi-217-r3-python.patch b/media-libs/portmidi/files/portmidi-217-r3-python.patch
new file mode 100644 (file)
index 0000000..cfc6b24
--- /dev/null
@@ -0,0 +1,50 @@
+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"],
++                      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
new file mode 100644 (file)
index 0000000..5205ea8
--- /dev/null
@@ -0,0 +1,134 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+DISTUTILS_OPTIONAL=1
+inherit cmake-utils desktop xdg distutils-r1 java-pkg-opt-2
+
+DESCRIPTION="Library for real time MIDI input and output"
+HOMEPAGE="http://portmedia.sourceforge.net/"
+SRC_URI="mirror://sourceforge/portmedia/${PN}-src-${PV}.zip"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~sparc ~x86"
+IUSE="debug doc java python static-libs test-programs"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+BDEPEND="
+       app-arch/unzip
+       doc? (
+               app-doc/doxygen
+               dev-texlive/texlive-fontsrecommended
+               dev-texlive/texlive-latexextra
+               virtual/latex-base
+       )
+       java? ( >=virtual/jdk-1.8 )
+       python? ( >=dev-python/cython-0.12.1[${PYTHON_USEDEP}] )
+"
+CDEPEND="
+       media-libs/alsa-lib
+       python? ( ${PYTHON_DEPS} )
+"
+RDEPEND="${CDEPEND}
+       java? ( >=virtual/jre-1.8 )
+"
+DEPEND="${CDEPEND}"
+
+S="${WORKDIR}/${PN}"
+
+PATCHES=(
+       # fix parallel make failures, fix java support, and allow optional
+       # components like test programs and static libs to be skipped
+       "${FILESDIR}"/${P}-cmake.patch
+
+       # add include directories and remove references to missing files
+       "${FILESDIR}"/${PF}-python.patch
+)
+
+pkg_setup() {
+       use java && java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+       cmake-utils_src_prepare
+
+       # install wrapper for pmdefaults
+       if use java ; then
+               cat > pm_java/pmdefaults/pmdefaults <<-EOF
+                       #!/bin/sh
+                       java -Djava.library.path="${EPREFIX}/usr/$(get_libdir)/" \\
+                               -jar "${EPREFIX}/usr/share/${PN}/lib/pmdefaults.jar"
+               EOF
+               [[ $? -ne 0 ]] && die "cat pmdefaults failed"
+       fi
+}
+
+src_configure() {
+       if use debug ; then
+               CMAKE_BUILD_TYPE=Debug
+       else
+               CMAKE_BUILD_TYPE=Release
+       fi
+
+       local mycmakeargs=(
+               -DPORTMIDI_ENABLE_JAVA=$(usex java)
+               -DPORTMIDI_ENABLE_STATIC=$(usex static-libs)
+               -DPORTMIDI_ENABLE_TEST=$(usex test-programs)
+       )
+
+       if use java ; then
+               mycmakeargs+=(-DJAR_INSTALL_DIR="${EPREFIX}/usr/share/${PN}/lib")
+       fi
+
+       cmake-utils_src_configure
+}
+
+src_compile() {
+       cmake-utils_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
+               distutils-r1_src_compile
+               popd > /dev/null
+       fi
+
+       if use doc ; then
+               doxygen || die "doxygen failed"
+               pushd latex > /dev/null
+               VARTEXFONTS="${T}"/fonts emake
+               popd > /dev/null
+       fi
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       dodoc CHANGELOG.txt README.txt pm_linux/README_LINUX.txt
+
+       use doc && dodoc latex/refman.pdf
+
+       if use python ; then
+               pushd pm_python > /dev/null
+               distutils-r1_src_install
+               popd > /dev/null
+       fi
+
+       if use java ; then
+               newdoc pm_java/README.txt README_JAVA.txt
+               newicon pm_java/pmdefaults/pmdefaults-icon.png pmdefaults.png
+               make_desktop_entry pmdefaults Pmdefaults pmdefaults "AudioVideo;Audio;Midi;"
+       fi
+
+       if use test-programs ; then
+               exeinto /usr/$(get_libdir)/${PN}
+               local app
+               for app in latency midiclock midithread midithru mm qtest sysex test ; do
+                       doexe "${CMAKE_BUILD_DIR}"/${app}
+               done
+       fi
+}