| 1 | 
  1 | 
    
    # Copyright 1999-2020 Gentoo Authors 
   | 
  
  | 2 | 
  2 | 
    
    # Distributed under the terms of the GNU General Public License v2 
   | 
  
  | 3 | 
  3 | 
    
    
   | 
  
  | 4 | 
   | 
    
    EAPI=6 
   | 
  
   | 
  4 | 
    
    EAPI=7 
   | 
  
  | 5 | 
  5 | 
    
    
   | 
  
  | 6 | 
   | 
    
    PYTHON_COMPAT=( python3_{6,7} )
   | 
  
   | 
  6 | 
    
    PYTHON_COMPAT=( python3_{6,7,8} )
   | 
  
  | 7 | 
  7 | 
    
    
   | 
  
  | 8 | 
   | 
    
    inherit bash-completion-r1 multilib python-r1 
   | 
  
   | 
  8 | 
    
    inherit autotools bash-completion-r1 multilib python-r1 
   | 
  
  | 9 | 
  9 | 
    
    
   | 
  
  | 10 | 
  10 | 
    
    if [[ ${PV} == 9999* ]]; then
   | 
  
  | 11 | 
  11 | 
    
    	EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/${PN}/${PN}.git"
   | 
  
  | 12 | 
   | 
    
    	inherit autotools git-r3 
   | 
  
   | 
  12 | 
    
    	inherit git-r3 
   | 
  
  | 13 | 
  13 | 
    
    else 
   | 
  
  | 14 | 
  14 | 
    
    	SRC_URI="https://www.kernel.org/pub/linux/utils/kernel/kmod/${P}.tar.xz"
   | 
  
  | 15 | 
  15 | 
    
    	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86" 
   | 
  
  | 16 | 
   | 
    
    	inherit libtool 
   | 
  
   | 
  16 | 
    
    	#inherit libtool 
   | 
  
  | 17 | 
  17 | 
    
    fi 
   | 
  
  | 18 | 
  18 | 
    
    
   | 
  
  | 19 | 
  19 | 
    
    DESCRIPTION="library and tools for managing linux kernel modules" 
   | 
  
| ... | ... |  | 
  | 21 | 
  21 | 
    
    
   | 
  
  | 22 | 
  22 | 
    
    LICENSE="LGPL-2" 
   | 
  
  | 23 | 
  23 | 
    
    SLOT="0" 
   | 
  
  | 24 | 
   | 
    
    IUSE="debug doc libressl lzma pkcs7 python static-libs +tools zlib zstd" 
   | 
  
   | 
  24 | 
    
    IUSE="debug doc libressl +lzma pkcs7 python static-libs +tools +zlib +zstd" 
   | 
  
  | 25 | 
  25 | 
    
    
   | 
  
  | 26 | 
  26 | 
    
    # Upstream does not support running the test suite with custom configure flags. 
   | 
  
  | 27 | 
  27 | 
    
    # I was also told that the test suite is intended for kmod developers. 
   | 
  
| ... | ... |  | 
  | 42 | 
  42 | 
    
    		libressl? ( dev-libs/libressl:0= ) 
   | 
  
  | 43 | 
  43 | 
    
    	) 
   | 
  
  | 44 | 
  44 | 
    
    	zlib? ( >=sys-libs/zlib-1.2.6 )" #427130 
   | 
  
  | 45 | 
   | 
    
    DEPEND="${RDEPEND}
   | 
  
  | 46 | 
   | 
    
    	doc? ( dev-util/gtk-doc ) 
   | 
  
   | 
  45 | 
    
    DEPEND="${RDEPEND}"
   | 
  
   | 
  46 | 
    
    BDEPEND=" 
   | 
  
   | 
  47 | 
    
    	doc? ( 
   | 
  
   | 
  48 | 
    
    		dev-util/gtk-doc 
   | 
  
   | 
  49 | 
    
    		dev-util/gtk-doc-am 
   | 
  
   | 
  50 | 
    
    	) 
   | 
  
  | 47 | 
  51 | 
    
    	lzma? ( virtual/pkgconfig ) 
   | 
  
  | 48 | 
  52 | 
    
    	python? ( 
   | 
  
  | 49 | 
  53 | 
    
    		dev-python/cython[${PYTHON_USEDEP}]
   | 
  
  | 50 | 
  54 | 
    
    		virtual/pkgconfig 
   | 
  
  | 51 | 
  55 | 
    
    		) 
   | 
  
  | 52 | 
   | 
    
    	zlib? ( virtual/pkgconfig )" 
   | 
  
   | 
  56 | 
    
    	zlib? ( virtual/pkgconfig ) 
   | 
  
   | 
  57 | 
    
    " 
   | 
  
  | 53 | 
  58 | 
    
    if [[ ${PV} == 9999* ]]; then
   | 
  
  | 54 | 
  59 | 
    
    	DEPEND="${DEPEND}
   | 
  
  | 55 | 
  60 | 
    
    		dev-libs/libxslt" 
   | 
  
| ... | ... |  | 
  | 59 | 
  64 | 
    
    
   | 
  
  | 60 | 
  65 | 
    
    DOCS="NEWS README TODO" 
   | 
  
  | 61 | 
  66 | 
    
    
   | 
  
  | 62 | 
   | 
    
    PATCHES=( 
   | 
  
  | 63 | 
   | 
    
    	"${FILESDIR}/${P}-libressl.patch" # bug 677960
   | 
  
  | 64 | 
   | 
    
    	"${FILESDIR}/zstd-support.patch"
   | 
  
   | 
  67 | 
    
    PATCHES=( "${FILESDIR}"/${P}-depmod-do-not-output-.bin-to-stdout.patch
   | 
  
   | 
  68 | 
    
    	"${FILESDIR}"/zstd-support-27.patch
   | 
  
  | 65 | 
  69 | 
    
    ) 
   | 
  
  | 66 | 
  70 | 
    
    
   | 
  
  | 67 | 
  71 | 
    
    src_prepare() {
   | 
  
  | 68 | 
  72 | 
    
    	default 
   | 
  
  | 69 | 
  73 | 
    
    
   | 
  
  | 70 | 
   | 
    
    	if [[ ! -e configure ]] ; then 
   | 
  
   | 
  74 | 
    
    	if [[ ! -e configure ]] || use doc ; then 
   | 
  
  | 71 | 
  75 | 
    
    		if use doc; then 
   | 
  
   | 
  76 | 
    
    			cp "${EROOT}"/usr/share/aclocal/gtk-doc.m4 m4 || die
   | 
  
  | 72 | 
  77 | 
    
    			gtkdocize --copy --docdir libkmod/docs || die 
   | 
  
  | 73 | 
  78 | 
    
    		else 
   | 
  
  | 74 | 
  79 | 
    
    			touch libkmod/docs/gtk-doc.make 
   | 
  
| ... | ... |  | 
  | 91 | 
  96 | 
    
    		--with-bashcompletiondir="$(get_bashcompdir)" 
   | 
  
  | 92 | 
  97 | 
    
    		--with-rootlibdir="${EPREFIX}/$(get_libdir)"
   | 
  
  | 93 | 
  98 | 
    
    		$(use_enable debug) 
   | 
  
  | 94 | 
   | 
    
    		$(use_enable doc gtk-doc) 
   | 
  
   | 
  99 | 
    
    		$(usex doc '--enable-gtk-doc' '') 
   | 
  
  | 95 | 
  100 | 
    
    		$(use_enable static-libs static) 
   | 
  
  | 96 | 
  101 | 
    
    		$(use_enable tools) 
   | 
  
  | 97 | 
  102 | 
    
    		$(use_with lzma xz) 
   | 
  
| ... | ... |  | 
  | 151 | 
  156 | 
    
    		python_foreach_impl python_install 
   | 
  
  | 152 | 
  157 | 
    
    	fi 
   | 
  
  | 153 | 
  158 | 
    
    
   | 
  
  | 154 | 
   | 
    
    	find "${ED}" -name "*.la" -delete || die
   | 
  
   | 
  159 | 
    
    	find "${ED}" -type f -name "*.la" -delete || die
   | 
  
  | 155 | 
  160 | 
    
    
   | 
  
  | 156 | 
  161 | 
    
    	if use tools; then 
   | 
  
  | 157 | 
  162 | 
    
    		local cmd 
   | 
  
| ... | ... |  | 
  | 177 | 
  182 | 
    
    } 
   | 
  
  | 178 | 
  183 | 
    
    
   | 
  
  | 179 | 
  184 | 
    
    pkg_postinst() {
   | 
  
  | 180 | 
   | 
    
    	if [[ -L ${EROOT%/}/etc/runlevels/boot/static-nodes ]]; then
   | 
  
   | 
  185 | 
    
    	if [[ -L ${EROOT}/etc/runlevels/boot/static-nodes ]]; then
   | 
  
  | 181 | 
  186 | 
    
    		ewarn "Removing old conflicting static-nodes init script from the boot runlevel" 
   | 
  
  | 182 | 
   | 
    
    		rm -f "${EROOT%/}"/etc/runlevels/boot/static-nodes
   | 
  
   | 
  187 | 
    
    		rm -f "${EROOT}"/etc/runlevels/boot/static-nodes
   | 
  
  | 183 | 
  188 | 
    
    	fi 
   | 
  
  | 184 | 
  189 | 
    
    
   | 
  
  | 185 | 
  190 | 
    
    	# Add kmod to the runlevel automatically if this is the first install of this package. 
   | 
  
  | 186 | 
  191 | 
    
    	if [[ -z ${REPLACING_VERSIONS} ]]; then
   | 
  
  | 187 | 
   | 
    
    		if [[ ! -d ${EROOT%/}/etc/runlevels/sysinit ]]; then
   | 
  
  | 188 | 
   | 
    
    			mkdir -p "${EROOT%/}"/etc/runlevels/sysinit
   | 
  
   | 
  192 | 
    
    		if [[ ! -d ${EROOT}/etc/runlevels/sysinit ]]; then
   | 
  
   | 
  193 | 
    
    			mkdir -p "${EROOT}"/etc/runlevels/sysinit
   | 
  
  | 189 | 
  194 | 
    
    		fi 
   | 
  
  | 190 | 
   | 
    
    		if [[ -x ${EROOT%/}/etc/init.d/kmod-static-nodes ]]; then
   | 
  
  | 191 | 
   | 
    
    			ln -s /etc/init.d/kmod-static-nodes "${EROOT%/}"/etc/runlevels/sysinit/kmod-static-nodes
   | 
  
   | 
  195 | 
    
    		if [[ -x ${EROOT}/etc/init.d/kmod-static-nodes ]]; then
   | 
  
   | 
  196 | 
    
    			ln -s /etc/init.d/kmod-static-nodes "${EROOT}"/etc/runlevels/sysinit/kmod-static-nodes
   | 
  
  | 192 | 
  197 | 
    
    		fi 
   | 
  
  | 193 | 
  198 | 
    
    	fi 
   | 
  
  | 194 | 
  199 | 
    
    
   | 
  
  | 195 | 
   | 
    
    	if [[ -e ${EROOT%/}/etc/runlevels/sysinit ]]; then
   | 
  
  | 196 | 
   | 
    
    		if [[ ! -e ${EROOT%/}/etc/runlevels/sysinit/kmod-static-nodes ]]; then
   | 
  
   | 
  200 | 
    
    	if [[ -e ${EROOT}/etc/runlevels/sysinit ]]; then
   | 
  
   | 
  201 | 
    
    		if ! has_version sys-apps/systemd && [[ ! -e ${EROOT}/etc/runlevels/sysinit/kmod-static-nodes ]]; then
   | 
  
  | 197 | 
  202 | 
    
    			ewarn 
   | 
  
  | 198 | 
  203 | 
    
    			ewarn "You need to add kmod-static-nodes to the sysinit runlevel for" 
   | 
  
  | 199 | 
  204 | 
    
    			ewarn "kernel modules to have required static nodes!" 
   |