net-tools-1.60_p20141019041918-r1.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="3"
  4. inherit flag-o-matic toolchain-funcs eutils
  5. if [[ ${PV} == "9999" ]] ; then
  6. EGIT_REPO_URI="git://git.code.sf.net/p/net-tools/code"
  7. EGIT_PROJECT="${PN}"
  8. inherit git-2
  9. else
  10. PATCH_VER="1"
  11. SRC_URI="mirror://gentoo/${P}.tar.xz
  12. mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz"
  13. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~x86-linux"
  14. fi
  15. DESCRIPTION="Standard Linux networking tools"
  16. HOMEPAGE="http://net-tools.sourceforge.net/"
  17. LICENSE="GPL-2"
  18. SLOT="0"
  19. IUSE="nls old-output selinux static"
  20. RDEPEND="!<sys-apps/openrc-0.9.9.3
  21. selinux? ( sys-libs/libselinux )"
  22. DEPEND="${RDEPEND}
  23. selinux? ( virtual/pkgconfig )
  24. app-arch/xz-utils"
  25. maint_pkg_create() {
  26. cd /usr/local/src/net-tools
  27. #git-update
  28. local stamp=$(date --date="$(git log -n1 --pretty=format:%ci master)" -u +%Y%m%d%H%M%S)
  29. local pv="${PV/_p*}_p${stamp}"; pv=${pv/9999/1.60}
  30. local p="${PN}-${pv}"
  31. git archive --prefix="${p}/" master | tar xf - -C "${T}"
  32. pushd "${T}" >/dev/null
  33. sed -i "/^RELEASE/s:=.*:=${pv}:" */Makefile || die
  34. tar cf - ${p}/ | xz > ${p}.tar.xz
  35. popd >/dev/null
  36. local patches="${p}-patches-${PATCH_VER:-1}"
  37. local d="${T}/${patches}"
  38. mkdir "${d}"
  39. git format-patch -o "${d}" master..gentoo > /dev/null
  40. echo "From https://cgit.gentoo.org/proj/net-tools.git" > "${d}"/README
  41. tar cf - -C "${T}" ${d##*/} | xz > "${T}"/${patches}.tar.xz
  42. rm -rf "${d}"
  43. du -b "${T}"/*.tar.xz
  44. }
  45. pkg_setup() { [[ -n ${VAPIER_LOVES_YOU} ]] && maint_pkg_create ; }
  46. set_opt() {
  47. local opt=$1 ans
  48. shift
  49. ans=$("$@" && echo y || echo n)
  50. einfo "Setting option ${opt} to ${ans}"
  51. sed -i \
  52. -e "/^bool.* ${opt} /s:[yn]$:${ans}:" \
  53. config.in || die
  54. }
  55. src_prepare() {
  56. if [[ -n ${PATCH_VER} ]] ; then
  57. use old-output || EPATCH_EXCLUDE="0001-revert-621a2f376334f8097604b9fee5783e0f1141e66d-for-.patch"
  58. EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch "${WORKDIR}"/${P}-patches-${PATCH_VER}
  59. fi
  60. }
  61. src_configure() {
  62. set_opt I18N use nls
  63. set_opt HAVE_HWIB has_version '>=sys-kernel/linux-headers-2.6'
  64. set_opt HAVE_HWTR has_version '<sys-kernel/linux-headers-3.5'
  65. set_opt HAVE_HWSTRIP has_version '<sys-kernel/linux-headers-3.6'
  66. set_opt HAVE_SELINUX use selinux
  67. if use static ; then
  68. append-flags -static
  69. append-ldflags -static
  70. fi
  71. tc-export AR CC
  72. yes "" | ./configure.sh config.in || die
  73. }
  74. src_install() {
  75. emake DESTDIR="${ED}" install || die
  76. dodoc README README.ipv6 TODO
  77. }
  78. pkg_postinst() {
  79. einfo "etherwake and such have been split into net-misc/ethercard-diag"
  80. }