mupen64plus-1.5-r2.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="2"
  4. inherit eutils flag-o-matic games toolchain-funcs
  5. MY_P="Mupen64Plus-${PV/./-}-src"
  6. PATCH_VERSION="20100507"
  7. DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator"
  8. HOMEPAGE="http://www.mupen64plus.org/"
  9. SRC_URI="https://mupen64plus.googlecode.com/files/${MY_P}.tar.gz mirror://gentoo/${P}-patches-${PATCH_VERSION}.tar.bz2"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="amd64 x86"
  13. IUSE="+gtk libsamplerate lirc qt4 cpu_flags_x86_sse"
  14. # GTK+ is currently required by plugins even if no GUI support is enabled
  15. RDEPEND="virtual/opengl
  16. media-libs/freetype:2
  17. media-libs/libpng
  18. media-libs/libsdl
  19. media-libs/sdl-ttf
  20. media-fonts/dejavu
  21. sys-libs/zlib[minizip]
  22. x11-libs/gtk+:2
  23. libsamplerate? ( media-libs/libsamplerate )
  24. lirc? ( app-misc/lirc )
  25. qt4? ( dev-qt/qtgui:4
  26. dev-qt/qtcore:4 )
  27. app-arch/xz-utils"
  28. DEPEND="${RDEPEND}
  29. dev-lang/yasm
  30. virtual/pkgconfig"
  31. S="${WORKDIR}/${MY_P}"
  32. pkg_setup() {
  33. if [[ ! $(tc-getCC) =~ gcc ]]; then
  34. eerror
  35. eerror "Compilers like clang and icc are not supported at this point"
  36. eerror
  37. die "You need gcc to build ${PN}"
  38. fi
  39. if ! use gtk && ! use qt4; then
  40. ewarn "Building ${PN} without any GUI! To get one, enable USE=gtk or USE=qt4."
  41. elif use gtk && use qt4; then
  42. ewarn "Only one GUI can be built, using GTK+ one."
  43. fi
  44. games_pkg_setup
  45. }
  46. src_prepare() {
  47. EPATCH_SOURCE="${WORKDIR}/patches" EPATCH_SUFFIX="patch" \
  48. epatch
  49. rm -rf main/zip
  50. epatch "${FILESDIR}"/${P}-minizip.patch #383845
  51. sed -i \
  52. -e "s:/usr/local/share/mupen64plus:${GAMES_DATADIR}/mupen64plus:" \
  53. -e "s:%PUT_PLUGIN_PATH_HERE%:$(games_get_libdir)/${PN}/plugins/:" \
  54. main/main.c || die "sed failed"
  55. # Fix 010_all_fix-desktop-file.patch instead of using sed on the next major bump
  56. sed -i \
  57. -e "s:^Icon=mupen64plus-large.xpm:Icon=mupen64plus:" \
  58. mupen64plus.desktop.in || die "sed failed"
  59. epatch "${FILESDIR}"/${P}-gcc46.patch
  60. }
  61. get_opts() {
  62. if use amd64 || use x86 ; then
  63. echo -n "CPU=X86 ARCH=64BITS$(use x86 && echo -n _32) "
  64. fi
  65. use libsamplerate || echo -n "NO_RESAMP=1 "
  66. use lirc && echo -n "LIRC=1 "
  67. use cpu_flags_x86_sse || echo -n "NO_ASM=1 "
  68. echo -n GUI=
  69. if use gtk; then
  70. echo -n GTK2
  71. elif use qt4; then
  72. echo -n QT4
  73. else
  74. echo -n NONE
  75. fi
  76. }
  77. src_compile() {
  78. tc-export CC CXX
  79. use x86 && use cpu_flags_x86_sse && append-flags -fomit-frame-pointer
  80. emake $(get_opts) DBGSYM=1 CC="${CC}" CXX="${CXX}" LD="${CC}" all || die "make failed"
  81. }
  82. src_install() {
  83. # These are:
  84. # 1) prefix - not used really, printed only
  85. # 2) SHAREDIR
  86. # 3) BINDIR
  87. # 4) 'LIBDIR' - where to put plugins in
  88. # 5) 'MANDIR' - exact directory to put man file in
  89. # 6) APPLICATIONSDIR - where to put .desktop in
  90. ./install.sh "${D}" \
  91. "${D}${GAMES_DATADIR}/${PN}" \
  92. "${D}${GAMES_BINDIR}" \
  93. "${D}$(games_get_libdir)/${PN}/plugins" \
  94. "${D}/usr/share/man/man1" \
  95. "${D}/usr/share/applications" \
  96. || or die "install.sh failed"
  97. # Copy icon into system-wide location
  98. newicon icons/mupen64plus-large.png ${PN}.png || die "newicon failed"
  99. # 'Move' docs into correct dir
  100. rm -r "${D}${GAMES_DATADIR}/${PN}/doc"
  101. dodoc README RELEASE TODO doc/*.txt "${FILESDIR}/README.gentoo-patches-${PATCH_VERSION}" || die "dodoc failed"
  102. prepgamesdirs
  103. }
  104. pkg_postinst() {
  105. games_pkg_postinst
  106. if use lirc; then
  107. elog "For lirc configuration see:"
  108. elog "https://code.google.com/p/mupen64plus/wiki/LIRC"
  109. fi
  110. }