ndiswrapper-1.59.ebuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit base linux-mod toolchain-funcs
  5. DESCRIPTION="Wrapper for using Windows drivers for some wireless cards"
  6. HOMEPAGE="http://ndiswrapper.sourceforge.net/"
  7. SRC_URI="mirror://sourceforge/${PN}/stable/${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. KEYWORDS="amd64 x86"
  10. IUSE="debug usb"
  11. DEPEND="sys-apps/pciutils"
  12. RDEPEND="${DEPEND}
  13. net-wireless/wireless-tools"
  14. PATCHES=( "${FILESDIR}"/${P}-cflags.patch
  15. "${FILESDIR}"/${P}-3.14.patch
  16. "${FILESDIR}"/${P}-4.0.patch
  17. "${FILESDIR}"/${P}-4.2.patch )
  18. MODULE_NAMES="ndiswrapper(misc:${S}/driver)"
  19. BUILD_TARGETS="all"
  20. MODULESD_NDISWRAPPER_ALIASES=("wlan0 ndiswrapper")
  21. pkg_pretend() {
  22. CONFIG_CHECK="~WEXT_PRIV"
  23. use usb && CONFIG_CHECK="${CONFIG_CHECK} ~USB"
  24. ERROR_USB="You need to enable USB support in your kernel to use usb support in ndiswrapper."
  25. ERROR_WEXT_PRIV="Your kernel does not support WEXT_PRIV. To enable it you need to enable a wireless driver that enables it, for example PRISM54 or IPW2200"
  26. linux-mod_pkg_setup
  27. }
  28. src_compile() {
  29. local params
  30. # Enable verbose debugging information
  31. if use debug; then
  32. params="DEBUG=3"
  33. use usb && params="${params} USB_DEBUG=1"
  34. fi
  35. cd utils
  36. emake CC=$(tc-getCC)
  37. use usb || params="${params} DISABLE_USB=1"
  38. BUILD_PARAMS="KSRC=${KV_DIR} KVERS=${KV_FULL} KBUILD='${KV_OUT_DIR}' ${params}"
  39. linux-mod_src_compile
  40. }
  41. src_install() {
  42. dodoc AUTHORS ChangeLog INSTALL README
  43. doman ndiswrapper.8
  44. keepdir /etc/ndiswrapper
  45. linux-mod_src_install
  46. cd utils
  47. emake DESTDIR="${D}" install
  48. }
  49. pkg_postinst() {
  50. linux-mod_pkg_postinst
  51. echo
  52. elog "NDISwrapper requires .inf and .sys files from a Windows(tm) driver"
  53. elog "to function. Download these to /root for example, then"
  54. elog "run 'ndiswrapper -i /root/foo.inf'. After that you can delete them."
  55. elog "They will be copied to /etc/ndiswrapper/."
  56. elog "Once done, please run 'update-modules'."
  57. echo
  58. elog "Please look at ${HOMEPAGE}"
  59. elog "for the FAQ, HowTos, tips, configuration, and installation"
  60. elog "information."
  61. echo
  62. for i in $(lspci -n | egrep '(0280|0200):' | cut -d' ' -f1)
  63. do
  64. i_desc=$(lspci -nn | grep "$i" | awk -F': ' '{print $2}' | awk -F'[' '{print $1}')
  65. if [[ -n "${i_desc}" ]] ; then
  66. elog "Possible hardware: ${i_desc}"
  67. fi
  68. done
  69. echo
  70. elog "NDISwrapper devs need support (_hardware_, cash)."
  71. elog "Don't hesitate if you can help."
  72. elog "See ${HOMEPAGE} for details."
  73. echo
  74. if [[ ${ROOT} == "/" ]]; then
  75. einfo "Attempting to automatically reinstall any Windows drivers"
  76. einfo "you might already have."
  77. echo
  78. local driver
  79. for driver in $(ls /etc/ndiswrapper) ; do
  80. einfo "Driver: ${driver}"
  81. mv "/etc/ndiswrapper/${driver}" "${T}"
  82. ndiswrapper -i "${T}/${driver}/${driver}.inf"
  83. done
  84. fi
  85. }