1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 SUPPORT_PYTHON_ABIS="1"
8 inherit cmake-utils distutils eutils java-pkg-opt-2 multilib python
10 DESCRIPTION="A library for real time MIDI input and output"
11 HOMEPAGE="http://portmedia.sourceforge.net/"
12 SRC_URI="mirror://sourceforge/portmedia/${PN}-src-${PV}.zip"
16 KEYWORDS="~amd64 ~x86"
17 IUSE="debug java python test-programs"
19 PYTHON_DEPEND="python? 2:2.6"
21 CDEPEND="media-libs/alsa-lib"
23 java? ( >=virtual/jre-1.6 )"
25 java? ( >=virtual/jdk-1.6 )
26 python? ( >=dev-python/cython-0.12.1 )
28 # build of docs not working
29 # doc? ( app-doc/doxygen
30 # virtual/latex-base )"
32 RESTRICT_PYTHON_ABIS="3.*"
36 # Bug #3295129 reported upstream
37 CMAKE_IN_SOURCE_BUILD=1
39 # seems to be needed, if the default "Gentoo" is used there will be
40 # problems. f.e. no midi devices in pmdefaults, maybe even no midi devices at
42 CMAKE_BUILD_TYPE=$(use debug && echo Debug || echo Release)
45 use java && java-pkg-opt-2_pkg_setup
46 use python && python_pkg_setup
50 # with this patch the java installation directories can be specified and
51 # allows java to be enabled/disabled
52 epatch "${FILESDIR}/${P}-cmake-libdir-java-opts.patch"
54 # fix problems with cmake 2.8.6
55 epatch "${FILESDIR}/${P}-cmake-workdir-java-opts.patch"
57 # find the header and our compiled libs in the distutils setup.py
58 epatch "${FILESDIR}/${P}-python-setup.py.patch"
61 # this stuff fixes up the pmdefaults wrapper for locations where
62 # Gentoo prefers to keep jars, it also specifies a library directory
63 cat > pm_java/pmdefaults/pmdefaults <<-EOF
65 java -Djava.library.path="${EPREFIX}"/usr/$(get_libdir)/ \\
66 -jar "${EPREFIX}/usr/share/${PN}/lib/pmdefaults.jar"
68 [ "$?" -neq "0" ] && die "cat pmdefaults failed"
71 use python && python_copy_sources
76 $(cmake-utils_use java PORTMIDI_ENABLE_JAVA)
78 # this seems to be needed. if not set there will be a sandbox
79 # violation. if set to ./ the java parts will not build.
80 # one may end up with a blob named Gentoo, Debug or Release. hmmm
81 -DCMAKE_CACHEFILE_DIR="${S}/build"
84 # java stuff, the portmidi wiki says JAVA_JVM_LIBRARY needs to be specified
86 # search for libjvm.so in JAVA_HOME to set JAVA_JVM_LIBRARY
87 local javalib=`find "${JAVA_HOME}" -name "libjvm.so" | head -n 1`
89 mycmakeargs+=(-DJAVA_JVM_LIBRARY="${javalib}"
90 # tell cmake where to install the jar, this requires the cmake
91 # patch, can be a relative path from CMAKE_INSTALL_PREFIX or
93 -DJAR_INSTALL_DIR="${EPREFIX}/usr/share/${PN}/lib"
97 cmake-utils_src_configure
101 # parallel make is broken when java is enabled so force -j1 :(
102 cmake-utils_src_compile $(use java && echo "-j1")
106 pushd pm_python || die "pushd python failed"
107 # hack. will error out if these files are not found
108 touch CHANGES.txt TODO.txt
109 distutils_src_compile
113 # make the docs (NOT WORKING)
115 # doxygen || die "doxygen failed"
116 # pushd latex || die "pushd latex failed"
117 # VARTEXFONTS="${T}/fonts" make ${MAKEOPTS} || die "make doc failed"
123 cmake-utils_src_install
125 dodoc CHANGELOG.txt README.txt pm_linux/README_LINUX.txt || die "dodoc failed"
127 # install the python modules
129 pushd pm_python || die "pushd pm_python failed"
130 distutils_src_install
134 # a desktop entry and icon for the pmdefaults java configuration gui
136 newdoc pm_java/README.txt README_JAVA.txt || die "newdoc failed"
137 doicon pm_java/pmdefaults/pmdefaults-icon.png || die "doicon failed"
138 make_desktop_entry pmdefaults Pmdefaults pmdefaults-icon \
139 "AudioVideo;Audio;Midi;"
142 # some portmidi test apps
143 if use test-programs ; then
144 # maybe a better location can be used
145 exeinto /usr/$(get_libdir)/${PN}
147 for app in latency midiclock midithread \
148 midithru mm qtest sysex test ; do
149 doexe ${S}"/build/${CMAKE_BUILD_TYPE}/${app}" \
150 || die "doins test programs failed"
156 # prevent distutils_pkg_postinst from being called autmatically if
158 use python && distutils_pkg_postinst
162 # prevent distutils_pkg_postrm from being called autmatically if
164 use python && distutils_pkg_postrm