logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

portmidi-217-r3.ebuild (3488B)


  1. # Copyright 1999-2020 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. PYTHON_COMPAT=( python3_{6,7,8} )
  5. DISTUTILS_OPTIONAL=1
  6. # ninja: error: build.ninja:521: multiple rules generate pm_java/pmdefaults.jar [-w dupbuild=err]
  7. CMAKE_MAKEFILE_GENERATOR="emake"
  8. inherit cmake desktop xdg distutils-r1 java-pkg-opt-2 flag-o-matic
  9. DESCRIPTION="Library for real time MIDI input and output"
  10. HOMEPAGE="http://portmedia.sourceforge.net/"
  11. SRC_URI="mirror://sourceforge/portmedia/${PN}-src-${PV}.zip"
  12. LICENSE="MIT"
  13. SLOT="0"
  14. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
  15. IUSE="debug doc java python static-libs sndio test-programs"
  16. REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
  17. BDEPEND="
  18. app-arch/unzip
  19. doc? (
  20. app-doc/doxygen
  21. dev-texlive/texlive-fontsrecommended
  22. dev-texlive/texlive-latexextra
  23. virtual/latex-base
  24. )
  25. python? ( >=dev-python/cython-0.12.1[${PYTHON_USEDEP}] )
  26. "
  27. CDEPEND="
  28. media-libs/alsa-lib
  29. sndio? ( media-sound/sndio:= )
  30. python? ( ${PYTHON_DEPS} )
  31. "
  32. RDEPEND="${CDEPEND}
  33. java? ( >=virtual/jre-1.8 )
  34. "
  35. DEPEND="
  36. ${CDEPEND}
  37. java? ( >=virtual/jdk-1.8 )
  38. "
  39. S="${WORKDIR}/${PN}"
  40. PATCHES=(
  41. # fix parallel make failures, fix java support, and allow optional
  42. # components like test programs and static libs to be skipped
  43. "${FILESDIR}"/${P}-cmake.patch
  44. # add include directories and remove references to missing files
  45. "${FILESDIR}"/${P}-r4-python.patch
  46. )
  47. pkg_setup() {
  48. use java && java-pkg-opt-2_pkg_setup
  49. }
  50. src_prepare() {
  51. cmake_src_prepare
  52. if use sndio
  53. then
  54. mkdir "${S}"/pm_sndio || die
  55. cp "${FILESDIR}/${P}"-pmsndio.c "${S}"/pm_sndio/pmsndio.c || die
  56. cp "${FILESDIR}/${P}"-pmsndio.h "${S}"/pm_sndio/pmsndio.h || die
  57. eapply "${FILESDIR}/${P}"-sndio.patch
  58. fi
  59. # install wrapper for pmdefaults
  60. if use java ; then
  61. cat > pm_java/pmdefaults/pmdefaults <<-EOF
  62. #!/bin/sh
  63. java -Djava.library.path="${EPREFIX}/usr/$(get_libdir)/" \\
  64. -jar "${EPREFIX}/usr/share/${PN}/lib/pmdefaults.jar"
  65. EOF
  66. [[ $? -ne 0 ]] && die "cat pmdefaults failed"
  67. fi
  68. }
  69. src_configure() {
  70. if use debug ; then
  71. CMAKE_BUILD_TYPE=Debug
  72. else
  73. CMAKE_BUILD_TYPE=Release
  74. fi
  75. local mycmakeargs=(
  76. -DPORTMIDI_ENABLE_JAVA=$(usex java)
  77. -DPORTMIDI_ENABLE_STATIC=$(usex static-libs)
  78. -DPORTMIDI_ENABLE_TEST=$(usex test-programs)
  79. )
  80. if use java ; then
  81. mycmakeargs+=(-DJAR_INSTALL_DIR="${EPREFIX}/usr/share/${PN}/lib")
  82. fi
  83. cmake_src_configure
  84. }
  85. src_compile() {
  86. cmake_src_compile
  87. if use python ; then
  88. sed -i -e "/library_dirs=.*linux/s#./linux#${CMAKE_BUILD_DIR}#" pm_python/setup.py || die
  89. pushd pm_python > /dev/null
  90. append-ldflags -L"${BUILD_DIR}"
  91. distutils-r1_src_compile
  92. popd > /dev/null
  93. fi
  94. if use doc ; then
  95. doxygen || die "doxygen failed"
  96. pushd latex > /dev/null
  97. VARTEXFONTS="${T}"/fonts emake
  98. popd > /dev/null
  99. fi
  100. }
  101. src_install() {
  102. cmake_src_install
  103. dodoc CHANGELOG.txt README.txt pm_linux/README_LINUX.txt
  104. use doc && dodoc latex/refman.pdf
  105. if use python ; then
  106. pushd pm_python > /dev/null
  107. distutils-r1_src_install
  108. popd > /dev/null
  109. fi
  110. if use java ; then
  111. newdoc pm_java/README.txt README_JAVA.txt
  112. newicon pm_java/pmdefaults/pmdefaults-icon.png pmdefaults.png
  113. make_desktop_entry pmdefaults Pmdefaults pmdefaults "AudioVideo;Audio;Midi;"
  114. fi
  115. if use test-programs ; then
  116. exeinto /usr/$(get_libdir)/${PN}
  117. local app
  118. for app in latency midiclock midithread midithru mm qtest sysex test ; do
  119. doexe "${BUILD_DIR}"/${app}
  120. done
  121. fi
  122. }