git: d25b263de3bc - main - lang/pocl: Update to 1.8

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Tue, 09 Nov 2021 17:57:13 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d25b263de3bc36fcc18c42b706fd4cd77ccf097d

commit d25b263de3bc36fcc18c42b706fd4cd77ccf097d
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2021-11-09 17:29:35 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2021-11-09 17:56:40 +0000

    lang/pocl: Update to 1.8
    
    PR:             257449
---
 lang/pocl/Makefile                             | 53 ++++++++++++++++----------
 lang/pocl/distinfo                             |  6 +--
 lang/pocl/files/patch-lib_CL_devices_cpuinfo.c | 40 ++++++++++---------
 lang/pocl/pkg-plist                            | 19 ++++-----
 4 files changed, 67 insertions(+), 51 deletions(-)

diff --git a/lang/pocl/Makefile b/lang/pocl/Makefile
index 724199d3dc88..053e00841a4f 100644
--- a/lang/pocl/Makefile
+++ b/lang/pocl/Makefile
@@ -1,41 +1,54 @@
-PORTNAME=		pocl
-PORTVERSION=		1.6
-PORTREVISION=		1
-DISTVERSIONPREFIX=	v
-CATEGORIES=		lang
+PORTNAME=	pocl
+PORTVERSION=	1.8
+DISTVERSIONPREFIX=v
+CATEGORIES=	lang
 
-MAINTAINER=		ohartmann@walstatt.org
-COMMENT=		POrtable Computing Language (POCL)
+MAINTAINER=	ohartmann@freebsd-de.org
+COMMENT=	POrtable Computing Language (POCL)
 
-LICENSE=		MIT
-LICENSE_FILE=		${WRKSRC}/LICENSE
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
 
-ONLY_FOR_ARCHS=		amd64 i386
+ONLY_FOR_ARCHS=	aarch64 amd64 i386
 ONLY_FOR_ARCHS_REASON=	only tested on x86
 
-BUILD_DEPENDS=	llvm${LLVM_VERSION}>=0:devel/llvm${LLVM_VERSION} \
-			opencl>=2.2:devel/opencl
-LIB_DEPENDS=	libhwloc.so.15:devel/hwloc2 libOpenCL.so:devel/ocl-icd
+BUILD_DEPENDS=	llvm${LLVM_VERSION}>=10:devel/llvm${LLVM_VERSION} \
+		opencl>=2.2:devel/opencl
+LIB_DEPENDS=	libhwloc.so:devel/hwloc2 libOpenCL.so:devel/ocl-icd
 RUN_DEPENDS=	${BUILD_DEPENDS}
 
 USES=		cmake localbase:ldflags ncurses pkgconfig
 USE_GITHUB=	yes
 USE_LDCONFIG=	yes
 
-LLVM_VERSION=	${MESA_LLVM_VER:U11}
+LLVM_VERSION=	${MESA_LLVM_VER:U13}
 CMAKE_ARGS=	-DWITH_LLVM_CONFIG="${LOCALBASE}/llvm${LLVM_VERSION}/bin/llvm-config" \
 		-DPOCL_INSTALL_PKGCONFIG_DIR="${PREFIX}/libdata/pkgconfig" \
-		-DKERNELLIB_HOST_CPU_VARIANTS="distro" \
-		-DSINGLE_LLVM_LIB=ON
+		-DSINGLE_LLVM_LIB=ON \
+		${CMAKE_ARGS_${ARCH}}
+
+CMAKE_ARGS_aarch64=	-DLLC_HOST_CPU=cortex-a53
+CMAKE_ARGS_amd64=	-DKERNELLIB_HOST_CPU_VARIANTS="distro"
 
 PLIST_SUB=	CONFIGURE_TARGET=${CONFIGURE_TARGET:S/amd64/x86_64/}
 
 OPTIONS_DEFINE=	DOCS
 
-DOCS_DESC=		Build documentation (needs sphinx)
-DOCS_CMAKE_OFF=		-DENABLE_DOCS=OFF
-DOCS_CMAKE_ON=		-DENABLE_DOCS=ON
-DOCS_USES=		python:3.6+
+DOCS_DESC=	Build documentation (needs sphinx)
+DOCS_CMAKE_OFF=	-DENABLE_DOCS=OFF
+DOCS_CMAKE_ON=	-DENABLE_DOCS=ON
+DOCS_USES=	python:3.6+
 DOCS_BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}sphinx>=0,1:textproc/py-sphinx@${PY_FLAVOR}
 
+.include <bsd.port.options.mk>
+
+.if ${ARCH} == aarch64
+PLIST_SUB+=     AARCH64=""
+PLIST_SUB+=	X86="@comment "
+.else
+PLIST_SUB+=     AARCH64="@comment "
+PLIST_SUB+=	X86=""
+.endif
+PLIST_SUB+=	CONFIGURE_TARGET=${CONFIGURE_TARGET:S/amd64/x86_64/}
+
 .include <bsd.port.mk>
diff --git a/lang/pocl/distinfo b/lang/pocl/distinfo
index f34173a78d88..5b95d2ff1d4f 100644
--- a/lang/pocl/distinfo
+++ b/lang/pocl/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1608358712
-SHA256 (pocl-pocl-v1.6_GH0.tar.gz) = b0a4c0c056371b6f0db726b88fbb76bbee94948fb2abd4dbc8d958f7c42f766c
-SIZE (pocl-pocl-v1.6_GH0.tar.gz) = 1595212
+TIMESTAMP = 1634367852
+SHA256 (pocl-pocl-v1.8_GH0.tar.gz) = 0f63377ae1826e16e90038fc8e7f65029be4ff6f9b059f6907174b5c0d1f8ab2
+SIZE (pocl-pocl-v1.8_GH0.tar.gz) = 1614545
diff --git a/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c b/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c
index 1b5b861a29d8..ddc39b56f3a0 100644
--- a/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c
+++ b/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c
@@ -1,5 +1,5 @@
---- lib/CL/devices/cpuinfo.c.orig	2020-12-16 13:02:13 UTC
-+++ lib/CL/devices/cpuinfo.c
+--- lib/CL/devices/cpuinfo.c.orig	2021-10-12 16:33:15.000000000 +0200
++++ lib/CL/devices/cpuinfo.c	2021-10-16 09:29:13.414668000 +0200
 @@ -34,6 +34,12 @@
  #include "config.h"
  #include "cpuinfo.h"
@@ -13,7 +13,7 @@
  static const char* cpuinfo = "/proc/cpuinfo";
  #define MAX_CPUINFO_SIZE 64*1024
  //#define DEBUG_POCL_CPUINFO
-@@ -41,9 +47,6 @@ static const char* cpuinfo = "/proc/cpuinfo";
+@@ -41,9 +47,6 @@
  //Linux' cpufrec interface
  static const char* cpufreq_file="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq";
  
@@ -23,7 +23,7 @@
  /* Strings to parse in /proc/cpuinfo. Else branch is for x86, x86_64 */
  #if   defined  __powerpc__
   #define FREQSTRING "clock"
-@@ -156,8 +159,51 @@ pocl_cpuinfo_detect_max_clock_frequency()
+@@ -156,8 +159,51 @@
      } 
    return -1;  
  }
@@ -75,7 +75,7 @@
  /**
   * Detects the number of parallel hardware threads supported by
   * the CPU by parsing the cpuinfo.
-@@ -235,6 +281,19 @@ pocl_cpuinfo_detect_compute_unit_count()
+@@ -235,6 +281,19 @@
      } 
    return -1;  
  }
@@ -95,7 +95,7 @@
  
  #if __arm__ || __aarch64__
  enum
-@@ -302,6 +361,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi
+@@ -302,6 +361,7 @@
     * short_name is in the .data anyways.*/
    device->long_name = device->short_name;
  
@@ -103,7 +103,7 @@
    /* default vendor and vendor_id, in case it cannot be found by other means */
    device->vendor = cpuvendor_default;
    if (device->vendor_id == 0)
-@@ -404,7 +464,26 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi
+@@ -404,7 +464,26 @@
    char *new_name = (char*)malloc (len);
    snprintf (new_name, len, "%s-%s", device->short_name, start);
    device->long_name = new_name;
@@ -130,25 +130,27 @@
    /* If the vendor_id field is still empty, we should get the PCI ID associated
     * with the CPU vendor (if there is one), to be ready for the (currently
     * provisional) OpenCL 3.0 specification that has finally clarified the
-@@ -415,10 +494,20 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi
+@@ -415,13 +494,23 @@
     */
    if (!device->vendor_id)
      {
 -      f = fopen (pci_bus_root_vendor_file, "r");
--      num_read = fscanf (f, "%x", &device->vendor_id);
-+#if 	defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-+			/*
-+			 * Future work: try to extract vendor ID from PCI root bus from MIB
-+			*/
++#if		defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++		/*
++		*	Future work: try to extract vendor ID from PCI root bus from MIB
++		*/
 +#elif	defined(__linux__)
 +      FILE *f = fopen (pci_bus_root_vendor_file, "r");
-+      int num_read = fscanf (f, "%x", &device->vendor_id);
-       fclose (f);
-       /* no error checking, if it failed we just won't have the info */
+       if (f)
+         {
+           /* no error checking, if it failed we just won't have the info */
+           num_read = fscanf (f, "%x", &device->vendor_id);
+           fclose (f);
+         }
 +#else
-+			/*
-+			 *	Other aliens ...
-+			*/
++		/*
++		*		Other aliens ...
++		*/
 +#endif
      }
  }
diff --git a/lang/pocl/pkg-plist b/lang/pocl/pkg-plist
index 7ca227b75991..5eb68042fef3 100644
--- a/lang/pocl/pkg-plist
+++ b/lang/pocl/pkg-plist
@@ -2,7 +2,7 @@ bin/poclcc
 etc/OpenCL/vendors/pocl.icd
 lib/libpocl.so
 lib/libpocl.so.2
-lib/libpocl.so.2.6.0
+lib/libpocl.so.2.8.0
 lib/pocl/libllvmopencl.so
 lib/pocl/libpocl-devices-basic.so
 lib/pocl/libpocl-devices-pthread.so
@@ -21,11 +21,12 @@ libdata/pkgconfig/pocl.pc
 %%DATADIR%%/include/pocl_image_types.h
 %%DATADIR%%/include/pocl_spir.h
 %%DATADIR%%/include/pocl_types.h
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx.bc
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx2.bc
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx512.bc
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx_f16c.bc
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx_fma4.bc
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-sse2.bc
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-sse41.bc
-%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-ssse3.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx2.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx512.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx_f16c.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-avx_fma4.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-sse2.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-sse41.bc
+%%X86%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-ssse3.bc
+%%AARCH64%%%%DATADIR%%/kernel-%%CONFIGURE_TARGET%%-cortex-a53.bc