capi4k-utils-20050718-r7.ebuild 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils linux-info multilib versionator
  5. YEAR_PV="${PV:0:4}"
  6. MON_PV="${PV:4:2}"
  7. DAY_PV="${PV:6:2}"
  8. MY_P="${PN}-${YEAR_PV}-${MON_PV}-${DAY_PV}"
  9. PATCHVER="5"
  10. TARBALL_FILES="capi4k-files-${PV}-r${PATCHVER}.tar.xz"
  11. TARBALL_PATCHES="capi4k-patches-${PV}-r${PATCHVER}.tar.xz"
  12. DESCRIPTION="CAPI4Linux Utils"
  13. HOMEPAGE="ftp://ftp.in-berlin.de/pub/capi4linux/"
  14. SRC_URI="ftp://ftp.in-berlin.de/pub/capi4linux/${MY_P}.tar.gz
  15. ftp://ftp.in-berlin.de/pub/capi4linux/OLD/${MY_P}.tar.gz
  16. http://sbriesen.de/gentoo/distfiles/${TARBALL_FILES}
  17. http://sbriesen.de/gentoo/distfiles/${TARBALL_PATCHES}"
  18. LICENSE="GPL-2"
  19. SLOT="0/3.0.4"
  20. KEYWORDS="alpha amd64 ppc x86"
  21. IUSE="fax +pppd rcapid"
  22. COMMON_DEP="pppd? ( net-dialup/ppp:= )"
  23. DEPEND="${COMMON_DEP}
  24. virtual/linux-sources
  25. virtual/os-headers
  26. app-arch/xz-utils
  27. >=sys-apps/sed-4"
  28. RDEPEND="${COMMON_DEP}
  29. dev-lang/perl"
  30. S="${WORKDIR}/${PN}"
  31. pkg_setup() {
  32. # check kernel config
  33. CONFIG_CHECK="~ISDN ~ISDN_CAPI ~ISDN_CAPI_CAPI20"
  34. use pppd && CONFIG_CHECK="${CONFIG_CHECK} ~ISDN_CAPI_MIDDLEWARE ~ISDN_CAPI_CAPIFS_BOOL"
  35. get_version # config checked later in pkg_postinst
  36. # find installed pppd version
  37. if use pppd; then
  38. local INSTALLED_PPP="$(best_version net-dialup/ppp)"
  39. PPPVERSION="${INSTALLED_PPP#net-dialup/ppp-}"
  40. PPPVERSION="$(version_format_string '$1.$2.$3' ${PPPVERSION})"
  41. if [ -z "${PPPVERSION}" ]; then
  42. die "No pppd installation found"
  43. fi
  44. fi
  45. }
  46. src_prepare() {
  47. # add ppp-2.4.4 support
  48. epatch "${WORKDIR}/capi4k-patches/pppd244.diff"
  49. # add ppp-2.4.5 support
  50. epatch "${WORKDIR}/capi4k-patches/pppd245.diff"
  51. # apply rcapid patches
  52. epatch "${WORKDIR}/capi4k-patches/rcapid.diff"
  53. # apply msg2str-safety patch (see bug #170870)
  54. epatch "${WORKDIR}/capi4k-patches/msg2str-safety.diff"
  55. # apply capi20.h patches (needed for glibc-2.7)
  56. epatch "${WORKDIR}/capi4k-patches/capi20-include.diff"
  57. # set our config
  58. cp -f "${WORKDIR}/capi4k-files/config" .config
  59. # patch all Makefile.* and Rules.make to use our CFLAGS
  60. sed -i -e "s:^\(CFLAGS.*\)-O2:\1${CFLAGS}:g" */Makefile.* */Rules.make || die "sed failed"
  61. # patch capi20/Makefile.* to use -fPIC for shared library
  62. sed -i -e "s:^\(CFLAGS.*\):\1 -fPIC:g" capi20/Makefile.* || die "sed failed"
  63. # patch pppdcapiplugin/Makefile to use only the ppp versions we want
  64. sed -i -e "s:^\(PPPVERSIONS = \).*$:\1${PPPVERSION}:g" pppdcapiplugin/Makefile || die "sed failed"
  65. # patch capiinit/capiinit.c to look also in /lib/firmware
  66. sed -i -e "s:\(\"/lib/firmware/isdn\",\):\1 \"/lib/firmware\",:g" capiinit/capiinit.c || die "sed failed"
  67. # no, we don't need any devices nodes
  68. sed -i -e "s:\(sh scripts/makedev.sh\):echo \1:g" Makefile || die "sed failed"
  69. # add --libdir to configure call in Makefile
  70. sed -i -e "s:\(\./configure \):\1--libdir=/usr/$(get_libdir) :g" Makefile || die "sed failed"
  71. # patch /usr/lib/pppd in pppdcapiplugin tree
  72. sed -i -e "s:/usr/lib/pppd:/usr/$(get_libdir)/pppd:g" \
  73. pppdcapiplugin/ppp-*/Makefile pppdcapiplugin/{README,*.8} || die "sed failed"
  74. # respecting LDFLAGS (see bug #293209)
  75. sed -i -e "s:^LDFLAGS\s\(\s*\)=:LDFLAGS+\1=:g" \
  76. {capiinfo,capiinit,capifax,rcapid,avmb1}/Makefile* pppdcapiplugin/Rules.make || die
  77. # build rcapid
  78. if ! use rcapid; then
  79. sed -i -e "s:^\(CONFIG_RCAPID=.*\)$:# \1:g" .config || die
  80. fi
  81. # build pppdcapiplugin
  82. if use pppd; then
  83. # workaround for bug #511800
  84. if has_version \>=net-dialup/ppp-2.4.6; then
  85. pushd pppdcapiplugin &>/dev/null || die
  86. mv ppp-2.4.5 "ppp-${PPPVERSION}" || die
  87. popd &>/dev/null
  88. fi
  89. else
  90. sed -i -e "s:^\(CONFIG_PPPDCAPIPLUGIN=.*\)$:# \1:g" .config || die
  91. fi
  92. # build capifax
  93. if ! use fax; then
  94. sed -i -e "s:^\(CONFIG_CAPIFAX=.*\)$:# \1:g" .config || die
  95. fi
  96. epatch_user
  97. }
  98. src_configure() {
  99. # bug 468662 - we NEED to redefine AR and CC both with tc-export and at compile phase
  100. tc-export AR CC
  101. emake subconfig
  102. }
  103. src_compile() {
  104. # bug 468662 - we NEED to redefine AR and CC both with tc-export and at compile phase
  105. emake AR="$(tc-getAR)" CC="$(tc-getCC)"
  106. }
  107. src_install() {
  108. default_src_install
  109. prune_libtool_files
  110. # install base
  111. dobin scripts/isdncause
  112. newinitd "${WORKDIR}/capi4k-files/capi.initd" capi
  113. newconfd "${WORKDIR}/capi4k-files/capi.confd" capi
  114. insinto /etc
  115. doins "${WORKDIR}/capi4k-files/capi.conf"
  116. dodoc "${WORKDIR}/capi4k-files/README.gentoo" scripts/makedev.sh
  117. # install rcapid stuff
  118. if use rcapid; then
  119. insinto /etc/xinetd.d
  120. newins "${WORKDIR}/capi4k-files/rcapid.xinetd" rcapid
  121. newdoc rcapid/README README.rcapid
  122. fi
  123. # install pppdcapiplugin stuff
  124. if use pppd; then
  125. insinto /etc/ppp/peers
  126. doins pppdcapiplugin/peers/t-dsl
  127. docinto pppdcapiplugin
  128. dodoc pppdcapiplugin/README pppdcapiplugin/examples/*
  129. # fixing permissions (see bug #136120)
  130. fperms 0644 /usr/share/man/man8/capiplugin.8
  131. fi
  132. }
  133. pkg_postinst() {
  134. elog
  135. elog "Please read the instructions in README.gentoo in:"
  136. elog "/usr/share/doc/${PF}/"
  137. elog
  138. elog "Annotation for active AVM ISDN boards (B1 ISA/PCI, ...):"
  139. elog "If you run"
  140. elog " emerge isdn-firmware"
  141. elog "you will probably find your board's firmware in /lib/firmware."
  142. elog
  143. elog "If you have another active ISDN board, you should create"
  144. elog "/lib/firmware and copy there your board's firmware."
  145. elog
  146. ewarn "If you're upgrading from an older capi4k-utils, you must recompile"
  147. ewarn "the other packages on your system that link with libcapi after the"
  148. ewarn "upgrade completes. To perform this action, please run revdep-rebuild"
  149. ewarn "in package app-portage/gentoolkit."
  150. elog
  151. elog "If any of the following kernel configuration options is missing, you"
  152. elog "should reconfigure and rebuild your kernel before using capi4k-utils."
  153. linux-info_pkg_setup
  154. elog
  155. }