Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Sep 2012 14:29:22 -0700 (PDT)
From:      Christian Mangin <christian.mangin@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/171297: [PATCH] devel/tbb: Remove hardcoded dependency on gcc
Message-ID:  <50452132.21d4320a.231d.54d3@mx.google.com>
Resent-Message-ID: <201209032130.q83LU6p6026652@freefall.freebsd.org>

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

>Number:         171297
>Category:       ports
>Synopsis:       [PATCH] devel/tbb: Remove hardcoded dependency on gcc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 03 21:30:05 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Christian Mangin
>Release:        FreeBSD 9.1-RC1 amd64
>Organization:
>Environment:
System: FreeBSD 9.1-RC1 amd64

>Description:
This port has a hardcoded dependency on gcc and will not compile if gcc 
is not present in the base system. It does honor $CXX but not $CC.

In fact, this port requires the presence of a file 'FreeBSD.<compiler>.inc' 
to actually accept using a given C compiler. At this time, only 
'FreeBSD.gcc.inc' is present and therefore gcc is required.

My solution here is to create a copy the file with the correct name for
the requested C compiler and make the appropriate substitutions.

This has been tested to work with base clang, base gcc and lang/gcc.
>How-To-Repeat:
>Fix:
Patch attached:

--- tbb.diff begins here ---
diff -ruN tbb.orig/Makefile tbb/Makefile
--- tbb.orig/Makefile	2012-01-16 04:46:55.000000000 -0500
+++ tbb/Makefile	2012-09-03 16:37:19.393758379 -0400
@@ -23,16 +23,17 @@
 USE_LDCONFIG=	yes
 USE_GMAKE=	yes
 ALL_TARGET=	default
-MAKE_ENV=	CPLUS=${CXX}
 
 WRKSRC=	${WRKDIR}/tbb40_233oss
 
 post-extract:
+	@${CP} ${WRKSRC}/build/FreeBSD.gcc.inc ${WRKSRC}/build/FreeBSD.${CC}.inc
 	@${CP} ${FILESDIR}/version_info_FreeBSD.sh ${WRKSRC}/build/
 
 post-patch:
-	@${REINPLACE_CMD} 's|-lpthread|${PTHREAD_LIBS}|g' \
-		${WRKSRC}/build/FreeBSD.gcc.inc
+	@${REINPLACE_CMD} -e 's|-lpthread|${PTHREAD_LIBS}|g' \
+		-e 's|gcc|${CC}|g' -e 's|g++|${CXX}|g' \
+		${WRKSRC}/build/FreeBSD.${CC}.inc
 
 do-install:
 	cd ${WRKSRC}; \
diff -ruN tbb.orig/files/patch-build-FreeBSD.gcc.inc tbb/files/patch-build-FreeBSD.gcc.inc
--- tbb.orig/files/patch-build-FreeBSD.gcc.inc	2010-09-03 04:52:37.000000000 -0400
+++ tbb/files/patch-build-FreeBSD.gcc.inc	1969-12-31 19:00:00.000000000 -0500
@@ -1,11 +0,0 @@
---- build/FreeBSD.gcc.inc.orig	2010-08-28 00:14:43.080234020 +0200
-+++ build/FreeBSD.gcc.inc	2010-08-28 00:14:53.400821755 +0200
-@@ -37,7 +37,7 @@
- 
- TBB_NOSTRICT = 1
- 
--CPLUS = g++ 
-+#CPLUS = g++ 
- CONLY = gcc
- LIB_LINK_FLAGS = -shared
- LIBS = -lpthread 
diff -ruN tbb.orig/files/patch-build-FreeBSD.inc tbb/files/patch-build-FreeBSD.inc
--- tbb.orig/files/patch-build-FreeBSD.inc	2009-04-29 03:35:00.000000000 -0400
+++ tbb/files/patch-build-FreeBSD.inc	2012-09-03 14:03:42.506757619 -0400
@@ -1,5 +1,23 @@
---- build/FreeBSD.inc.orig	2008-06-07 08:56:22.000000000 +0200
-+++ build/FreeBSD.inc	2008-12-16 09:32:21.710673762 +0100
+--- build/FreeBSD.inc.orig	2012-09-03 13:10:45.423760088 -0400
++++ build/FreeBSD.inc	2012-09-03 13:13:15.765760027 -0400
+@@ -37,14 +37,14 @@
+ endif
+ 
+ ifndef runtime
+-        gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//')
++        gcc_version:=$(shell $(CC) -v 2>&1 | grep ' version' | sed -e 's/^.* version //' | sed -e 's/ .*$$//')
+         os_version:=$(shell uname -r)
+         os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//')
+         export runtime:=cc$(gcc_version)_kernel$(os_kernel_version)
+ endif
+ 
+-native_compiler := gcc
+-export compiler ?= gcc
++native_compiler := $(CC) 
++export compiler ?= $(CC)
+ debugger ?= gdb
+ 
+ CMD=$(SHELL) -c
 @@ -54,7 +54,7 @@
  MD?=mkdir -p
  NUL= /dev/null
diff -ruN tbb.orig/files/version_info_FreeBSD.sh tbb/files/version_info_FreeBSD.sh
--- tbb.orig/files/version_info_FreeBSD.sh	2009-04-29 03:35:00.000000000 -0400
+++ tbb/files/version_info_FreeBSD.sh	2012-09-03 12:45:31.831779484 -0400
@@ -5,7 +5,7 @@
 echo '"TBB:' "BUILD_HOST\t\t"`hostname -s`" ("`uname -p`")"'" ENDL \'
 echo '"TBB:' "BUILD_OS\t\t"`uname -sr`'" ENDL \'
 echo '"TBB:' "BUILD_KERNEL\t"`uname -rv`'" ENDL \'
-echo '"TBB:' "BUILD_GCC\t\t"`g++ -v </dev/null 2>&1 | grep 'gcc.*version'`'" ENDL \'
+echo '"TBB:' "BUILD_GCC\t\t"`${CXX} -v </dev/null 2>&1 | grep ' version'`'" ENDL \'
 [ -z "$COMPILER_VERSION" ] || echo '"TBB:' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \'
 echo '"TBB:' "BUILD_GLIBC\t"`ldconfig -r | grep -oE '/lib/libc.so.[0-9]+' | sort -rn | head -n 1 | sed 's|/lib/libc\.so\.||'`'" ENDL \'
 echo '"TBB:' "BUILD_LD\t\t"`ld -v | grep 'version'`'" ENDL \'
--- tbb.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?50452132.21d4320a.231d.54d3>