Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 May 2006 21:39:32 +0200 (CEST)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Erwin Lansing <erwin@FreeBSD.org>
Subject:   ports/98105: [patch] new feature: IA32_BINARY_PORT macro
Message-ID:  <20060529193932.B50D699978B@server.t-hosting.hu>
Resent-Message-ID: <200605291940.k4TJeElY075941@freefall.freebsd.org>

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

>Number:         98105
>Category:       ports
>Synopsis:       [patch] new feature: IA32_BINARY_PORT macro
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 29 19:40:14 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Gabor Kovesdan
>Release:        FreeBSD 5.3-RELEASE-p17 amd64
>Organization:
n/a
>Environment:
>Description:

This patch adds a new macro (IA32_BINARY_PORT), which can be set in port Makefiles.
This feature is an axtension to the existing NOT_FOR_ARCHS / ONLY_FOR_ARCHS
system, especially for i386 binary ports that fetch compiled i386 binaries.
These ports can also be used on amd64/ia64 architectures, but the compatibility
layer must be installed. Currently, we don't have a method to check if it is
installed, so the affected ports can't be handled appropriately.
While here, I added a ${SYSCTL} variable, I think, it enhances the readability.
An update for Porter's Handbook is also attached.

Reviewed by: erwin
More info: http://wikitest.freebsd.org/G%C3%A1borK%C3%B6vesd%C3%A1n

>How-To-Repeat:
>Fix:

--- bsd.port.mk.diff begins here ---
Index: Mk/bsd.port.mk
===================================================================
RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.533
diff -u -r1.533 bsd.port.mk
--- Mk/bsd.port.mk	23 May 2006 21:53:18 -0000	1.533
+++ Mk/bsd.port.mk	29 May 2006 08:44:18 -0000
@@ -1048,6 +1048,7 @@
 SORT?=		/usr/bin/sort
 STRIP_CMD?=	/usr/bin/strip
 SU_CMD?=	/usr/bin/su root -c
+SYSCTL?=	/sbin/sysctl
 TAIL?=		/usr/bin/tail
 TEST?=		test				# Shell builtin
 TR?=		/usr/bin/tr
@@ -1077,6 +1078,25 @@
 # Kludge for pre-3.0 systems
 MACHINE_ARCH?=	i386
 
+# Check the compatibility layer for amd64/ia64
+.if defined(IA32_BINARY_PORT) && ${ARCH} != "i386"
+.if ${ARCH} == "amd64" || ${ARCH} =="ia64"
+.if exists(/usr/lib32)
+HAVE_COMPAT_IA32_LIBS?=  YES
+.endif
+.if !defined(HAVE_COMPAT_IA32_KERN)
+HAVE_COMPAT_IA32_KERN!= if ${SYSCTL} -a compat.ia32.maxvmem >/dev/null 2>&1; then echo YES; fi
+.endif
+.if !defined(HAVE_COMPAT_IA32_KERN)
+IGNORE= you need a kernel with compiled-in IA32 compatibility to use this port
+.elif !defined(HAVE_COMPAT_IA32_LIBS)
+IGNORE= you need the 32-bit libraries installed under /usr/lib32 to use this port
+.endif
+.else
+IGNORE= you have to use i386 (or compatible) platform to use this port
+.endif
+.endif
+
 # Get the operating system type
 .if !defined(OPSYS)
 OPSYS!=	${UNAME} -s
@@ -1089,7 +1109,7 @@
 
 # Get __FreeBSD_version
 .if !defined(OSVERSION)
-OSVERSION!=	/sbin/sysctl -n kern.osreldate
+OSVERSION!=	${SYSCTL} -n kern.osreldate
 .endif
 
 # Get the object format.
@@ -2651,7 +2671,7 @@
 .if defined(GNU_CONFIGURE)
 # Maximum command line length
 .if !defined(CONFIGURE_MAX_CMD_LEN)
-CONFIGURE_MAX_CMD_LEN!=	/sbin/sysctl -n kern.argmax
+CONFIGURE_MAX_CMD_LEN!=	${SYSCTL} -n kern.argmax
 .endif
 CONFIGURE_ARGS+=	--prefix=${PREFIX} ${CONFIGURE_TARGET}
 CONFIGURE_ENV+=		lt_cv_sys_max_cmd_len=${CONFIGURE_MAX_CMD_LEN}
--- bsd.port.mk.diff ends here ---

--- porters-handbook.diff begins here ---
Index: en_US.ISO8859-1/books/porters-handbook/book.sgml
===================================================================
RCS file: /usr/cvs/doc/en_US.ISO8859-1/books/porters-handbook/book.sgml,v
retrieving revision 1.714
diff -u -r1.714 book.sgml
--- en_US.ISO8859-1/books/porters-handbook/book.sgml	25 May 2006 21:43:57 -0000	1.714
+++ en_US.ISO8859-1/books/porters-handbook/book.sgml	27 May 2006 10:36:42 -0000
@@ -9881,6 +9881,13 @@
 	      <makevar>NOT_FOR_ARCHS_REASON_<replaceable>ARCH</replaceable></makevar>.
 	  </listitem>
 
+	  <listitem>
+	    <para>If a port fetches compiled i386 binaries and installs them
+	      <makevar>IA32_BINARY_PORT</makevar> should be set.  If this variable
+	      is set it will be checked if the kernel has compiled-in IA32
+	      compatibility and if one of these two dependencies isn't available
+	      <makevar>IGNORE<makevar> will be set automatically.</para>
+	  </listitem>
 	</itemizedlist>
 
 	</sect2>
--- porters-handbook.diff ends here ---


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



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