Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Mar 2012 05:19:05 GMT
From:      "4721@hushmail.com" <4721@hushmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/165994: [patch] fix several usages of ${SRC_BASE} before it is defined
Message-ID:  <201203130519.q2D5J5OB009686@red.freebsd.org>
Resent-Message-ID: <201203130520.q2D5K2Lk098827@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         165994
>Category:       ports
>Synopsis:       [patch] fix several usages of ${SRC_BASE} before it is defined
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 13 05:20:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     4721@hushmail.com
>Release:        
>Organization:
>Environment:
>Description:
SRC_BASE is being used before being defined in several ports. it happened to 
work anyways in most cases because the main use of SRC_BASE is for checking if
${SRC_BASE}/sys/ (/usr/src/sys/) exists, and if SRC_BASE is empty, it just
checks for /sys/ which does exist on most systems as a symlink to /usr/src/sys/.

example from sysutils/graid5 (note graid5 has been independently fixed since
this was made):

.if !exists(${SRC_BASE}/sys/Makefile)
IGNORE= requires kernel source files
.elif !exists(${SRC_BASE}/sbin/geom/Makefile)
IGNORE= requires sbin source files
.endif

===>  graid5-1.1.20110927.40 requires sbin source files.
*** Error code 1

65254: stat("/sys/Makefile",{ mode=-rw-r--r-- ,inode=781342,size=1677,blksize=4096 }) = 0 (0x0)
65254: stat("/sbin/geom/Makefile",0x7fffffffd5d0) ERR#20 'Not a directory'

the ${SRC_BASE}/sys/Makefile happens to work due to the /sys symlink.
switch to bsd.port.pre/post.mk and files are correctly checked.

73664: stat("/usr/src/sys/Makefile",{ mode=-rw-r--r-- ,inode=781342,size=1677,blksize=4096 }) = 0 (0x0)
73664: stat("/usr/src/sbin/geom/Makefile",{ mode=-rw-r--r-- ,inode=685289,size=525,blksize=4096 }) = 0 (0x0)

attached patch fixes this in several ports in different ways, due to differing
Makefile usages and structures.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -r -u ports.orig/audio/oss/Makefile ports/audio/oss/Makefile
--- ports.orig/audio/oss/Makefile
+++ ports/audio/oss/Makefile
@@ -57,12 +57,12 @@
 
 OPTIONS=	VORBIS	"OGG/Vorbis audio support"	on
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/Makefile)
 IGNORE=		requires kernel source to be installed
 .endif
 
-.include <bsd.port.pre.mk>
-
 CONFIGURE_ENV+=	HOSTCC="${CC}"
 
 .if !defined(WITHOUT_VORBIS)
diff -r -u ports.orig/comms/uarduno/Makefile ports/comms/uarduno/Makefile
--- ports.orig/comms/uarduno/Makefile
+++ ports/comms/uarduno/Makefile
@@ -19,6 +19,8 @@
 MAKE_ENV+=	KMODDIR=${KMODDIR}
 LOCALBASE=	${KMODDIR}
 
+.include <bsd.port.pre.mk>
+
 SRCPREFIX?=	${SRC_BASE}
 
 # disable mtree or you'll get a /boot/kernel/... directory hierarchy put there
@@ -41,8 +43,6 @@
 #
 CFLAGS+=	-DKERNELVER=${OSVERSION}
 
-.include <bsd.port.pre.mk>
-
 .if ${OSVERSION} < 800000
 # Simple check for 7.x kernel source (find usb.c)
 .if ! exists(${SRCPREFIX}/sys/dev/usb/usb.c)
diff -r -u ports.orig/emulators/virtio-kmod/Makefile ports/emulators/virtio-kmod/Makefile
--- ports.orig/emulators/virtio-kmod/Makefile
+++ ports/emulators/virtio-kmod/Makefile
@@ -22,12 +22,12 @@
 KMODDIR?=	/boot/modules
 PLIST_SUB=	KMODDIR=${KMODDIR:C,^/,,}
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/Makefile)
 IGNORE=		requires kernel source to be installed
 .endif
 
-.include <bsd.port.pre.mk>
-
 .if ${OSREL} != "8.2" && ${OSREL} != "9.0"
 IGNORE=		not supported $${OSREL} (${OSREL})
 .endif
diff -r -u ports.orig/emulators/virtualbox-ose/Makefile ports/emulators/virtualbox-ose/Makefile
--- ports.orig/emulators/virtualbox-ose/Makefile
+++ ports/emulators/virtualbox-ose/Makefile
@@ -81,10 +81,6 @@
 SUB_LIST+=	VBOXUSER=${VBOXUSER}
 USE_RC_SUBR+=	vboxheadless
 
-KMK_BUILDTYPE=	release
-KMK_CONFIG=	VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys
-KMK_FLAGS=
-
 .if defined(WITHOUT_QT4) && !defined(WITHOUT_NLS)
 BROKEN=		NLS support requires QT4 frontend. Run 'make config' again!
 .endif
@@ -126,6 +122,12 @@
 PLIST_SUB+=	GUESTADDITIONS="@comment "
 .endif
 
+.include <bsd.port.pre.mk>
+                
+KMK_BUILDTYPE=	release   
+KMK_CONFIG=	VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys
+KMK_FLAGS=
+
 .if defined(WITH_DEBUG)
 KMK_FLAGS+=	BUILD_TYPE=debug
 KMK_BUILDTYPE=	debug
@@ -176,8 +178,6 @@
 PLIST_SUB+=	I386="@comment "
 .endif
 
-.include <bsd.port.pre.mk>
-
 .if ${OSVERSION} < 800000
 BROKEN=		Does not compile on FreeBSD 7.x
 .endif
diff -r -u ports.orig/emulators/virtualbox-ose-legacy/Makefile ports/emulators/virtualbox-ose-legacy/Makefile
--- ports.orig/emulators/virtualbox-ose-legacy/Makefile
+++ ports/emulators/virtualbox-ose-legacy/Makefile
@@ -80,10 +80,6 @@
 SUB_LIST+=	VBOXUSER=${VBOXUSER}
 USE_RC_SUBR+=	vboxheadless
 
-KMK_BUILDTYPE=	release
-KMK_CONFIG=	VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys
-KMK_FLAGS=
-
 .if defined(WITHOUT_QT4) && !defined(WITHOUT_NLS)
 BROKEN=		NLS support requires QT4 frontend. Run 'make config' again!
 .endif
@@ -125,6 +121,12 @@
 PLIST_SUB+=	GUESTADDITIONS="@comment "
 .endif
 
+.include <bsd.port.pre.mk>
+
+KMK_BUILDTYPE=	release
+KMK_CONFIG=	VBOX_LIBPATH_X11=${LOCALBASE} VBOX_FREEBSD_SRC=${SRC_BASE}/sys
+KMK_FLAGS=
+
 .if defined(WITH_DEBUG)
 KMK_FLAGS+=	BUILD_TYPE=debug
 KMK_BUILDTYPE=	debug
@@ -175,8 +177,6 @@
 PLIST_SUB+=	I386="@comment "
 .endif
 
-.include <bsd.port.pre.mk>
-
 .if ${OSVERSION} > 900012
 EXTRA_PATCHES+=	${FILESDIR}/extrapatch-include-iprt-string.h
 .endif
diff -r -u ports.orig/graphics/kix-kmod/Makefile ports/graphics/kix-kmod/Makefile
--- ports.orig/graphics/kix-kmod/Makefile
+++ ports/graphics/kix-kmod/Makefile
@@ -16,6 +16,8 @@
 MAINTAINER=	jon@witchspace.com
 COMMENT=	A graphical screensaver kernel module
 
+.include <bsd.port.pre.mk>
+
 SYSDIR?=	${SRC_BASE}/sys
 .if !exists(${SYSDIR}/dev/syscons/syscons.h)
 IGNORE=		requires kernel source (in ${SYSDIR}) to build
@@ -30,4 +32,4 @@
 post-install:
 	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -r -u ports.orig/graphics/plasma-kmod/Makefile ports/graphics/plasma-kmod/Makefile
--- ports.orig/graphics/plasma-kmod/Makefile
+++ ports/graphics/plasma-kmod/Makefile
@@ -15,6 +15,8 @@
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A plasma-effect screensaver kernel module
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/dev/syscons/syscons.h)
 IGNORE=		requires kernel source (in ${SRC_BASE}) to build
 .endif
@@ -27,8 +29,6 @@
 post-install:
 	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.pre.mk>
-
 .if ${ARCH} == "amd64"
 BROKEN=		Does not configure
 .endif
diff -r -u ports.orig/multimedia/ptx-kmod/Makefile ports/multimedia/ptx-kmod/Makefile
--- ports.orig/multimedia/ptx-kmod/Makefile
+++ ports/multimedia/ptx-kmod/Makefile
@@ -26,10 +26,11 @@
 USE_RC_SUBR=	ptx.sh
 PORTDOCS=	README
 
+.include <bsd.port.pre.mk>
+
 KMODDIR=	libexec/${PORTNAME}
 SYSDIR?=	${SRC_BASE}/sys
 
-.include <bsd.port.pre.mk>
 KERNCONF?=	GENERIC
 
 # Use the first component of ${KERNCONF}.
diff -r -u ports.orig/net/iet/Makefile ports/net/iet/Makefile
--- ports.orig/net/iet/Makefile
+++ ports/net/iet/Makefile
@@ -31,6 +31,8 @@
 
 USE_RC_SUBR=	ietd
 
+.include <bsd.port.pre.mk>
+
 KMODDIR=	${PREFIX}/modules
 PLIST_SUB+=	KMODDIR=${KMODDIR}
 MAKE_ENV+=	KMODDIR=${KMODDIR} DATADIR=${DATADIR} SYSDIR="${SRC_BASE}/sys"
@@ -41,8 +43,6 @@
 IGNORE=		requires kernel sources to build
 .endif
 
-.include <bsd.port.pre.mk>
-
 .if ${OSVERSION} < 800107
 BROKEN=		requires 8.0-RELEASE or higher
 .endif
diff -r -u ports.orig/net/ng_car/Makefile ports/net/ng_car/Makefile
--- ports.orig/net/ng_car/Makefile
+++ ports/net/ng_car/Makefile
@@ -22,12 +22,12 @@
 MAN4=		ng_car.4
 MANCOMPRESSED=	yes
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/Makefile)
 IGNORE=	this port requires kernel sources
 .endif
 
-.include <bsd.port.pre.mk>
-
 .if ${OSVERSION} >= 700041
 IGNORE=	already exists in base system
 .endif
diff -r -u ports.orig/net/ng_mikrotik_eoip/Makefile ports/net/ng_mikrotik_eoip/Makefile
--- ports.orig/net/ng_mikrotik_eoip/Makefile
+++ ports/net/ng_mikrotik_eoip/Makefile
@@ -25,6 +25,8 @@
 PLIST_SUB+=	KMODDIR=${KMODDIR} \
 		PORTNAME=${PORTNAME}
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/sys/module.h)
 IGNORE=		requires kernel source files
 .endif
@@ -38,4 +40,4 @@
 do-install:
 	@${INSTALL_KLD} ${WRKSRC}/${PORTNAME}.ko ${KMODDIR}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -r -u ports.orig/net/skyfish/Makefile ports/net/skyfish/Makefile
--- ports.orig/net/skyfish/Makefile
+++ ports/net/skyfish/Makefile
@@ -13,6 +13,8 @@
 MAINTAINER=	nsand@sura.ru
 COMMENT=	Grabbing TCP streams from network interface (SAT internet)
 
+.include <bsd.port.pre.mk>
+
 SYSDIR?=	${SRC_BASE}/sys
 KMODDIR=	/boot/modules
 PLIST_SUB+=	KMODDIR=${KMODDIR}
@@ -28,4 +30,4 @@
 	exit 1
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -r -u ports.orig/net/skystar2/Makefile ports/net/skystar2/Makefile
--- ports.orig/net/skystar2/Makefile
+++ ports/net/skystar2/Makefile
@@ -17,6 +17,7 @@
 COMMENT=	Kernel module and program for SkyStar2/SkyStar2.8A, ver. ${PORTVERSION}
 
 USE_BZIP2=	yes
+.include <bsd.port.pre.mk>
 SYSDIR?=	${SRC_BASE}/sys
 KMODDIR=	/boot/modules
 PLIST_SUB+=	KMODDIR=${KMODDIR}
@@ -49,8 +50,6 @@
 .endfor
 .endif
 
-.include <bsd.port.pre.mk>
-
 .if ${ARCH} == "ia64" || ${ARCH} == "powerpc" || ${ARCH} == "sparc64"
 BROKEN=		Does not compile on ia64, powerprc, or sparc64
 .elif ${OSVERSION} >= 900000
diff -r -u ports.orig/net/ttbudget/Makefile ports/net/ttbudget/Makefile
--- ports.orig/net/ttbudget/Makefile
+++ ports/net/ttbudget/Makefile
@@ -17,6 +17,8 @@
 COMMENT=	Driver for 'TechnoTrend budget DVB S-1401' (SkyStar3)
 
 USE_BZIP2=	yes
+
+.include <bsd.port.pre.mk>
 SYSDIR?=	${SRC_BASE}/sys
 KMODDIR=	/boot/modules
 PLIST_SUB+=	KMODDIR=${KMODDIR}
@@ -32,8 +34,6 @@
 post-install:
 	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.pre.mk>
-
 .if ${ARCH} == "ia64" || ${ARCH} == "powerpc" || ${ARCH} == "sparc64"
 BROKEN=		Does not compile on ia64, powerprc, or sparc64
 .elif ${OSVERSION} >= 900000
diff -r -u ports.orig/print/acroreadwrapper/Makefile ports/print/acroreadwrapper/Makefile
--- ports.orig/print/acroreadwrapper/Makefile
+++ ports/print/acroreadwrapper/Makefile
@@ -30,6 +30,9 @@
 		PLUGINDIR=${PLUGINDIR} \
 		KMODDIR=${KMODDIR}
 USE_RC_SUBR=	linux_adobe.sh
+
+.include <bsd.port.pre.mk>
+
 MAKE_ENV=	KMODDIR=${KMODDIR} SYSDIR=${SRC_BASE}/sys DESTDIR=${PREFIX}/
 
 ADOBEBASE=	Adobe
@@ -38,7 +41,6 @@
 PLUGINDIR=	lib/npapi/linux-acroread
 KMODDIR=	libexec/linux_adobe
 
-.include <bsd.port.pre.mk>
 KERNCONF?=	GENERIC
 
 # Use the first component of ${KERNCONF}.
diff -r -u ports.orig/sysutils/acpi_call/Makefile ports/sysutils/acpi_call/Makefile
--- ports.orig/sysutils/acpi_call/Makefile
+++ ports/sysutils/acpi_call/Makefile
@@ -20,6 +20,8 @@
 PLIST_SUB+=	KMODDIR=${KMODDIR} \
 		PORTNAME=${PORTNAME}
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/sys/module.h)
 IGNORE=		requires kernel source files
 .endif
@@ -34,4 +36,4 @@
 	@${INSTALL_KLD} ${WRKSRC}/${PORTNAME}.ko ${KMODDIR}
 	@${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/sbin
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -r -u ports.orig/sysutils/cciss_vol_status/Makefile ports/sysutils/cciss_vol_status/Makefile
--- ports.orig/sysutils/cciss_vol_status/Makefile
+++ ports/sysutils/cciss_vol_status/Makefile
@@ -21,8 +21,10 @@
 MAN8=		cciss_vol_status.8
 PLIST_FILES=	bin/cciss_vol_status
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/dev/ciss/cissio.h)
 IGNORE=		cciss_vol_status requires kernel sources of the ciss driver
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -r -u ports.orig/sysutils/fusefs-kmod/Makefile ports/sysutils/fusefs-kmod/Makefile
--- ports.orig/sysutils/fusefs-kmod/Makefile
+++ ports/sysutils/fusefs-kmod/Makefile
@@ -26,13 +26,13 @@
 USE_RC_SUBR=	fusefs
 KMODDIR?=	${PREFIX}/modules
 PLIST_SUB=	KMODDIR=${KMODDIR}
+SRC_BASE?=	/usr/src
 MAKE_ENV=	BINDIR="${PREFIX}/sbin" MANDIR="${MANPREFIX}/man/man" \
 		KMODDIR="${KMODDIR}" SYSDIR="${SRC_BASE}/sys" \
 		MOUNT="${SRC_BASE}/sbin/mount"
 WRKSRC=		${WRKDIR}/fuse4bsd-${HG_SHORTREV}
 DISABLE_SIZE=	yes
 
-SRC_BASE?=	/usr/src
 SETUP=		setup.sh
 HG_SHORTREV=	498acaef33b0
 
diff -r -u ports.orig/sysutils/lsof/Makefile ports/sysutils/lsof/Makefile
--- ports.orig/sysutils/lsof/Makefile
+++ ports/sysutils/lsof/Makefile
@@ -40,6 +40,8 @@
 .endif
 
 USE_BZIP2=	yes
+
+.include <bsd.port.pre.mk>
 HAS_CONFIGURE=	yes
 CONFIGURE_SCRIPT=	Configure
 CONFIGURE_ARGS=	-n freebsd
@@ -81,4 +83,4 @@
 	    ${FIND} -d share/lsof -type d \
 	        | ${SED} -e 's/^/@dirrm /g' >>${TMPPLIST}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -r -u ports.orig/sysutils/pefs-kmod/Makefile ports/sysutils/pefs-kmod/Makefile
--- ports.orig/sysutils/pefs-kmod/Makefile
+++ ports/sysutils/pefs-kmod/Makefile
@@ -18,6 +18,8 @@
 
 FETCH_ARGS=	-Fpr		# work around 302 redirect at guthub
 
+.include <bsd.port.pre.mk>
+
 KMODDIR?=	/boot/modules
 PLIST_SUB=	KMODDIR=${KMODDIR}
 MAKE_ENV=	BINDIR="${PREFIX}/sbin" MANDIR="${MANPREFIX}/man/man" \
@@ -28,8 +30,6 @@
 
 ONLY_FOR_ARCHS=	i386 amd64	# not tested on other archs
 
-.include <bsd.port.pre.mk>
-
 .if ${OSVERSION} < 800000
 BROKEN=		requires fairly recent FreeBSD-STABLE, or FreeBSD-CURRENT
 .endif
diff -r -u ports.orig/sysutils/scprotect/Makefile ports/sysutils/scprotect/Makefile
--- ports.orig/sysutils/scprotect/Makefile
+++ ports/sysutils/scprotect/Makefile
@@ -26,6 +26,8 @@
 #MAN4=		scprotect.4
 #MANCOMPRESSED=	yes
 
+.include <bsd.port.pre.mk>
+
 .if !exists(${SRC_BASE}/sys/Makefile)
 IGNORE=		requires kernel sources
 .endif
@@ -33,4 +35,4 @@
 post-install:
 	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>


>Release-Note:
>Audit-Trail:
>Unformatted:



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