aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2008-06-15 14:09:12 +0800
committerRong-En Fan <rafan@FreeBSD.org>2008-06-15 14:09:12 +0800
commitbe9750b9c61907237fa58ff45848b0673e7cfa45 (patch)
tree5f56a66730e6a3ff3f2c9fd3b8d004d707553cc9
parent6e9a12de8594955216af8a7363a96da1cfdb0c9a (diff)
downloadfreebsd-ports-gnome-be9750b9c61907237fa58ff45848b0673e7cfa45.tar.gz
freebsd-ports-gnome-be9750b9c61907237fa58ff45848b0673e7cfa45.tar.zst
freebsd-ports-gnome-be9750b9c61907237fa58ff45848b0673e7cfa45.zip
- Convert old style rc script to the new world order
- Install kernel modules in PREFIX/modules instead of PREFIX/lib - Bump PORTREVISION PR: ports/124063 (based on) Submitted by: Volodymyr Kostyrko <c.kworr at gmail.com> Tested by: Volodymyr Kostyrko <c.kworr at gmail.com> (earlier version)
-rw-r--r--audio/aureal-kmod/Makefile21
-rw-r--r--audio/aureal-kmod/files/aureal.in96
-rw-r--r--audio/aureal-kmod/files/aureal.sh82
-rw-r--r--audio/aureal-kmod/files/pkg-message.in37
-rw-r--r--audio/aureal-kmod/pkg-message38
-rw-r--r--audio/aureal-kmod/pkg-plist15
6 files changed, 153 insertions, 136 deletions
diff --git a/audio/aureal-kmod/Makefile b/audio/aureal-kmod/Makefile
index 0d860fa2e12d..8ccef216d451 100644
--- a/audio/aureal-kmod/Makefile
+++ b/audio/aureal-kmod/Makefile
@@ -7,7 +7,7 @@
PORTNAME= aureal-kmod
PORTVERSION= 1.5
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= audio kld
MASTER_SITES= http://www.matey.org/au88x0/
DISTNAME= au88x0-${PORTVERSION}_${DISTREVISION}
@@ -22,11 +22,19 @@ SRCPREFIX?= /usr/src
STRAYFILES= au88x0.h au88x0.c asp10.o asp20.o asp30.o
DISTREVISION= 4
-WRKSRC= ${WRKDIR}
+KMODDIR= ${PREFIX}/modules/au88x0
+KMODDIR_REL= ${KMODDIR:S%${PREFIX}/%%}
+
+USE_RC_SUBR= aureal
+SUB_FILES= pkg-message
+SUB_LIST= KMODDIR=${KMODDIR} RC_SUBR_SUFFIX=${RC_SUBR_SUFFIX}
-PKGMESSAGE= ${WRKSRC}/.MESSAGE
+PLIST_SUB= KMODDIR=${KMODDIR_REL}
+
+WRKSRC= ${WRKDIR}
MAKE_ENV= WRKSRC="${WRKSRC}"
+MAKE_ARGS= KMODDIR="${KMODDIR}"
# Make sure kernel sources are present before going any further
.if ! exists(${SRCPREFIX}/sys/dev/sound/pcm/sound.c)
@@ -51,14 +59,9 @@ pre-fetch:
.endfor
pre-install:
- @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${PKGDIR}/pkg-message > \
- ${PKGMESSAGE}
- @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${FILESDIR}/aureal.sh > \
- ${WRKDIR}/aureal.sh.sample
- ${MKDIR} ${PREFIX}/lib/au88x0
+ ${MKDIR} ${KMODDIR}
post-install:
- @${INSTALL_SCRIPT} ${WRKDIR}/aureal.sh.sample ${PREFIX}/etc/rc.d
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/audio/aureal-kmod/files/aureal.in b/audio/aureal-kmod/files/aureal.in
new file mode 100644
index 000000000000..4c9ac678fbfe
--- /dev/null
+++ b/audio/aureal-kmod/files/aureal.in
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# PROVIDE: aureal
+# BEFORE: hald
+# KEYWORD: nojail
+#
+# Add the following line to /etc/rc.conf[.local] to enable aureal
+#
+# aureal_enable="YES"
+#
+# By default the script automatically detects the right kernel module
+# to load, if this fails, you can set "aureal_card" to the right value.
+# Possible values are 8810, 8820, and 8830.
+#
+# If your AMD Athlon system is based on a VIA Apollo KX133 motherboard
+# chipset, your system will most certainly lock up shortly after
+# you start a playback. To work around this issue please add this following
+# line to /etc/rc.conf[.local]:
+#
+# aureal_viakx133fix="YES"
+#
+
+. %%RC_SUBR%%
+
+name="aureal"
+rcvar=${name}_enable
+
+start_cmd="aureal_start"
+stop_cmd="aureal_stop"
+
+load_rc_config $name
+
+: ${aureal_enable="NO"}
+: ${aureal_card=""}
+: ${aureal_viakx133fix="NO"}
+
+aureal_detect()
+{
+ PCICONF="/usr/sbin/pciconf"
+ if [ -z "${aureal_card}" -a -x ${PCICONF} ]; then
+ if [ "`${PCICONF} -l 2>&- | grep 0x000312eb`" ]; then
+ aureal_card=8810
+ elif [ "`${PCICONF} -l 2>&- | grep 0x000112eb`" ]; then
+ aureal_card=8820
+ elif [ "`${PCICONF} -l 2>&- | grep 0x000212eb`" ]; then
+ aureal_card=8830
+ fi
+ fi
+
+ if [ -z "${aureal_card}" ]; then
+ err 1 "Unable to determine your Aureal car type - override it by aureal_card rc variable"
+ fi
+
+ PREFIX=%%PREFIX%%
+ KMODDIR=%%KMODDIR%%
+ DRIVERFILE=snd_au${aureal_card}
+}
+
+aureal_start()
+{
+ aureal_detect
+ if [ ! -f ${KMODDIR}/${DRIVERFILE}.ko ]; then
+ err 64 "${KMODDIR}/${DRIVERFILE} for ${aureal_card} not found!"
+ fi
+ if ! kldstat -qm ${DRIVERFILE}; then
+ if ! kldload ${KMODDIR}/${DRIVERFILE}.ko; then
+ warn 'aureal module failed to load'
+ return 1
+ fi
+ fi
+
+ if checkyesno aureal_viakx133fix; then
+ pcisel=`${PCICONF} -l 2>&- | grep ^pcm0 | awk -F: '{ gsub("^[^@]*@", ""); print $1":"$2":"$3 }'`
+ if [ -z "$pcisel" ]; then
+ warn "Soundcard PCI selector undetermined. Unable to install VIA KX133 workaround. Starting a playback will likely to lock-up your system!"
+ return 0
+ fi
+
+ oldvalue=`${PCICONF} -r -b $pcisel 0x40 2>&- | sed 's/ *$//'`
+ ${PCICONF} -w -b $pcisel 0x40 0xff
+ newvalue=`${PCICONF} -r -b $pcisel 0x40 2>&- | sed 's/ *$//'`
+ info "with VIA KX133 workaround: ${pcisel},0x40: ${oldvalue} -> ${newvalue}"
+ fi
+
+ return 0
+}
+
+aureal_stop()
+{
+ aureal_detect
+ kldstat -qm ${DRIVERFILE} && kldunload ${DRIVERFILE}
+
+ return 0
+}
+
+run_rc_command "$1"
diff --git a/audio/aureal-kmod/files/aureal.sh b/audio/aureal-kmod/files/aureal.sh
deleted file mode 100644
index fd31863ed662..000000000000
--- a/audio/aureal-kmod/files/aureal.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-#---------------------------------------------------------------------
-#
-# I. Auto-detection of your Aureal Vortex sound card
-#
-# If for some reason this script fails to guess the type of your
-# Aureal card correctly, you can manually override it here.
-# Set this to 8810 (Vortex Advantage), 8820 (Vortex 1) or 8830
-# (Vortex 2):
-#
-#CARD=8830
-#
-# II. VIA Apollo KX133 lock-up issue workaround
-#
-# If your AMD Athlon system is based on a VIA Apollo KX133 motherboard
-# chipset, your system will most certainly lock up shortly after
-# you start a playback. To work around this issue please uncomment
-# this line:
-#
-#VIAKX133FIX=yes
-#---------------------------------------------------------------------
-
-PCICONF="/usr/sbin/pciconf"
-
-if [ -z "${CARD}" -a -x ${PCICONF} ]; then
- if [ "`${PCICONF} -l 2>&- | grep 0x000312eb`" ]; then
- CARD=8810
- elif [ "`${PCICONF} -l 2>&- | grep 0x000112eb`" ]; then
- CARD=8820
- elif [ "`${PCICONF} -l 2>&- | grep 0x000212eb`" ]; then
- CARD=8830
- fi
-fi
-
-if [ -z "${CARD}" ]; then
- echo "Unable to determine your Aureal card type -" \
- "override it manually in $0" >&2
- exit 255
-fi
-
-PREFIX=%%PREFIX%%
-LIBDIR=${PREFIX}/lib/au88x0
-DRIVERFILE=snd_au${CARD}.ko
-
-case "$1" in
- start)
- if [ ! -f ${LIBDIR}/${DRIVERFILE} ]; then
- echo ""
- echo "${LIBDIR}/${DRIVERFILE} for ${CARD} not found!"
- echo ""
- exit 64
- fi
- /sbin/kldload ${LIBDIR}/${DRIVERFILE}
-
- echo -n " aureal-kmod"
-
- # Increase PCI timeout for broken VIA Apollo KX133 chipsets
- # NOTE: This assumes your Aureal card is the pcm0 device
- if [ "$VIAKX133FIX" ]; then
- pcisel=`${PCICONF} -l 2>&- | grep ^pcm0 | awk -F: '{ gsub("^[^@]*@", ""); print $1":"$2":"$3 }'`
- if [ -z "$pcisel" ]; then
- echo " (WARNING: Soundcard PCI selector undetermined. Unable to install VIA KX133 workaround. Starting a playback will likely to lock-up your system!)"
- exit 64
- fi
- oldvalue=`${PCICONF} -r -b $pcisel 0x40 2>&- | sed 's/ *$//'`
- echo -n " (with VIA KX133 workaround: ${pcisel},0x40: ${oldvalue} -> "
- ${PCICONF} -w -b $pcisel 0x40 0xff
- echo -n "`${PCICONF} -r -b $pcisel 0x40 2>&- | sed 's/ *$//'`)"
- fi
- ;;
- stop)
- /sbin/kldunload ${DRIVERFILE}
- echo -n " aureal-kmod"
- ;;
- *)
- echo ""
- echo "Usage: `basename $0` { start | stop }"
- echo ""
- exit 64
- ;;
-esac
-
diff --git a/audio/aureal-kmod/files/pkg-message.in b/audio/aureal-kmod/files/pkg-message.in
new file mode 100644
index 000000000000..9f1dddb45e9d
--- /dev/null
+++ b/audio/aureal-kmod/files/pkg-message.in
@@ -0,0 +1,37 @@
+-------------------------------------------------------------------------------
+IMPORTANT! MAKE SURE TO READ THE FOLLOWING!
+
+To use this driver, put the following line in /etc/rc.conf
+
+aureal_enable="YES"
+
+To load the driver run (as root):
+
+%%PREFIX%%/etc/rc.d/aureal%%RC_SUBR_SUFFIX%% start
+
+To unload it:
+
+%%PREFIX%%/etc/rc.d/aureal%%RC_SUBR_SUFFIX%% stop
+
+It'll also load the driver automatically when the system is started.
+
+In case it fails to detect the type of your Vortex soundcard correctly,
+set the 'aureal_card' variable in your /etc/rc.conf to either 8810, 8820,
+or 8830 depending on which Aureal chipset you have.
+
+If your system is based on a Via Apollo KX133 chipset, your computer will
+most likely lock up soon after playback is started. This is a known issue.
+Make sure you put
+
+aureal_viakx133fix="YES"
+
+in your /etc/rc.conf.
+
+Please note that you also need to have the 'sound.ko' moduld loaded already.
+
+Report problems to Alexander Matey <ports@matey.org>.
+
+Thanks and enjoy!
+
+-Maxim
+-------------------------------------------------------------------------------
diff --git a/audio/aureal-kmod/pkg-message b/audio/aureal-kmod/pkg-message
deleted file mode 100644
index 3313cdf82523..000000000000
--- a/audio/aureal-kmod/pkg-message
+++ /dev/null
@@ -1,38 +0,0 @@
--------------------------------------------------------------------------------
-IMPORTANT! MAKE SURE TO READ THE FOLLOWING!
-
-To use the driver, make a copy of %%PREFIX%%/etc/rc.d/aureal.sh.sample under
-%%PREFIX%%/etc/rc.d/aureal.sh and do: chmod +x %%PREFIX%%/etc/rc.d/aureal.sh.
-
-To load the driver run (as root):
-
-# %%PREFIX%%/etc/rc.d/aureal.sh start
-
-To unload it:
-
-# %%PREFIX%%/etc/rc.d/aureal.sh stop
-
-It'll also load the driver automatically when the system is started.
-
-In case it fails to detect the type of your Vortex soundcard correctly,
-edit this script and set "CARD=" to 88X0 where X is 1, 2 or 3 depending
-on which Aureal chipset you have - au8810 (Vortex Advantage), au8820
-(Vortex 1) or au8830 (Vortex 2) correspondingly.
-
-If your system is based on a Via Apollo KX133 chipset, your computer will
-most likely lock up soon after playback is started. This is a known issue.
-Make sure to uncomment "VIAKX133FIX=yes" in aureal.sh start-up script.
-
-Please note that you also need to have a `snd_pcm.ko' module either already
-loaded or placed into appropriate location for modules on your system (default
-is /modules/ on 4-STABLE and /boot/kernel/ on 5-CURRENT). You can compile and
-install snd_pcm by doing:
-
-# cd /sys/modules/sound/pcm/ && make all install
-
-Report problems to Alexander Matey <ports@matey.org>.
-
-Thanks and enjoy!
-
--Maxim
--------------------------------------------------------------------------------
diff --git a/audio/aureal-kmod/pkg-plist b/audio/aureal-kmod/pkg-plist
index 19f23d44534c..e2b8fecdde3e 100644
--- a/audio/aureal-kmod/pkg-plist
+++ b/audio/aureal-kmod/pkg-plist
@@ -1,7 +1,8 @@
-etc/rc.d/aureal.sh.sample
-@unexec `if [ -e /bin/chflags ]; then echo /bin/chflags; else echo /usr/bin/chflags; fi` noschg %D/lib/au88x0/snd_au88?0.ko
-@rmtry lib/au88x0/linker.hints
-lib/au88x0/snd_au8810.ko
-lib/au88x0/snd_au8820.ko
-lib/au88x0/snd_au8830.ko
-@dirrm lib/au88x0
+@unexec `if [ -e /bin/chflags ]; then echo /bin/chflags; else echo /usr/bin/chflags; fi` noschg %D/%%KMODDIR%%/snd_au88?0.ko
+@unexec kldxref %D/%%KMODDIR%%
+@unexec rm -f %D/%%KMODDIR%%/linker.hints
+%%KMODDIR%%/snd_au8810.ko
+%%KMODDIR%%/snd_au8820.ko
+%%KMODDIR%%/snd_au8830.ko
+@dirrmtry %%KMODDIR%%
+@dirrmtry modules