diff --git a/emulators/rtc/Makefile b/emulators/rtc/Makefile index b20a7acfd7cb..ec92a8215c7a 100644 --- a/emulators/rtc/Makefile +++ b/emulators/rtc/Makefile @@ -6,7 +6,7 @@ # PORTNAME= rtc -PORTVERSION= 2000.09.11 +PORTVERSION= 2000.09.22 CATEGORIES= emulators linux MASTER_SITES= # none DISTFILES= # none @@ -25,13 +25,15 @@ STARTUP= rtc.sh MAKE_ARGS= KMODDIR="${KMODDIR}" CDEV_MAJOR="${CDEV_MAJOR}" PLIST_SUB= DEVDIR="${DEVDIR}" CDEV_MAJOR="${CDEV_MAJOR}" RTC_H_DIR="${RTC_H_DIR}" +SRC_BASE?= /usr/src + .include .if ${OSVERSION} < 400013 BROKEN= "Systems prior to 400013 is out of support" .endif -.if !exists(/sys/Makefile) +.if !exists(${SRC_BASE}/sys/Makefile) BROKEN= "Kernel source files required" .endif @@ -45,10 +47,15 @@ do-extract: @cd ${FILESDIR} && ${CP} Makefile *.[ch] ${WRKSRC}/ post-patch: -.if !exists(/sys/compat/linux/linux_ioctl.h) +.if !exists(${SRC_BASE}/sys/compat/linux/linux_ioctl.h) ${PERL} -i -pe 's,compat(/linux/linux_ioctl\.h),i386$$1,' \ ${WRKSRC}/rtc_linux.c .endif + @if ! grep -w dev2unit ${SRC_BASE}/sys/kern/kern_conf.c >/dev/null; \ + then \ + ${ECHO} "dev2unit() not found in sys/kern/kern_conf.c. Using lminor() instead."; \ + ${PERL} -i -pe 's,dev2unit,lminor,' ${WRKSRC}/rtc.c; \ + fi pre-install: ${MKDIR} ${KMODDIR} diff --git a/emulators/rtc/files/rtc.c b/emulators/rtc/files/rtc.c index 95681ce5bdc0..ff6899e3251b 100644 --- a/emulators/rtc/files/rtc.c +++ b/emulators/rtc/files/rtc.c @@ -115,7 +115,7 @@ rtc_attach(dev_t dev) struct rtc_softc *sc; int unit; - unit = lminor(dev); + unit = dev2unit(dev); DLog(Lenter, "%d %p", unit, dev); if (dev->si_drv1) { DLog(Lexit, "old %p, %p", dev, dev->si_drv1); diff --git a/emulators/rtc/files/rtc.sh b/emulators/rtc/files/rtc.sh index 5fa3843be1f4..8751f46c710d 100644 --- a/emulators/rtc/files/rtc.sh +++ b/emulators/rtc/files/rtc.sh @@ -1,12 +1,13 @@ #!/bin/sh -kmod=@@PREFIX@@/modules/rtc.ko +kmoddir=@@PREFIX@@/modules +kmod=rtc.ko case "$1" in start) - if [ -x $kmod ]; then + if [ -x $kmoddir/$kmod ]; then echo -n ' rtc' - kldload $kmod + kldload $kmoddir/$kmod fi ;; stop)