1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit cmake-utils eutils multilib java-pkg-opt-2 distutils
9 DESCRIPTION="A library for real time MIDI input and output"
10 HOMEPAGE="http://portmedia.sourceforge.net/"
11 SRC_URI="mirror://sourceforge/portmedia/${PN}-src-${PV}.zip"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="debug java python test-programs"
18 PYTHON_DEPEND="python? 2:2.6"
20 CDEPEND="media-libs/alsa-lib"
22 java? ( >=virtual/jre-1.6 )"
24 java? ( >=virtual/jdk-1.6 )
25 python? ( >=dev-python/cython-0.12.1 )
27 # build of docs not working
28 # doc? ( app-doc/doxygen
29 # virtual/latex-base )"
33 # Bug #3295129 reported upstream
34 CMAKE_IN_SOURCE_BUILD=1
36 # seems to be needed, if the default "Gentoo" is used there will be
37 # problems. f.e. no midi devices in pmdefaults, maybe even no midi devices at
39 CMAKE_BUILD_TYPE=$(use debug && echo Debug || echo Release)
42 # with this patch the java installation directories can be specified and
43 # allows java to be enabled/disabled
44 epatch "${FILESDIR}/${P}-cmake-libdir-java-opts.patch"
46 # find the header and our compiled libs in the distutils setup.py
47 epatch "${FILESDIR}/${P}-python-setup.py.patch"
50 # this stuff fixes up the pmdefaults wrapper for locations where
51 # Gentoo prefers to keep jars, it also specifies a library directory
52 cat > pm_java/pmdefaults/pmdefaults <<-EOF
54 java -Djava.library.path=/usr/$(get_libdir)/ \\
55 -jar "${EPREFIX}/usr/share/${PN}/lib/pmdefaults.jar"
57 [ "$?" -neq "0" ] && die "cat pmdefaults failed"
63 $(cmake-utils_use java PORTMIDI_ENABLE_JAVA)
65 # this seems to be needed. if not set there will be a sandbox
66 # violation. if set to ./ the java parts will not build.
67 # one may end up with a blob named Gentoo, Debug or Release. hmmm
68 -DCMAKE_CACHEFILE_DIR="${S}/build"
71 # java stuff, the portmidi wiki says JAVA_JVM_LIBRARY needs to be specified
73 # search for libjvm.so in JAVA_HOME to set JAVA_JVM_LIBRARY
74 local javalib=`find "${JAVA_HOME}" -name "libjvm.so" | head -n 1`
76 mycmakeargs+=(-DJAVA_JVM_LIBRARY="${javalib}"
77 # tell cmake where to install the jar, this requires the cmake
78 # patch, can be a relative path from CMAKE_INSTALL_PREFIX or
80 -DJAR_INSTALL_DIR="${EPREFIX}/usr/share/${PN}/lib"
84 cmake-utils_src_configure
88 # parallel make is broken when java is enabled so force -j1 :(
89 cmake-utils_src_compile $(use java && echo "-j1")
93 pushd pm_python || die "pushd python failed"
94 # hack. will error out if these files are not found
95 touch CHANGES.txt TODO.txt
100 # make the docs (NOT WORKING)
102 # doxygen || die "doxygen failed"
103 # pushd latex || die "pushd latex failed"
104 # VARTEXFONTS="${T}/fonts" make ${MAKEOPTS} || die "make doc failed"
110 cmake-utils_src_install
112 dodoc CHANGELOG.txt README.txt pm_linux/README_LINUX.txt || die "dodoc failed"
114 # install the python modules
116 pushd pm_python || die "pushd pm_python failed"
117 distutils_src_install
121 # a desktop entry and icon for the pmdefaults java configuration gui
123 newdoc pm_java/README.txt README_JAVA.txt || die "newdoc failed"
124 doicon pm_java/pmdefaults/pmdefaults-icon.png || die "doicon failed"
125 make_desktop_entry pmdefaults Pmdefaults pmdefaults-icon \
126 "AudioVideo;Audio;Midi;"
129 # some portmidi test apps
130 if use test-programs ; then
131 # maybe a better location can be used
132 exeinto /usr/$(get_libdir)/${PN}
134 for app in latency midiclock midithread \
135 midithru mm qtest sysex test ; do
136 doexe ${S}"/build/${CMAKE_BUILD_TYPE}/${app}" \
137 || die "doins test programs failed"
143 # prevent distutils_pkg_postinst from being called autmatically if
145 use python && distutils_pkg_postinst
149 # prevent distutils_pkg_postrm from being called autmatically if
151 use python && distutils_pkg_postrm