distcc-3.1-r10.ebuild 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python2_7 )
  5. inherit eutils fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user
  6. DESCRIPTION="Distribute compilation of C code across several machines on a network"
  7. HOMEPAGE="http://distcc.org/"
  8. SRC_URI="https://distcc.googlecode.com/files/${P}.tar.bz2"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
  12. IUSE="avahi gtk hardened ipv6 selinux xinetd"
  13. RESTRICT="test"
  14. CDEPEND="${PYTHON_DEPS}
  15. dev-libs/popt
  16. avahi? ( >=net-dns/avahi-0.6[dbus] )
  17. gtk? ( x11-libs/gtk+:2 )"
  18. DEPEND="${CDEPEND}
  19. virtual/pkgconfig"
  20. RDEPEND="${CDEPEND}
  21. !net-misc/pump
  22. >=sys-devel/gcc-config-1.4.1
  23. selinux? ( sec-policy/selinux-distcc )
  24. xinetd? ( sys-apps/xinetd )"
  25. REQUIRED_USE="${PYTHON_REQUIRED_USE}"
  26. DISTCC_LOG=""
  27. DCCC_PATH="/usr/$(get_libdir)/distcc/bin"
  28. DISTCC_VERBOSE="0"
  29. pkg_setup() {
  30. enewuser distcc 240 -1 -1 daemon
  31. python-single-r1_pkg_setup
  32. }
  33. src_prepare() {
  34. epatch "${FILESDIR}/${PN}-3.0-xinetd.patch"
  35. # bug #253786
  36. epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch"
  37. # bug #255188
  38. epatch "${FILESDIR}/${P}-freedesktop.patch"
  39. # bug #258364
  40. epatch "${FILESDIR}/${P}-python.patch"
  41. # bug #351979
  42. epatch "${FILESDIR}/${P}-argc-fix.patch"
  43. epatch_user
  44. sed -i -e "/PATH/s:\$distcc_location:${DCCC_PATH}:" pump.in || die
  45. # Bugs #120001, #167844 and probably more. See patch for description.
  46. use hardened && epatch "${FILESDIR}/distcc-hardened.patch"
  47. }
  48. src_configure() {
  49. local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}"
  50. # More legacy stuff?
  51. [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags
  52. # --disable-rfc2553 b0rked, bug #254176
  53. use ipv6 && myconf="${myconf} --enable-rfc2553"
  54. econf \
  55. $(use_with avahi) \
  56. $(use_with gtk) \
  57. ${myconf}
  58. }
  59. src_install() {
  60. # In rare cases, parallel make install failed
  61. MAKEOPTS+=" -j1"
  62. default
  63. dobin "${FILESDIR}/3.0/distcc-config"
  64. newinitd "${FILESDIR}/${PV}/init" distccd
  65. systemd_dounit "${FILESDIR}/distccd.service"
  66. systemd_install_serviced "${FILESDIR}/distccd.service.conf"
  67. cp "${FILESDIR}/3.1/conf" "${T}/distccd" || die
  68. if use avahi; then
  69. cat >> "${T}/distccd" <<-EOF
  70. # Enable zeroconf support in distccd
  71. DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
  72. EOF
  73. sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die
  74. fi
  75. doconfd "${T}/distccd"
  76. cat > "${T}/02distcc" <<-EOF
  77. # This file is managed by distcc-config; use it to change these settings.
  78. DISTCC_LOG="${DISTCC_LOG}"
  79. DCCC_PATH="${DCCC_PATH}"
  80. DISTCC_VERBOSE="${DISTCC_VERBOSE}"
  81. EOF
  82. doenvd "${T}/02distcc"
  83. # create the masquerade directory
  84. dodir "${DCCC_PATH}"
  85. for f in cc c++ gcc g++; do
  86. dosym /usr/bin/distcc "${DCCC_PATH}/${f}"
  87. if [ "${f}" != "cc" ]; then
  88. dosym /usr/bin/distcc "${DCCC_PATH}/${CTARGET:-${CHOST}}-${f}"
  89. fi
  90. done
  91. if use gtk; then
  92. einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
  93. einfo "This is to have a little sensability in naming schemes between distccmon programs"
  94. mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
  95. dosym distccmon-gui /usr/bin/distccmon-gnome
  96. fi
  97. if use xinetd; then
  98. insinto /etc/xinetd.d
  99. newins "doc/example/xinetd" distcc
  100. fi
  101. rm -rf "${ED}/etc/default" || die
  102. rm -f "${ED}/etc/distcc/clients.allow" || die
  103. rm -f "${ED}/etc/distcc/commands.allow.sh" || die
  104. python_fix_shebang "${ED}"
  105. python_optimize
  106. }
  107. pkg_postinst() {
  108. use gtk && fdo-mime_desktop_database_update
  109. if use ipv6; then
  110. elog
  111. elog "IPv6 is not supported yet by ${P}."
  112. fi
  113. elog
  114. elog "Tips on using distcc with Gentoo can be found at"
  115. elog "https://wiki.gentoo.org/wiki/Distcc"
  116. elog
  117. elog "How to use pump mode with Gentoo:"
  118. elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\""
  119. elog "# pump emerge -u world"
  120. elog
  121. elog "To use the distccmon programs with Gentoo you should use this command:"
  122. elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-text 5"
  123. if use gtk; then
  124. elog "Or:"
  125. elog "# DISTCC_DIR=\"${DISTCC_DIR}\" distccmon-gnome"
  126. fi
  127. elog
  128. elog "***SECURITY NOTICE***"
  129. elog "If you are upgrading distcc please make sure to run etc-update to"
  130. elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with"
  131. elog "added security precautions (the --listen and --allow directives)"
  132. elog
  133. }
  134. pkg_postrm() {
  135. use gtk && fdo-mime_desktop_database_update
  136. }