bitlbee-9999.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit user systemd toolchain-funcs
  5. if [[ ${PV} == "9999" ]]; then
  6. EGIT_REPO_URI="https://github.com/bitlbee/bitlbee.git"
  7. inherit git-r3
  8. else
  9. SRC_URI="https://get.bitlbee.org/src/${P}.tar.gz"
  10. KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
  11. fi
  12. DESCRIPTION="irc to IM gateway that support multiple IM protocols"
  13. HOMEPAGE="https://www.bitlbee.org/"
  14. LICENSE="GPL-2"
  15. SLOT="0"
  16. IUSE_PROTOCOLS="msn oscar purple twitter +xmpp"
  17. IUSE="debug +gnutls ipv6 libevent libressl nss otr +plugins selinux test xinetd
  18. ${IUSE_PROTOCOLS}"
  19. REQUIRED_USE="
  20. || ( purple xmpp msn oscar )
  21. xmpp? ( !nss )
  22. "
  23. COMMON_DEPEND="
  24. >=dev-libs/glib-2.16
  25. purple? ( net-im/pidgin )
  26. libevent? ( dev-libs/libevent:= )
  27. otr? ( >=net-libs/libotr-4 )
  28. gnutls? ( net-libs/gnutls:= )
  29. !gnutls? (
  30. nss? ( dev-libs/nss )
  31. !nss? (
  32. libressl? ( dev-libs/libressl:= )
  33. !libressl? ( dev-libs/openssl:0= )
  34. )
  35. )
  36. "
  37. DEPEND="${COMMON_DEPEND}
  38. virtual/pkgconfig
  39. selinux? ( sec-policy/selinux-bitlbee )
  40. test? ( dev-libs/check )"
  41. RDEPEND="${COMMON_DEPEND}
  42. virtual/logger
  43. xinetd? ( sys-apps/xinetd )"
  44. pkg_setup() {
  45. enewgroup bitlbee
  46. enewuser bitlbee -1 -1 /var/lib/bitlbee bitlbee
  47. }
  48. src_prepare() {
  49. if [[ ${PV} != "9999" ]]; then
  50. eapply \
  51. "${FILESDIR}"/${P}-systemd-user.patch \
  52. "${FILESDIR}"/${P}-verbose-build.patch
  53. fi
  54. eapply_user
  55. }
  56. src_configure() {
  57. local myconf
  58. # setup plugins, protocol, ipv6 and debug
  59. myconf+=( --jabber=$(usex xmpp 1 0) )
  60. for flag in debug ipv6 plugins ${IUSE_PROTOCOLS/+xmpp/} ; do
  61. myconf+=( --${flag}=$(usex ${flag} 1 0) )
  62. done
  63. # set otr
  64. if use otr && use plugins ; then
  65. myconf+=( --otr=plugin )
  66. else
  67. if use otr ; then
  68. ewarn "OTR support has been disabled automatically because it"
  69. ewarn "requires the plugins USE flag."
  70. fi
  71. myconf+=( --otr=0 )
  72. fi
  73. # setup ssl use flags
  74. if use gnutls ; then
  75. myconf+=( --ssl=gnutls )
  76. einfo "Using gnutls for SSL support"
  77. else
  78. ewarn "Only gnutls is officially supported by upstream."
  79. if use nss ; then
  80. myconf+=( --ssl=nss )
  81. einfo "Using nss for SSL support"
  82. else
  83. myconf+=( --ssl=openssl )
  84. einfo "Using openssl for SSL support"
  85. fi
  86. fi
  87. # set event handler
  88. if use libevent ; then
  89. myconf+=( --events=libevent )
  90. else
  91. myconf+=( --events=glib )
  92. fi
  93. # not autotools-based
  94. ./configure \
  95. --prefix=/usr \
  96. --datadir=/usr/share/bitlbee \
  97. --etcdir=/etc/bitlbee \
  98. --plugindir=/usr/$(get_libdir)/bitlbee \
  99. --systemdsystemunitdir=$(systemd_get_systemunitdir) \
  100. --doc=1 \
  101. --strip=0 \
  102. --verbose=1 \
  103. "${myconf[@]}" || die
  104. sed -i \
  105. -e "/^EFLAGS/s:=:&${LDFLAGS} :" \
  106. Makefile.settings || die
  107. }
  108. src_compile() {
  109. emake CC="$(tc-getCC)" LD="$(tc-getLD)"
  110. }
  111. src_install() {
  112. emake DESTDIR="${D}" install install-etc install-doc install-dev install-systemd
  113. keepdir /var/lib/bitlbee
  114. fperms 700 /var/lib/bitlbee
  115. fowners bitlbee:bitlbee /var/lib/bitlbee
  116. dodoc doc/{AUTHORS,CHANGES,CREDITS,FAQ,README}
  117. if use xinetd ; then
  118. insinto /etc/xinetd.d
  119. newins doc/bitlbee.xinetd bitlbee
  120. fi
  121. newinitd "${FILESDIR}"/bitlbee.initd-r1 bitlbee
  122. newconfd "${FILESDIR}"/bitlbee.confd-r1 bitlbee
  123. exeinto /usr/share/bitlbee
  124. doexe utils/{convert_purple.py,bitlbee-ctl.pl}
  125. }
  126. pkg_postinst() {
  127. chown -R bitlbee:bitlbee "${ROOT}"/var/lib/bitlbee
  128. [[ -d "${ROOT}"/var/run/bitlbee ]] &&
  129. chown -R bitlbee:bitlbee "${ROOT}"/var/run/bitlbee
  130. if [[ -z ${REPLACING_VERSIONS} ]]; then
  131. einfo
  132. elog "The bitlbee init script will now attempt to stop all processes owned by the"
  133. elog "bitlbee user, including per-client forks."
  134. elog
  135. elog "Tell the init script not to touch anything besides the main bitlbee process"
  136. elog "by changing the BITLBEE_STOP_ALL variable in"
  137. elog " /etc/conf.d/bitlbee"
  138. einfo
  139. fi
  140. }