Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Oct 2013 11:34:46 +0000 (UTC)
From:      Rene Ladan <rene@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r332228 - head/Mk/Uses
Message-ID:  <201310311134.r9VBYkAB059851@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rene
Date: Thu Oct 31 11:34:46 2013
New Revision: 332228
URL: http://svnweb.freebsd.org/changeset/ports/332228

Log:
  Add a new USES for kernel module ports.
  
  USES=kmod takes no arguments and:
  - adds kld to CATEGORIES
  - sets SSP_UNSAFE
  - sets IGNORE if the kernel sources are not found
  - defines KMODDIR to /boot/modules by default, add it to
    PLIST_SUB and MAKE_ENV, and create it upon installation
  - handles cross-referencing kernel modules upon installation and
    deinstallation
  
  Approved by:	bapt

Added:
  head/Mk/Uses/kmod.mk   (contents, props changed)

Added: head/Mk/Uses/kmod.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/Mk/Uses/kmod.mk	Thu Oct 31 11:34:46 2013	(r332228)
@@ -0,0 +1,47 @@
+# $FreeBSD$
+#
+# Handles dependency on kernel sources
+#
+# MAINTAINER: rene@FreeBSD.org
+#
+# Feature:	kmod
+# Usage:	USES=kmod
+# Valid ARGS:	none
+#
+.if !defined(_INCLUDE_USES_KMOD_MK)
+_INCLUDE_USES_KMOD_MK=	yes
+
+.if defined(kmod_ARGS)
+IGNORE=	USES=kmod takes no arguments
+.endif
+
+.if !exists(${SRC_BASE}/sys/Makefile)
+IGNORE=	requires kernel source files in ${SRC_BASE}
+.endif
+
+CATEGORIES+=	kld
+
+SSP_UNSAFE=	kernel module does not support SSP
+
+KMODDIR?=	/boot/modules
+PLIST_SUB+=	KMODDIR="${KMODDIR:C,^/,,}"
+MAKE_ENV+=	KMODDIR="${KMODDIR}" SYSDIR="${SRC_BASE}/sys"
+
+pre-install: kmod-pre-install
+kmod-pre-install:
+.if defined(NO_STAGE)
+	${MKDIR} ${KMODDIR}
+.else
+	${MKDIR} ${STAGEDIR}${KMODDIR}
+.endif
+
+post-install: kmod-post-install
+kmod-post-install:
+	${ECHO_CMD} "@exec /usr/sbin/kldxref ${KMODDIR}"  >> ${TMPPLIST}
+	${ECHO_CMD} "@unexec /usr/sbin/kldxref ${KMODDIR}" >> ${TMPPLIST}
+	${ECHO_CMD} "@dirrmtry ${KMODDIR}" >> ${TMPPLIST}
+.if defined(NO_STAGE)
+	/usr/sbin/kldxref ${KMODDIR}
+.endif
+
+.endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310311134.r9VBYkAB059851>