Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 2013 00:43:26 GMT
From:      "O. Hartmann" <ohartman@zedat.fu-berlin.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/178982: devel/opencl: Update and patch Makefile
Message-ID:  <201305260043.r4Q0hQBN020905@oldred.FreeBSD.org>
Resent-Message-ID: <201305260050.r4Q0o0ff004567@freefall.freebsd.org>

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

>Number:         178982
>Category:       ports
>Synopsis:       devel/opencl: Update and patch Makefile
>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:   Sun May 26 00:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     O. Hartmann
>Release:        
>Organization:
FU Berlin
>Environment:
>Description:
Since Khronos doesn't provide a tarball, patching the headers according to new ports in spe (devel/pocl, devel/opencl-icd, devel/ocl-icd, devel/ocltools) which will require devel/opencl as a dependency needs to be done in a convenient way.

- remove CONFLICT pocl* for this port since devel/pocl will require devel/opencl
- add a patch provided by POCL patching the Khronos OpenCL 1.2 CL/cl.hpp C++ header file
- install and patch source files (headers) in a WRKSRC folder for further treatment (patching)

This patch can be postponed until port devel/pocl becomes available through the port system.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: files/patch-cl.hpp
===================================================================
--- files/patch-cl.hpp	(revision 0)
+++ files/patch-cl.hpp	(revision 654)
@@ -0,0 +1,72 @@
+--- cl.hpp.orig	2013-05-26 02:27:11.000000000 +0200
++++ cl.hpp	2013-05-26 02:28:08.000000000 +0200
+@@ -212,8 +212,6 @@
+ #if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
+ #include <alloca.h>
+ 
+-#include <emmintrin.h>
+-#include <xmmintrin.h>
+ #endif // linux
+ 
+ #include <cstring>
+@@ -1035,7 +1033,7 @@
+ #endif // !_WIN32
+     }
+ 
+-    inline void fence() { _mm_mfence(); }
++    inline void fence() { __sync_synchronize(); }
+ }; // namespace detail
+ 
+     
+@@ -1114,23 +1112,7 @@
+ template <typename Func>
+ struct GetInfoHelper<Func, VECTOR_CLASS<cl::Device> >
+ {
+-    static cl_int get(Func f, cl_uint name, VECTOR_CLASS<cl::Device>* param)
+-    {
+-        ::size_t required;
+-        cl_int err = f(name, 0, NULL, &required);
+-        if (err != CL_SUCCESS) {
+-            return err;
+-        }
+-
+-        cl_device_id* value = (cl_device_id*) alloca(required);
+-        err = f(name, required, value, NULL);
+-        if (err != CL_SUCCESS) {
+-            return err;
+-        }
+-
+-        param->assign(&value[0], &value[required/sizeof(cl_device_id)]);
+-        return CL_SUCCESS;
+-    }
++    static cl_int get(Func f, cl_uint name, VECTOR_CLASS<cl::Device>* param);
+ };
+ 
+ // Specialized for getInfo<CL_PROGRAM_BINARIES>
+@@ -1990,6 +1972,26 @@
+ #endif // #if defined(CL_VERSION_1_1)
+ };
+ 
++template <typename Func>
++cl_int detail::GetInfoHelper<Func, VECTOR_CLASS<cl::Device> >::
++    get(Func f, cl_uint name, VECTOR_CLASS<cl::Device>* param)
++    {
++        ::size_t required;
++        cl_int err = f(name, 0, NULL, &required);
++        if (err != CL_SUCCESS) {
++            return err;
++        }
++
++        cl_device_id* value = (cl_device_id*) alloca(required);
++        err = f(name, required, value, NULL);
++        if (err != CL_SUCCESS) {
++            return err;
++        }
++
++        param->assign(&value[0], &value[required/sizeof(cl_device_id)]);
++        return CL_SUCCESS;
++    }
++
+ /*! \brief Class interface for cl_platform_id.
+  *
+  *  \note Copies of these objects are inexpensive, since they don't 'own'
Index: Makefile
===================================================================
--- Makefile	(revision 613)
+++ Makefile	(working copy)
@@ -3,30 +3,38 @@
 
 PORTNAME=	opencl
 PORTVERSION=	1.2
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel
 MASTER_SITES=	http://www.khronos.org/registry/cl/api/${PORTVERSION}/
 DISTFILES=	opencl.h cl_platform.h cl.h cl_ext.h cl_dx9_media_sharing.h \
 		cl_d3d10.h cl_d3d11.h  cl_gl.h cl_gl_ext.h cl.hpp
 DIST_SUBDIR=	${PORTNAME}
 EXTRACT_ONLY=
+WRKSRC=		${WRKDIR}/${DIST_SUBDIR}
 
 MAINTAINER=	ohartman@zedat.fu-berlin.de
 COMMENT=	Open Computing Language (OpenCL) specifications V1.2 (header files)
 
-CONFLICTS=	opencl-1.[0-1] pocl*
+CONFLICTS=	opencl-1.[0-1]
 
 NO_BUILD=	yes
 NO_WRKSUBDIR=	yes
 
-PLIST_DIRS=	include/CL
+PLIST_DIRS+=	include/CL
 .for f in ${DISTFILES}
 PLIST_FILES+=include/CL/$f
 .endfor
 
+pre-patch:
+		@${MKDIR} ${WRKSRC}
+.for f in ${DISTFILES}
+		@${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/$f ${WRKSRC}/
+.endfor
+
 do-install:
-		${MKDIR} ${PREFIX}/include/CL
-		${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/*.h  ${PREFIX}/include/CL
-		${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/*.hpp  ${PREFIX}/include/CL
+		@${MKDIR} ${PREFIX}/include/CL
+.for f in ${DISTFILES}
+		@${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/$f  ${PREFIX}/include/CL
+.endfor
 
 .include <bsd.port.mk>


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



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