Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  3 Jun 2009 19:43:54 +0200 (CEST)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        emulation@FreeBSD.org
Subject:   [bsd.port.mk] unified support for LINUX_OSRELEASE dependency
Message-ID:  <20090603174354.4467D14D5825@server.mypc.hu>

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

>Submitter-Id:	current-users
>Originator:	Gabor Kovesdan
>Organization:	
>Confidential:	no 
>Synopsis:	[bsd.port.mk] unified support for LINUX_OSRELEASE dependency
>Severity:	non-critical
>Priority:	medium
>Category:	ports
>Class:		change-request
>Release:	
>Environment:
>Description:
So far we haven't had a unified support for dealing with cases where a specific
version of Linux emulation is necessary.  We have the same for GCC versions or
Perl version but not for Linux emulation, so I thought it would be useful to
add similar knobs to the Ports Collection infrastructure.  Also, the current
IGNORE reasons that ports give, don't seem quite clear to our users, I got a
PR for my Gentoo port because a user couldn't understand the actual problem.
This is another reason I thought of unifying this part.


>How-To-Repeat:
>Fix:

--- linux-osrel.diff begins here ---
Index: ports/Mk/bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.619
diff -u -r1.619 bsd.port.mk
--- ports/Mk/bsd.port.mk	22 May 2009 21:57:33 -0000	1.619
+++ ports/Mk/bsd.port.mk	3 Jun 2009 17:37:10 -0000
@@ -477,6 +477,13 @@
 #				  Set to value <X>, if the port needs emulators/linux_base-<X>.
 #				  If set to "7", a dependency is registered to emulators/linux_base.
 #				  Implies appropriate settings for STRIP and STRIP_CMD.
+#
+# USE_LINUX_OSRELEASE	- Controls the exact, the maximal or the minimal working LINUX_OSRELEASE
+#				  value the port works with.
+#
+# USE_LINUX_OSRELEASE_REASON	- Sets a reason for the dependency, which is used to
+#				  set IGNORE.
+#
 # USE_LINUX_PREFIX
 #				- controls the action of PREFIX (see above). Only use this
 #				  if the port is a linux infrastructure port (e.g. contains libs
@@ -1809,8 +1816,53 @@
 USE_LINUX?=	yes
 .endif
 
-.if defined(USE_LINUX)
+.if defined(USE_LINUX_OSRELEASE)
+.if !defined(LINUX_OSRELEASE)
+LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
+.endif
+
+.if ${LINUX_OSRELEASE}x == "x"
+IGNORE=		Linuxulator is not (kld)loaded
+.endif
+
+linux_major=	${LINUX_OSRELEASE:C|\..*||}
+_linux_minor=	${LINUX_OSRELEASE:S|^${linux_major}||:S|^.||:C|\..*||}
+_linux_micro=	${LINUX_OSRELEASE:S|^${linux_major}||:S|^.${_linux_minor}||:S|^.||:C|\..*||}
+linux_minor=	${_linux_minor:S|^|000|:C|.*(...)|\1|}
+linux_micro=	${_linux_micro:S|^|00|:C|.*(..)|\1|}
+linux_osrel=	${linux_major}${linux_minor}${linux_micro}
+
+want_linux_sign=	${USE_LINUX_OSRELEASE:C|^[0-9.]+||}
+want_linux_ver=		${USE_LINUX_OSRELEASE:S|${want_linux_sign}$||}
+want_linux_major=	${want_linux_ver:C|\..*||}
+_want_linux_minor=	${want_linux_ver:S|^${want_linux_major}||:S|^.||:C|\..*||}
+_want_linux_micro=	${want_linux_ver:S|^${want_linux_major}||:S|^.${_want_linux_minor}||:S|^.||:C|\..*||}
+want_linux_minor=	${_want_linux_minor:S|^|000|:C|.*(...)|\1|}
+want_linux_micro=	${_want_linux_micro:S|^|00|:C|.*(..)|\1|}
+want_linux_osrel=	${want_linux_major}${want_linux_minor}${want_linux_micro}
+
+.if ${want_linux_sign} == "+"
+.if ${want_linux_osrel} > ${linux_osrel}
+USE_LINUX_OSRELEASE_REASON?=      requires Linux emulation ${want_linux_ver} or later, please consult the documentation and set the compat.linux.osrelease sysctl appropriately
+IGNORE= ${USE_LINUX_OSRELEASE_REASON}
+.endif
+.elif ${want_linux_sign} == ""
+.if ${want_linux_osrel} != ${linux_osrel}
+USE_LINUX_OSRELEASE_REASON?=      requires Linux emulation ${want_linux_ver} exactly, please consult the documentation and set the compat.linux.osrelease sysctl appropriately
+IGNORE= ${USE_LINUX_OSRELEASE_REASON}
+.endif
+.elif ${want_linux_sign} == "-"
+.if ${want_linux_osrel} <= ${linux_osrel}
+USE_LINUX_OSRELEASE_REASON?=      requires Linux emulation earlier than ${want_linux_ver}, please consult the documentation and set the compat.linux.osrelease sysctl appropriately
+IGNORE= ${USE_LINUX_OSRELEASE_REASON}
+.endif
+.else # wrong suffix
+IGNORE= improper use of USE_LINUX_OSRELEASE
+.endif
 
+.endif
+
+.if defined(USE_LINUX)
 .  if !defined(LINUX_OSRELEASE)
 LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
 .  endif
Index: ports/devel/uppaal/Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/uppaal/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- ports/devel/uppaal/Makefile	10 Jan 2009 15:27:26 -0000	1.9
+++ ports/devel/uppaal/Makefile	3 Jun 2009 17:37:10 -0000
@@ -15,6 +15,7 @@
 
 USE_ZIP=	yes
 USE_LINUX=	yes
+USE_LINUX_OSRELEASE=	2.6.16+
 USE_JAVA=	yes
 JAVA_VERSION=	1.6+
 JAVA_RUN=	yes
@@ -33,12 +34,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE} == "2.4.2" || ${OSVERSION} < 700000
-IGNORE=requires compat.linux.osrelease of at least 2.6.16 (needs 7.0 or later)
-.endif
-
 .if !exists(${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}) && !defined(PACKAGE_BUILDING)
 ECHO_MSG=/usr/bin/printf
 IGNORE=Please download ${DISTNAME}${EXTRACT_SUFX} into\
Index: ports/emulators/linux_base-f10/Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/linux_base-f10/Makefile,v
retrieving revision 1.53
diff -u -r1.53 Makefile
--- ports/emulators/linux_base-f10/Makefile	1 Jun 2009 17:26:13 -0000	1.53
+++ ports/emulators/linux_base-f10/Makefile	3 Jun 2009 17:37:10 -0000
@@ -108,6 +108,7 @@
 ONLY_FOR_ARCHS=		i386 amd64
 LINUX_RPM_ARCH=		i386
 USE_LINUX_PREFIX=	yes
+USE_LINUX_OSRELEASE=	2.6.16+
 NO_WRKSUBDIR=		yes
 MD5_FILE?=		${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
 PLIST_SUB=		GLIBCVER="2.9"
@@ -123,14 +124,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE}x == "x"
-IGNORE=			linuxulator is not (kld)loaded
-.elif ${LINUX_OSRELEASE} == "2.4.2"
-IGNORE=			compat.linux.osrelease: 2.4.2 is not supported, please use 2.6.16
-.endif
-
 REMOVE_DIRS=		boot dev etc/fonts home initrd root tmp var/log var/run var/tmp \
 			usr/local usr/tmp
 REMOVE_FILES=		bin/df bin/su etc/exports etc/group etc/localtime \
Index: ports/emulators/linux_base-f7/Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/linux_base-f7/Makefile,v
retrieving revision 1.38
diff -u -r1.38 Makefile
--- ports/emulators/linux_base-f7/Makefile	31 Mar 2008 03:54:46 -0000	1.38
+++ ports/emulators/linux_base-f7/Makefile	3 Jun 2009 17:37:10 -0000
@@ -98,6 +98,7 @@
 ONLY_FOR_ARCHS=		i386 amd64
 LINUX_RPM_ARCH=		i386
 USE_LINUX_PREFIX=	yes
+USE_LINUX_OSRELEASE=	2.6.16+
 NO_WRKSUBDIR=		yes
 MD5_FILE?=		${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
 PLIST_SUB=		GLIBCVER="2.6"
@@ -113,14 +114,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE}x == "x"
-IGNORE=			linuxulator is not (kld)loaded
-.elif ${LINUX_OSRELEASE} == "2.4.2"
-IGNORE=			compat.linux.osrelease: 2.4.2 is not supported
-.endif
-
 REMOVE_DIRS=		boot dev home initrd root tmp var/log var/run var/tmp \
 			usr/local usr/tmp
 REMOVE_FILES=		bin/df bin/su etc/exports etc/group etc/localtime \
Index: ports/emulators/linux_base-f8/Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/linux_base-f8/Makefile,v
retrieving revision 1.51
diff -u -r1.51 Makefile
--- ports/emulators/linux_base-f8/Makefile	28 Jan 2009 22:16:43 -0000	1.51
+++ ports/emulators/linux_base-f8/Makefile	3 Jun 2009 17:37:10 -0000
@@ -107,6 +107,7 @@
 ONLY_FOR_ARCHS=		i386 amd64
 LINUX_RPM_ARCH=		i386
 USE_LINUX_PREFIX=	yes
+USE_LINUX_OSRELEASE=	2.6.16+
 NO_WRKSUBDIR=		yes
 MD5_FILE?=		${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
 PLIST_SUB=		GLIBCVER="2.7"
@@ -122,14 +123,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE}x == "x"
-IGNORE=			linuxulator is not (kld)loaded
-.elif ${LINUX_OSRELEASE} == "2.4.2"
-IGNORE=			compat.linux.osrelease: 2.4.2 is not supported
-.endif
-
 REMOVE_DIRS=		boot dev etc/fonts home initrd root tmp var/log var/run var/tmp \
 			usr/local usr/tmp
 REMOVE_FILES=		bin/df bin/su etc/exports etc/group etc/localtime \
Index: ports/emulators/linux_base-f9/Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/linux_base-f9/Makefile,v
retrieving revision 1.53
diff -u -r1.53 Makefile
--- ports/emulators/linux_base-f9/Makefile	6 Apr 2009 13:22:27 -0000	1.53
+++ ports/emulators/linux_base-f9/Makefile	3 Jun 2009 17:37:10 -0000
@@ -112,6 +112,7 @@
 			linux_base-f7-[0-9]* linux_base-f8-[0-9]* linux-glib2-*
 ONLY_FOR_ARCHS=		i386 amd64
 LINUX_RPM_ARCH=		i386
+USE_LINUX_OSRELEASE=	2.6.16+
 USE_LINUX_PREFIX=	yes
 NO_WRKSUBDIR=		yes
 MD5_FILE?=		${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
@@ -128,14 +129,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE}x == "x"
-IGNORE=			linuxulator is not (kld)loaded
-.elif ${LINUX_OSRELEASE} == "2.4.2"
-IGNORE=			compat.linux.osrelease: 2.4.2 is not supported, please use 2.6.16
-.endif
-
 REMOVE_DIRS=		boot dev etc/fonts home initrd root tmp var/log var/run var/tmp \
 			usr/local usr/tmp
 REMOVE_FILES=		bin/df bin/su etc/exports etc/group etc/localtime \
Index: ports/emulators/linux_base-fc6/Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/linux_base-fc6/Makefile,v
retrieving revision 1.34
diff -u -r1.34 Makefile
--- ports/emulators/linux_base-fc6/Makefile	31 Mar 2008 03:54:45 -0000	1.34
+++ ports/emulators/linux_base-fc6/Makefile	3 Jun 2009 17:37:10 -0000
@@ -102,6 +102,7 @@
 ONLY_FOR_ARCHS=		i386 amd64
 LINUX_RPM_ARCH=		i386
 USE_LINUX_PREFIX=	yes
+USE_LINUX_OSRELEASE=	2.6.16+
 NO_WRKSUBDIR=		yes
 MD5_FILE?=		${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
 PLIST_SUB=		GLIBCVER="2.5"
@@ -117,14 +118,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE}x == "x"
-IGNORE=			linuxulator is not (kld)loaded
-.elif ${LINUX_OSRELEASE} == "2.4.2"
-IGNORE=			compat.linux.osrelease: 2.4.2 is not supported
-.endif
-
 REMOVE_DIRS=		boot dev home initrd root tmp var/log var/run var/tmp \
 			usr/local usr/tmp
 REMOVE_FILES=		bin/df bin/su etc/exports etc/group etc/localtime \
Index: ports/emulators/linux_dist-gentoo-stage1/Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/linux_dist-gentoo-stage1/Makefile,v
retrieving revision 1.41
diff -u -r1.41 Makefile
--- ports/emulators/linux_dist-gentoo-stage1/Makefile	24 Nov 2008 13:22:28 -0000	1.41
+++ ports/emulators/linux_dist-gentoo-stage1/Makefile	3 Jun 2009 17:37:10 -0000
@@ -18,6 +18,7 @@
 RESTRICTED=	binaries licensed under GNU GPL without accompanying source
 
 USE_BZIP2=		YES
+USE_LINUX_OSRELEASE=	2.6.16+
 DIST_SUBDIR=		gentoo-linux
 NO_BUILD=		YES
 ONLY_FOR_ARCHS=		amd64 i386
@@ -43,14 +44,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE}x == "x"
-IGNORE=			linuxulator is not (kld)loaded
-.elif ${LINUX_OSRELEASE} == "2.4.2"
-IGNORE=			compat.linux.osrelease: 2.4.2 is not supported
-.endif
-
 do-extract:
 	${MKDIR} ${WRKDIR}
 
Index: ports/emulators/linux_dist-gentoo-stage3/Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/linux_dist-gentoo-stage3/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- ports/emulators/linux_dist-gentoo-stage3/Makefile	24 Nov 2008 13:23:21 -0000	1.12
+++ ports/emulators/linux_dist-gentoo-stage3/Makefile	3 Jun 2009 17:37:10 -0000
@@ -16,6 +16,7 @@
 RESTRICTED=	binaries licensed under GNU GPL without accompanying source
 
 USE_BZIP2=		YES
+USE_LINUX_OSRELEASE=	2.6.16+
 DIST_SUBDIR=		gentoo-linux
 NO_BUILD=		YES
 ONLY_FOR_ARCHS=		i386 amd64
@@ -43,14 +44,6 @@
 
 .include <bsd.port.pre.mk>
 
-LINUX_OSRELEASE!=	${ECHO_CMD} `${SYSCTL} -n compat.linux.osrelease 2>/dev/null`
-
-.if ${LINUX_OSRELEASE}x == "x"
-IGNORE=			linuxulator is not (kld)loaded
-.elif ${LINUX_OSRELEASE} == "2.4.2"
-IGNORE=			compat.linux.osrelease: 2.4.2 is not supported
-.endif
-
 .if (${GENTOO_OPTIMIZED} == "i686")
 MASTER_SITE_SUBDIR=	releases/x86/${PORTVERSION}/stages
 DISTNAME=	stage3-${GENTOO_OPTIMIZED}-${PORTVERSION}
--- linux-osrel.diff ends here ---





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