summaryrefslogtreecommitdiffstats
path: root/source/d
diff options
context:
space:
mode:
Diffstat (limited to 'source/d')
-rwxr-xr-xsource/d/Cython/Cython.SlackBuild37
-rw-r--r--source/d/Cython/Cython.url3
-rw-r--r--source/d/Cython/slack-desc4
-rw-r--r--source/d/FTBFSlog15
-rwxr-xr-xsource/d/autoconf/autoconf.SlackBuild18
-rw-r--r--source/d/autoconf/slack-desc10
-rw-r--r--source/d/automake/automake-1.15-perl-escape-curly-bracket.patch21
-rwxr-xr-xsource/d/automake/automake.SlackBuild28
-rw-r--r--source/d/automake/slack-desc16
-rwxr-xr-xsource/d/binutils/binutils.SlackBuild108
-rw-r--r--source/d/binutils/patches/binutils-2.20.51.0.10-ppc64-pie.patch12
-rw-r--r--source/d/binutils/patches/binutils-2.22.52.0.1-relro-on-by-default.patch58
-rw-r--r--source/d/binutils/patches/binutils-2.23.52.0.1-addr2line-dynsymtab.patch38
-rw-r--r--source/d/binutils/patches/binutils-2.26-Bsymbolic_PIE.patch146
-rw-r--r--source/d/binutils/patches/binutils-2.26-fix-GOT-offset-calculation.patch17
-rw-r--r--source/d/binutils/patches/binutils-2.26-fix-compile-warnings.patch75
-rw-r--r--source/d/binutils/patches/binutils-2.26-formatting.patch297
-rw-r--r--source/d/binutils/patches/binutils-2.26-lto.patch2652
-rw-r--r--source/d/binutils/patches/binutils-rh1312151.patch22
-rw-r--r--source/d/binutils/slack-desc8
-rwxr-xr-xsource/d/bison/bison.SlackBuild24
-rw-r--r--source/d/bison/slack-desc10
-rwxr-xr-xsource/d/ccache/ccache.SlackBuild21
-rw-r--r--source/d/ccache/slack-desc8
-rwxr-xr-xsource/d/clisp/clisp.SlackBuild107
-rw-r--r--source/d/clisp/clisp.c_data.compact_empty_buckets.diff12
-rw-r--r--source/d/clisp/ffcall-arm.patch93
-rw-r--r--source/d/clisp/slack-desc10
-rwxr-xr-xsource/d/clisp/source.download17
-rwxr-xr-xsource/d/cmake/cmake.SlackBuild28
-rwxr-xr-xsource/d/cmake/extract-manpages-from-binary.sh38
-rw-r--r--source/d/cmake/slack-desc6
-rwxr-xr-xsource/d/cscope/cscope.SlackBuild18
-rw-r--r--source/d/cscope/slack-desc8
-rwxr-xr-xsource/d/cvs/cvs.SlackBuild36
-rw-r--r--source/d/cvs/slack-desc10
-rwxr-xr-xsource/d/dev86/dev86.SlackBuild37
-rw-r--r--source/d/dev86/slack-desc2
-rwxr-xr-xsource/d/distcc/distcc.SlackBuild25
-rw-r--r--source/d/distcc/distcc.url1
-rw-r--r--source/d/distcc/slack-desc10
-rw-r--r--source/d/doxygen/doxygen.9468ede.diff52
-rwxr-xr-xsource/d/doxygen/doxygen.SlackBuild72
-rw-r--r--source/d/doxygen/slack-desc10
-rwxr-xr-xsource/d/flex/flex.SlackBuild28
-rw-r--r--source/d/flex/slack-desc10
-rw-r--r--source/d/gcc/antlr-runtime-3.4.jarbin164368 -> 0 bytes
-rw-r--r--source/d/gcc/create_gcj_jvm.sh93
-rw-r--r--source/d/gcc/ecj-4.9.jarbin1619429 -> 0 bytes
-rw-r--r--source/d/gcc/ecj.sh5
-rw-r--r--source/d/gcc/ecj.url1
-rw-r--r--source/d/gcc/fastjar-patches/1000-fastjar-0.97-segfault.patch29
-rw-r--r--source/d/gcc/fastjar-patches/1001-fastjar-0.97-len1.patch16
-rw-r--r--source/d/gcc/fastjar-patches/1002-fastjar-0.97-filename0.patch14
-rw-r--r--source/d/gcc/fastjar-patches/1003-fastjar-CVE-2010-0831.patch102
-rw-r--r--source/d/gcc/fastjar-patches/1004-fastjar-man.patch27
-rw-r--r--source/d/gcc/gcc.66782.diff124
-rw-r--r--source/d/gcc/gcc.69140.diff13
-rwxr-xr-xsource/d/gcc/gcc.SlackBuild558
-rw-r--r--source/d/gcc/slack-desc.gcc8
-rw-r--r--source/d/gcc/slack-desc.gcc-brig19
-rw-r--r--source/d/gcc/slack-desc.gcc-g++8
-rw-r--r--source/d/gcc/slack-desc.gcc-gfortran10
-rw-r--r--source/d/gcc/slack-desc.gcc-gnat12
-rw-r--r--source/d/gcc/slack-desc.gcc-go10
-rw-r--r--source/d/gcc/slack-desc.gcc-java19
-rw-r--r--source/d/gcc/slack-desc.gcc-objc8
-rwxr-xr-xsource/d/gdb/gdb.SlackBuild36
-rw-r--r--source/d/gdb/slack-desc20
-rw-r--r--source/d/git/git-2.17.0.tar.signbin0 -> 566 bytes
-rw-r--r--source/d/git/git-2.9.0.tar.signbin543 -> 0 bytes
-rwxr-xr-xsource/d/git/git.SlackBuild19
-rw-r--r--source/d/git/slack-desc6
-rw-r--r--source/d/gnu-cobol/slack-desc19
-rwxr-xr-xsource/d/gnucobol/gnucobol.SlackBuild (renamed from source/d/gnu-cobol/gnu-cobol.SlackBuild)41
-rw-r--r--source/d/gnucobol/slack-desc19
-rwxr-xr-xsource/d/gperf/gperf.SlackBuild24
-rw-r--r--source/d/gperf/slack-desc8
-rwxr-xr-xsource/d/guile/guile.SlackBuild36
-rw-r--r--source/d/guile/slack-desc10
-rwxr-xr-xsource/d/help2man/help2man.SlackBuild22
-rw-r--r--source/d/help2man/slack-desc8
-rwxr-xr-xsource/d/indent/indent.SlackBuild29
-rw-r--r--source/d/indent/slack-desc8
-rwxr-xr-xsource/d/intltool/intltool.SlackBuild19
-rw-r--r--source/d/intltool/no-guess-builddir.diff31
-rw-r--r--source/d/intltool/slack-desc8
-rw-r--r--source/d/kernel-headers/slack-desc19
-rwxr-xr-xsource/d/libtool/libtool.SlackBuild24
-rw-r--r--source/d/libtool/slack-desc10
-rw-r--r--source/d/llvm/clang.toolchains.i586.triple.diff12
-rw-r--r--source/d/llvm/clang_disable_pgo.patch14
-rwxr-xr-xsource/d/llvm/llvm.SlackBuild73
-rw-r--r--source/d/llvm/llvm.url12
-rw-r--r--source/d/llvm/slack-desc8
-rwxr-xr-xsource/d/m4/m4.SlackBuild23
-rw-r--r--source/d/m4/slack-desc10
-rwxr-xr-xsource/d/make/make.SlackBuild21
-rw-r--r--source/d/make/make.glibc-2.27.glob.diff32
-rw-r--r--source/d/make/make.guile22.diff13
-rw-r--r--source/d/make/slack-desc10
-rwxr-xr-xsource/d/mercurial/mercurial.SlackBuild25
-rw-r--r--source/d/mercurial/mercurial.url1
-rw-r--r--source/d/mercurial/slack-desc16
-rwxr-xr-xsource/d/meson/meson.SlackBuild80
-rw-r--r--source/d/meson/meson.url1
-rw-r--r--source/d/meson/slack-desc19
-rwxr-xr-xsource/d/nasm/nasm.SlackBuild28
-rw-r--r--source/d/nasm/slack-desc8
-rwxr-xr-xsource/d/ninja/ninja.SlackBuild132
-rw-r--r--source/d/ninja/ninja.url1
-rw-r--r--source/d/ninja/slack-desc19
-rw-r--r--source/d/opencl-headers/LICENSE.txt20
-rw-r--r--source/d/opencl-headers/cl.hpp12934
-rw-r--r--source/d/opencl-headers/cl2.hpp9570
-rwxr-xr-xsource/d/opencl-headers/opencl-headers.SlackBuild81
-rw-r--r--source/d/opencl-headers/opencl-headers.url3
-rw-r--r--source/d/opencl-headers/slack-desc19
-rwxr-xr-xsource/d/oprofile/oprofile.SlackBuild27
-rw-r--r--source/d/oprofile/slack-desc12
-rwxr-xr-xsource/d/p2c/p2c.SlackBuild29
-rw-r--r--source/d/p2c/p2c.getline.diff118
-rw-r--r--source/d/p2c/slack-desc12
-rwxr-xr-xsource/d/parallel/parallel.SlackBuild147
-rw-r--r--source/d/parallel/slack-desc19
-rwxr-xr-xsource/d/patchelf/patchelf.SlackBuild144
-rw-r--r--source/d/patchelf/slack-desc19
-rw-r--r--source/d/perl/DBD-mysql.net_buffer_length.diff35
-rw-r--r--source/d/perl/libnet-3.08-Do-not-create-Net-libnet.cfg.patch43
-rwxr-xr-xsource/d/perl/perl.SlackBuild227
-rw-r--r--source/d/perl/slack-desc14
-rwxr-xr-xsource/d/pkg-config/pkg-config.SlackBuild27
-rw-r--r--source/d/pkg-config/slack-desc10
-rwxr-xr-xsource/d/pmake/pmake.SlackBuild29
-rw-r--r--source/d/pmake/slack-desc10
-rw-r--r--source/d/python-pip/pip.url1
-rwxr-xr-xsource/d/python-pip/python-pip.SlackBuild89
-rw-r--r--source/d/python-pip/slack-desc19
-rwxr-xr-xsource/d/python-setuptools/python-setuptools.SlackBuild36
-rw-r--r--source/d/python-setuptools/python-setuptools.url1
-rw-r--r--source/d/python-setuptools/slack-desc6
-rwxr-xr-xsource/d/python/python.SlackBuild26
-rw-r--r--source/d/python/python.x86_64.diff153
-rw-r--r--source/d/python/slack-desc10
-rw-r--r--source/d/python3/README18
-rwxr-xr-xsource/d/python3/python3.SlackBuild166
-rw-r--r--source/d/python3/python3.no-static-library.diff59
-rw-r--r--source/d/python3/python3.readline.set_pre_input_hook.diff12
-rw-r--r--source/d/python3/python3.x86_64.diff164
-rw-r--r--source/d/python3/slack-desc19
-rwxr-xr-xsource/d/rcs/rcs.SlackBuild22
-rw-r--r--source/d/rcs/slack-desc8
-rwxr-xr-xsource/d/re2c/re2c.SlackBuild134
-rw-r--r--source/d/re2c/re2c.url1
-rw-r--r--source/d/re2c/slack-desc19
-rwxr-xr-xsource/d/ruby/ruby.SlackBuild28
-rw-r--r--source/d/ruby/slack-desc10
-rw-r--r--source/d/rust/link_libffi.diff12
-rwxr-xr-xsource/d/rust/rust.SlackBuild294
-rw-r--r--source/d/rust/rust.url23
-rw-r--r--source/d/rust/slack-desc19
-rwxr-xr-xsource/d/scons/scons.SlackBuild18
-rw-r--r--source/d/scons/slack-desc6
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/ChangeLog.slacktrack705
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/FAQ234
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/INSTALL9
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/OVERVIEW595
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_CHECKLIST244
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_URLS38
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/RELEASE_NOTES137
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/SLACKDTXT.examples103
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/SLACKTRACK.examples34
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/TODO65
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/USAGE8
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/WARNINGS38
-rw-r--r--source/d/slacktrack/slacktrack-project/docs/buildscript-examples/README19
-rw-r--r--source/d/slacktrack/slacktrack-project/ln-wrapper.c19
-rwxr-xr-xsource/d/slacktrack/slacktrack-project/man/man.build51
-rw-r--r--source/d/slacktrack/slacktrack-project/man/slackdtxt.pod205
-rw-r--r--source/d/slacktrack/slacktrack-project/man/slacktrack.pod949
-rwxr-xr-xsource/d/slacktrack/slacktrack-project/old_stuff/findy17
-rwxr-xr-xsource/d/slacktrack/slacktrack-project/scripts/slackdtxt312
-rwxr-xr-xsource/d/slacktrack/slacktrack-project/scripts/slacktrack1305
-rw-r--r--source/d/slacktrack/slacktrack-project/slack-desc21
-rwxr-xr-xsource/d/slacktrack/slacktrack-project/slacktrack.SlackBuild107
-rwxr-xr-xsource/d/slacktrack/slacktrack-project/tests/test-exclusion12
-rwxr-xr-xsource/d/slacktrack/slacktrack.SlackBuild27
-rw-r--r--source/d/strace/slack-desc12
-rwxr-xr-xsource/d/strace/strace.SlackBuild19
-rw-r--r--source/d/strace/strace.url2
-rw-r--r--source/d/subversion/slack-desc10
-rwxr-xr-xsource/d/subversion/subversion.SlackBuild44
-rw-r--r--source/d/swig/slack-desc10
-rwxr-xr-xsource/d/swig/swig.SlackBuild17
-rw-r--r--source/d/yasm/slack-desc8
-rwxr-xr-xsource/d/yasm/yasm.SlackBuild24
196 files changed, 31504 insertions, 5146 deletions
diff --git a/source/d/Cython/Cython.SlackBuild b/source/d/Cython/Cython.SlackBuild
index 117160688..c3924c692 100755
--- a/source/d/Cython/Cython.SlackBuild
+++ b/source/d/Cython/Cython.SlackBuild
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for Cython
@@ -22,8 +22,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=Cython
-VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
if [ -z "$ARCH" ]; then
@@ -34,29 +36,22 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
-if [ "$ARCH" = "i586" ]; then
- SLKCFLAGS="-O2 -march=i586 -mtune=i686"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "i686" ]; then
- SLKCFLAGS="-O2 -march=i686 -mtune=i686"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2 -fPIC"
- LIBDIRSUFFIX="64"
-else
- SLKCFLAGS="-O2"
- LIBDIRSUFFIX=""
-fi
-
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PKGNAM-$VERSION
-tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
@@ -66,6 +61,12 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+python3 setup.py install --root=$PKG --prefix=/usr || exit 1
+
+for i in cython cythonize cygdb; do
+ mv $PKG/usr/bin/$i $PKG/usr/bin/${i}3
+done
+
python setup.py install --root=$PKG --prefix=/usr || exit 1
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
diff --git a/source/d/Cython/Cython.url b/source/d/Cython/Cython.url
index caf98d8b4..75c3b5f12 100644
--- a/source/d/Cython/Cython.url
+++ b/source/d/Cython/Cython.url
@@ -1,2 +1 @@
-http://www.cython.org
-http://cython.org/release/Cython-0.23.4.tar.gz
+http://pypi.python.org/pypi/Cython/
diff --git a/source/d/Cython/slack-desc b/source/d/Cython/slack-desc
index 6c8067332..2cf3b852b 100644
--- a/source/d/Cython/slack-desc
+++ b/source/d/Cython/slack-desc
@@ -2,14 +2,14 @@
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
-# You must make exactly 11 lines for the formatting to be correct. It's also
+# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
Cython: Cython (C bindings for Python)
Cython:
Cython: Cython is a language that makes writing C extensions for the Python
-Cython: language as easy as Python itself. Cython is based on the well-known
+Cython: language as easy as Python itself. Cython is based on the well-known
Cython: Pyrex, but supports more cutting edge functionality and optimizations.
Cython:
Cython: Homepage: http://www.cython.org/
diff --git a/source/d/FTBFSlog b/source/d/FTBFSlog
new file mode 100644
index 000000000..3b50d8fda
--- /dev/null
+++ b/source/d/FTBFSlog
@@ -0,0 +1,15 @@
+Thu Mar 29 18:14:22 UTC 2018
+ doxygen: build fixed with update to flex. Thanks to nobodino.
++--------------------------+
+Fri Feb 16 20:45:05 UTC 2018
+ make: use a different patch directly to glob/glob.c as the other patch was
+ producing an unstable binary. Thanks to nobodino.
++--------------------------+
+Sun Feb 11 05:21:56 UTC 2018
+ Fix all packages that fail to build from source:
+ make: patch GLOB test in configure.ac to fix build with glibc-2.27.
++--------------------------+
+Thu Feb 1 21:36:53 UTC 2018
+ Fix all packages that fail to build from source:
+ p2c: change builtin getline() function to p2c_getline()
+ rcs: build with -std=c99
diff --git a/source/d/autoconf/autoconf.SlackBuild b/source/d/autoconf/autoconf.SlackBuild
index d71daa506..c748923bd 100755
--- a/source/d/autoconf/autoconf.SlackBuild
+++ b/source/d/autoconf/autoconf.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2005-2010 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2005-2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=autoconf
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -32,14 +33,21 @@ NUMJOBS=${NUMJOBS:-" -j7 "}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-noarch-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-autoconf
diff --git a/source/d/autoconf/slack-desc b/source/d/autoconf/slack-desc
index 4a3b9a9f4..31f852a50 100644
--- a/source/d/autoconf/slack-desc
+++ b/source/d/autoconf/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,9 +11,9 @@ autoconf:
autoconf: GNU autoconf is an extensible package of m4 macros that produce shell
autoconf: scripts to automatically configure software source code packages.
autoconf: These scripts can adapt the packages to many kinds of UNIX-like
-autoconf: systems without manual user intervention. Autoconf creates a
+autoconf: systems without manual user intervention. Autoconf creates a
autoconf: configuration script for a package from a template file that lists the
autoconf: operating system features that the package can use, in the form of m4
-autoconf: macro calls. You must install the "m4" package to be able to use
+autoconf: macro calls. You must install the "m4" package to be able to use
autoconf: autoconf.
autoconf:
diff --git a/source/d/automake/automake-1.15-perl-escape-curly-bracket.patch b/source/d/automake/automake-1.15-perl-escape-curly-bracket.patch
deleted file mode 100644
index 7c22c4ee0..000000000
--- a/source/d/automake/automake-1.15-perl-escape-curly-bracket.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From: Pavel Raiskup <praiskup@redhat.com>
-Date: Tue, 7 Jul 2015 10:54:24 +0200
-Subject: [PATCH 2/2] bin/automake: escape '{' in regexp pattern
-
-Resolves: rhbz#1239379
-Upstream report:
-http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21001
-
-diff --git a/bin/automake.in b/bin/automake.in
-index eedc8bc..a679d16 100644
---- a/bin/automake.in
-+++ b/bin/automake.in
-@@ -3878,7 +3878,7 @@ sub substitute_ac_subst_variables_worker
- sub substitute_ac_subst_variables
- {
- my ($text) = @_;
-- $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
-+ $text =~ s/\$\{([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
- return $text;
- }
-
diff --git a/source/d/automake/automake.SlackBuild b/source/d/automake/automake.SlackBuild
index 058b3b97d..810eb3152 100755
--- a/source/d/automake/automake.SlackBuild
+++ b/source/d/automake/automake.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2012, 2015 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2012, 2015, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,12 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
-VERSION=${VERSION:-$(echo automake-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+PKGNAM=automake
+VERSION=${VERSION:-$(echo automake-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
NUMJOBS=${NUMJOBS:-" -j7 "}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Note: the package is _built_ as 'noarch'
# Automatically determine architecture for build & packaging:
@@ -35,7 +37,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-noarch-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-automake
@@ -44,11 +53,8 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf automake-$VERSION
-tar xvf $CWD/automake-$VERSION.tar.xz || exit 1
-cd automake-$VERSION
-
-# Patch to work with Perl 5.20:
-zcat $CWD/automake-1.15-perl-escape-curly-bracket.patch.gz | patch -p1 --verbose || exit 1
+tar xvf $CWD/automake-$VERSION.tar.?z || exit 1
+cd automake-$VERSION || exit 1
chown -R root:root .
find . \
@@ -61,7 +67,7 @@ find . \
--prefix=/usr \
--mandir=/usr/man \
--infodir=/usr/info \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
diff --git a/source/d/automake/slack-desc b/source/d/automake/slack-desc
index 0c6cff62a..3ee36e637 100644
--- a/source/d/automake/slack-desc
+++ b/source/d/automake/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
automake: automake (a Makefile generator)
automake:
-automake: This is Automake, a Makefile generator. It was inspired by the 4.4BSD
+automake: This is Automake, a Makefile generator. It was inspired by the 4.4BSD
automake: make and include files, but aims to be portable and to conform to the
-automake: GNU standards for Makefile variables and targets. Automake is a Perl
-automake: script. The input files are called Makefile.am. The output files are
-automake: called Makefile.in; they are intended for use with Autoconf. Automake
-automake: requires certain things to be done in your configure.in. You must
+automake: GNU standards for Makefile variables and targets. Automake is a Perl
+automake: script. The input files are called Makefile.am. The output files are
+automake: called Makefile.in; they are intended for use with Autoconf. Automake
+automake: requires certain things to be done in your configure.in. You must
automake: install the "m4" and "perl" packages to be able to use automake.
automake:
automake:
diff --git a/source/d/binutils/binutils.SlackBuild b/source/d/binutils/binutils.SlackBuild
index 41fa980b2..717c0b6a7 100755
--- a/source/d/binutils/binutils.SlackBuild
+++ b/source/d/binutils/binutils.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2005-2016 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2005-2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,9 +22,10 @@
# Modified 2011 by Eric Hameleers <alien at slackware.com> for ARM port.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=binutils
-VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
@@ -39,6 +40,14 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
# Uncomment this to include the experimental gold linker:
@@ -87,7 +96,6 @@ case "$ARCH" in
*) TARGET=$ARCH-slackware-linux ;;
esac
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-binutils
@@ -96,33 +104,26 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf binutils-$VERSION
-tar xvf $CWD/binutils-$VERSION.tar.xz || \
- tar xvf $CWD/binutils-$VERSION.tar.bz2 || exit 1
-cd binutils-$VERSION
+tar xvf $CWD/binutils-$VERSION.tar.?z || exit 1
+cd binutils-$VERSION || exit 1
# Various upstream patches:
-zcat $CWD/patches/binutils-2.20.51.0.2-libtool-lib64.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.20.51.0.10-ppc64-pie.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.25-version.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.25-set-long-long.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.20.51.0.10-copy-osabi.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.20.51.0.10-sec-merge-emit.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.22.52.0.1-relro-on-by-default.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.23.52.0.1-addr2line-dynsymtab.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.24-ldforcele.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.25.1-cleansweep.patch | patch -p2 --verbose || exit 1
-zcat $CWD/patches/binutils-2.26-formatting.patch | patch -p2 --verbose || exit 1
-zcat $CWD/patches/binutils-2.26-fix-compile-warnings.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.26-Bsymbolic_PIE.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.26-lto.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-rh1312151.patch | patch -p1 --verbose || exit 1
-zcat $CWD/patches/binutils-2.26-fix-GOT-offset-calculation.patch | patch -p1 --verbose || exit 1
+zcat $CWD/patches/binutils-2.20.51.0.2-libtool-lib64.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/patches/binutils-2.25-version.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/patches/binutils-2.25-set-long-long.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/patches/binutils-2.20.51.0.10-copy-osabi.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/patches/binutils-2.20.51.0.10-sec-merge-emit.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/patches/binutils-2.24-ldforcele.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/patches/binutils-2.25.1-cleansweep.patch.gz | patch -p2 --verbose || exit 1
# Export the demangle.h header file:
zcat $CWD/patches/binutils.export.demangle.h.diff.gz | patch -p1 --verbose || exit 1
# Don't check to see if "config.h" was included in the installed headers:
zcat $CWD/patches/binutils.no-config-h-check.diff.gz | patch -p1 --verbose || exit 1
+# Set %version to something halfway meaningful:
+sed -i -e 's/%''{release}/slack15/g' bfd/Makefile{.am,.in}
+
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -143,6 +144,7 @@ CFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--infodir=/usr/info \
--with-docdir=/usr/doc/binutils-$VERSION \
+ --disable-compressed-debug-sections \
--enable-shared \
--enable-multilib \
--enable-64-bit-bfd \
@@ -156,32 +158,54 @@ CFLAGS="$SLKCFLAGS" \
--build=$TARGET \
|| exit 1
+# Use "tooldir=/usr" to avoid internal references to the /usr/${TARGET}/
+# directory. While binutils won't actually use that directory after this,
+# we'll still create it since some people have made local use of it.
+# Note that this will place ldscripts in /usr/lib, even on $ARCH that
+# use LIBDIRSUFFIX=64. According to Ian Lance Taylor, the ldscripts have
+# been built into the linker for quite some time and the ones in the
+# filesystem aren't actually loaded. For the most part they are now
+# documentation and it doesn't matter where they reside.
make clean || exit 1
-make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG || exit 1
-
-# Differentiate between BSD strings and GNU strings
-( cd $PKG/usr/bin ; mv strings strings-GNU )
-( cd $PKG/usr/man/man1 ; mv strings.1 strings-GNU.1 )
-
-# Move ldscripts to /usr/lib${LIBDIRSUFFIX}, and then put symlinks in place
-mv $PKG/usr/${TARGET}/lib/ldscripts $PKG/usr/lib${LIBDIRSUFFIX}
-( cd $PKG/usr/${TARGET}
- ln -s /usr/lib${LIBDIRSUFFIX}/ldscripts lib/ldscripts
- for FILE in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip ; do
- if [ -r "/usr/bin/$FILE" ]; then
- rm -f bin/$FILE
- ln -s /usr/bin/$FILE bin/$FILE
- fi
- done
-)
+make tooldir=/usr $NUMJOBS || make tooldir=/usr || exit 1
+make tooldir=/usr install DESTDIR=$PKG || exit 1
+
+# Using tooldir=/usr also makes the /usr/${TARGET}/lib${LIBDIRSUFFIX}
+# directory obsolete, and the build will no longer install it. But since
+# some people might be making local use of that directory, we'll install
+# it anyway:
+mkdir -p $PKG/usr/${TARGET}/lib${LIBDIRSUFFIX}
+# Same with /usr/${TARGET}/bin:
+mkdir -p $PKG/usr/${TARGET}/bin
+
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
+# Add a symlink since binutils's version of strings used to be called
+# "strings-GNU" on Slackware, and it's possible that people have scripts
+# that use that name:
+( cd $PKG/usr/bin ; ln -sf strings strings-GNU )
+
+## OBSOLETE, since we're using tooldir=/usr. But we'll keep this cruft as a
+## reference until we get the all clear on the tooldir= changes. :-)
+## Move ldscripts to /usr/lib${LIBDIRSUFFIX}, and then put symlinks in place
+#mv $PKG/usr/${TARGET}/lib/ldscripts $PKG/usr/lib${LIBDIRSUFFIX}
+#( cd $PKG/usr/${TARGET}
+# ln -s /usr/lib${LIBDIRSUFFIX}/ldscripts lib/ldscripts
+# for FILE in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip ; do
+# if [ -r "/usr/bin/$FILE" ]; then
+# rm -f bin/$FILE
+# ln -s /usr/bin/$FILE bin/$FILE
+# fi
+# done
+#)
# If the requested default linker is present, make it the default:
# Set the link differently on the system to change the default at runtime.
if [ -r $PKG/usr/bin/$DEFAULT_LD ]; then
( cd $PKG/usr/bin ; rm -f ld ; ln -sf $DEFAULT_LD ld )
fi
-
+
find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
diff --git a/source/d/binutils/patches/binutils-2.20.51.0.10-ppc64-pie.patch b/source/d/binutils/patches/binutils-2.20.51.0.10-ppc64-pie.patch
deleted file mode 100644
index 740c071bd..000000000
--- a/source/d/binutils/patches/binutils-2.20.51.0.10-ppc64-pie.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/bfd/elf64-ppc.c 2012-09-11 12:13:00.637448573 +0100
-+++ b/bfd/elf64-ppc.c 2012-09-11 12:13:17.922449052 +0100
-@@ -13523,6 +13523,9 @@
- {
- BFD_ASSERT (h->elf.dynindx != -1);
- outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
-+ if (h->elf.dynindx == -1
-+ && h->elf.root.type == bfd_link_hash_undefweak)
-+ memset (&outrel, 0, sizeof outrel);
- }
- else
- {
diff --git a/source/d/binutils/patches/binutils-2.22.52.0.1-relro-on-by-default.patch b/source/d/binutils/patches/binutils-2.22.52.0.1-relro-on-by-default.patch
deleted file mode 100644
index ba8318df9..000000000
--- a/source/d/binutils/patches/binutils-2.22.52.0.1-relro-on-by-default.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-diff -upr ../binutils-2.22.52.0.1.orig/ld/testsuite/config/default.exp ld/testsuite/config/default.exp
---- a/ld/testsuite/config/default.exp 2012-03-06 14:00:31.141957656 +0000
-+++ b/ld/testsuite/config/default.exp 2012-03-06 14:09:33.492940503 +0000
-@@ -23,7 +23,7 @@
- #
-
- if ![info exists ld] then {
-- set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
-+ set ld "[findfile $base_dir/ld-new $base_dir/ld-new [transform ld]] -znorelro"
- }
-
- if ![info exists as] then {
-@@ -60,7 +60,7 @@ if {![file isdirectory tmpdir/ld]} then
- catch "exec ln -s ld tmpdir/ld/collect-ld" status
- catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status
- }
--set gcc_B_opt "-B[pwd]/tmpdir/ld/"
-+set gcc_B_opt "-B[pwd]/tmpdir/ld/ -Wl,-z,norelro"
-
- # load the linker path
- set ld_L_opt ""
-@@ -279,7 +279,7 @@
- }
-
- if ![info exists LD] then {
-- set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
-+ set LD "[findfile $base_dir/ld-new ./ld-new [transform ld]] -znorelro"
- }
-
- if ![info exists LDFLAGS] then {
-diff -cpr ../binutils-2.22.52.0.1.orig/ld/testsuite/ld-bootstrap/bootstrap.exp ld/testsuite/ld-bootstrap/bootstrap.exp
---- a/ld/testsuite/ld-bootstrap/bootstrap.exp 2012-03-06 14:00:30.503957676 +0000
-+++ b/ld/testsuite/ld-bootstrap/bootstrap.exp 2012-03-06 15:03:33.949837926 +0000
-@@ -71,7 +71,13 @@
-
- # This test can only be run if we have the ld build directory,
- # since we need the object files.
-- if {$ld != "$objdir/ld-new"} {
-+ set ldexe $ld
-+ set ldparm [string first " " $ld]
-+ if { $ldparm > 0 } then {
-+ set ldparm [expr $ldparm - 1]
-+ set ldexe [string range $ld 0 $ldparm]
-+ }
-+ if {$ldexe != "$objdir/ld-new"} {
- untested $testname
- continue
- }
---- binutils-2.26.orig/ld/emultempl/elf32.em 2016-01-25 10:11:33.990291993 +0000
-+++ binutils-2.26/ld/emultempl/elf32.em 2016-01-25 10:21:40.333016777 +0000
-@@ -104,6 +104,7 @@ gld${EMULATION_NAME}_before_parse (void)
- config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
- config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
- `if test -n "$CALL_NOP_BYTE" ; then echo link_info.call_nop_byte = $CALL_NOP_BYTE; fi`;
-+ link_info.relro = TRUE;
- }
-
- EOF
diff --git a/source/d/binutils/patches/binutils-2.23.52.0.1-addr2line-dynsymtab.patch b/source/d/binutils/patches/binutils-2.23.52.0.1-addr2line-dynsymtab.patch
deleted file mode 100644
index 944f4fdd3..000000000
--- a/source/d/binutils/patches/binutils-2.23.52.0.1-addr2line-dynsymtab.patch
+++ /dev/null
@@ -1,38 +0,0 @@
---- a/bfd/opncls.c 2013-03-14 11:25:30.338306122 +0000
-+++ b/bfd/opncls.c 2013-03-14 12:20:21.686397360 +0000
-@@ -1297,6 +1297,8 @@
- bfd_malloc (strlen (debug_file_directory) + 1
- + (canon_dirlen > dirlen ? canon_dirlen : dirlen)
- + strlen (".debug/")
-+#define FEDORA_LIB_DEBUG_DIR "/usr/lib/debug/"
-+ + strlen (FEDORA_LIB_DEBUG_DIR) + strlen ("usr/")
- + strlen (base)
- + 1);
- if (debugfile == NULL)
-@@ -1332,6 +1334,26 @@
- if (check_func (debugfile, crc32))
- goto found;
-
-+ /* Then try in the global debug dir for Fedora libraries. */
-+ sprintf (debugfile, "%s%s%s", FEDORA_LIB_DEBUG_DIR, dir, base);
-+ if (separate_debug_file_exists (debugfile, crc32))
-+ {
-+ free (base);
-+ free (dir);
-+ free (canon_dir);
-+ return debugfile;
-+ }
-+
-+ /* Then try in the usr subdirectory of the global debug dir for Fedora libraries. */
-+ sprintf (debugfile, "%s/usr%s%s", FEDORA_LIB_DEBUG_DIR, dir, base);
-+ if (separate_debug_file_exists (debugfile, crc32))
-+ {
-+ free (base);
-+ free (dir);
-+ free (canon_dir);
-+ return debugfile;
-+ }
-+
- /* Then try in the global debugfile directory. */
- strcpy (debugfile, debug_file_directory);
- dirlen = strlen (debug_file_directory) - 1;
diff --git a/source/d/binutils/patches/binutils-2.26-Bsymbolic_PIE.patch b/source/d/binutils/patches/binutils-2.26-Bsymbolic_PIE.patch
deleted file mode 100644
index 552056a70..000000000
--- a/source/d/binutils/patches/binutils-2.26-Bsymbolic_PIE.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-diff -upr binutils-2.26.orig/ld/ld.texinfo binutils-2.26/ld/ld.texinfo
---- binutils-2.26.orig/ld/ld.texinfo 2016-02-16 10:45:43.245336561 +0000
-+++ binutils-2.26/ld/ld.texinfo 2016-02-16 10:47:04.670763451 +0000
-@@ -1325,15 +1325,21 @@ libraries.
- When creating a shared library, bind references to global symbols to the
- definition within the shared library, if any. Normally, it is possible
- for a program linked against a shared library to override the definition
--within the shared library. This option is only meaningful on ELF
--platforms which support shared libraries.
-+within the shared library. This option can also be used with the
-+@option{--export-dynamic} option, when creating a position independent
-+executable, to bind references to global symbols to the definition within
-+the executable. This option is only meaningful on ELF platforms which
-+support shared libraries and position independent executables.
-
- @kindex -Bsymbolic-functions
- @item -Bsymbolic-functions
- When creating a shared library, bind references to global function
- symbols to the definition within the shared library, if any.
-+This option can also be used with the @option{--export-dynamic} option,
-+when creating a position independent executable, to bind references
-+to global function symbols to the definition within the executable.
- This option is only meaningful on ELF platforms which support shared
--libraries.
-+libraries and position independent executables.
-
- @kindex --dynamic-list=@var{dynamic-list-file}
- @item --dynamic-list=@var{dynamic-list-file}
-diff -upr binutils-2.26.orig/ld/lexsup.c binutils-2.26/ld/lexsup.c
---- binutils-2.26.orig/ld/lexsup.c 2016-02-16 10:45:43.246336567 +0000
-+++ binutils-2.26/ld/lexsup.c 2016-02-16 10:47:04.671763456 +0000
-@@ -1586,15 +1586,14 @@ parse_args (unsigned argc, char **argv)
- /* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
- --dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
- --dynamic-list FILE. -Bsymbolic and -Bsymbolic-functions are
-- for shared libraries. -Bsymbolic overrides all others and vice
-- versa. */
-+ for PIC outputs. -Bsymbolic overrides all others and vice versa. */
- switch (command_line.symbolic)
- {
- case symbolic_unset:
- break;
- case symbolic:
-- /* -Bsymbolic is for shared library only. */
-- if (bfd_link_dll (&link_info))
-+ /* -Bsymbolic is for PIC output only. */
-+ if (bfd_link_pic (&link_info))
- {
- link_info.symbolic = TRUE;
- /* Should we free the unused memory? */
-@@ -1603,8 +1602,8 @@ parse_args (unsigned argc, char **argv)
- }
- break;
- case symbolic_functions:
-- /* -Bsymbolic-functions is for shared library only. */
-- if (bfd_link_dll (&link_info))
-+ /* -Bsymbolic-functions is for PIC output only. */
-+ if (bfd_link_pic (&link_info))
- command_line.dynamic_list = dynamic_list_data;
- break;
- }
-diff -upr binutils-2.26.orig/ld/testsuite/ld-i386/i386.exp binutils-2.26/ld/testsuite/ld-i386/i386.exp
---- binutils-2.26.orig/ld/testsuite/ld-i386/i386.exp 2016-02-16 10:45:43.319336949 +0000
-+++ binutils-2.26/ld/testsuite/ld-i386/i386.exp 2016-02-16 10:47:04.672763461 +0000
-@@ -319,6 +319,7 @@ run_dump_test "load5a"
- run_dump_test "load5b"
- run_dump_test "load6"
- run_dump_test "pr19175"
-+run_dump_test "pr19615"
-
- if { !([istarget "i?86-*-linux*"]
- || [istarget "i?86-*-gnu*"]
---- /dev/null 2016-02-16 08:27:18.513962320 +0000
-+++ binutils-2.26/ld/testsuite/ld-i386/pr19615.s 2016-02-16 10:56:11.886632341 +0000
-@@ -0,0 +1,13 @@
-+ .text
-+ .globl _start
-+ .type _start, @function
-+_start:
-+ ret
-+
-+ .globl xyzzy /* This symbol should be exported */
-+ .type xyzzy, @function
-+xyzzy:
-+ ret
-+
-+ .section ".xyzzy_ptr","aw",%progbits
-+ .dc.a xyzzy
---- /dev/null 2016-02-16 08:27:18.513962320 +0000
-+++ binutils-2.26/ld/testsuite/ld-i386/pr19615.d 2016-02-16 10:56:11.886632341 +0000
-@@ -0,0 +1,13 @@
-+#as: --32
-+#ld: -pie -Bsymbolic -E -melf_i386
-+#readelf: -r --wide --dyn-syms
-+
-+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
-+ Offset Info Type Sym. Value Symbol's Name
-+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
-+
-+Symbol table '.dynsym' contains [0-9]+ entries:
-+ Num: Value Size Type Bind Vis Ndx Name
-+#...
-+[ ]*[a-f0-9]+: [a-f0-9]+ 0 FUNC GLOBAL DEFAULT [a-f0-9]+ xyzzy
-+#...
---- /dev/null 2016-02-16 08:27:18.513962320 +0000
-+++ binutils-2.26/ld/testsuite/ld-x86-64/pr19615.s 2016-02-16 10:57:55.386174958 +0000
-@@ -0,0 +1,13 @@
-+ .text
-+ .globl _start
-+ .type _start, @function
-+_start:
-+ ret
-+
-+ .globl xyzzy /* This symbol should be exported */
-+ .type xyzzy, @function
-+xyzzy:
-+ ret
-+
-+ .section ".xyzzy_ptr","aw",%progbits
-+ .dc.a xyzzy
---- /dev/null 2016-02-16 08:27:18.513962320 +0000
-+++ binutils-2.26/ld/testsuite/ld-x86-64/pr19615.d 2016-02-16 10:57:55.386174958 +0000
-@@ -0,0 +1,13 @@
-+#as: --64
-+#ld: -pie -Bsymbolic -E -melf_x86_64
-+#readelf: -r --wide --dyn-syms
-+
-+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
-+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
-+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9]+
-+
-+Symbol table '.dynsym' contains [0-9]+ entries:
-+ Num: Value Size Type Bind Vis Ndx Name
-+#...
-+[ ]*[a-f0-9]+: [a-f0-9]+ 0 FUNC GLOBAL DEFAULT [a-f0-9]+ xyzzy
-+#...
---- binutils-2.26.orig/ld/testsuite/ld-x86-64/x86-64.exp 2016-02-16 10:45:43.443337600 +0000
-+++ binutils-2.26/ld/testsuite/ld-x86-64/x86-64.exp 2016-02-16 11:01:02.418162157 +0000
-@@ -353,6 +353,7 @@ run_dump_test "pr19013-x32"
- run_dump_test "pr19013-nacl"
- run_dump_test "pr19162"
- run_dump_test "pr19175"
-+run_dump_test "pr19615"
-
- # Add $PLT_CFLAGS if PLT is expected.
- global PLT_CFLAGS
diff --git a/source/d/binutils/patches/binutils-2.26-fix-GOT-offset-calculation.patch b/source/d/binutils/patches/binutils-2.26-fix-GOT-offset-calculation.patch
deleted file mode 100644
index 99e8b7080..000000000
--- a/source/d/binutils/patches/binutils-2.26-fix-GOT-offset-calculation.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- binutils-2.26.orig/bfd/elf32-i386.c 2016-02-29 15:47:45.172597805 +0000
-+++ binutils-2.26/bfd/elf32-i386.c 2016-02-29 15:48:42.161904973 +0000
-@@ -4016,10 +4016,12 @@ elf_i386_relocate_section (bfd *output_b
-
- /* It is relative to .got.plt section. */
- if (h->got.offset != (bfd_vma) -1)
-- /* Use GOT entry. */
-+ /* Use GOT entry. Mask off the least significant bit in
-+ GOT offset which may be set by R_386_GOT32 processing
-+ below. */
- relocation = (htab->elf.sgot->output_section->vma
- + htab->elf.sgot->output_offset
-- + h->got.offset - offplt);
-+ + (h->got.offset & ~1) - offplt);
- else
- /* Use GOTPLT entry. */
- relocation = (h->plt.offset / plt_entry_size - 1 + 3) * 4;
diff --git a/source/d/binutils/patches/binutils-2.26-fix-compile-warnings.patch b/source/d/binutils/patches/binutils-2.26-fix-compile-warnings.patch
deleted file mode 100644
index 0fa527c7e..000000000
--- a/source/d/binutils/patches/binutils-2.26-fix-compile-warnings.patch
+++ /dev/null
@@ -1,75 +0,0 @@
---- binutils-2.26.orig/gold/dirsearch.cc 2016-02-04 10:31:45.228796199 +0000
-+++ binutils-2.26/gold/dirsearch.cc 2016-02-04 11:33:15.875824355 +0000
-@@ -122,6 +122,7 @@ class Dir_caches
- Cache_hash caches_;
- };
-
-+#if 0
- Dir_caches::~Dir_caches()
- {
- for (Cache_hash::iterator p = this->caches_.begin();
-@@ -129,6 +130,7 @@ Dir_caches::~Dir_caches()
- ++p)
- delete p->second;
- }
-+#endif
-
- void
- Dir_caches::add(const char* dirname)
---- binutils-2.26.orig/gold/arm.cc 2016-02-04 10:31:45.227796193 +0000
-+++ binutils-2.26/gold/arm.cc 2016-02-04 12:02:43.897996168 +0000
-@@ -4493,7 +4493,7 @@ Stub::do_fixed_endian_write(unsigned cha
- // Reloc_stub::Key methods.
-
- // Dump a Key as a string for debugging.
--
-+#if 0
- std::string
- Reloc_stub::Key::name() const
- {
-@@ -4524,7 +4524,7 @@ Reloc_stub::Key::name() const
- return std::string(buffer);
- }
- }
--
-+#endif
- // Reloc_stub methods.
-
- // Determine the type of stub needed, if any, for a relocation of R_TYPE at
---- binutils-2.26.orig/gas/config/tc-arm.c 2016-02-04 10:31:44.893794316 +0000
-+++ binutils-2.26/gas/config/tc-arm.c 2016-02-04 12:41:25.534564806 +0000
-@@ -155,10 +155,12 @@ static const arm_feature_set *object_arc
-
- /* Constants for known architecture features. */
- static const arm_feature_set fpu_default = FPU_DEFAULT;
--static const arm_feature_set fpu_arch_vfp_v1 = FPU_ARCH_VFP_V1;
- static const arm_feature_set fpu_arch_vfp_v2 = FPU_ARCH_VFP_V2;
-+#if 0
-+static const arm_feature_set fpu_arch_vfp_v1 = FPU_ARCH_VFP_V1;
- static const arm_feature_set fpu_arch_vfp_v3 = FPU_ARCH_VFP_V3;
- static const arm_feature_set fpu_arch_neon_v1 = FPU_ARCH_NEON_V1;
-+#endif
- static const arm_feature_set fpu_arch_fpa = FPU_ARCH_FPA;
- static const arm_feature_set fpu_any_hard = FPU_ANY_HARD;
- static const arm_feature_set fpu_arch_maverick = FPU_ARCH_MAVERICK;
-@@ -210,7 +212,9 @@ static const arm_feature_set arm_ext_vir
- static const arm_feature_set arm_ext_pan = ARM_FEATURE_CORE_HIGH (ARM_EXT2_PAN);
-
- static const arm_feature_set arm_arch_any = ARM_ANY;
-+#if 0
- static const arm_feature_set arm_arch_full = ARM_FEATURE (-1, -1, -1);
-+#endif
- static const arm_feature_set arm_arch_t2 = ARM_ARCH_THUMB2;
- static const arm_feature_set arm_arch_none = ARM_ARCH_NONE;
- static const arm_feature_set arm_arch_v6m_only = ARM_ARCH_V6M_ONLY;
-@@ -259,8 +263,10 @@ static const arm_feature_set fpu_crypto_
- ARM_FEATURE_COPROC (FPU_CRYPTO_EXT_ARMV8);
- static const arm_feature_set crc_ext_armv8 =
- ARM_FEATURE_COPROC (CRC_EXT_ARMV8);
-+#if 0
- static const arm_feature_set fpu_neon_ext_v8_1 =
- ARM_FEATURE_COPROC (FPU_NEON_EXT_ARMV8 | FPU_NEON_EXT_RDMA);
-+#endif
-
- static int mfloat_abi_opt = -1;
- /* Record user cpu selection for object attributes. */
diff --git a/source/d/binutils/patches/binutils-2.26-formatting.patch b/source/d/binutils/patches/binutils-2.26-formatting.patch
deleted file mode 100644
index 0eadb0c30..000000000
--- a/source/d/binutils/patches/binutils-2.26-formatting.patch
+++ /dev/null
@@ -1,297 +0,0 @@
---- ../binutils-2.26.orig/bfd/coff-i386.c 2016-02-04 10:31:44.684793142 +0000
-+++ bfd/coff-i386.c 2016-02-04 10:32:02.106891045 +0000
-@@ -139,41 +139,41 @@ coff_i386_reloc (bfd *abfd,
- #define DOIT(x) \
- x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
-
-- if (diff != 0)
-- {
-- reloc_howto_type *howto = reloc_entry->howto;
-- unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-+ if (diff != 0)
-+ {
-+ reloc_howto_type *howto = reloc_entry->howto;
-+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-+
-+ switch (howto->size)
-+ {
-+ case 0:
-+ {
-+ char x = bfd_get_8 (abfd, addr);
-+ DOIT (x);
-+ bfd_put_8 (abfd, x, addr);
-+ }
-+ break;
-
-- switch (howto->size)
-+ case 1:
- {
-- case 0:
-- {
-- char x = bfd_get_8 (abfd, addr);
-- DOIT (x);
-- bfd_put_8 (abfd, x, addr);
-- }
-- break;
--
-- case 1:
-- {
-- short x = bfd_get_16 (abfd, addr);
-- DOIT (x);
-- bfd_put_16 (abfd, (bfd_vma) x, addr);
-- }
-- break;
--
-- case 2:
-- {
-- long x = bfd_get_32 (abfd, addr);
-- DOIT (x);
-- bfd_put_32 (abfd, (bfd_vma) x, addr);
-- }
-- break;
-+ short x = bfd_get_16 (abfd, addr);
-+ DOIT (x);
-+ bfd_put_16 (abfd, (bfd_vma) x, addr);
-+ }
-+ break;
-
-- default:
-- abort ();
-+ case 2:
-+ {
-+ long x = bfd_get_32 (abfd, addr);
-+ DOIT (x);
-+ bfd_put_32 (abfd, (bfd_vma) x, addr);
- }
-- }
-+ break;
-+
-+ default:
-+ abort ();
-+ }
-+ }
-
- /* Now let bfd_perform_relocation finish everything up. */
- return bfd_reloc_continue;
---- ../binutils-2.26.orig/bfd/coff-x86_64.c 2016-02-04 10:31:44.686793153 +0000
-+++ bfd/coff-x86_64.c 2016-02-04 10:33:02.044227862 +0000
-@@ -138,59 +138,61 @@ coff_amd64_reloc (bfd *abfd,
- #define DOIT(x) \
- x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
-
-- if (diff != 0)
-- {
-- reloc_howto_type *howto = reloc_entry->howto;
-- unsigned char *addr = (unsigned char *) data + reloc_entry->address;
--
-- /* FIXME: We do not have an end address for data, so we cannot
-- accurately range check any addresses computed against it.
-- cf: PR binutils/17512: file: 1085-1761-0.004.
-- For now we do the best that we can. */
-- if (addr < (unsigned char *) data || addr > ((unsigned char *) data) + input_section->size)
-+ if (diff != 0)
-+ {
-+ reloc_howto_type *howto = reloc_entry->howto;
-+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-+
-+ /* FIXME: We do not have an end address for data, so we cannot
-+ accurately range check any addresses computed against it.
-+ cf: PR binutils/17512: file: 1085-1761-0.004.
-+ For now we do the best that we can. */
-+ if (addr < (unsigned char *) data
-+ || addr > ((unsigned char *) data) + input_section->size)
-+ {
-+ bfd_set_error (bfd_error_bad_value);
-+ return bfd_reloc_notsupported;
-+ }
-+
-+ switch (howto->size)
-+ {
-+ case 0:
- {
-- bfd_set_error (bfd_error_bad_value);
-- return bfd_reloc_notsupported;
-+ char x = bfd_get_8 (abfd, addr);
-+ DOIT (x);
-+ bfd_put_8 (abfd, x, addr);
- }
-+ break;
-
-- switch (howto->size)
-+ case 1:
- {
-- case 0:
-- {
-- char x = bfd_get_8 (abfd, addr);
-- DOIT (x);
-- bfd_put_8 (abfd, x, addr);
-- }
-- break;
--
-- case 1:
-- {
-- short x = bfd_get_16 (abfd, addr);
-- DOIT (x);
-- bfd_put_16 (abfd, (bfd_vma) x, addr);
-- }
-- break;
--
-- case 2:
-- {
-- long x = bfd_get_32 (abfd, addr);
-- DOIT (x);
-- bfd_put_32 (abfd, (bfd_vma) x, addr);
-- }
-- break;
-- case 4:
-- {
-- long long x = bfd_get_64 (abfd, addr);
-- DOIT (x);
-- bfd_put_64 (abfd, (bfd_vma) x, addr);
-- }
-- break;
--
-- default:
-- bfd_set_error (bfd_error_bad_value);
-- return bfd_reloc_notsupported;
-+ short x = bfd_get_16 (abfd, addr);
-+ DOIT (x);
-+ bfd_put_16 (abfd, (bfd_vma) x, addr);
- }
-- }
-+ break;
-+
-+ case 2:
-+ {
-+ long x = bfd_get_32 (abfd, addr);
-+ DOIT (x);
-+ bfd_put_32 (abfd, (bfd_vma) x, addr);
-+ }
-+ break;
-+
-+ case 4:
-+ {
-+ long long x = bfd_get_64 (abfd, addr);
-+ DOIT (x);
-+ bfd_put_64 (abfd, (bfd_vma) x, addr);
-+ }
-+ break;
-+
-+ default:
-+ bfd_set_error (bfd_error_bad_value);
-+ return bfd_reloc_notsupported;
-+ }
-+ }
-
- /* Now let bfd_perform_relocation finish everything up. */
- return bfd_reloc_continue;
---- ../binutils-2.26.orig/bfd/elf64-s390.c 2016-02-09 15:01:11.983640775 +0000
-+++ bfd/elf64-s390.c 2016-02-09 15:01:37.675779605 +0000
-@@ -337,10 +337,10 @@ elf_s390_reloc_name_lookup (bfd *abfd AT
- && strcasecmp (elf_howto_table[i].name, r_name) == 0)
- return &elf_howto_table[i];
-
-- if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0)
-- return &elf64_s390_vtinherit_howto;
-- if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0)
-- return &elf64_s390_vtentry_howto;
-+ if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0)
-+ return &elf64_s390_vtinherit_howto;
-+ if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0)
-+ return &elf64_s390_vtentry_howto;
-
- return NULL;
- }
---- ../binutils-2.26.orig/bfd/pe-mips.c 2016-02-09 15:01:11.995640840 +0000
-+++ bfd/pe-mips.c 2016-02-09 15:31:21.348317265 +0000
-@@ -95,44 +95,44 @@ coff_mips_reloc (bfd *abfd,
- #define DOIT(x) \
- x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask))
-
-- if (diff != 0)
-- {
-- reloc_howto_type *howto = reloc_entry->howto;
-- unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-+ if (diff != 0)
-+ {
-+ reloc_howto_type *howto = reloc_entry->howto;
-+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-+
-+ switch (howto->size)
-+ {
-+ case 0:
-+ {
-+ char x = bfd_get_8 (abfd, addr);
-+
-+ DOIT (x);
-+ bfd_put_8 (abfd, x, addr);
-+ }
-+ break;
-+
-+ case 1:
-+ {
-+ short x = bfd_get_16 (abfd, addr);
-+
-+ DOIT (x);
-+ bfd_put_16 (abfd, (bfd_vma) x, addr);
-+ }
-+ break;
-
-- switch (howto->size)
-+ case 2:
- {
-- case 0:
-- {
-- char x = bfd_get_8 (abfd, addr);
--
-- DOIT (x);
-- bfd_put_8 (abfd, x, addr);
-- }
-- break;
--
-- case 1:
-- {
-- short x = bfd_get_16 (abfd, addr);
--
-- DOIT (x);
-- bfd_put_16 (abfd, (bfd_vma) x, addr);
-- }
-- break;
--
-- case 2:
-- {
-- long x = bfd_get_32 (abfd, addr);
--
-- DOIT (x);
-- bfd_put_32 (abfd, (bfd_vma) x, addr);
-- }
-- break;
-+ long x = bfd_get_32 (abfd, addr);
-
-- default:
-- abort ();
-+ DOIT (x);
-+ bfd_put_32 (abfd, (bfd_vma) x, addr);
- }
-- }
-+ break;
-+
-+ default:
-+ abort ();
-+ }
-+ }
-
- /* Now let bfd_perform_relocation finish everything up. */
- return bfd_reloc_continue;
---- ../binutils-2.26.orig/gas/config/tc-ia64.c 2016-02-09 15:01:12.086641332 +0000
-+++ gas/config/tc-ia64.c 2016-02-09 15:30:18.562003661 +0000
-@@ -4360,7 +4360,8 @@ dot_prologue (int dummy ATTRIBUTE_UNUSED
- as_warn (_("Pointless use of zero first operand to .prologue"));
- else
- mask = e.X_add_number;
-- n = popcount (mask);
-+
-+ n = popcount (mask);
-
- if (sep == ',')
- parse_operand_and_eval (&e, 0);
diff --git a/source/d/binutils/patches/binutils-2.26-lto.patch b/source/d/binutils/patches/binutils-2.26-lto.patch
deleted file mode 100644
index a20757b65..000000000
--- a/source/d/binutils/patches/binutils-2.26-lto.patch
+++ /dev/null
@@ -1,2652 +0,0 @@
-diff -rup binutils-2.26.orig/bfd/bfd.c binutils-2.26/bfd/bfd.c
---- binutils-2.26.orig/bfd/bfd.c 2016-02-19 09:35:36.231000625 +0000
-+++ binutils-2.26/bfd/bfd.c 2016-02-19 09:35:54.901106498 +0000
-@@ -57,6 +57,14 @@ CODE_FRAGMENT
- . bfd_byte data[1];
- . };
- .
-+.enum bfd_lto_object_type
-+. {
-+. lto_non_object,
-+. lto_non_ir_object,
-+. lto_ir_object,
-+. lto_mixed_object
-+. };
-+.
- .struct bfd
- .{
- . {* The filename the application opened the BFD with. *}
-@@ -227,6 +235,9 @@ CODE_FRAGMENT
- . {* Set if this is a plugin output file. *}
- . unsigned int lto_output : 1;
- .
-+. {* LTO object type. *}
-+. ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2;
-+.
- . {* Set to dummy BFD created when claimed by a compiler plug-in
- . library. *}
- . bfd *plugin_dummy_bfd;
-@@ -252,6 +263,9 @@ CODE_FRAGMENT
- . {* The last section on the section list. *}
- . struct bfd_section *section_last;
- .
-+. {* The object-only section on the section list. *}
-+. struct bfd_section *object_only_section;
-+.
- . {* The number of sections. *}
- . unsigned int section_count;
- .
-@@ -2270,3 +2284,36 @@ bfd_convert_section_contents (bfd *ibfd,
- *ptr_size = size;
- return TRUE;
- }
-+
-+/*
-+FUNCTION
-+ bfd_group_signature
-+
-+SYNOPSIS
-+ asymbol *bfd_group_signature (asection *group, asymbol **isympp);
-+
-+DESCRIPTION
-+ Return a pointer to the symbol used as a signature for GROUP.
-+*/
-+
-+asymbol *
-+bfd_group_signature (asection *group, asymbol **isympp)
-+{
-+ bfd *abfd = group->owner;
-+ Elf_Internal_Shdr *ghdr;
-+
-+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
-+ return NULL;
-+
-+ ghdr = &elf_section_data (group)->this_hdr;
-+ if (ghdr->sh_link < elf_numsections (abfd))
-+ {
-+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-+ Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
-+
-+ if (symhdr->sh_type == SHT_SYMTAB
-+ && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
-+ return isympp[ghdr->sh_info - 1];
-+ }
-+ return NULL;
-+}
-diff -rup binutils-2.26.orig/bfd/bfd-in2.h binutils-2.26/bfd/bfd-in2.h
---- binutils-2.26.orig/bfd/bfd-in2.h 2016-02-19 09:35:36.280000903 +0000
-+++ binutils-2.26/bfd/bfd-in2.h 2016-02-19 09:35:54.900106492 +0000
-@@ -1089,6 +1089,9 @@ struct bfd_section *bfd_create_gnu_debug
- bfd_boolean bfd_fill_in_gnu_debuglink_section
- (bfd *abfd, struct bfd_section *sect, const char *filename);
-
-+const char *bfd_extract_object_only_section
-+ (bfd *abfd);
-+
- /* Extracted from libbfd.c. */
-
- /* Byte swapping macros for user section data. */
-@@ -1654,6 +1657,9 @@ extern asection _bfd_std_section[4];
- #define BFD_COM_SECTION_NAME "*COM*"
- #define BFD_IND_SECTION_NAME "*IND*"
-
-+/* GNU object-only section name. */
-+#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
-+
- /* Pointer to the common section. */
- #define bfd_com_section_ptr (&_bfd_std_section[0])
- /* Pointer to the undefined section. */
-@@ -6511,6 +6517,14 @@ struct bfd_build_id
- bfd_byte data[1];
- };
-
-+enum bfd_lto_object_type
-+ {
-+ lto_non_object,
-+ lto_non_ir_object,
-+ lto_ir_object,
-+ lto_mixed_object
-+ };
-+
- struct bfd
- {
- /* The filename the application opened the BFD with. */
-@@ -6681,6 +6695,9 @@ struct bfd
- /* Set if this is a plugin output file. */
- unsigned int lto_output : 1;
-
-+ /* LTO object type. */
-+ ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2;
-+
- /* Set to dummy BFD created when claimed by a compiler plug-in
- library. */
- bfd *plugin_dummy_bfd;
-@@ -6706,6 +6723,9 @@ struct bfd
- /* The last section on the section list. */
- struct bfd_section *section_last;
-
-+ /* The object-only section on the section list. */
-+ struct bfd_section *object_only_section;
-+
- /* The number of sections. */
- unsigned int section_count;
-
-@@ -7026,6 +7046,8 @@ bfd_boolean bfd_convert_section_contents
- (bfd *ibfd, asection *isec, bfd *obfd,
- bfd_byte **ptr, bfd_size_type *ptr_size);
-
-+asymbol *bfd_group_signature (asection *group, asymbol **isympp);
-+
- /* Extracted from archive.c. */
- symindex bfd_get_next_mapent
- (bfd *abfd, symindex previous, carsym **sym);
-diff -rup binutils-2.26.orig/bfd/elf.c binutils-2.26/bfd/elf.c
---- binutils-2.26.orig/bfd/elf.c 2016-02-19 09:35:36.280000903 +0000
-+++ binutils-2.26/bfd/elf.c 2016-02-19 09:35:54.904106515 +0000
-@@ -2387,6 +2387,7 @@ static const struct bfd_elf_special_sect
- { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { STRING_COMMA_LEN (".gnu.lto_"), -1, SHT_PROGBITS, SHF_EXCLUDE },
- { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
-+ { STRING_COMMA_LEN (".gnu_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE },
- { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
- { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
- { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 },
-diff -rup binutils-2.26.orig/bfd/format.c binutils-2.26/bfd/format.c
---- binutils-2.26.orig/bfd/format.c 2016-02-19 09:35:36.265000818 +0000
-+++ binutils-2.26/bfd/format.c 2016-02-19 09:36:21.420256880 +0000
-@@ -46,6 +46,9 @@ SUBSECTION
- #include "sysdep.h"
- #include "bfd.h"
- #include "libbfd.h"
-+#if BFD_SUPPORTS_PLUGINS
-+#include "plugin.h"
-+#endif
-
- /* IMPORT from targets.c. */
- extern const size_t _bfd_target_vector_entries;
-@@ -179,6 +182,33 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE
- preserve->marker = NULL;
- }
-
-+/* Set lto_type in ABFD. */
-+
-+static void
-+bfd_set_lto_type (bfd *abfd)
-+{
-+ if (abfd->format == bfd_object
-+ && abfd->lto_type == lto_non_object
-+ && (abfd->flags & (DYNAMIC | EXEC_P)) == 0)
-+ {
-+ asection *sec;
-+ enum bfd_lto_object_type type = lto_non_ir_object;
-+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
-+ {
-+ if (strcmp (sec->name, GNU_OBJECT_ONLY_SECTION_NAME) == 0)
-+ {
-+ type = lto_mixed_object;
-+ abfd->object_only_section = sec;
-+ break;
-+ }
-+ else if (type != lto_ir_object
-+ && strncmp (sec->name, ".gnu.lto_", 9) == 0)
-+ type = lto_ir_object;
-+ }
-+ abfd->lto_type = type;
-+ }
-+}
-+
- /*
- FUNCTION
- bfd_check_format_matches
-@@ -221,7 +251,10 @@ bfd_check_format_matches (bfd *abfd, bfd
- }
-
- if (abfd->format != bfd_unknown)
-- return abfd->format == format;
-+ {
-+ bfd_set_lto_type (abfd);
-+ return abfd->format == format;
-+ }
-
- if (matching != NULL || *bfd_associated_vector != NULL)
- {
-@@ -285,6 +318,13 @@ bfd_check_format_matches (bfd *abfd, bfd
- || (*target)->match_priority > best_match)
- continue;
-
-+#if BFD_SUPPORTS_PLUGINS
-+ /* If the plugin target is explicitly specified when a BFD file
-+ is opened, don't check it twice. */
-+ if (bfd_plugin_specified_p () && bfd_plugin_target_p (*target))
-+ continue;
-+#endif
-+
- /* If we already tried a match, the bfd is modified and may
- have sections attached, which will confuse the next
- _bfd_check_format call. */
-@@ -449,6 +489,8 @@ bfd_check_format_matches (bfd *abfd, bfd
- if (matching_vector)
- free (matching_vector);
-
-+ bfd_set_lto_type (abfd);
-+
- /* File position has moved, BTW. */
- return TRUE;
- }
-diff -rup binutils-2.26.orig/bfd/opncls.c binutils-2.26/bfd/opncls.c
---- binutils-2.26.orig/bfd/opncls.c 2016-02-19 09:35:36.281000909 +0000
-+++ binutils-2.26/bfd/opncls.c 2016-02-19 09:35:54.905106520 +0000
-@@ -1717,3 +1717,69 @@ bfd_fill_in_gnu_debuglink_section (bfd *
-
- return TRUE;
- }
-+
-+/*
-+FUNCTION
-+ bfd_extract_object_only_section
-+
-+SYNOPSIS
-+ const char *bfd_extract_object_only_section
-+ (bfd *abfd);
-+
-+DESCRIPTION
-+
-+ Takes a @var{ABFD} and extract the .gnu_object_only section into
-+ a temporary file.
-+
-+RETURNS
-+ The name of the temporary file is returned if all is ok.
-+ Otherwise <<NULL>> is returned and bfd_error is set.
-+*/
-+
-+const char *
-+bfd_extract_object_only_section (bfd *abfd)
-+{
-+ asection *sec = abfd->object_only_section;
-+ const char *name;
-+ FILE *file;
-+ bfd_byte *memhunk = NULL;
-+ size_t off, size;
-+ bfd_error_type err;
-+
-+ /* Get a temporary object-only file. */
-+ name = make_temp_file (".obj-only.o");
-+
-+ /* Open the object-only file. */
-+ file = real_fopen (name, FOPEN_WB);
-+ if (!bfd_get_full_section_contents (abfd, sec, &memhunk))
-+ {
-+ err = bfd_get_error ();
-+
-+loser:
-+ free (memhunk);
-+ fclose (file);
-+ unlink (name);
-+ bfd_set_error (err);
-+ return NULL;
-+ }
-+
-+ off = 0;
-+ size = sec->size;
-+ while (off != size)
-+ {
-+ size_t written, nwrite = size - off;
-+
-+ written = fwrite (memhunk + off, 1, nwrite, file);
-+ if (written < nwrite && ferror (file))
-+ {
-+ err = bfd_error_system_call;
-+ goto loser;
-+ }
-+
-+ off += written;
-+ }
-+
-+ free (memhunk);
-+ fclose (file);
-+ return name;
-+}
-diff -rup binutils-2.26.orig/bfd/plugin.c binutils-2.26/bfd/plugin.c
---- binutils-2.26.orig/bfd/plugin.c 2016-02-19 09:35:36.271000852 +0000
-+++ binutils-2.26/bfd/plugin.c 2016-02-19 09:35:54.905106520 +0000
-@@ -130,6 +130,146 @@ register_claim_file (ld_plugin_claim_fil
- return LDPS_OK;
- }
-
-+static asection bfd_plugin_fake_text_section
-+ = BFD_FAKE_SECTION (bfd_plugin_fake_text_section, 0, 0, ".text", 0);
-+static asection bfd_plugin_fake_common_section
-+ = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, SEC_IS_COMMON, 0,
-+ NULL, 0);
-+
-+/* Get symbols from object only section. */
-+
-+static void
-+bfd_plugin_get_symbols_in_object_only (bfd *abfd)
-+{
-+ struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
-+ const char *object_only_file;
-+ bfd *nbfd;
-+ long storage;
-+ long object_only_nsyms, added_nsyms, i;
-+ asymbol **object_only_syms, **added_syms;
-+
-+ plugin_data->object_only_syms = NULL;
-+ plugin_data->object_only_nsyms = 0;
-+
-+ if (abfd->sections == NULL && abfd->my_archive == NULL)
-+ {
-+ nbfd = bfd_openr (abfd->filename, NULL);
-+ if (nbfd == NULL)
-+ {
-+ (*_bfd_error_handler)
-+ (_("%s: failed to open to extract object only section: %s"),
-+ abfd->filename, bfd_errmsg (bfd_get_error ()));
-+ goto error_return;
-+ }
-+ else if (!bfd_check_format (nbfd, bfd_object))
-+ {
-+ /* There is no object only section if it isn't a bfd_object
-+ file. */
-+error_return:
-+ bfd_close (nbfd);
-+ return;
-+ }
-+ }
-+ else
-+ {
-+ if (!bfd_check_format (abfd, bfd_object))
-+ {
-+ (*_bfd_error_handler)
-+ (_("%B: invalid file to extract object only section: %s"),
-+ abfd, bfd_errmsg (bfd_get_error ()));
-+ return;
-+ }
-+ nbfd = abfd;
-+ }
-+
-+ if (nbfd->lto_type == lto_mixed_object
-+ && (nbfd->flags & HAS_SYMS) != 0)
-+ {
-+ object_only_file = bfd_extract_object_only_section (nbfd);
-+ if (object_only_file == NULL)
-+ (*_bfd_error_handler)
-+ (_("%B: failed to extract object only section: %s"),
-+ abfd, bfd_errmsg (bfd_get_error ()));
-+ }
-+ else
-+ object_only_file = NULL;
-+
-+ /* Close the new bfd we just opened. */
-+ if (nbfd != abfd)
-+ bfd_close (nbfd);
-+
-+ /* Return if there is no object only section or there is no
-+ symbol in object only section. */
-+ if (!object_only_file)
-+ return;
-+
-+ /* Open the file containing object only section. */
-+ nbfd = bfd_openr (object_only_file, NULL);
-+ if (!bfd_check_format (nbfd, bfd_object))
-+ {
-+ (*_bfd_error_handler)
-+ (_("%B: failed to open object only section: %s"),
-+ abfd, bfd_errmsg (bfd_get_error ()));
-+ goto quit;
-+ }
-+
-+ storage = bfd_get_symtab_upper_bound (nbfd);
-+ if (storage <= 0)
-+ {
-+ if (storage < 0)
-+ (*_bfd_error_handler)
-+ (_("%B: failed to get symbol table in object only section: %s"),
-+ abfd, bfd_errmsg (bfd_get_error ()));
-+
-+ goto quit;
-+ }
-+
-+ object_only_syms = (asymbol **) bfd_malloc (storage);
-+ object_only_nsyms = bfd_canonicalize_symtab (nbfd, object_only_syms);
-+
-+ /* FIXME: We waste some spaces if not all symbols are copied. */
-+ added_syms = (asymbol **) bfd_alloc (abfd, storage);
-+ added_nsyms = 0;
-+
-+ /* Copy only global symbols from object only section. */
-+ for (i = 0; i < object_only_nsyms; i++)
-+ {
-+ asection *sec = object_only_syms[i]->section;
-+ flagword flags = object_only_syms[i]->flags;
-+ asymbol *s;
-+
-+ if (bfd_is_com_section (sec))
-+ sec = &bfd_plugin_fake_common_section;
-+ else if (bfd_is_und_section (sec))
-+ ;
-+ else if ((flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
-+ sec = &bfd_plugin_fake_text_section;
-+ else
-+ continue;
-+
-+ s = bfd_alloc (abfd, sizeof (asymbol));
-+ BFD_ASSERT (s);
-+ added_syms[added_nsyms++] = s;
-+
-+ s->section = sec;
-+ s->the_bfd = abfd;
-+ s->name = xstrdup (object_only_syms[i]->name);
-+ s->value = 0;
-+ s->flags = flags;
-+ s->udata.p = NULL;
-+ }
-+
-+ plugin_data->object_only_syms = added_syms;
-+ plugin_data->object_only_nsyms = added_nsyms;
-+
-+ free (object_only_syms);
-+
-+quit:
-+ /* Close and remove the object only section file. */
-+ bfd_close (nbfd);
-+ unlink (object_only_file);
-+}
-+
- static enum ld_plugin_status
- add_symbols (void * handle,
- int nsyms,
-@@ -142,10 +282,13 @@ add_symbols (void * handle,
- plugin_data->nsyms = nsyms;
- plugin_data->syms = syms;
-
-- if (nsyms != 0)
-+ abfd->tdata.plugin_data = plugin_data;
-+
-+ bfd_plugin_get_symbols_in_object_only (abfd);
-+
-+ if ((nsyms + plugin_data->object_only_nsyms) != 0)
- abfd->flags |= HAS_SYMS;
-
-- abfd->tdata.plugin_data = plugin_data;
- return LDPS_OK;
- }
-
-@@ -440,7 +583,8 @@ static long
- bfd_plugin_get_symtab_upper_bound (bfd *abfd)
- {
- struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
-- long nsyms = plugin_data->nsyms;
-+ /* Add symbols from object only section. */
-+ long nsyms = plugin_data->nsyms + plugin_data->object_only_nsyms;
-
- BFD_ASSERT (nsyms >= 0);
-
-@@ -474,12 +618,7 @@ bfd_plugin_canonicalize_symtab (bfd *abf
- struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
- long nsyms = plugin_data->nsyms;
- const struct ld_plugin_symbol *syms = plugin_data->syms;
-- static asection fake_section;
-- static asection fake_common_section;
-- int i;
--
-- fake_section.name = ".text";
-- fake_common_section.flags = SEC_IS_COMMON;
-+ int i, j;
-
- for (i = 0; i < nsyms; i++)
- {
-@@ -492,10 +631,11 @@ bfd_plugin_canonicalize_symtab (bfd *abf
- s->name = syms[i].name;
- s->value = 0;
- s->flags = convert_flags (&syms[i]);
-+ s->udata.p = NULL;
- switch (syms[i].def)
- {
- case LDPK_COMMON:
-- s->section = &fake_common_section;
-+ s->section = &bfd_plugin_fake_common_section;
- break;
- case LDPK_UNDEF:
- case LDPK_WEAKUNDEF:
-@@ -503,15 +643,18 @@ bfd_plugin_canonicalize_symtab (bfd *abf
- break;
- case LDPK_DEF:
- case LDPK_WEAKDEF:
-- s->section = &fake_section;
-+ s->section = &bfd_plugin_fake_text_section;
- break;
- default:
- BFD_ASSERT (0);
- }
--
-- s->udata.p = (void *) &syms[i];
- }
-
-+ /* Copy symbols from object only section. */
-+ nsyms += plugin_data->object_only_nsyms;
-+ for (j = 0; j < plugin_data->object_only_nsyms; j++, i++)
-+ alocation[i] = plugin_data->object_only_syms[j];
-+
- return nsyms;
- }
-
-diff -rup binutils-2.26.orig/bfd/plugin.h binutils-2.26/bfd/plugin.h
---- binutils-2.26.orig/bfd/plugin.h 2016-02-19 09:35:36.271000852 +0000
-+++ binutils-2.26/bfd/plugin.h 2016-02-19 09:35:54.906106526 +0000
-@@ -33,6 +33,8 @@ typedef struct plugin_data_struct
- {
- int nsyms;
- const struct ld_plugin_symbol *syms;
-+ int object_only_nsyms;
-+ asymbol **object_only_syms;
- }
- plugin_data_struct;
-
-diff -rup binutils-2.26.orig/bfd/section.c binutils-2.26/bfd/section.c
---- binutils-2.26.orig/bfd/section.c 2016-02-19 09:35:36.276000881 +0000
-+++ binutils-2.26/bfd/section.c 2016-02-19 09:35:54.906106526 +0000
-@@ -588,6 +588,9 @@ CODE_FRAGMENT
- .#define BFD_COM_SECTION_NAME "*COM*"
- .#define BFD_IND_SECTION_NAME "*IND*"
- .
-+.{* GNU object-only section name. *}
-+.#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
-+.
- .{* Pointer to the common section. *}
- .#define bfd_com_section_ptr (&_bfd_std_section[0])
- .{* Pointer to the undefined section. *}
-diff -rup binutils-2.26.orig/binutils/objcopy.c binutils-2.26/binutils/objcopy.c
---- binutils-2.26.orig/binutils/objcopy.c 2016-02-19 09:35:36.287000943 +0000
-+++ binutils-2.26/binutils/objcopy.c 2016-02-19 09:35:54.908106537 +0000
-@@ -1108,30 +1108,6 @@ is_specified_symbol (const char *name, h
- return htab_find (htab, name) != NULL;
- }
-
--/* Return a pointer to the symbol used as a signature for GROUP. */
--
--static asymbol *
--group_signature (asection *group)
--{
-- bfd *abfd = group->owner;
-- Elf_Internal_Shdr *ghdr;
--
-- if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
-- return NULL;
--
-- ghdr = &elf_section_data (group)->this_hdr;
-- if (ghdr->sh_link < elf_numsections (abfd))
-- {
-- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-- Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
--
-- if (symhdr->sh_type == SHT_SYMTAB
-- && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
-- return isympp[ghdr->sh_info - 1];
-- }
-- return NULL;
--}
--
- /* Return TRUE if the section is a DWO section. */
-
- static bfd_boolean
-@@ -1237,7 +1213,7 @@ is_strip_section (bfd *abfd ATTRIBUTE_UN
- /* PR binutils/3181
- If we are going to strip the group signature symbol, then
- strip the group section too. */
-- gsym = group_signature (sec);
-+ gsym = bfd_group_signature (sec, isympp);
- if (gsym != NULL)
- gname = gsym->name;
- else
-@@ -3091,7 +3067,7 @@ setup_section (bfd *ibfd, sec_ptr isecti
-
- if ((isection->flags & SEC_GROUP) != 0)
- {
-- asymbol *gsym = group_signature (isection);
-+ asymbol *gsym = bfd_group_signature (isection, isympp);
-
- if (gsym != NULL)
- {
-diff -rup binutils-2.26.orig/binutils/readelf.c binutils-2.26/binutils/readelf.c
---- binutils-2.26.orig/binutils/readelf.c 2016-02-19 09:35:36.295000988 +0000
-+++ binutils-2.26/binutils/readelf.c 2016-02-19 09:35:54.911106554 +0000
-@@ -3900,6 +3900,7 @@ get_section_type_name (unsigned int sh_t
- case 0x7ffffffd: return "AUXILIARY";
- case 0x7fffffff: return "FILTER";
- case SHT_GNU_LIBLIST: return "GNU_LIBLIST";
-+ case SHT_GNU_OBJECT_ONLY: return "GNU_OBJECT_ONLY";
-
- default:
- if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
-diff -rup binutils-2.26.orig/gas/testsuite/gas/elf/section9.d binutils-2.26/gas/testsuite/gas/elf/section9.d
---- binutils-2.26.orig/gas/testsuite/gas/elf/section9.d 2016-02-19 09:35:36.397001567 +0000
-+++ binutils-2.26/gas/testsuite/gas/elf/section9.d 2016-02-19 09:35:54.912106560 +0000
-@@ -4,4 +4,5 @@
- #...
- [ ]*\[.*\][ ]+\.gnu\.lto_main[ ]+PROGBITS.*[ ]+E[ ]+.*
- [ ]*\[.*\][ ]+\.gnu\.lto_\.pureconst[ ]+PROGBITS.*[ ]+E[ ]+.*
-+[ ]*\[.*\][ ]+\.gnu_object_only[ ]+GNU_OBJECT_ONLY.*[ ]+E[ ]+.*
- #pass
-diff -rup binutils-2.26.orig/gas/testsuite/gas/elf/section9.s binutils-2.26/gas/testsuite/gas/elf/section9.s
---- binutils-2.26.orig/gas/testsuite/gas/elf/section9.s 2016-02-19 09:35:36.397001567 +0000
-+++ binutils-2.26/gas/testsuite/gas/elf/section9.s 2016-02-19 09:35:54.912106560 +0000
-@@ -2,3 +2,5 @@
- .byte 0,0,0,0
- .section .gnu.lto_.pureconst,"",%progbits
- .byte 0,0,0,0
-+ .section .gnu_object_only
-+ .byte 0,0,0,0
-diff -rup binutils-2.26.orig/include/bfdlink.h binutils-2.26/include/bfdlink.h
---- binutils-2.26.orig/include/bfdlink.h 2016-02-19 09:35:36.672003126 +0000
-+++ binutils-2.26/include/bfdlink.h 2016-02-19 09:35:54.913106566 +0000
-@@ -400,6 +400,12 @@ struct bfd_link_info
- /* TRUE if ok to have multiple definition. */
- unsigned int allow_multiple_definition: 1;
-
-+ /* TRUE if .gnu_object_only section should be created. */
-+ unsigned int emit_gnu_object_only: 1;
-+
-+ /* TRUE if .gnu_object_only section is being created. */
-+ unsigned int emitting_gnu_object_only: 1;
-+
- /* TRUE if ok to have version with no definition. */
- unsigned int allow_undefined_version: 1;
-
-diff -rup binutils-2.26.orig/include/elf/common.h binutils-2.26/include/elf/common.h
---- binutils-2.26.orig/include/elf/common.h 2016-02-19 09:35:36.675003143 +0000
-+++ binutils-2.26/include/elf/common.h 2016-02-19 09:35:54.913106566 +0000
-@@ -478,6 +478,7 @@
- #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */
- #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
- #define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
-+#define SHT_GNU_OBJECT_ONLY 0x6ffffff8 /* Object only */
-
- /* The next three section types are defined by Solaris, and are named
- SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU*
-diff -rup binutils-2.26.orig/ld/emultempl/aarch64elf.em binutils-2.26/ld/emultempl/aarch64elf.em
---- binutils-2.26.orig/ld/emultempl/aarch64elf.em 2016-02-19 09:35:36.698003274 +0000
-+++ binutils-2.26/ld/emultempl/aarch64elf.em 2016-02-19 09:35:54.914106571 +0000
-@@ -271,7 +271,7 @@ gld${EMULATION_NAME}_after_allocation (v
- }
-
- static void
--gld${EMULATION_NAME}_finish (void)
-+aarch64_finish (void)
- {
- if (!bfd_link_relocatable (&link_info))
- {
-@@ -283,7 +283,7 @@ gld${EMULATION_NAME}_finish (void)
- }
- }
-
-- finish_default ();
-+ gld${EMULATION_NAME}_finish ();
- }
-
- /* This is a convenient point to tell BFD about target specific flags.
-@@ -435,4 +435,4 @@ LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=
- LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
-
- # Call the extra arm-elf function
--LDEMUL_FINISH=gld${EMULATION_NAME}_finish
-+LDEMUL_FINISH=aarch64_finish
-diff -rup binutils-2.26.orig/ld/emultempl/alphaelf.em binutils-2.26/ld/emultempl/alphaelf.em
---- binutils-2.26.orig/ld/emultempl/alphaelf.em 2016-02-19 09:35:36.698003274 +0000
-+++ binutils-2.26/ld/emultempl/alphaelf.em 2016-02-19 09:35:54.914106571 +0000
-@@ -104,7 +104,7 @@ alpha_finish (void)
- if (limit_32bit)
- elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
-
-- finish_default ();
-+ gld${EMULATION_NAME}_finish ();
- }
- EOF
-
-diff -rup binutils-2.26.orig/ld/emultempl/armelf.em binutils-2.26/ld/emultempl/armelf.em
---- binutils-2.26.orig/ld/emultempl/armelf.em 2016-02-19 09:35:36.698003274 +0000
-+++ binutils-2.26/ld/emultempl/armelf.em 2016-02-19 09:35:54.914106571 +0000
-@@ -377,7 +377,7 @@ gld${EMULATION_NAME}_after_allocation (v
- }
-
- static void
--gld${EMULATION_NAME}_finish (void)
-+arm_finish (void)
- {
- struct bfd_link_hash_entry * h;
-
-@@ -404,7 +404,7 @@ gld${EMULATION_NAME}_finish (void)
- }
- }
-
-- finish_default ();
-+ gld${EMULATION_NAME}_finish ();
-
- if (thumb_entry_symbol)
- {
-@@ -730,4 +730,4 @@ LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=
- LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
-
- # Call the extra arm-elf function
--LDEMUL_FINISH=gld${EMULATION_NAME}_finish
-+LDEMUL_FINISH=arm_finish
-diff -rup binutils-2.26.orig/ld/emultempl/avrelf.em binutils-2.26/ld/emultempl/avrelf.em
---- binutils-2.26.orig/ld/emultempl/avrelf.em 2016-02-19 09:35:36.698003274 +0000
-+++ binutils-2.26/ld/emultempl/avrelf.em 2016-02-19 09:35:54.915106577 +0000
-@@ -209,7 +209,7 @@ avr_finish (void)
- else
- elf_elfheader (abfd)->e_flags &= ~EF_AVR_LINKRELAX_PREPARED;
-
-- finish_default ();
-+ gld${EMULATION_NAME}_finish ();
- }
- EOF
-
-diff -rup binutils-2.26.orig/ld/emultempl/elf32.em binutils-2.26/ld/emultempl/elf32.em
---- binutils-2.26.orig/ld/emultempl/elf32.em 2016-02-19 09:35:36.700003285 +0000
-+++ binutils-2.26/ld/emultempl/elf32.em 2016-02-19 09:35:54.915106577 +0000
-@@ -66,6 +66,7 @@ static void gld${EMULATION_NAME}_before_
- static void gld${EMULATION_NAME}_after_allocation (void);
- static lang_output_section_statement_type *gld${EMULATION_NAME}_place_orphan
- (asection *, const char *, int);
-+static void gld${EMULATION_NAME}_finish (void);
- EOF
-
- if [ "x${USE_LIBPATH}" = xyes ] ; then
-@@ -1795,6 +1796,8 @@ output_rel_find (asection *sec, int isdy
- return last;
- }
-
-+static int orphan_init_done = 0;
-+
- /* Place an orphan section. We use this to put random SHF_ALLOC
- sections in the right segment. */
-
-@@ -1803,7 +1806,7 @@ gld${EMULATION_NAME}_place_orphan (asect
- const char *secname,
- int constraint)
- {
-- static struct orphan_save hold[] =
-+ static struct orphan_save orig_hold[] =
- {
- { ".text",
- SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
-@@ -1833,6 +1836,7 @@ gld${EMULATION_NAME}_place_orphan (asect
- SEC_HAS_CONTENTS,
- 0, 0, 0, 0 },
- };
-+ static struct orphan_save hold[ARRAY_SIZE (orig_hold)];
- enum orphan_save_index
- {
- orphan_text = 0,
-@@ -1845,7 +1849,6 @@ gld${EMULATION_NAME}_place_orphan (asect
- orphan_sdata,
- orphan_nonalloc
- };
-- static int orphan_init_done = 0;
- struct orphan_save *place;
- lang_output_section_statement_type *after;
- lang_output_section_statement_type *os;
-@@ -1924,15 +1927,22 @@ gld${EMULATION_NAME}_place_orphan (asect
-
- if (!orphan_init_done)
- {
-- struct orphan_save *ho;
-+ struct orphan_save *ho, *horig;
-
- for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
-+ for (ho = hold, horig = orig_hold;
-+ ho < hold + ARRAY_SIZE (hold);
-+ ++ho, ++horig)
-+ {
-+ *ho = *horig;
-+ if (ho->name != NULL)
- if (ho->name != NULL)
- {
- ho->os = lang_output_section_find (ho->name);
- if (ho->os != NULL && ho->os->flags == 0)
- ho->os->flags = ho->flags;
- }
-+ }
- orphan_init_done = 1;
- }
-
-@@ -2017,6 +2027,27 @@ gld${EMULATION_NAME}_place_orphan (asect
- EOF
- fi
-
-+fragment <<EOF
-+
-+/* Final emulation specific call. */
-+
-+static void
-+gld${EMULATION_NAME}_finish (void)
-+{
-+EOF
-+if test x"$LDEMUL_PLACE_ORPHAN" != xgld"$EMULATION_NAME"_place_orphan; then
-+fragment <<EOF
-+ /* Support the object-only output. */
-+ if (link_info.emit_gnu_object_only)
-+ orphan_init_done = 0;
-+
-+EOF
-+fi
-+fragment <<EOF
-+ finish_default ();
-+}
-+EOF
-+
- if test x"$LDEMUL_AFTER_ALLOCATION" != xgld"$EMULATION_NAME"_after_allocation; then
- fragment <<EOF
-
-@@ -2503,7 +2534,7 @@ struct ld_emulation_xfer_struct ld_${EMU
- ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
- "${EMULATION_NAME}",
- "${OUTPUT_FORMAT}",
-- ${LDEMUL_FINISH-finish_default},
-+ ${LDEMUL_FINISH-gld${EMULATION_NAME}_finish},
- ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
- ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-gld${EMULATION_NAME}_open_dynamic_archive},
- ${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan},
-diff -rup binutils-2.26.orig/ld/emultempl/ppc32elf.em binutils-2.26/ld/emultempl/ppc32elf.em
---- binutils-2.26.orig/ld/emultempl/ppc32elf.em 2016-02-19 09:35:36.699003279 +0000
-+++ binutils-2.26/ld/emultempl/ppc32elf.em 2016-02-19 09:35:54.916106583 +0000
-@@ -215,7 +215,7 @@ ppc_finish (void)
- {
- if (params.ppc476_workaround)
- lang_for_each_statement (no_zero_padding);
-- finish_default ();
-+ gld${EMULATION_NAME}_finish ();
- }
-
- EOF
-diff -rup binutils-2.26.orig/ld/emultempl/ppc64elf.em binutils-2.26/ld/emultempl/ppc64elf.em
---- binutils-2.26.orig/ld/emultempl/ppc64elf.em 2016-02-19 09:35:36.699003279 +0000
-+++ binutils-2.26/ld/emultempl/ppc64elf.em 2016-02-19 09:35:54.916106583 +0000
-@@ -562,7 +562,7 @@ gld${EMULATION_NAME}_after_allocation (v
- /* Final emulation specific call. */
-
- static void
--gld${EMULATION_NAME}_finish (void)
-+ppc_finish (void)
- {
- char *msg = NULL;
- char *line, *endline;
-@@ -594,7 +594,7 @@ gld${EMULATION_NAME}_finish (void)
- free (msg);
-
- ppc64_elf_restore_symbols (&link_info);
-- finish_default ();
-+ gld${EMULATION_NAME}_finish ();
- }
-
-
-@@ -928,4 +928,4 @@ LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=
- LDEMUL_AFTER_OPEN=ppc_after_open
- LDEMUL_BEFORE_ALLOCATION=ppc_before_allocation
- LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation
--LDEMUL_FINISH=gld${EMULATION_NAME}_finish
-+LDEMUL_FINISH=ppc_finish
-diff -rup binutils-2.26.orig/ld/emultempl/spuelf.em binutils-2.26/ld/emultempl/spuelf.em
---- binutils-2.26.orig/ld/emultempl/spuelf.em 2016-02-19 09:35:36.699003279 +0000
-+++ binutils-2.26/ld/emultempl/spuelf.em 2016-02-19 09:35:54.916106583 +0000
-@@ -416,7 +416,7 @@ spu_elf_relink (void)
- /* Final emulation specific call. */
-
- static void
--gld${EMULATION_NAME}_finish (void)
-+spu_finish (void)
- {
- if (is_spu_target ())
- {
-@@ -432,7 +432,7 @@ gld${EMULATION_NAME}_finish (void)
- einfo ("%P: --auto-overlay ignored with zero local store range\n");
- }
-
-- finish_default ();
-+ gld${EMULATION_NAME}_finish ();
- }
-
- static char *
-@@ -832,5 +832,5 @@ PARSE_AND_LIST_ARGS_CASES='
-
- LDEMUL_AFTER_OPEN=spu_after_open
- LDEMUL_BEFORE_ALLOCATION=spu_before_allocation
--LDEMUL_FINISH=gld${EMULATION_NAME}_finish
-+LDEMUL_FINISH=spu_finish
- LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
-diff -rup binutils-2.26.orig/ld/ldexp.c binutils-2.26/ld/ldexp.c
---- binutils-2.26.orig/ld/ldexp.c 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldexp.c 2016-02-19 09:35:54.917106588 +0000
-@@ -1616,14 +1616,15 @@ align_n (bfd_vma value, bfd_vma align)
- }
-
- void
--ldexp_init (void)
-+ldexp_init (bfd_boolean object_only)
- {
- /* The value "13" is ad-hoc, somewhat related to the expected number of
- assignments in a linker script. */
-- if (!bfd_hash_table_init_n (&definedness_table,
-- definedness_newfunc,
-- sizeof (struct definedness_hash_entry),
-- 13))
-+ if (!object_only
-+ && !bfd_hash_table_init_n (&definedness_table,
-+ definedness_newfunc,
-+ sizeof (struct definedness_hash_entry),
-+ 13))
- einfo (_("%P%F: can not create hash table: %E\n"));
- }
-
-@@ -1658,7 +1659,8 @@ ldexp_finalize_syms (void)
- }
-
- void
--ldexp_finish (void)
-+ldexp_finish (bfd_boolean object_only)
- {
-- bfd_hash_table_free (&definedness_table);
-+ if (!object_only)
-+ bfd_hash_table_free (&definedness_table);
- }
-diff -rup binutils-2.26.orig/ld/ldexp.h binutils-2.26/ld/ldexp.h
---- binutils-2.26.orig/ld/ldexp.h 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldexp.h 2016-02-19 09:35:54.917106588 +0000
-@@ -229,8 +229,8 @@ fill_type *exp_get_fill
- (etree_type *, fill_type *, char *);
- bfd_vma exp_get_abs_int
- (etree_type *, int, char *);
--void ldexp_init (void);
-+void ldexp_init (bfd_boolean);
- void ldexp_finalize_syms (void);
--void ldexp_finish (void);
-+void ldexp_finish (bfd_boolean);
-
- #endif
-diff -rup binutils-2.26.orig/ld/ldfile.c binutils-2.26/ld/ldfile.c
---- binutils-2.26.orig/ld/ldfile.c 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldfile.c 2016-02-19 09:35:54.918106594 +0000
-@@ -313,7 +313,9 @@ success:
- && !no_more_claiming
- && bfd_check_format (entry->the_bfd, bfd_object))
- plugin_maybe_claim (entry);
-+ else
- #endif /* ENABLE_PLUGINS */
-+ cmdline_check_object_only_section (entry->the_bfd, FALSE);
-
- /* It opened OK, the format checked out, and the plugins have had
- their chance to claim it, so this is success. */
-diff -rup binutils-2.26.orig/ld/ldlang.c binutils-2.26/ld/ldlang.c
---- binutils-2.26.orig/ld/ldlang.c 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldlang.c 2016-02-19 09:35:54.921106611 +0000
-@@ -36,6 +36,7 @@
- #include "ldctor.h"
- #include "ldfile.h"
- #include "ldemul.h"
-+#include "ldwrite.h"
- #include "fnmatch.h"
- #include "demangle.h"
- #include "hashtab.h"
-@@ -45,6 +46,9 @@
- #include "plugin.h"
- #endif /* ENABLE_PLUGINS */
-
-+/* FIXME: Put it here to avoid NAME conflict from ldgram.h. */
-+#include "elf-bfd.h"
-+
- #ifndef offsetof
- #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
- #endif
-@@ -68,6 +72,9 @@ static lang_statement_list_type *stat_sa
- static lang_statement_list_type **stat_save_ptr = &stat_save[0];
- static struct unique_sections *unique_section_list;
- static struct asneeded_minfo *asneeded_list_head;
-+static cmdline_list_type cmdline_object_only_file_list;
-+static cmdline_list_type cmdline_object_only_archive_list;
-+static cmdline_list_type cmdline_temp_object_only_list;
-
- /* Forward declarations. */
- static void exp_init_os (etree_type *);
-@@ -86,6 +93,10 @@ static void lang_do_version_exports_sect
- static void lang_finalize_version_expr_head
- (struct bfd_elf_version_expr_head *);
- static void lang_do_memory_regions (void);
-+static void cmdline_lists_init (void);
-+static void cmdline_get_object_only_input_files (void);
-+static void print_cmdline_list (cmdline_union_type *);
-+static bfd_boolean cmdline_on_object_only_archive_list_p (bfd *);
-
- /* Exported variables. */
- const char *output_target;
-@@ -1219,14 +1230,17 @@ output_section_statement_table_free (voi
- /* Build enough state so that the parser can build its tree. */
-
- void
--lang_init (void)
-+lang_init (bfd_boolean object_only)
- {
-- obstack_begin (&stat_obstack, 1000);
-+ if (!object_only)
-+ obstack_begin (&stat_obstack, 1000);
-
- stat_ptr = &statement_list;
-
- output_section_statement_table_init ();
-
-+ cmdline_lists_init ();
-+
- lang_list_init (stat_ptr);
-
- lang_list_init (&input_file_chain);
-@@ -2843,6 +2857,12 @@ load_symbols (lang_input_statement_type
- loaded = FALSE;
- }
-
-+ if (link_info.emitting_gnu_object_only)
-+ {
-+ if (!cmdline_on_object_only_archive_list_p (member))
-+ continue;
-+ }
-+
- subsbfd = member;
- if (!(*link_info.callbacks
- ->add_archive_element) (&link_info, member,
-@@ -6780,7 +6800,38 @@ lang_process (void)
- open_input_bfds (statement_list.head, OPEN_BFD_RESCAN);
- }
- }
-+ else
- #endif /* ENABLE_PLUGINS */
-+ if (bfd_link_relocatable (&link_info))
-+ {
-+ /* Check if .gnu_object_only section should be created. */
-+ bfd *p;
-+ int object_type;
-+
-+ object_type = 0;
-+ for (p = link_info.input_bfds; p != (bfd *) NULL; p = p->link.next)
-+ {
-+ object_type |= 1 << p->lto_type;
-+ if ((object_type & (1 << lto_mixed_object)) != 0
-+ || ((object_type
-+ & (1 << lto_non_ir_object
-+ | 1 << lto_ir_object))
-+ == (1 << lto_non_ir_object | 1 << lto_ir_object)))
-+ {
-+ link_info.emit_gnu_object_only = TRUE;
-+ break;
-+ }
-+ }
-+
-+ if (verbose
-+ && (cmdline_object_only_file_list.head
-+ || cmdline_object_only_archive_list.head))
-+ {
-+ info_msg (_("Object-only input files:\n "));
-+ print_cmdline_list (cmdline_object_only_file_list.head);
-+ print_cmdline_list (cmdline_object_only_archive_list.head);
-+ }
-+ }
-
- link_info.gc_sym_list = &entry_symbol;
- if (entry_symbol.name == NULL)
-@@ -8275,3 +8326,965 @@ lang_print_memory_usage (void)
- printf (" %6.2f%%\n", percent);
- }
- }
-+
-+static void
-+cmdline_lists_init (void)
-+{
-+ cmdline_object_only_file_list.tail
-+ = &cmdline_object_only_file_list.head;
-+ cmdline_object_only_archive_list.tail
-+ = &cmdline_object_only_archive_list.head;
-+ cmdline_temp_object_only_list.tail
-+ = &cmdline_temp_object_only_list.head;
-+}
-+
-+/* Allocate an item with TYPE and DATA. */
-+
-+static cmdline_union_type *
-+cmdline_list_new (cmdline_enum_type type, void *data)
-+{
-+ cmdline_union_type *new_opt;
-+
-+ new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
-+ new_opt->header.type = type;
-+ switch (type)
-+ {
-+ default:
-+ break;
-+ case cmdline_is_file_enum:
-+ new_opt->file.filename = (const char *) data;
-+ break;
-+ case cmdline_is_bfd_enum:
-+ new_opt->abfd.abfd = (bfd *) data;
-+ break;
-+ }
-+ return new_opt;
-+}
-+
-+/* Append an item with TYPE and DATA to LIST. */
-+
-+static void
-+cmdline_list_append (cmdline_list_type *list, cmdline_enum_type type,
-+ void *data)
-+{
-+ cmdline_union_type *new_opt = cmdline_list_new (type, data);
-+ new_opt->header.next = NULL;
-+ *list->tail = new_opt;
-+ list->tail = &new_opt->header.next;
-+}
-+
-+static void
-+print_cmdline_list (cmdline_union_type *c)
-+{
-+ for (; c != NULL; c = c->header.next)
-+ switch (c->header.type)
-+ {
-+ default:
-+ abort ();
-+ case cmdline_is_file_enum:
-+ info_msg (" %s", c->file.filename);
-+ break;
-+ case cmdline_is_bfd_enum:
-+ info_msg (" [%B]", c->abfd.abfd);
-+ break;
-+ }
-+
-+ info_msg ("\n");
-+}
-+
-+/* Return TRUE if ABFD is on cmdline_object_only_archive_list. */
-+
-+static bfd_boolean
-+cmdline_on_object_only_archive_list_p (bfd *abfd)
-+{
-+ cmdline_union_type *c, *next;
-+ bfd *archive, *obfd, *oarchive;
-+ ufile_ptr origin = abfd->origin;
-+
-+ archive = bfd_my_archive (abfd);
-+ for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
-+ {
-+ if (c->header.type != cmdline_is_bfd_enum)
-+ abort ();
-+
-+ next = c->header.next;
-+ obfd = c->abfd.abfd;
-+ oarchive = bfd_my_archive (obfd);
-+
-+ /* The list is grouped by archive file name and sorted by member
-+ origin. */
-+ if (strcmp (archive->filename, oarchive->filename) != 0)
-+ continue;
-+
-+ if (origin == obfd->origin)
-+ return TRUE;
-+ else if (origin < obfd->origin)
-+ return FALSE;
-+ }
-+
-+ return FALSE;
-+}
-+
-+/* Append an item with TYPE and DATA to cmdline_object_only_file_list
-+ or cmdline_object_only_archive_list if needed. */
-+
-+static void
-+cmdline_object_only_list_append (cmdline_enum_type type, void *data)
-+{
-+ cmdline_union_type *c;
-+ cmdline_union_type *new_opt, *next, **prev;
-+ bfd *abfd, *archive;
-+ bfd *obfd, *oarchive;
-+ bfd *nbfd, *narchive;
-+ ufile_ptr origin, norigin;
-+
-+ /* Put it on cmdline_object_only_file_list if it isn't an archive
-+ member. */
-+ switch (type)
-+ {
-+ default:
-+ abort ();
-+ case cmdline_is_bfd_enum:
-+ abfd = (bfd *) data;
-+ archive = bfd_my_archive (abfd);
-+ if (archive)
-+ break;
-+ case cmdline_is_file_enum:
-+ cmdline_list_append (&cmdline_object_only_file_list, type, data);
-+ return;
-+ }
-+
-+ /* Put archive member on cmdline_object_only_archive_list and sort
-+ the list by archive name and archive member origin. */
-+ new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
-+ new_opt->header.type = cmdline_is_bfd_enum;
-+ new_opt->header.next = NULL;
-+ new_opt->abfd.abfd = (bfd *) data;
-+
-+ c = cmdline_object_only_archive_list.head;
-+ if (c == NULL)
-+ {
-+ cmdline_object_only_archive_list.head = new_opt;
-+ cmdline_object_only_archive_list.tail = &new_opt->header.next;
-+ return;
-+ }
-+
-+ prev = NULL;
-+ origin = abfd->origin;
-+ for (; c != NULL; c = next)
-+ {
-+ if (c->header.type != cmdline_is_bfd_enum)
-+ abort ();
-+
-+ next = c->header.next;
-+
-+ obfd = c->abfd.abfd;
-+ oarchive = bfd_my_archive (obfd);
-+
-+ if (strcmp (archive->filename, oarchive->filename) == 0)
-+ {
-+ bfd_boolean after;
-+
-+ if (origin < obfd->origin)
-+ {
-+ /* Insert it before the current. */
-+ new_opt->header.next = c;
-+ if (prev)
-+ *prev = new_opt;
-+ else
-+ cmdline_object_only_archive_list.head = new_opt;
-+ return;
-+ }
-+
-+ after = TRUE;
-+
-+ /* Check origin. */
-+ while (next)
-+ {
-+ if (next->header.type != cmdline_is_bfd_enum)
-+ abort ();
-+
-+ nbfd = next->abfd.abfd;
-+ norigin = nbfd->origin;
-+ if (origin > norigin)
-+ {
-+ /* Insert it after NEXT. */
-+ break;
-+ }
-+
-+ narchive = bfd_my_archive (nbfd);
-+ if (strcmp (archive->filename, narchive->filename) != 0)
-+ {
-+ /* Insert it befor NEXT. */
-+ after = FALSE;
-+ break;
-+ }
-+
-+ c = next;
-+ next = next->header.next;
-+ }
-+
-+ if (after && next)
-+ {
-+ c = next;
-+ next = next->header.next;
-+ }
-+
-+ if (*cmdline_object_only_archive_list.tail == c->header.next)
-+ cmdline_object_only_archive_list.tail
-+ = &new_opt->header.next;
-+
-+ prev = &c->header.next;
-+ new_opt->header.next = next;
-+ *prev = new_opt;
-+ return;
-+ }
-+
-+ prev = &c->header.next;
-+ }
-+
-+ *cmdline_object_only_archive_list.tail = new_opt;
-+ cmdline_object_only_archive_list.tail = &new_opt->header.next;
-+}
-+
-+/* Get object-only input files. */
-+
-+static void
-+cmdline_get_object_only_input_files (void)
-+{
-+ cmdline_union_type *c, *next;
-+ bfd *abfd, *archive;
-+ bfd *nbfd, *narchive;
-+
-+ /* Add files first. */
-+ for (c = cmdline_object_only_file_list.head;
-+ c != NULL; c = c->header.next)
-+ switch (c->header.type)
-+ {
-+ default:
-+ abort ();
-+ case cmdline_is_file_enum:
-+ lang_add_input_file (c->file.filename,
-+ lang_input_file_is_file_enum, NULL);
-+ break;
-+ case cmdline_is_bfd_enum:
-+ abfd = c->abfd.abfd;
-+ if (bfd_my_archive (abfd))
-+ abort ();
-+ lang_add_input_file (abfd->filename,
-+ lang_input_file_is_file_enum, NULL);
-+ break;
-+ }
-+
-+ /* Add archive members next. */
-+ for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
-+ {
-+ if (c->header.type != cmdline_is_bfd_enum)
-+ abort ();
-+
-+ next = c->header.next;
-+
-+ abfd = c->abfd.abfd;
-+ archive = bfd_my_archive (abfd);
-+
-+ /* Add the first archive of the archive member group. */
-+ lang_add_input_file (archive->filename,
-+ lang_input_file_is_file_enum, NULL);
-+
-+ /* Skip the rest members in the archive member group. */
-+ do
-+ {
-+ if (!next)
-+ break;
-+
-+ if (next->header.type != cmdline_is_bfd_enum)
-+ abort ();
-+
-+ next = next->header.next;
-+ if (!next)
-+ break;
-+ nbfd = next->abfd.abfd;
-+ narchive = bfd_my_archive (nbfd);
-+ }
-+ while (strcmp (archive->filename, narchive->filename) == 0);
-+ }
-+}
-+
-+struct cmdline_arg
-+{
-+ bfd *obfd;
-+ asymbol **isympp;
-+ int status;
-+};
-+
-+/* Create a section in OBFD with the same
-+ name and attributes as ISECTION in IBFD. */
-+
-+static void
-+setup_section (bfd *ibfd, sec_ptr isection, void *p)
-+{
-+ struct cmdline_arg *arg = (struct cmdline_arg *) p;
-+ bfd *obfd = arg->obfd;
-+ asymbol **isympp = arg->isympp;
-+ const char *name = isection->name;
-+ sec_ptr osection;
-+ const char *err;
-+
-+ /* Skip the object-only section. */
-+ if (ibfd->object_only_section == isection)
-+ return;
-+
-+ /* If we have already failed earlier on, do not keep on generating
-+ complaints now. */
-+ if (arg->status)
-+ return;
-+
-+ osection = bfd_make_section_anyway_with_flags (obfd, name,
-+ isection->flags);
-+
-+ if (osection == NULL)
-+ {
-+ err = _("failed to create output section");
-+ goto loser;
-+ }
-+
-+ osection->size = isection->size;
-+ osection->vma = isection->vma;
-+ osection->lma = isection->lma;
-+ osection->alignment_power = isection->alignment_power;
-+
-+ /* Copy merge entity size. */
-+ osection->entsize = isection->entsize;
-+
-+ /* This used to be mangle_section; we do here to avoid using
-+ bfd_get_section_by_name since some formats allow multiple
-+ sections with the same name. */
-+ isection->output_section = osection;
-+ isection->output_offset = 0;
-+
-+ if ((isection->flags & SEC_GROUP) != 0)
-+ {
-+ asymbol *gsym = bfd_group_signature (isection, isympp);
-+
-+ if (gsym != NULL)
-+ {
-+ gsym->flags |= BSF_KEEP;
-+ if (ibfd->xvec->flavour == bfd_target_elf_flavour)
-+ elf_group_id (isection) = gsym;
-+ }
-+ }
-+
-+ /* Allow the BFD backend to copy any private data it understands
-+ from the input section to the output section. */
-+ if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
-+ {
-+ err = _("failed to copy private data");
-+ goto loser;
-+ }
-+
-+ /* All went well. */
-+ return;
-+
-+loser:
-+ arg->status = 1;
-+ einfo (_("%P%F: setup_section: %s: %s\n"), err, name);
-+}
-+
-+/* Copy the data of input section ISECTION of IBFD
-+ to an output section with the same name in OBFD.
-+ If stripping then don't copy any relocation info. */
-+
-+static void
-+copy_section (bfd *ibfd, sec_ptr isection, void *p)
-+{
-+ struct cmdline_arg *arg = (struct cmdline_arg *) p;
-+ bfd *obfd = arg->obfd;
-+ asymbol **isympp = arg->isympp;
-+ arelent **relpp;
-+ long relcount;
-+ sec_ptr osection;
-+ bfd_size_type size;
-+ long relsize;
-+ flagword flags;
-+ const char *err;
-+
-+ /* Skip the object-only section. */
-+ if (ibfd->object_only_section == isection)
-+ return;
-+
-+ /* If we have already failed earlier on, do not keep on generating
-+ complaints now. */
-+ if (arg->status)
-+ return;
-+
-+ flags = bfd_get_section_flags (ibfd, isection);
-+ if ((flags & SEC_GROUP) != 0)
-+ return;
-+
-+ osection = isection->output_section;
-+ size = bfd_get_section_size (isection);
-+
-+ if (size == 0 || osection == 0)
-+ return;
-+
-+ relsize = bfd_get_reloc_upper_bound (ibfd, isection);
-+
-+ if (relsize < 0)
-+ {
-+ /* Do not complain if the target does not support relocations. */
-+ if (relsize == -1
-+ && bfd_get_error () == bfd_error_invalid_operation)
-+ relsize = 0;
-+ else
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+ }
-+
-+ if (relsize == 0)
-+ bfd_set_reloc (obfd, osection, NULL, 0);
-+ else
-+ {
-+ relpp = (arelent **) xmalloc (relsize);
-+ relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
-+ if (relcount < 0)
-+ {
-+ err = _("relocation count is negative");
-+ goto loser;
-+ }
-+
-+ bfd_set_reloc (obfd, osection,
-+ relcount == 0 ? NULL : relpp, relcount);
-+ if (relcount == 0)
-+ free (relpp);
-+ }
-+
-+ if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS)
-+ {
-+ bfd_byte *memhunk = NULL;
-+
-+ if (!bfd_get_full_section_contents (ibfd, isection, &memhunk))
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+
-+ if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+ free (memhunk);
-+ }
-+
-+ /* All went well. */
-+ return;
-+
-+loser:
-+ einfo (_("%P%F: copy_section: %s: %s\n"), err, isection->name);
-+}
-+/* Open the temporary bfd created in the same directory as PATH. */
-+
-+static bfd *
-+cmdline_fopen_temp (const char *path, const char *target,
-+ const char *mode)
-+{
-+#define template "ldXXXXXX"
-+ const char *slash = strrchr (path, '/');
-+ char *tmpname;
-+ size_t len;
-+ int fd;
-+
-+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
-+ {
-+ /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
-+ char *bslash = strrchr (path, '\\');
-+
-+ if (slash == NULL || (bslash != NULL && bslash > slash))
-+ slash = bslash;
-+ if (slash == NULL && path[0] != '\0' && path[1] == ':')
-+ slash = path + 1;
-+ }
-+#endif
-+
-+ if (slash != (char *) NULL)
-+ {
-+ len = slash - path;
-+ tmpname = (char *) xmalloc (len + sizeof (template) + 2);
-+ memcpy (tmpname, path, len);
-+
-+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
-+ /* If tmpname is "X:", appending a slash will make it a root
-+ directory on drive X, which is NOT the same as the current
-+ directory on drive X. */
-+ if (len == 2 && tmpname[1] == ':')
-+ tmpname[len++] = '.';
-+#endif
-+ tmpname[len++] = '/';
-+ }
-+ else
-+ {
-+ tmpname = (char *) xmalloc (sizeof (template));
-+ len = 0;
-+ }
-+
-+ memcpy (tmpname + len, template, sizeof (template));
-+#undef template
-+
-+#ifdef HAVE_MKSTEMP
-+ fd = mkstemp (tmpname);
-+#else
-+ tmpname = mktemp (tmpname);
-+ if (tmpname == NULL)
-+ return NULL;
-+ fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
-+#endif
-+ if (fd == -1)
-+ return NULL;
-+ return bfd_fopen (tmpname, target, mode, fd);
-+}
-+
-+/* Add the object-only section. */
-+
-+static void
-+cmdline_add_object_only_section (bfd_byte *contents, size_t size)
-+{
-+ bfd_vma start;
-+ flagword flags;
-+ enum bfd_architecture iarch;
-+ unsigned int imach;
-+ long symcount;
-+ long symsize;
-+ asymbol **isympp = NULL;
-+ asymbol **osympp = NULL;
-+ bfd *obfd = NULL, *ibfd;
-+ const char *err;
-+ struct arg
-+ {
-+ bfd *obfd;
-+ asymbol **isympp;
-+ int status;
-+ } arg;
-+ char **matching;
-+ char *ofilename = NULL;
-+ asection *sec;
-+
-+ ibfd = bfd_openr (output_filename, output_target);
-+ if (!ibfd)
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+
-+ if (!bfd_check_format_matches (ibfd, bfd_object, &matching))
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+
-+ obfd = cmdline_fopen_temp (output_filename, output_target, "w");
-+ if (!obfd)
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+ /* To be used after bfd_close (). */
-+ ofilename = xstrdup (bfd_get_filename (obfd));
-+
-+ if (!bfd_set_format (obfd, bfd_object))
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+
-+ /* Copy the start address, flags and architecture of input file to
-+ output file. */
-+ flags = bfd_get_file_flags (ibfd);
-+ start = bfd_get_start_address (ibfd);
-+ iarch = bfd_get_arch (ibfd);
-+ imach = bfd_get_mach (ibfd);
-+ if (!bfd_set_start_address (obfd, start)
-+ || !bfd_set_file_flags (obfd, flags)
-+ || !bfd_set_arch_mach (obfd, iarch, imach))
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+
-+ symsize = bfd_get_symtab_upper_bound (ibfd);
-+ if (symsize < 0)
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+
-+ isympp = (asymbol **) xmalloc (symsize);
-+ symcount = bfd_canonicalize_symtab (ibfd, isympp);
-+ if (symcount < 0)
-+ {
-+ err = bfd_errmsg (bfd_get_error ());
-+ goto loser;
-+ }
-+
-+ arg.obfd = obfd;
-+ arg.isympp = isympp;
-+ arg.status = 0;
-+
-+ /* BFD mandates that all output sections be created and sizes set before
-+ any output is done. Thus, we traverse all sections multiple times. */
-+ bfd_map_over_sections (ibfd, setup_section, &arg);
-+
-+ if (arg.status)
-+ {
-+ err = _("error setting up sections");
-+ goto loser;
-+ }
-+
-+ /* Allow the BFD backend to copy any private data it understands
-+ from the input section to the output section. */
-+ if (! bfd_copy_private_header_data (ibfd, obfd))
-+ {
-+ err = _("error copying private header data");
-+ goto loser;
-+ }
-+
-+ /* Create the object-only section. */
-+ sec = bfd_make_section_with_flags (obfd,
-+ GNU_OBJECT_ONLY_SECTION_NAME,
-+ (SEC_HAS_CONTENTS
-+ | SEC_READONLY
-+ | SEC_DATA
-+ | SEC_LINKER_CREATED));
-+ if (sec == NULL)
-+ {
-+ err = _("can't create object-only section");
-+ goto loser;
-+ }
-+
-+ if (! bfd_set_section_size (obfd, sec, size))
-+ {
-+ err = _("can't set object-only section size");
-+ goto loser;
-+ }
-+
-+ if (ibfd->object_only_section)
-+ {
-+ /* Filter out the object-only section symbol. */
-+ long src_count = 0, dst_count = 0;
-+ asymbol **from, **to;
-+
-+ osympp = (asymbol **) xmalloc (symcount * sizeof (asymbol *));
-+ from = isympp;
-+ to = osympp;
-+ for (; src_count < symcount; src_count++)
-+ {
-+ asymbol *sym = from[src_count];
-+ if (bfd_get_section (sym) != ibfd->object_only_section)
-+ to[dst_count++] = sym;
-+ }
-+ to[dst_count] = NULL;
-+ symcount = dst_count;
-+ bfd_set_symtab (obfd, osympp, symcount);
-+ }
-+ else
-+ bfd_set_symtab (obfd, isympp, symcount);
-+
-+ /* This has to happen after the symbol table has been set. */
-+ bfd_map_over_sections (ibfd, copy_section, &arg);
-+
-+ if (arg.status)
-+ {
-+ err = _("error copying sections");
-+ goto loser;
-+ }
-+
-+ /* Copy the object-only section to the output. */
-+ if (! bfd_set_section_contents (obfd, sec, contents, 0, size))
-+ {
-+ err = _("error adding object-only section");
-+ goto loser;
-+ }
-+
-+ /* Allow the BFD backend to copy any private data it understands
-+ from the input BFD to the output BFD. This is done last to
-+ permit the routine to look at the filtered symbol table, which is
-+ important for the ECOFF code at least. */
-+ if (! bfd_copy_private_bfd_data (ibfd, obfd))
-+ {
-+ err = _("error copying private BFD data");
-+ goto loser;
-+ }
-+
-+ if (!bfd_close (obfd))
-+ {
-+ unlink (ofilename);
-+ einfo (_("%P%F: failed to finish output with object-only section\n"));
-+ }
-+
-+ /* Must be freed after bfd_close (). */
-+ free (isympp);
-+ if (osympp)
-+ free (osympp);
-+
-+ if (rename (ofilename, output_filename))
-+ {
-+ unlink (ofilename);
-+ einfo (_("%P%F: failed to rename output with object-only section\n"));
-+ }
-+
-+ free (ofilename);
-+ return;
-+
-+loser:
-+ if (isympp)
-+ free (isympp);
-+ if (osympp)
-+ free (osympp);
-+ if (obfd)
-+ bfd_close (obfd);
-+ if (ofilename)
-+ unlink (ofilename);
-+ einfo (_("%P%F: failed to add object-only section: %s\n"), err);
-+}
-+
-+/* Emit the final output with object-only section. */
-+
-+void
-+cmdline_emit_object_only_section (void)
-+{
-+ const char *saved_output_filename = output_filename;
-+ int fd;
-+ size_t size, off;
-+ bfd_byte *contents;
-+ struct stat st;
-+
-+ /* Get a temporary object-only file. */
-+ output_filename = make_temp_file (".obj-only.o");
-+
-+ had_output_filename = FALSE;
-+ link_info.input_bfds = NULL;
-+ link_info.input_bfds_tail = &link_info.input_bfds;
-+
-+ lang_init (TRUE);
-+ ldexp_init (TRUE);
-+
-+ ld_parse_linker_script ();
-+
-+ /* Set up the object-only output. */
-+ lang_final ();
-+
-+ /* Open the object-only file for output. */
-+ lang_for_each_statement (ldlang_open_output);
-+
-+ ldemul_create_output_section_statements ();
-+
-+ if (!bfd_section_already_linked_table_init ())
-+ einfo (_("%P%F: Failed to create hash table\n"));
-+
-+ /* Call cmdline_on_object_only_archive_list_p to check which member
-+ should be loaded. */
-+ input_flags.whole_archive = TRUE;
-+
-+ /* Set it to avoid adding more to cmdline lists. */
-+ link_info.emitting_gnu_object_only = TRUE;
-+
-+ /* Get object-only input files. */
-+ cmdline_get_object_only_input_files ();
-+
-+ /* Open object-only input files. */
-+ open_input_bfds (statement_list.head, FALSE);
-+
-+ ldemul_after_open ();
-+
-+ bfd_section_already_linked_table_free ();
-+
-+ /* Make sure that we're not mixing architectures. We call this
-+ after all the input files have been opened, but before we do any
-+ other processing, so that any operations merge_private_bfd_data
-+ does on the output file will be known during the rest of the
-+ link. */
-+ lang_check ();
-+
-+ /* Size up the common data. */
-+ lang_common ();
-+
-+ /* Update wild statements. */
-+ update_wild_statements (statement_list.head);
-+
-+ /* Run through the contours of the script and attach input sections
-+ to the correct output sections. */
-+ map_input_to_output_sections (statement_list.head, NULL, NULL);
-+
-+ /* Find any sections not attached explicitly and handle them. */
-+ lang_place_orphans ();
-+
-+ /* Do anything special before sizing sections. This is where ELF
-+ and other back-ends size dynamic sections. */
-+ ldemul_before_allocation ();
-+
-+ /* Size up the sections. */
-+ lang_size_sections (NULL, ! RELAXATION_ENABLED);
-+
-+ /* See if anything special should be done now we know how big
-+ everything is. This is where relaxation is done. */
-+ ldemul_after_allocation ();
-+
-+ ldemul_finish ();
-+
-+ /* Make sure that the section addresses make sense. */
-+ if (command_line.check_section_addresses)
-+ lang_check_section_addresses ();
-+
-+ lang_end ();
-+
-+ ldwrite ();
-+
-+ ldexp_finish (TRUE);
-+ lang_finish ();
-+
-+ if (! bfd_close (link_info.output_bfd))
-+ einfo (_("%P%F:%s: final close failed on object-only output: %E\n"),
-+ output_filename);
-+
-+ /* Read in the object-only file. */
-+ fd = open (output_filename, O_RDONLY | O_BINARY);
-+ if (fd < 0)
-+ {
-+ bfd_set_error (bfd_error_system_call);
-+ einfo (_("%P%F:%s: cannot open object-only output: %E"),
-+ output_filename);
-+ }
-+
-+ /* Get the object-only file size. */
-+ if (fstat (fd, &st) != 0)
-+ {
-+ bfd_set_error (bfd_error_system_call);
-+ einfo (_("%P%F:%s: cannot stat object-only output: %E"),
-+ output_filename);
-+ }
-+
-+ size = st.st_size;
-+ off = 0;
-+ contents = (bfd_byte *) xmalloc (size);
-+ while (off != size)
-+ {
-+ ssize_t got;
-+
-+ got = read (fd, contents + off, size - off);
-+ if (got < 0)
-+ {
-+ bfd_set_error (bfd_error_system_call);
-+ einfo (_("%P%F:%s: read failed on object-only output: %E"),
-+ output_filename);
-+ }
-+
-+ off += got;
-+ }
-+
-+ close (fd);
-+
-+ /* Remove the temporary object-only file. */
-+ unlink (output_filename);
-+
-+ output_filename = saved_output_filename;
-+
-+ cmdline_add_object_only_section (contents, size);
-+
-+ free (contents);
-+}
-+
-+/* Extract the object-only section. */
-+
-+static const char *
-+cmdline_extract_object_only_section (bfd *abfd)
-+{
-+ const char *name = bfd_extract_object_only_section (abfd);
-+
-+ if (name == NULL)
-+ einfo (_("%P%F: cannot extract object-only section from %B: %E"),
-+ abfd);
-+
-+ /* It should be removed after it is done. */
-+ cmdline_list_append (&cmdline_temp_object_only_list,
-+ cmdline_is_file_enum, (void *) name);
-+
-+ return name;
-+}
-+
-+/* Check and handle the object-only section. */
-+
-+void
-+cmdline_check_object_only_section (bfd *abfd, bfd_boolean lto)
-+{
-+ const char *filename;
-+
-+ if (link_info.emitting_gnu_object_only
-+ || abfd->format != bfd_object)
-+ return;
-+
-+ if (lto)
-+ {
-+ /* For LTO link, we only need to extract object-only section
-+ from the mixed object, add it to input, and put it on LTO
-+ claimed output. */
-+ switch (abfd->lto_type)
-+ {
-+ default:
-+ abort ();
-+ case lto_mixed_object:
-+ filename = cmdline_extract_object_only_section (abfd);
-+ lang_add_input_file (filename,
-+ lang_input_file_is_file_enum, NULL);
-+ break;
-+ case lto_non_ir_object:
-+ case lto_ir_object:
-+ break;
-+ }
-+ }
-+ else if (bfd_link_relocatable (&link_info))
-+ {
-+ /* For non-LTO relocatable link, we need to append non-IR object
-+ file and the object file in object-only section to the object
-+ only list. */
-+ switch (abfd->lto_type)
-+ {
-+ default:
-+ abort ();
-+ case lto_mixed_object:
-+ filename = cmdline_extract_object_only_section (abfd);
-+ cmdline_object_only_list_append (cmdline_is_file_enum,
-+ (void *) filename);
-+ break;
-+ case lto_non_ir_object:
-+ cmdline_object_only_list_append (cmdline_is_bfd_enum, abfd);
-+ break;
-+ case lto_ir_object:
-+ break;
-+ }
-+ }
-+}
-+
-+/* Remove temporary object-only files. */
-+
-+void
-+cmdline_remove_object_only_files (void)
-+{
-+ cmdline_union_type *c;
-+
-+#ifdef ENABLE_PLUGINS
-+ if (plugin_save_temps)
-+ return;
-+#endif
-+
-+ c = cmdline_temp_object_only_list.head;
-+ for (; c != NULL; c = c->header.next)
-+ switch (c->header.type)
-+ {
-+ default:
-+ abort ();
-+ case cmdline_is_file_enum:
-+ unlink (c->file.filename);
-+ break;
-+ }
-+}
-diff -rup binutils-2.26.orig/ld/ldlang.h binutils-2.26/ld/ldlang.h
---- binutils-2.26.orig/ld/ldlang.h 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldlang.h 2016-02-19 09:35:54.921106611 +0000
-@@ -517,7 +517,7 @@ extern struct asneeded_minfo **asneeded_
- extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *);
-
- extern void lang_init
-- (void);
-+ (bfd_boolean);
- extern void lang_finish
- (void);
- extern lang_memory_region_type * lang_memory_region_lookup
-@@ -693,4 +693,45 @@ lang_ld_feature (char *);
- extern void
- lang_print_memory_usage (void);
-
-+typedef enum
-+{
-+ cmdline_is_file_enum,
-+ cmdline_is_bfd_enum
-+} cmdline_enum_type;
-+
-+typedef struct cmdline_header_struct
-+{
-+ union cmdline_union *next;
-+ cmdline_enum_type type;
-+} cmdline_header_type;
-+
-+typedef struct cmdline_file_struct
-+{
-+ cmdline_header_type header;
-+ const char *filename;
-+} cmdline_file_type;
-+
-+typedef struct cmdline_bfd_struct
-+{
-+ cmdline_header_type header;
-+ bfd *abfd;
-+} cmdline_bfd_type;
-+
-+typedef union cmdline_union
-+{
-+ cmdline_header_type header;
-+ cmdline_file_type file;
-+ cmdline_bfd_type abfd;
-+} cmdline_union_type;
-+
-+typedef struct cmdline_list
-+{
-+ cmdline_union_type *head;
-+ cmdline_union_type **tail;
-+} cmdline_list_type;
-+
-+extern void cmdline_emit_object_only_section (void);
-+extern void cmdline_check_object_only_section (bfd *, bfd_boolean);
-+extern void cmdline_remove_object_only_files (void);
-+
- #endif
-diff -rup binutils-2.26.orig/ld/ldlex.h binutils-2.26/ld/ldlex.h
---- binutils-2.26.orig/ld/ldlex.h 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldlex.h 2016-02-19 09:35:54.921106611 +0000
-@@ -134,6 +134,7 @@ enum option_values
- #ifdef ENABLE_PLUGINS
- OPTION_PLUGIN,
- OPTION_PLUGIN_OPT,
-+ OPTION_PLUGIN_SAVE_TEMPS,
- #endif /* ENABLE_PLUGINS */
- OPTION_DEFAULT_SCRIPT,
- OPTION_PRINT_OUTPUT_FORMAT,
-diff -rup binutils-2.26.orig/ld/ldmain.c binutils-2.26/ld/ldmain.c
---- binutils-2.26.orig/ld/ldmain.c 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldmain.c 2016-02-19 09:35:54.922106617 +0000
-@@ -219,6 +219,9 @@ main (int argc, char **argv)
-
- xatexit (ld_cleanup);
-
-+ /* Remove temporary object-only files. */
-+ xatexit (cmdline_remove_object_only_files);
-+
- /* Set up the sysroot directory. */
- ld_sysroot = get_sysroot (argc, argv);
- if (*ld_sysroot)
-@@ -291,8 +294,8 @@ main (int argc, char **argv)
- default_target = ldemul_choose_target (argc, argv);
- config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
- config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
-- lang_init ();
-- ldexp_init ();
-+ lang_init (FALSE);
-+ ldexp_init (FALSE);
- ldemul_before_parse ();
- lang_has_input_file = FALSE;
- parse_args (argc, argv);
-@@ -307,34 +310,7 @@ main (int argc, char **argv)
-
- ldemul_set_symbols ();
-
-- /* If we have not already opened and parsed a linker script,
-- try the default script from command line first. */
-- if (saved_script_handle == NULL
-- && command_line.default_script != NULL)
-- {
-- ldfile_open_command_file (command_line.default_script);
-- parser_input = input_script;
-- yyparse ();
-- }
--
-- /* If we have not already opened and parsed a linker script
-- read the emulation's appropriate default script. */
-- if (saved_script_handle == NULL)
-- {
-- int isfile;
-- char *s = ldemul_get_script (&isfile);
--
-- if (isfile)
-- ldfile_open_default_command_file (s);
-- else
-- {
-- lex_string = s;
-- lex_redirect (s, _("built in linker script"), 1);
-- }
-- parser_input = input_script;
-- yyparse ();
-- lex_string = NULL;
-- }
-+ ld_parse_linker_script ();
-
- if (verbose)
- {
-@@ -445,7 +421,7 @@ main (int argc, char **argv)
- fprintf (stderr, "lookup = %p val %lx\n", h, h ? h->u.def.value : 1);
- }
- #endif
-- ldexp_finish ();
-+ ldexp_finish (FALSE);
- lang_finish ();
-
- /* Even if we're producing relocatable output, some non-fatal errors should
-@@ -465,6 +441,8 @@ main (int argc, char **argv)
- if (! bfd_close (link_info.output_bfd))
- einfo (_("%F%B: final close failed: %E\n"), link_info.output_bfd);
-
-+ link_info.output_bfd = NULL;
-+
- /* If the --force-exe-suffix is enabled, and we're making an
- executable file and it doesn't end in .exe, copy it to one
- which does. */
-@@ -512,6 +490,9 @@ main (int argc, char **argv)
- }
- }
-
-+ if (link_info.emit_gnu_object_only)
-+ cmdline_emit_object_only_section ();
-+
- END_PROGRESS (program_name);
-
- if (config.stats)
-@@ -805,7 +786,9 @@ add_archive_element (struct bfd_link_inf
- *subsbfd = input->the_bfd;
- }
- }
-+ else
- #endif /* ENABLE_PLUGINS */
-+ cmdline_check_object_only_section (input->the_bfd, FALSE);
-
- ldlang_add_file (input);
-
-@@ -1484,3 +1467,38 @@ notice (struct bfd_link_info *info,
-
- return TRUE;
- }
-+
-+/* Parse the linker script. */
-+
-+void
-+ld_parse_linker_script ()
-+{
-+ /* If we have not already opened and parsed a linker script,
-+ try the default script from command line first. */
-+ if (saved_script_handle == NULL
-+ && command_line.default_script != NULL)
-+ {
-+ ldfile_open_command_file (command_line.default_script);
-+ parser_input = input_script;
-+ yyparse ();
-+ }
-+
-+ /* If we have not already opened and parsed a linker script
-+ read the emulation's appropriate default script. */
-+ if (saved_script_handle == NULL)
-+ {
-+ int isfile;
-+ char *s = ldemul_get_script (&isfile);
-+
-+ if (isfile)
-+ ldfile_open_default_command_file (s);
-+ else
-+ {
-+ lex_string = s;
-+ lex_redirect (s, _("built in linker script"), 1);
-+ }
-+ parser_input = input_script;
-+ yyparse ();
-+ lex_string = NULL;
-+ }
-+}
-diff -rup binutils-2.26.orig/ld/ldmain.h binutils-2.26/ld/ldmain.h
---- binutils-2.26.orig/ld/ldmain.h 2016-02-19 09:35:36.701003291 +0000
-+++ binutils-2.26/ld/ldmain.h 2016-02-19 09:35:54.922106617 +0000
-@@ -59,4 +59,6 @@ extern void add_wrap (const char *);
- extern void add_ignoresym (struct bfd_link_info *, const char *);
- extern void add_keepsyms_file (const char *);
-
-+extern void ld_parse_linker_script (void);
-+
- #endif
-diff -rup binutils-2.26.orig/ld/lexsup.c binutils-2.26/ld/lexsup.c
---- binutils-2.26.orig/ld/lexsup.c 2016-02-19 09:35:36.700003285 +0000
-+++ binutils-2.26/ld/lexsup.c 2016-02-19 09:35:54.923106623 +0000
-@@ -169,6 +169,9 @@ static const struct ld_option ld_options
- '\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH },
- { {"plugin-opt", required_argument, NULL, OPTION_PLUGIN_OPT},
- '\0', N_("ARG"), N_("Send arg to last-loaded plugin"), ONE_DASH },
-+ { {"plugin-save-temps", no_argument, NULL, OPTION_PLUGIN_SAVE_TEMPS},
-+ '\0', NULL, N_("Store plugin intermediate files permanently"),
-+ ONE_DASH },
- { {"flto", optional_argument, NULL, OPTION_IGNORE},
- '\0', NULL, N_("Ignored for GCC LTO option compatibility"),
- ONE_DASH },
-@@ -1020,6 +1023,9 @@ parse_args (unsigned argc, char **argv)
- if (plugin_opt_plugin_arg (optarg))
- einfo (_("%P%F: bad -plugin-opt option\n"));
- break;
-+ case OPTION_PLUGIN_SAVE_TEMPS:
-+ plugin_save_temps = TRUE;
-+ break;
- #endif /* ENABLE_PLUGINS */
- case 'q':
- link_info.emitrelocations = TRUE;
-diff -rup binutils-2.26.orig/ld/plugin.c binutils-2.26/ld/plugin.c
---- binutils-2.26.orig/ld/plugin.c 2016-02-19 09:35:36.702003296 +0000
-+++ binutils-2.26/ld/plugin.c 2016-02-19 09:35:54.923106623 +0000
-@@ -57,6 +57,9 @@ extern int errno;
- /* Report plugin symbols. */
- bfd_boolean report_plugin_symbols;
-
-+/* Store plugin intermediate files permanently. */
-+bfd_boolean plugin_save_temps;
-+
- /* The suffix to append to the name of the real (claimed) object file
- when generating a dummy BFD to hold the IR symbols sent from the
- plugin. For cosmetic use only; appears in maps, crefs etc. */
-@@ -1182,6 +1185,9 @@ plugin_maybe_claim (lang_input_statement
- {
- bfd *abfd = entry->the_bfd->plugin_dummy_bfd;
-
-+ /* Check object only section. */
-+ cmdline_check_object_only_section (entry->the_bfd, TRUE);
-+
- /* Discard the real file's BFD and substitute the dummy one. */
-
- /* BFD archive handling caches elements so we can't call
-@@ -1227,14 +1233,17 @@ plugin_call_cleanup (void)
- {
- if (curplug->cleanup_handler && !curplug->cleanup_done)
- {
-- enum ld_plugin_status rv;
-- curplug->cleanup_done = TRUE;
-- called_plugin = curplug;
-- rv = (*curplug->cleanup_handler) ();
-- called_plugin = NULL;
-- if (rv != LDPS_OK)
-- info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"),
-- curplug->name, rv);
-+ if (!plugin_save_temps)
-+ {
-+ enum ld_plugin_status rv;
-+ curplug->cleanup_done = TRUE;
-+ called_plugin = curplug;
-+ rv = (*curplug->cleanup_handler) ();
-+ called_plugin = NULL;
-+ if (rv != LDPS_OK)
-+ info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"),
-+ curplug->name, rv);
-+ }
- dlclose (curplug->dlhandle);
- }
- curplug = curplug->next;
-diff -rup binutils-2.26.orig/ld/plugin.h binutils-2.26/ld/plugin.h
---- binutils-2.26.orig/ld/plugin.h 2016-02-19 09:35:36.702003296 +0000
-+++ binutils-2.26/ld/plugin.h 2016-02-19 09:35:54.924106628 +0000
-@@ -24,6 +24,9 @@
- /* Report plugin symbols. */
- extern bfd_boolean report_plugin_symbols;
-
-+/* Store plugin intermediate files permanently. */
-+extern bfd_boolean plugin_save_temps;
-+
- /* Set at all symbols read time, to avoid recursively offering the plugin
- its own newly-added input files and libs to claim. */
- extern bfd_boolean no_more_claiming;
-diff -rup binutils-2.26.orig/ld/scripttempl/armbpabi.sc binutils-2.26/ld/scripttempl/armbpabi.sc
---- binutils-2.26.orig/ld/scripttempl/armbpabi.sc 2016-02-19 09:35:36.704003308 +0000
-+++ binutils-2.26/ld/scripttempl/armbpabi.sc 2016-02-19 09:35:54.924106628 +0000
-@@ -36,7 +36,7 @@ INTERP=".interp 0 : { *(.interp) }
- PLT=".plt ${RELOCATING-0} : { *(.plt) }"
- RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- if test -z "${NO_SMALL_DATA}"; then
- SBSS=".sbss ${RELOCATING-0} :
- {
-diff -rup binutils-2.26.orig/ld/scripttempl/elf32sh-symbian.sc binutils-2.26/ld/scripttempl/elf32sh-symbian.sc
---- binutils-2.26.orig/ld/scripttempl/elf32sh-symbian.sc 2016-02-19 09:35:36.705003313 +0000
-+++ binutils-2.26/ld/scripttempl/elf32sh-symbian.sc 2016-02-19 09:35:54.925106634 +0000
-@@ -88,7 +88,7 @@ fi
- PLT=".plt : { *(.plt) } :dynamic :dyn"
- DYNAMIC=".dynamic : { *(.dynamic) } :dynamic :dyn"
- RODATA=".rodata ALIGN(4) : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) *(.gnu_object_only) }"
- test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) } :dynamic :dyn"
- INIT_ARRAY=".init_array ${RELOCATING-0} :
- {
-diff -rup binutils-2.26.orig/ld/scripttempl/elf64hppa.sc binutils-2.26/ld/scripttempl/elf64hppa.sc
---- binutils-2.26.orig/ld/scripttempl/elf64hppa.sc 2016-02-19 09:35:36.705003313 +0000
-+++ binutils-2.26/ld/scripttempl/elf64hppa.sc 2016-02-19 09:35:54.925106634 +0000
-@@ -132,7 +132,7 @@ fi
- DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- if test -z "${NO_SMALL_DATA}"; then
- SBSS=".sbss ${RELOCATING-0} :
- {
-diff -rup binutils-2.26.orig/ld/scripttempl/elf.sc binutils-2.26/ld/scripttempl/elf.sc
---- binutils-2.26.orig/ld/scripttempl/elf.sc 2016-02-19 09:35:36.705003313 +0000
-+++ binutils-2.26/ld/scripttempl/elf.sc 2016-02-19 09:35:54.924106628 +0000
-@@ -170,7 +170,7 @@ RELA_IPLT=".rela.iplt ${RELOCATING-0}
- DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- if test -z "${NO_SMALL_DATA}"; then
- SBSS=".${SBSS_NAME} ${RELOCATING-0} :
- {
-diff -rup binutils-2.26.orig/ld/scripttempl/elfxtensa.sc binutils-2.26/ld/scripttempl/elfxtensa.sc
---- binutils-2.26.orig/ld/scripttempl/elfxtensa.sc 2016-02-19 09:35:36.705003313 +0000
-+++ binutils-2.26/ld/scripttempl/elfxtensa.sc 2016-02-19 09:35:54.925106634 +0000
-@@ -145,7 +145,7 @@ fi
- DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- INIT_LIT=".init.literal 0 : { *(.init.literal) }"
- INIT=".init 0 : { *(.init) }"
- FINI_LIT=".fini.literal 0 : { *(.fini.literal) }"
-diff -rup binutils-2.26.orig/ld/scripttempl/mep.sc binutils-2.26/ld/scripttempl/mep.sc
---- binutils-2.26.orig/ld/scripttempl/mep.sc 2016-02-19 09:35:36.706003319 +0000
-+++ binutils-2.26/ld/scripttempl/mep.sc 2016-02-19 09:35:54.926106640 +0000
-@@ -119,7 +119,7 @@ fi
- DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- if test -z "${NO_SMALL_DATA}"; then
- SBSS=".sbss ${RELOCATING-0} :
- {
-diff -rup binutils-2.26.orig/ld/scripttempl/pep.sc binutils-2.26/ld/scripttempl/pep.sc
---- binutils-2.26.orig/ld/scripttempl/pep.sc 2016-02-19 09:35:36.706003319 +0000
-+++ binutils-2.26/ld/scripttempl/pep.sc 2016-02-19 09:35:54.926106640 +0000
-@@ -178,6 +178,7 @@ SECTIONS
- *(.drectve)
- ${RELOCATING+ *(.note.GNU-stack)}
- ${RELOCATING+ *(.gnu.lto_*)}
-+ ${RELOCATING+ *(.gnu_object_only)}
- }
-
- .idata ${RELOCATING+BLOCK(__section_alignment__)} :
-diff -rup binutils-2.26.orig/ld/scripttempl/pe.sc binutils-2.26/ld/scripttempl/pe.sc
---- binutils-2.26.orig/ld/scripttempl/pe.sc 2016-02-19 09:35:36.706003319 +0000
-+++ binutils-2.26/ld/scripttempl/pe.sc 2016-02-19 09:35:54.926106640 +0000
-@@ -165,6 +165,7 @@ SECTIONS
- *(.drectve)
- ${RELOCATING+ *(.note.GNU-stack)}
- ${RELOCATING+ *(.gnu.lto_*)}
-+ ${RELOCATING+ *(.gnu_object_only)}
- }
-
- .idata ${RELOCATING+BLOCK(__section_alignment__)} :
-diff -rup binutils-2.26.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.26/ld/testsuite/ld-plugin/lto.exp
---- binutils-2.26.orig/ld/testsuite/ld-plugin/lto.exp 2016-02-19 09:35:36.807003892 +0000
-+++ binutils-2.26/ld/testsuite/ld-plugin/lto.exp 2016-02-19 09:36:15.450223025 +0000
-@@ -79,6 +79,15 @@ set lto_link_tests [list \
- [list "Build liblto-3.a" \
- "" "-flto $lto_fat" \
- {lto-3b.c} {} "liblto-3.a"] \
-+ [list "Compile 4a" \
-+ "" "-flto $lto_fat" \
-+ {lto-4a.c} {} ""] \
-+ [list "Compile 4b" \
-+ "" "-O2" \
-+ {lto-4b.c} {} ""] \
-+ [list "Compile 4c" \
-+ "" "-O2" \
-+ {lto-4c.c} {} ""] \
- [list "Compile 5a" \
- "" "-flto $lto_fat" \
- {lto-5a.c} {} ""] \
-@@ -94,6 +103,12 @@ set lto_link_tests [list \
- [list "Compile 9" \
- "" "-O2 -finline -flto" \
- {lto-9.cc} {} "" "c++"] \
-+ [list "Compile 10a" \
-+ "" "-O2" \
-+ {lto-10a.c} {} ""] \
-+ [list "Compile 10b" \
-+ "" "-O2 -flto $lto_fat" \
-+ {lto-10b.c} {} ""] \
- [list "Compile 11a" \
- "" "-O -flto" \
- {lto-11a.c} {} ""] \
-@@ -291,9 +306,21 @@ set lto_run_tests [list \
- [list "LTO 3c" \
- "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" \
- {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \
-+ [list "LTO 4a" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-4r-a.o" "" \
-+ {dummy.c} "lto-4a.exe" "lto-4.out" "" "c"] \
-+ [list "LTO 4c" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-4r-c.o" "" \
-+ {dummy.c} "lto-4c.exe" "lto-4.out" "" "c"] \
-+ [list "LTO 4d" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-4r-d.o" "" \
-+ {dummy.c} "lto-4d.exe" "lto-4.out" "" "c"] \
- [list "LTO 5" \
- "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
- {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \
-+ [list "LTO 10" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-10.o" "" \
-+ {dummy.c} "lto-10.exe" "lto-10.out" "" "c"] \
- [list "LTO 11" \
- "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \
- {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \
-@@ -378,6 +405,15 @@ if { [is_elf_format] && [check_lto_share
- }
- }
-
-+set testname "Build liblto-4.a"
-+remote_file host delete "tmpdir/liblto-4.a"
-+set catch_output [run_host_cmd "$ar" "rc tmpdir/liblto-4.a tmpdir/lto-4a.o tmpdir/lto-4b.o tmpdir/lto-4c.o"]
-+if {![string match "" $catch_output]} {
-+ unresolved $testname
-+ restore_notify
-+ return
-+}
-+
- set testname "Build liblto-11.a"
- remote_file host delete "tmpdir/liblto-11.a"
- set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
-@@ -424,8 +460,30 @@ return
- # Run "ld -r" to generate inputs for complex LTO tests.
- run_dump_test "lto-3r"
- remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
-+run_dump_test "lto-4r-a"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-a.o"
-+run_dump_test "lto-4r-b"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-b.o"
-+run_dump_test "lto-4r-c"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-c.o"
-+run_dump_test "lto-4r-d"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-d.o"
- run_dump_test "lto-5r"
- remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
-+run_dump_test "lto-10r"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-10.o"
-+set testname "nm mixed object"
-+set lto_plugin [run_host_cmd "$CC" "-print-prog-name=liblto_plugin.so tmpdir/lto-10.o"]
-+if { [ regexp "liblto_plugin.so" $lto_plugin ] } {
-+ set exec_output [run_host_cmd "$NM" "--plugin $lto_plugin tmpdir/lto-10.o"]
-+ if { [ regexp "T main" $exec_output ] } {
-+ pass $testname
-+ } {
-+ fail $testname
-+ }
-+} {
-+ fail $testname
-+ }
-
- run_cc_link_tests $lto_link_symbol_tests
-
-diff -rup binutils-2.26.orig/ld/testsuite/ld-plugin/lto.exp.orig binutils-2.26/ld/testsuite/ld-plugin/lto.exp.orig
---- binutils-2.26.orig/ld/testsuite/ld-plugin/lto.exp.orig 2016-02-19 09:35:36.805003880 +0000
-+++ binutils-2.26/ld/testsuite/ld-plugin/lto.exp.orig 2016-02-19 09:35:54.929106657 +0000
-@@ -79,6 +79,15 @@ set lto_link_tests [list \
- [list "Build liblto-3.a" \
- "" "-flto $lto_fat" \
- {lto-3b.c} {} "liblto-3.a"] \
-+ [list "Compile 4a" \
-+ "" "-flto $lto_fat" \
-+ {lto-4a.c} {} ""] \
-+ [list "Compile 4b" \
-+ "" "-O2" \
-+ {lto-4b.c} {} ""] \
-+ [list "Compile 4c" \
-+ "" "-O2" \
-+ {lto-4c.c} {} ""] \
- [list "Compile 5a" \
- "" "-flto $lto_fat" \
- {lto-5a.c} {} ""] \
-@@ -94,6 +103,12 @@ set lto_link_tests [list \
- [list "Compile 9" \
- "" "-O2 -finline -flto" \
- {lto-9.cc} {} "" "c++"] \
-+ [list "Compile 10a" \
-+ "" "-O2" \
-+ {lto-10a.c} {} ""] \
-+ [list "Compile 10b" \
-+ "" "-O2 -flto $lto_fat" \
-+ {lto-10b.c} {} ""] \
- [list "Compile 11a" \
- "" "-O -flto" \
- {lto-11a.c} {} ""] \
-@@ -291,9 +306,21 @@ set lto_run_tests [list \
- [list "LTO 3c" \
- "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" \
- {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \
-+ [list "LTO 4a" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-4r-a.o" "" \
-+ {dummy.c} "lto-4a.exe" "lto-4.out" "" "c"] \
-+ [list "LTO 4c" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-4r-c.o" "" \
-+ {dummy.c} "lto-4c.exe" "lto-4.out" "" "c"] \
-+ [list "LTO 4d" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-4r-d.o" "" \
-+ {dummy.c} "lto-4d.exe" "lto-4.out" "" "c"] \
- [list "LTO 5" \
- "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
- {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \
-+ [list "LTO 10" \
-+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-10.o" "" \
-+ {dummy.c} "lto-10.exe" "lto-10.out" "" "c"] \
- [list "LTO 11" \
- "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \
- {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \
-@@ -378,6 +405,15 @@ if { [is_elf_format] && [check_lto_share
- }
- }
-
-+set testname "Build liblto-4.a"
-+remote_file host delete "tmpdir/liblto-4.a"
-+set catch_output [run_host_cmd "$ar" "rc tmpdir/liblto-4.a tmpdir/lto-4a.o tmpdir/lto-4b.o tmpdir/lto-4c.o"]
-+if {![string match "" $catch_output]} {
-+ unresolved $testname
-+ restore_notify
-+ return
-+}
-+
- set testname "Build liblto-11.a"
- remote_file host delete "tmpdir/liblto-11.a"
- set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
-@@ -416,11 +452,26 @@ if { [at_least_gcc_version 4 7] } {
- }
- }
-
-+# Fedora specific binutils patches break some of the tests that follow...
-+restore_notify
-+return
-+
-+
- # Run "ld -r" to generate inputs for complex LTO tests.
- run_dump_test "lto-3r"
- remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
-+run_dump_test "lto-4r-a"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-a.o"
-+run_dump_test "lto-4r-b"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-b.o"
-+run_dump_test "lto-4r-c"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-c.o"
-+run_dump_test "lto-4r-d"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-d.o"
- run_dump_test "lto-5r"
- remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
-+run_dump_test "lto-10r"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-10.o"
-
- run_cc_link_tests $lto_link_symbol_tests
-
diff --git a/source/d/binutils/patches/binutils-rh1312151.patch b/source/d/binutils/patches/binutils-rh1312151.patch
deleted file mode 100644
index e989b86fe..000000000
--- a/source/d/binutils/patches/binutils-rh1312151.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- binutils-2.26.orig/bfd/elflink.c 2016-02-26 13:21:54.134859610 +0000
-+++ binutils-2.26/bfd/elflink.c 2016-02-26 13:22:49.083168157 +0000
-@@ -555,6 +555,19 @@ bfd_elf_record_link_assignment (bfd *out
- if (h == NULL)
- return provide;
-
-+ if (h->versioned == unknown)
-+ {
-+ /* Set versioned if symbol version is unknown. */
-+ char *version = strrchr (name, ELF_VER_CHR);
-+ if (version)
-+ {
-+ if (version > name && version[-1] != ELF_VER_CHR)
-+ h->versioned = versioned_hidden;
-+ else
-+ h->versioned = versioned;
-+ }
-+ }
-+
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
diff --git a/source/d/binutils/slack-desc b/source/d/binutils/slack-desc
index 417dc3332..b2d81d1d8 100644
--- a/source/d/binutils/slack-desc
+++ b/source/d/binutils/slack-desc
@@ -1,14 +1,14 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
binutils: binutils (GNU binary development tools)
binutils:
-binutils: Binutils is a collection of binary utilities. It includes "as" (the
+binutils: Binutils is a collection of binary utilities. It includes "as" (the
binutils: portable GNU assembler), "ld" (the GNU linker), and other utilities
binutils: for creating and working with binary programs.
binutils:
diff --git a/source/d/bison/bison.SlackBuild b/source/d/bison/bison.SlackBuild
index ea53e8be7..b11ccd7e7 100755
--- a/source/d/bison/bison.SlackBuild
+++ b/source/d/bison/bison.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2005-2008, 2009, 2010, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2005-2008, 2009, 2010, 2012, 2013, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,6 +20,7 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=bison
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
@@ -30,19 +31,26 @@ NUMJOBS=${NUMJOBS:--j6}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-bison
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
@@ -76,10 +84,10 @@ CFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=/usr/doc/bison-$VERSION \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG
+make install DESTDIR=$PKG || exit 1
find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
diff --git a/source/d/bison/slack-desc b/source/d/bison/slack-desc
index 9b4292530..02c40f6ae 100644
--- a/source/d/bison/slack-desc
+++ b/source/d/bison/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -12,8 +12,8 @@ bison: GNU "Bison" is a general-purpose parser generator that converts a
bison: grammar description for an LALR(1) context-free grammar into a C
bison: program to parse that grammar.
bison:
-bison: Bison is upward compatible with Yacc: all properly-written Yacc
-bison: grammars ought to work with Bison with no change. Anyone familiar
+bison: Bison is upward compatible with Yacc: all properly-written Yacc
+bison: grammars ought to work with Bison with no change. Anyone familiar
bison: with Yacc should be able to use Bison with little trouble.
bison:
bison:
diff --git a/source/d/ccache/ccache.SlackBuild b/source/d/ccache/ccache.SlackBuild
index ecd70ac38..16d64a717 100755
--- a/source/d/ccache/ccache.SlackBuild
+++ b/source/d/ccache/ccache.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2011, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,9 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=ccache
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -34,7 +36,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-ccache
@@ -57,7 +66,7 @@ find . \
./configure \
--prefix=/usr \
--mandir=/usr/man \
- --sysconfdir=/etc
+ --sysconfdir=/etc || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
@@ -79,7 +88,7 @@ fi
mkdir -p $PKG/usr/doc/ccache-$VERSION
cp -a \
- *.txt \
+ *.md *.txt *.html \
$PKG/usr/doc/ccache-$VERSION
# Strip binaries:
diff --git a/source/d/ccache/slack-desc b/source/d/ccache/slack-desc
index ebb56d940..f3fcf3b0e 100644
--- a/source/d/ccache/slack-desc
+++ b/source/d/ccache/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -14,6 +14,6 @@ ccache: being done again.
ccache:
ccache: ccache was written by Andrew Tridgell.
ccache:
-ccache:
+ccache: Homepage: https://ccache.samba.org/
ccache:
ccache:
diff --git a/source/d/clisp/clisp.SlackBuild b/source/d/clisp/clisp.SlackBuild
index f98057df1..4205aa137 100755
--- a/source/d/clisp/clisp.SlackBuild
+++ b/source/d/clisp/clisp.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2013, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2013, 2015, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,26 +20,35 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
-VERSION=2.49
-DIRNAME=2.49
-BUILD=${BUILD:-3}
+PKGNAM=clisp
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
# Bundled libraries:
-FFCALLVER=20120424cvs
+FFCALLVER=2.1
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
@@ -54,7 +63,6 @@ fi
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-clisp
@@ -64,12 +72,9 @@ mkdir -p $TMP $PKG
#=================================================================
# Build ffcall - needed for --dynamic-ffi with clisp.
cd $TMP
-rm -rf ffcall*
-tar xvf $CWD/ffcall-$FFCALLVER.tar.?z* || exit 1
-cd ffcall* || exit 1
-
-# Not sure if this is useful or not, but I'll leave it for MoZes:
-zcat $CWD/ffcall-arm.patch.gz | patch -p1 --verbose || exit 1
+rm -rf libffcall-$FFCALLVER
+tar xvf $CWD/libffcall-$FFCALLVER.tar.?z || exit 1
+cd libffcall-$FFCALLVER || exit 1
chown -R root:root .
find . \
@@ -83,22 +88,21 @@ CFLAGS="$SLKCFLAGS" \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
+ --enable-static=yes \
+ --enable-shared=no \
--build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
-# We need ffcall installed in order to build clisp:
-make install
-
-# Don't need this:
-rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.la
+# We need libffcall installed in order to build clisp:
+make install || exit 1
# Move docs around:
-mkdir -pm755 $PKG/usr/doc/clisp-$VERSION/ffcall-$FFCALLVER
+mkdir -pm755 $PKG/usr/doc/clisp-$VERSION/libffcall-$FFCALLVER
install -vpm644 README NEWS COPYING \
- $PKG/usr/doc/clisp-$VERSION/ffcall-$FFCALLVER
-mv -f $PKG/usr/share/html/* $PKG/usr/doc/clisp-$VERSION/ffcall-$FFCALLVER
+ $PKG/usr/doc/clisp-$VERSION/libffcall-$FFCALLVER
+mv -f $PKG/usr/share/html/* $PKG/usr/doc/clisp-$VERSION/libffcall-$FFCALLVER
rmdir $PKG/usr/share/html/
rmdir $PKG/usr/share/
@@ -107,8 +111,8 @@ rmdir $PKG/usr/share/
# OK, now we compile CLISP:
cd $TMP
rm -rf clisp-$VERSION
-tar xvf $CWD/clisp-$VERSION.tar.?z* || exit 1
-cd clisp-$DIRNAME || exit 1
+tar xvf $CWD/clisp-$VERSION.tar.?z || exit 1
+cd clisp-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -116,48 +120,51 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# Fix build failure with missing struct member:
+zcat $CWD/clisp.c_data.compact_empty_buckets.diff.gz | patch -p1 --verbose || exit
+
+# I'll be unsafe if I want to:
+export FORCE_UNSAFE_CONFIGURE=1
+
+# --cbc instead of --config below will check the build.
+# --cbcx will do even more extra checking.
+
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--docdir=/usr/doc/clisp-$VERSION \
+ --with-module=asdf \
+ --with-module=berkeley-db \
+ --with-module=bindings/glibc \
--with-module=clx/new-clx \
+ --with-module=dbus \
+ --with-module=gdbm \
+ --with-module=gtk2 \
--with-module=pcre \
--with-module=rawsock \
- --with-module=wildcard \
--with-module=zlib \
- --cbc with-gcc-wall \
+ --config builddir \
--with-dynamic-ffi || exit 1
-cd with-gcc-wall
-./makemake \
- --with-dynamic-ffi \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --with-module=clx/new-clx \
- --with-module=pcre \
- --with-module=rawsock \
- --with-module=wildcard \
- --with-module=zlib \
- --srcdir=../src \
- > Makefile
-make config.lisp
-make init
-make allc
-make $NUMJOBS lisp.run
-make interpreted.mem
-make halfcompiled.mem
-make lispinit.mem
-make manual
-make modular
+# Build:
+make $NUMJOBS -C builddir || make -C builddir || exit 1
-make install DESTDIR=$PKG || exit 1
+# Install into package:
+make -C builddir install DESTDIR=$PKG || exit 1
# Strip stuff:
find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+# Don't ship .la files:
+pushd $PKG
+ for lafile in usr/lib${LIBDIRSUFFIX}/*.la ; do
+ rm -f ${lafile} /${lafile}
+ done
+popd
+
#mv $PKG/usr/share/doc/clisp/* $PKG/usr/doc/clisp-$VERSION
rm -r $PKG/usr/share/doc
diff --git a/source/d/clisp/clisp.c_data.compact_empty_buckets.diff b/source/d/clisp/clisp.c_data.compact_empty_buckets.diff
new file mode 100644
index 000000000..0a3518487
--- /dev/null
+++ b/source/d/clisp/clisp.c_data.compact_empty_buckets.diff
@@ -0,0 +1,12 @@
+# Remove non-existant struct member:
+
+--- ./modules/berkeley-db/bdb.c.orig 2018-02-04 13:38:36.000000000 -0600
++++ ./modules/berkeley-db/bdb.c 2018-02-04 15:29:06.147941837 -0600
+@@ -2216,7 +2216,6 @@
+ c_data.compact_timeout = timeout;
+ c_data.compact_pages = pages;
+ SYSCALL(db->compact,(db,txn,pstart,pstop,&c_data,flags,&end));
+- pushSTACK(uint32_to_I(c_data.compact_empty_buckets));
+ pushSTACK(uint32_to_I(c_data.compact_pages_free));
+ pushSTACK(uint32_to_I(c_data.compact_pages_examine));
+ pushSTACK(uint32_to_I(c_data.compact_levels));
diff --git a/source/d/clisp/ffcall-arm.patch b/source/d/clisp/ffcall-arm.patch
deleted file mode 100644
index 8e8509b1e..000000000
--- a/source/d/clisp/ffcall-arm.patch
+++ /dev/null
@@ -1,93 +0,0 @@
---- ./callback/trampoline_r/cache-armel.c.orig 2009-04-27 10:44:13.000000000 -0600
-+++ ./callback/trampoline_r/cache-armel.c 2013-09-06 11:00:00.000000000 -0600
-@@ -12,8 +12,9 @@
-
- void __TR_clear_cache (char *first_addr, char *last_addr)
- {
-- register unsigned long _beg __asm ("a1") = first_addr;
-- register unsigned long _end __asm ("a2") = last_addr;
-+ register unsigned long _beg __asm ("a1") = (unsigned long) first_addr;
-+ register unsigned long _end __asm ("a2") = (unsigned long) last_addr;
- register unsigned long _flg __asm ("a3") = 0;
-- __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg));
-+ register unsigned long _sys __asm ("r7") = __ARM_NR_cacheflush;
-+ __asm __volatile__ ("swi 0x0" : "=r" (_beg) : "0" (_beg), "r" (_end), "r" (_flg), "r" (_sys));
- }
---- ./callback/trampoline_r/cache-armel.s.orig 2009-04-27 10:44:13.000000000 -0600
-+++ ./callback/trampoline_r/cache-armel.s 2013-09-06 13:00:00.000000000 -0600
-@@ -1,5 +1,5 @@
-- .cpu arm10tdmi
-- .fpu softvfp
-+ .arch armv7-a
-+ .fpu vfpv3-d16
- .file "cache-armel.c"
- .text
- .align 2
-@@ -9,10 +9,13 @@ __TR_clear_cache:
- @ args = 0, pretend = 0, frame = 0
- @ frame_needed = 0, uses_anonymous_args = 0
- @ link register save eliminated.
-- @ lr needed for prologue
-+ str r7, [sp, #-4]!
- mov r2, #0
-+ mov r7, #2
-+ movt r7, 15
- #APP
-- swi 0x9f0002
-+ swi 0x0
-+ ldr r7, [sp], #4
- bx lr
- .size __TR_clear_cache, .-__TR_clear_cache
-- .ident "GCC: (GNU) 3.4.4 (release) (CodeSourcery ARM 2005q3-2)"
-+ .ident "GCC: (GNU) 4.8.1 20130829 (Red Hat 4.8.1-7)"
---- ./trampoline/cache-armel.c.orig 2009-04-27 10:44:14.000000000 -0600
-+++ ./trampoline/cache-armel.c 2013-09-06 11:00:00.000000000 -0600
-@@ -12,8 +12,9 @@
-
- void __TR_clear_cache (char *first_addr, char *last_addr)
- {
-- register unsigned long _beg __asm ("a1") = first_addr;
-- register unsigned long _end __asm ("a2") = last_addr;
-+ register unsigned long _beg __asm ("a1") = (unsigned long) first_addr;
-+ register unsigned long _end __asm ("a2") = (unsigned long) last_addr;
- register unsigned long _flg __asm ("a3") = 0;
-- __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg));
-+ register unsigned long _sys __asm ("r7") = __ARM_NR_cacheflush;
-+ __asm __volatile__ ("swi 0x0" : "=r" (_beg) : "0" (_beg), "r" (_end), "r" (_flg), "r" (_sys));
- }
---- ./trampoline/cache-armel.s.orig 2009-04-27 10:44:14.000000000 -0600
-+++ ./trampoline/cache-armel.s 2013-09-06 13:00:00.000000000 -0600
-@@ -1,24 +1,21 @@
-- .cpu arm10tdmi
-- .fpu softvfp
-+ .arch armv7-a
-+ .fpu vfpv3-d16
- .file "cache-armel.c"
- .text
- .align 2
- .global __TR_clear_cache
- .type __TR_clear_cache, %function
- __TR_clear_cache:
-- @ args = 0, pretend = 0, frame = 8
-+ @ args = 0, pretend = 0, frame = 0
- @ frame_needed = 0, uses_anonymous_args = 0
- @ link register save eliminated.
-- sub sp, sp, #8
-- @ lr needed for prologue
-- str r0, [sp, #4]
-- str r1, [sp, #0]
-- ldr r0, [sp, #4]
-- ldr r1, [sp, #0]
-+ str r7, [sp, #-4]!
- mov r2, #0
-+ mov r7, #2
-+ movt r7, 15
- #APP
-- swi 0x9f0002
-- add sp, sp, #8
-+ swi 0x0
-+ ldr r7, [sp], #4
- bx lr
- .size __TR_clear_cache, .-__TR_clear_cache
-- .ident "GCC: (GNU) 3.4.4 (release) (CodeSourcery ARM 2005q3-2)"
-+ .ident "GCC: (GNU) 4.8.1 20130829 (Red Hat 4.8.1-7)"
diff --git a/source/d/clisp/slack-desc b/source/d/clisp/slack-desc
index 5fb2f1954..5dc55efad 100644
--- a/source/d/clisp/slack-desc
+++ b/source/d/clisp/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -13,7 +13,7 @@ clisp: GNU CLISP is a Common Lisp implementation by Bruno Haible of Karlsruhe
clisp: University and Michael Stoll of Munich University, both in Germany.
clisp: It mostly supports the Lisp described in the ANSI Common Lisp standard.
clisp: The user interface comes in German, English, French, Spanish, Dutch
-clisp: and Russian. GNU CLISP includes an interpreter, a compiler, a
+clisp: and Russian. GNU CLISP includes an interpreter, a compiler, a
clisp: debugger, a large subset of CLOS, a foreign language interface and a
-clisp: socket interface. An X11 interface is available through CLX and
+clisp: socket interface. An X11 interface is available through CLX and
clisp: Garnet.
diff --git a/source/d/clisp/source.download b/source/d/clisp/source.download
index 4de176999..06bc8c9b2 100755
--- a/source/d/clisp/source.download
+++ b/source/d/clisp/source.download
@@ -1,3 +1,14 @@
-# http://www.haible.de/bruno/packages-ffcall-README.html
-# wget -c http://www.haible.de/bruno/gnu/ffcall-1.10.tar.gz
-# wget -c ftp://download.fedora.redhat.com/pub/fedora/linux/development/source/SRPMS/ffcall-1.10-2.20080704cvs.fc10.src.rpm
+# Pull the latest clisp sources from the upstream mercurial repository:
+rm -rf clisp-2.49
+hg clone http://hg.code.sf.net/p/clisp/clisp clisp-2.49
+# Determine date and changeset for tarball labeling:
+DATE="$(date -d "$( cd clisp-2.49 ; hg parent | grep date: | cut -b 14- | cut -f 1 -d +)" +"%Y%m%d")"
+CHANGESET="$( cd clisp-2.49 ; hg parent | grep changeset: | cut -f 3 -d :)"
+# Don't package .hg:
+rm -fr clisp-2.49/.hg*
+# Create tarball:
+mv clisp-2.49 clisp-2.49.${DATE}.${CHANGESET}
+tar cf clisp-2.49.${DATE}.${CHANGESET}.tar clisp-2.49.${DATE}.${CHANGESET}
+plzip -9 -n 6 clisp-2.49.${DATE}.${CHANGESET}.tar
+# Clean up:
+rm -rf clisp-2.49.${DATE}.${CHANGESET}
diff --git a/source/d/cmake/cmake.SlackBuild b/source/d/cmake/cmake.SlackBuild
index 1f832f00f..6bd22500c 100755
--- a/source/d/cmake/cmake.SlackBuild
+++ b/source/d/cmake/cmake.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011, 2013, 2015 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010, 2011, 2013, 2015, 2017, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,8 +20,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=cmake
-VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
# Automatically determine the architecture we're building on:
@@ -34,6 +36,14 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i586" ]; then
@@ -46,7 +56,6 @@ else
SLKCFLAGS="-O2"
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
@@ -55,8 +64,8 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf $PKGNAM-$VERSION
-tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
-cd $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
+cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
@@ -76,7 +85,7 @@ cd cmake-build
--no-system-jsoncpp \
--system-zlib \
--system-bzip2 \
- --system-libarchive
+ --system-libarchive || exit 1
# --system-libs
# --sphinx-man \
@@ -93,8 +102,7 @@ CXXFLAGS="$SLKCFLAGS" \
--no-system-jsoncpp \
--system-zlib \
--system-bzip2 \
- --system-libarchive \
- --build=$ARCH-slackware-linux
+ --system-libarchive || exit 1
# --system-libs \
# --sphinx-man \
@@ -104,7 +112,7 @@ make install DESTDIR=$PKG || exit 1
# Install preprocessed man pages instead of adding six new python packages:
( cd $PKG
- tar xf $CWD/cmake.manpages.tar.xz
+ tar xf $CWD/cmake.manpages.tar.?z
)
# If there's a ChangeLog, installing at least part of the recent history
diff --git a/source/d/cmake/extract-manpages-from-binary.sh b/source/d/cmake/extract-manpages-from-binary.sh
new file mode 100755
index 000000000..59dc561b7
--- /dev/null
+++ b/source/d/cmake/extract-manpages-from-binary.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Copyright 2017 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This is a script to extract the manpages from cmake-*-Linux-x86_64.tar.gz
+# and output them as cmake.manpages.tar.xz in the current directory.
+
+rm -rf tmp-manpages
+mkdir tmp-manpages
+tar xf cmake-*-Linux-x86_64.tar.?z
+mv cmake-*-Linux-x86_64/man tmp-manpages
+rm -r cmake-*-Linux-x86_64
+mkdir tmp-manpages/usr
+mv tmp-manpages/man tmp-manpages/usr
+chown -R root:root tmp-manpages
+cd tmp-manpages
+tar cf ../cmake.manpages.tar .
+cd ..
+lzip -9 -f cmake.manpages.tar
+rm -r tmp-manpages
diff --git a/source/d/cmake/slack-desc b/source/d/cmake/slack-desc
index 8fb5c8ddc..016e58955 100644
--- a/source/d/cmake/slack-desc
+++ b/source/d/cmake/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -13,7 +13,7 @@ cmake: and compiler independent configuration files. CMake generates
cmake: native makefiles and workspaces that can be used in the
cmake: compiler environment of your choice.
cmake:
-cmake: CMake's home on the web is: http://www.cmake.org
+cmake: Homepage: http://www.cmake.org
cmake:
cmake:
cmake:
diff --git a/source/d/cscope/cscope.SlackBuild b/source/d/cscope/cscope.SlackBuild
index e88ece4d8..df452d9d1 100755
--- a/source/d/cscope/cscope.SlackBuild
+++ b/source/d/cscope/cscope.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2016 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=cscope
-VERSION=${VERSION:-$(echo $(basename $(echo $PRGNAM-*.tar.xz | cut -f 2 -d -) .tar.xz) | cut -f 2 -d -)}
-BUILD=${BUILD:-1}
+VERSION=${VERSION:-$(echo $(basename $(echo $PKGNAM-*.tar.xz | cut -f 2 -d -) .tar.xz) | cut -f 2 -d -)}
+BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -35,7 +36,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-cscope
diff --git a/source/d/cscope/slack-desc b/source/d/cscope/slack-desc
index b2126b523..4521c5f7e 100644
--- a/source/d/cscope/slack-desc
+++ b/source/d/cscope/slack-desc
@@ -1,14 +1,14 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
cscope: cscope (source code browsing tool)
cscope:
-cscope: Cscope is a text screen based source browsing tool. Although it is
+cscope: Cscope is a text screen based source browsing tool. Although it is
cscope: primarily designed to search C code (including lex and yacc files),
cscope: it can also be used for C++ code.
cscope:
diff --git a/source/d/cvs/cvs.SlackBuild b/source/d/cvs/cvs.SlackBuild
index 81250f4a0..1c5583293 100755
--- a/source/d/cvs/cvs.SlackBuild
+++ b/source/d/cvs/cvs.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010, 2013, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,24 +20,34 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+PKGNAM=cvs
VERSION=1.11.23
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
@@ -46,7 +56,6 @@ else
SLKCFLAGS="-O2"
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-cvs
rm -rf $PKG
@@ -55,7 +64,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf cvs-$VERSION
tar xvf $CWD/cvs-$VERSION.tar.bz2 || exit 1
-cd cvs-$VERSION
+cd cvs-$VERSION || exit 1
# Patch to handle recent glib crypt():
zcat $CWD/cvs.crypt-2.diff.gz | patch -p1 --verbose || exit 1
@@ -73,7 +82,7 @@ CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--mandir=/usr/man \
- --infodir=/usr/info
+ --infodir=/usr/info || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
@@ -86,14 +95,17 @@ gzip -9 $PKG/usr/info/*
gzip -9 $PKG/usr/man/man?/*.?
-( cd doc ; make txt )
mkdir -p $PKG/usr/doc/cvs-$VERSION
cp -a \
BUGS COPYING* DEVEL-CVS FAQ HACKING INSTALL MINOR-BUGS NEWS PROJECTS \
README TESTS TODO \
$PKG/usr/doc/cvs-$VERSION
-cat doc/cvs.txt | gzip -9c > $PKG/usr/doc/cvs-$VERSION/cvs.txt.gz
-cat doc/cvsclient.txt | gzip -9c > $PKG/usr/doc/cvs-$VERSION/cvsclient.txt.gz
+
+# This fails, but who cares in 2018
+#( cd doc ; make txt || exit 1 ) || exit 1
+#cat doc/cvs.txt | gzip -9c > $PKG/usr/doc/cvs-$VERSION/cvs.txt.gz
+#cat doc/cvsclient.txt | gzip -9c > $PKG/usr/doc/cvs-$VERSION/cvsclient.txt.gz
+
chmod 644 $PKG/usr/doc/cvs-$VERSION/*
gzip -9 $PKG/usr/doc/cvs-$VERSION/FAQ
( cd $PKG/usr/doc/cvs-$VERSION ; rm -rf contrib )
diff --git a/source/d/cvs/slack-desc b/source/d/cvs/slack-desc
index 9581cb88c..4e540c2ae 100644
--- a/source/d/cvs/slack-desc
+++ b/source/d/cvs/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -10,10 +10,10 @@ cvs: cvs (Concurrent Versions System)
cvs:
cvs: CVS is a version control system, which allows you to keep old versions
cvs: of files (usually source code), keep a log of who, when, and why
-cvs: changes occurred, etc., like RCS or SCCS. It handles multiple
+cvs: changes occurred, etc., like RCS or SCCS. It handles multiple
cvs: developers, multiple directories, triggers to enable/log/control
cvs: various operations, and can work over a wide area network.
cvs:
-cvs: Some of the people who have worked on CVS include: Dick Grune,
+cvs: Some of the people who have worked on CVS include: Dick Grune,
cvs: Brian Berliner, Jeff Polk, and others too numerous to mention.
cvs:
diff --git a/source/d/dev86/dev86.SlackBuild b/source/d/dev86/dev86.SlackBuild
index 583e821c0..1c10de807 100755
--- a/source/d/dev86/dev86.SlackBuild
+++ b/source/d/dev86/dev86.SlackBuild
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2007, 2008, 2015 Heinz Wiesinger, Amsterdam, The Netherlands
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,10 +21,12 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-PRGNAM=dev86
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=dev86
SRCNAM=Dev86src
VERSION=0.16.21
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -36,9 +38,16 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
-PKG=$TMP/package-$PRGNAM
+PKG=$TMP/package-$PKGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
@@ -58,9 +67,9 @@ fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
-rm -rf $PRGNAM-$VERSION
+rm -rf $PKGNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.?z* || exit 1
-cd $PRGNAM-$VERSION || exit 1
+cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -69,7 +78,7 @@ find . \
-exec chmod 644 {} \;
#Does not compile with changed CFLAGS
-#CC="gcc" make CFLAGS="-Wall -Wstrict-prototypes $SLKCFLAGS -g" DIST=$PKG
+#CC="gcc" make CFLAGS="-Wall -Wstrict-prototypes $SLKCFLAGS -g" DIST=$PKG || exit 1
CC="gcc" \
make \
DIST=$PKG MANDIR=/usr/man LIBDIR=/usr/lib${LIBDIRSUFFIX}/bcc \
@@ -84,15 +93,15 @@ find $PKG | xargs file | grep -e "executable" -e "shared object" \
for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
)
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a Changes Contributors COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a Changes Contributors COPYING README $PKG/usr/doc/$PKGNAM-$VERSION
for i in bootblocks copt dis88 elksemu unproto ; do
- cp -a $i/README $PKG/usr/doc/$PRGNAM-$VERSION/README.$i ;
+ cp -a $i/README $PKG/usr/doc/$PKGNAM-$VERSION/README.$i ;
done
find $PKG/usr/doc -type f -exec chmod 0644 {} \;
if [ "$ARCH" = "x86_64" ]; then # Remove traces of elks
- rm -f $PKG/usr/doc/$PRGNAM-$VERSION/README.elksemu
+ rm -f $PKG/usr/doc/$PKGNAM-$VERSION/README.elksemu
find $PKG/usr/man -name "elks*.*" -exec rm -f {} \;
fi
@@ -100,4 +109,4 @@ mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD.txz
+/sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/d/dev86/slack-desc b/source/d/dev86/slack-desc
index 50c46cef2..aa8e672f1 100644
--- a/source/d/dev86/slack-desc
+++ b/source/d/dev86/slack-desc
@@ -2,7 +2,7 @@
dev86: dev86 (8086 development utilities)
dev86:
dev86: This is a complete 8086 assembler and loader which can make 32-bit
-dev86: code for the 386+ processors. In the past it was used to compile the
+dev86: code for the 386+ processors. In the past it was used to compile the
dev86: 16-bit bootsector and setup binaries for the kernel, but modern
dev86: (2.4.x or newer) kernels use GNU ld instead.
dev86:
diff --git a/source/d/distcc/distcc.SlackBuild b/source/d/distcc/distcc.SlackBuild
index 99a9a5dbc..7d6947f49 100755
--- a/source/d/distcc/distcc.SlackBuild
+++ b/source/d/distcc/distcc.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2013, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,23 +20,32 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
-VERSION=3.1
-BUILD=${BUILD:-1}
+PKGNAM=distcc
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-distcc
@@ -45,7 +54,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf distcc-$VERSION
-tar xvf $CWD/distcc-$VERSION.tar.xz || exit 1
+tar xvf $CWD/distcc-$VERSION.tar.?z || exit 1
cd distcc-$VERSION || exit 1
chown -R root:root .
find . \
@@ -62,7 +71,7 @@ find . \
--without-gnome \
--without-avahi \
--disable-Werror \
- --target=$ARCH-slackware-linux
+ --target=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG docdir=/usr/doc/distcc-$VERSION || exit 1
diff --git a/source/d/distcc/distcc.url b/source/d/distcc/distcc.url
new file mode 100644
index 000000000..493d7c8e4
--- /dev/null
+++ b/source/d/distcc/distcc.url
@@ -0,0 +1 @@
+https://github.com/distcc/distcc
diff --git a/source/d/distcc/slack-desc b/source/d/distcc/slack-desc
index 121e97226..431c46ca2 100644
--- a/source/d/distcc/slack-desc
+++ b/source/d/distcc/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
distcc: distcc (distributed C/C++ compiler/daemon)
distcc:
distcc: distcc allows compilation of C code to be distributed across several
-distcc: machines on a network. distcc should always generate the same results
+distcc: machines on a network. distcc should always generate the same results
distcc: as a local compile, is simple to install and use, and is often
distcc: significantly faster than a local compile.
distcc:
-distcc: IMPORTANT SECURITY NOTE: distccd should only run on trusted networks.
+distcc: IMPORTANT SECURITY NOTE: distccd should only run on trusted networks.
distcc:
distcc: distcc was written by Martin Pool.
distcc:
diff --git a/source/d/doxygen/doxygen.9468ede.diff b/source/d/doxygen/doxygen.9468ede.diff
new file mode 100644
index 000000000..b189a85af
--- /dev/null
+++ b/source/d/doxygen/doxygen.9468ede.diff
@@ -0,0 +1,52 @@
+From 9468ede259153cf79eb8d61635389744e9a2ee7d Mon Sep 17 00:00:00 2001
+From: Dimitri van Heesch <dimitri@stack.nl>
+Date: Sun, 29 Oct 2017 11:47:48 +0100
+Subject: [PATCH] Bug 789168 - Increasing access of inherited C++ members with
+ 'using...' is not recognized by Doxygen
+
+---
+ src/doxygen.cpp | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/src/doxygen.cpp b/src/doxygen.cpp
+index d3554cffd..ec97d4354 100644
+--- a/src/doxygen.cpp
++++ b/src/doxygen.cpp
+@@ -2112,9 +2112,8 @@ static void findUsingDeclImports(EntryNav *rootNav)
+ (rootNav->parent()->section()&Entry::COMPOUND_MASK) // in a class/struct member
+ )
+ {
+- //printf("Found using declaration %s at line %d of %s inside section %x\n",
+- // root->name.data(),root->startLine,root->fileName.data(),
+- // root->parent->section);
++ //printf("Found using declaration %s inside section %x\n",
++ // rootNav->name().data(), rootNav->parent()->section());
+ QCString fullName=removeRedundantWhiteSpace(rootNav->parent()->name());
+ fullName=stripAnonymousNamespaceScope(fullName);
+ fullName=stripTemplateSpecifiersFromScope(fullName);
+@@ -2130,7 +2129,7 @@ static void findUsingDeclImports(EntryNav *rootNav)
+ ClassDef *bcd = getResolvedClass(cd,0,scope); // todo: file in fileScope parameter
+ if (bcd)
+ {
+- //printf("found class %s\n",bcd->name().data());
++ //printf("found class %s memName=%s\n",bcd->name().data(),memName.data());
+ MemberNameInfoSDict *mndict=bcd->memberNameInfoSDict();
+ if (mndict)
+ {
+@@ -11181,7 +11180,6 @@ void parseInput()
+ g_s.end();
+
+ g_s.begin("Searching for members imported via using declarations...\n");
+- findUsingDeclImports(rootNav);
+ // this should be after buildTypedefList in order to properly import
+ // used typedefs
+ findUsingDeclarations(rootNav);
+@@ -11249,6 +11247,7 @@ void parseInput()
+ g_s.begin("Searching for member function documentation...\n");
+ findObjCMethodDefinitions(rootNav);
+ findMemberDocumentation(rootNav); // may introduce new members !
++ findUsingDeclImports(rootNav); // may introduce new members !
+
+ transferRelatedFunctionDocumentation();
+ transferFunctionDocumentation();
+
diff --git a/source/d/doxygen/doxygen.SlackBuild b/source/d/doxygen/doxygen.SlackBuild
index 2a4a07338..ce86b9f4a 100755
--- a/source/d/doxygen/doxygen.SlackBuild
+++ b/source/d/doxygen/doxygen.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,24 +20,34 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
-VERSION=${VERSION:-$(basename $(echo doxygen-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev) .src)}
-BUILD=${BUILD:-1}
+PKGNAM=doxygen
+VERSION=${VERSION:-$(basename $(echo doxygen-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev) .src)}
+BUILD=${BUILD:-3}
NUMJOBS=${NUMJOBS:-" -j7 "}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@@ -50,7 +60,6 @@ else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-doxygen
@@ -58,8 +67,8 @@ rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf doxygen-$VERSION
-tar xvf $CWD/doxygen-${VERSION}.src.tar.?z* || exit 1
-cd doxygen-$VERSION
+tar xvf $CWD/doxygen-${VERSION}.src.tar.?z || exit 1
+cd doxygen-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -67,25 +76,38 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
-CFLAGS="$SLKCFLAGS" \
-CXXFLAGS="$SLKCFLAGS" \
-QTDIR=/usr/lib${LIBDIRSUFFIX}/qt \
-./configure \
- --shared \
- --release \
- --prefix /usr \
- --docdir /usr/doc/doxygen-$VERSION \
- --with-doxywizard
-
-make $NUMJOBS || make || exit 1
-make install INSTALL=$PKG/usr DOCDIR=$PKG/usr/doc/doxygen-$VERSION
-make install_docs INSTALL=$PKG/usr DOCDIR=$PKG/usr/doc/doxygen-$VERSION
+# Revert patch that leads to segfaults:
+zcat $CWD/doxygen.9468ede.diff.gz | patch -p1 -R --verbose || exit 1
+
+mkdir build
+cd build
+ cmake \
+ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DDOC_INSTALL_DIR:STRING="/doc/doxygen-$VERSION" \
+ -Dbuild_app=yes \
+ -Dbuild_doc=yes \
+ -Dbuild_parse=yes \
+ -Dbuild_search=yes \
+ -Dbuild_wizard=yes \
+ -Dbuild_xmlparser=yes \
+ -Duse_sqlite3=yes \
+ -G "Unix Makefiles" .. || exit 1
+ make $NUMJOBS || make || exit 1
+ make $NUMJOBS docs || make docs || exit 1
+ make install DESTDIR=$PKG || exit 1
+cd ..
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
-# If there are misplaced man pages, fix that:
-mv $PKG/usr/*.1 $PKG/usr/man/man1
+# Fix manpage location
+mv $PKG/usr/share/man $PKG/usr/man
+
+# Removed unused /usr/share
+rmdir $PKG/usr/share 2>/dev/null
# Compress and if needed symlink the man pages:
if [ -d $PKG/usr/man ]; then
diff --git a/source/d/doxygen/slack-desc b/source/d/doxygen/slack-desc
index df95eb7b4..8220d232f 100644
--- a/source/d/doxygen/slack-desc
+++ b/source/d/doxygen/slack-desc
@@ -1,17 +1,17 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
doxygen: doxygen (documentation generator)
doxygen:
doxygen: Doxygen is a documentation system for C++, C, Java, IDL, and to some
-doxygen: extent PHP and C#. Doxygen generates project documentation using
+doxygen: extent PHP and C#. Doxygen generates project documentation using
doxygen: special documentation blocks in the source code, easing the process of
-doxygen: keeping docs and code in sync. Doxygen produces documentation in
+doxygen: keeping docs and code in sync. Doxygen produces documentation in
doxygen: several output formats, including HTML, LaTeX, man pages, RTF, XML,
doxygen: compressed HTML, PostScript, and PDF.
doxygen:
diff --git a/source/d/flex/flex.SlackBuild b/source/d/flex/flex.SlackBuild
index b79f0e768..76956313e 100755
--- a/source/d/flex/flex.SlackBuild
+++ b/source/d/flex/flex.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2006, 2007, 2008, 2009, 2010, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006, 2007, 2008, 2009, 2010, 2013, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=flex
-VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.lz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -35,9 +36,16 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
@@ -60,7 +68,7 @@ fi
cd $TMP
rm -rf ${PKGNAM}-${VERSION}
-tar xvf $CWD/${PKGNAM}-$VERSION.tar.xz || exit 1
+tar xvf $CWD/${PKGNAM}-$VERSION.tar.lz || exit 1
cd ${PKGNAM}-$VERSION
# Make sure ownerships and permissions are sane:
@@ -71,6 +79,9 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# Fix an issue introduced with recent glibc versions. Thanks to LFS:
+sed -i "/math.h/a #include <malloc.h>" src/flexdef.h
+
# Configure:
CFLAGS="$SLKCFLAGS" \
./configure \
@@ -79,12 +90,15 @@ CFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=/usr/doc/flex-${VERSION} \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
# Build and install:
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
# A symlink to harken back to the Goodle days:
( cd $PKG/usr/bin ; ln -sf flex lex )
diff --git a/source/d/flex/slack-desc b/source/d/flex/slack-desc
index 0fe0399df..6e7274a96 100644
--- a/source/d/flex/slack-desc
+++ b/source/d/flex/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
flex: flex (fast lexical analyzer generator)
flex:
flex: flex is a tool for generating programs that perform pattern matching
-flex: on text. flex is a rewrite of the AT&T Unix lex tool (the two
+flex: on text. flex is a rewrite of the AT&T Unix lex tool (the two
flex: implementations do not share any code, though), with some extensions
flex: (and incompatibilities).
flex:
-flex:
+flex: Homepage: https://github.com/westes/flex
flex:
flex:
flex:
diff --git a/source/d/gcc/antlr-runtime-3.4.jar b/source/d/gcc/antlr-runtime-3.4.jar
deleted file mode 100644
index 865a537b0..000000000
--- a/source/d/gcc/antlr-runtime-3.4.jar
+++ /dev/null
Binary files differ
diff --git a/source/d/gcc/create_gcj_jvm.sh b/source/d/gcc/create_gcj_jvm.sh
deleted file mode 100644
index d1011860f..000000000
--- a/source/d/gcc/create_gcj_jvm.sh
+++ /dev/null
@@ -1,93 +0,0 @@
-# ---------------------------------------------------------------------------
-# This script creates a directory structure below /usr/lib/jvm and populates
-# it with symlinks to GCC binaries.
-# This will work as a compatibility layer to emulate an Oracle JDK/JRE.
-# This emulation is required in order to compile OpenJDK using GNU java.
-#
-# The same can automatically be achieved in Slackware's gcc packages if
-# the 'configure' command is called with the following additional parameters:
-# --enable-java-home \
-# --with-java-home=/usr/lib$LIBDIRSUFFIX/jvm/jre \
-# --with-jvm-root-dir=/usr/lib$LIBDIRSUFFIX/jvm \
-# --with-jvm-jar-dir=/usr/lib$LIBDIRSUFFIX/jvm/jvm-exports \
-# --with-arch-directory=$LIB_ARCH \
-#
-# Author: Eric Hameleers <alien@slackware.com> December 2011
-# ---------------------------------------------------------------------------
-
-# Automatically determine the architecture we're building on:
-if [ -z "$ARCH" ]; then
- case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
- arm*) export ARCH=arm ;;
- # Unless $ARCH is already set, use uname -m for all other archs:
- *) export ARCH=$( uname -m ) ;;
- esac
-fi
-
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
- LIBDIRSUFFIX=""
- LIB_ARCH=i386
-elif [ "$ARCH" = "i686" ]; then
- SLKCFLAGS="-O2 -march=i686 -mtune=i686"
- LIBDIRSUFFIX=""
- LIB_ARCH=i386
-elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2 -fPIC"
- LIBDIRSUFFIX="64"
- LIB_ARCH=amd64
-else
- SLKCFLAGS="-O2"
- LIBDIRSUFFIX=""
- LIB_ARCH=$ARCH
-fi
-
-# Where does the OpenJDK SlackBuild expect the GNU java compatibility symlinks:
-JVM=${1:-/usr/lib${LIBDIRSUFFIX}/jvm}
-BINDIR=/usr/bin
-
-# What version of GCC do we have installed:
-GCJVER=$(gcj -dumpversion)
-
-# First, remove the old set of symlinks if they should exist:
-rm -fr $JVM
-
-# Create a JDK compatible directory structure for GNU java:
-mkdir -p $JVM
-mkdir -p $JVM/bin
-mkdir -p $JVM/jre/bin
-mkdir -p $JVM/jre/lib/${LIB_ARCH}/client
-mkdir -p $JVM/jre/lib/${LIB_ARCH}/server
-mkdir -p $JVM/lib
-
-ln -sf $BINDIR/gjar $JVM/bin/jar
-ln -sf $BINDIR/grmic $JVM/bin/rmic
-ln -sf $BINDIR/gjavah $JVM/bin/javah
-ln -sf $BINDIR/jcf-dump $JVM/bin/javap
-ln -sf $BINDIR/gappletviewer $JVM/bin/appletviewer
-ln -sf $BINDIR/grmiregistry $JVM/bin/rmiregistry
-ln -sf $BINDIR/grmiregistry $JVM/jre/bin/rmiregistry
-ln -sf $BINDIR/gkeytool $JVM/bin/keytool
-ln -sf $BINDIR/gkeytool $JVM/jre/bin/keytool
-ln -sf $BINDIR/gij $JVM/bin/java
-ln -sf $BINDIR/ecj $JVM/bin/javac
-ln -sf /usr/lib/gcj-${GCJVER}-11/libjvm.so $JVM/jre/lib/${LIB_ARCH}/client/libjvm.so
-ln -sf /usr/lib/gcj-${GCJVER}-11/libjvm.so $JVM/jre/lib/${LIB_ARCH}/server/libjvm.so
-ln -sf /usr/lib/gcj-${GCJVER}-11/libjawt.so $JVM/jre/lib/${LIB_ARCH}/libjawt.so
-ln -sf /usr/share/java/libgcj-${GCJVER}.jar $JVM/jre/lib/rt.jar
-ln -sf /usr/share/java/libgcj-tools-${GCJVER}.jar $JVM/lib/tools.jar
-ln -sf /usr/include/c++/${GCJVER}/gnu/java $JVM/include
-
-# Add a Eclipse Java Compiler wrapper which is required
-# for bootstrapping OpenJDK using GNU java:
-cat <<EOT > /usr/bin/ecj
-#!/bin/sh
-
-CLASSPATH=/usr/share/java/ecj.jar\${CLASSPATH:+:}\$CLASSPATH \
- java org.eclipse.jdt.internal.compiler.batch.Main "\$@"
-
-EOT
-chmod 755 /usr/bin/ecj
-
-
diff --git a/source/d/gcc/ecj-4.9.jar b/source/d/gcc/ecj-4.9.jar
deleted file mode 100644
index 29dc442ff..000000000
--- a/source/d/gcc/ecj-4.9.jar
+++ /dev/null
Binary files differ
diff --git a/source/d/gcc/ecj.sh b/source/d/gcc/ecj.sh
deleted file mode 100644
index 1d8b79793..000000000
--- a/source/d/gcc/ecj.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-CLASSPATH=@JAVADIR@/ecj.jar${CLASSPATH:+:}$CLASSPATH \
- java org.eclipse.jdt.internal.compiler.batch.Main "$@"
-
diff --git a/source/d/gcc/ecj.url b/source/d/gcc/ecj.url
deleted file mode 100644
index 9a28b2ce6..000000000
--- a/source/d/gcc/ecj.url
+++ /dev/null
@@ -1 +0,0 @@
-ftp://sourceware.org/pub/java/ecj-4.9.jar
diff --git a/source/d/gcc/fastjar-patches/1000-fastjar-0.97-segfault.patch b/source/d/gcc/fastjar-patches/1000-fastjar-0.97-segfault.patch
deleted file mode 100644
index ab6262407..000000000
--- a/source/d/gcc/fastjar-patches/1000-fastjar-0.97-segfault.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-2009-01-14 Jakub Jelinek <jakub@redhat.com>
-
- * jartool.c (make_manifest): Initialize current_time before
- calling unix2dostime on it.
-
---- fastjar-0.97/jartool.c.jj 2008-10-15 18:35:37.000000000 +0200
-+++ fastjar-0.97/jartool.c 2009-01-14 15:40:50.000000000 +0100
-@@ -820,6 +820,10 @@ int make_manifest(int jfd, const char *m
- int mod_time; /* file modification time */
- struct zipentry *ze;
-
-+ current_time = time(NULL);
-+ if(current_time == (time_t)-1)
-+ exit_on_error("time");
-+
- mod_time = unix2dostime(&current_time);
-
- /* If we are creating a new manifest, create a META-INF directory entry */
-@@ -828,10 +832,6 @@ int make_manifest(int jfd, const char *m
-
- memset((file_header + 12), '\0', 16); /*clear mod time, crc, size fields*/
-
-- current_time = time(NULL);
-- if(current_time == (time_t)-1)
-- exit_on_error("time");
--
- PACK_UB2(file_header, LOC_EXTRA, 0);
- PACK_UB2(file_header, LOC_COMP, 0);
- PACK_UB2(file_header, LOC_FNLEN, nlen);
diff --git a/source/d/gcc/fastjar-patches/1001-fastjar-0.97-len1.patch b/source/d/gcc/fastjar-patches/1001-fastjar-0.97-len1.patch
deleted file mode 100644
index 722351d33..000000000
--- a/source/d/gcc/fastjar-patches/1001-fastjar-0.97-len1.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-2009-12-21 Chris Ball <cjb@laptop.org>
-
- * jartool.c (add_file_to_jar): Test write return value against -1
- instead of 1.
-
---- fastjar-0.97/jartool.c.jj 2008-10-15 12:35:37.000000000 -0400
-+++ fastjar-0.97/jartool.c 2009-12-22 06:48:09.309530000 -0500
-@@ -1257,7 +1257,7 @@ int add_file_to_jar(int jfd, int ffd, co
- exit_on_error("write");
-
- /* write the file name to the zip file */
-- if (1 == write(jfd, fname, file_name_length))
-+ if (-1 == write(jfd, fname, file_name_length))
- exit_on_error("write");
-
- if(verbose){
diff --git a/source/d/gcc/fastjar-patches/1002-fastjar-0.97-filename0.patch b/source/d/gcc/fastjar-patches/1002-fastjar-0.97-filename0.patch
deleted file mode 100644
index 34a02a74f..000000000
--- a/source/d/gcc/fastjar-patches/1002-fastjar-0.97-filename0.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-2010-03-01 Richard Guenther <rguenther@suse.de>
-
- * jartool.c (read_entries): Properly zero-terminate filename.
-
---- fastjar-0.97/jartool.c 6 Sep 2009 22:16:00 -0000 1.59
-+++ fastjar-0.97/jartool.c 1 Mar 2010 15:38:43 -0000 1.60
-@@ -790,6 +790,7 @@ int read_entries (int fd)
- progname, jarfile);
- return 1;
- }
-+ ze->filename[len] = '\0';
- len = UNPACK_UB4(header, CEN_EFLEN);
- len += UNPACK_UB4(header, CEN_COMLEN);
- if (lseek (fd, len, SEEK_CUR) == -1)
diff --git a/source/d/gcc/fastjar-patches/1003-fastjar-CVE-2010-0831.patch b/source/d/gcc/fastjar-patches/1003-fastjar-CVE-2010-0831.patch
deleted file mode 100644
index 2c6e23c76..000000000
--- a/source/d/gcc/fastjar-patches/1003-fastjar-CVE-2010-0831.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-2010-06-10 Jakub Jelinek <jakub@redhat.com>
- Dan Rosenberg <dan.j.rosenberg@gmail.com>
-
- * jartool.c (extract_jar): Fix up checks for traversal to parent
- directories, disallow absolute paths, make the code slightly more
- efficient.
-
---- fastjar-0.97/jartool.c.jj 2009-09-07 00:10:47.000000000 +0200
-+++ fastjar-0.97/jartool.c 2010-06-08 20:00:29.000000000 +0200
-@@ -1730,7 +1730,17 @@ int extract_jar(int fd, const char **fil
- struct stat sbuf;
- int depth = 0;
-
-- tmp_buff = malloc(sizeof(char) * strlen((const char *)filename));
-+ if(*filename == '/'){
-+ fprintf(stderr, "Absolute path names are not allowed.\n");
-+ exit(EXIT_FAILURE);
-+ }
-+
-+ tmp_buff = malloc(strlen((const char *)filename));
-+
-+ if(tmp_buff == NULL) {
-+ fprintf(stderr, "Out of memory.\n");
-+ exit(EXIT_FAILURE);
-+ }
-
- for(;;){
- const ub1 *idx = (const unsigned char *)strchr((const char *)start, '/');
-@@ -1738,25 +1748,28 @@ int extract_jar(int fd, const char **fil
- if(idx == NULL)
- break;
- else if(idx == start){
-+ tmp_buff[idx - filename] = '/';
- start++;
- continue;
- }
-- start = idx + 1;
-
-- strncpy(tmp_buff, (const char *)filename, (idx - filename));
-- tmp_buff[(idx - filename)] = '\0';
-+ memcpy(tmp_buff + (start - filename), (const char *)start, (idx - start));
-+ tmp_buff[idx - filename] = '\0';
-
- #ifdef DEBUG
- printf("checking the existance of %s\n", tmp_buff);
- #endif
-- if(strcmp(tmp_buff, "..") == 0){
-+ if(idx - start == 2 && memcmp(start, "..", 2) == 0){
- --depth;
- if (depth < 0){
- fprintf(stderr, "Traversal to parent directories during unpacking!\n");
- exit(EXIT_FAILURE);
- }
-- } else if (strcmp(tmp_buff, ".") != 0)
-+ } else if (idx - start != 1 || *start != '.')
- ++depth;
-+
-+ start = idx + 1;
-+
- if(stat(tmp_buff, &sbuf) < 0){
- if(errno != ENOENT)
- exit_on_error("stat");
-@@ -1765,6 +1778,7 @@ int extract_jar(int fd, const char **fil
- #ifdef DEBUG
- printf("Directory exists\n");
- #endif
-+ tmp_buff[idx - filename] = '/';
- continue;
- }else {
- fprintf(stderr, "Hmmm.. %s exists but isn't a directory!\n",
-@@ -1781,10 +1795,11 @@ int extract_jar(int fd, const char **fil
- if(verbose && handle)
- printf("%10s: %s/\n", "created", tmp_buff);
-
-+ tmp_buff[idx - filename] = '/';
- }
-
- /* only a directory */
-- if(strlen((const char *)start) == 0)
-+ if(*start == '\0')
- dir = TRUE;
-
- #ifdef DEBUG
-@@ -1792,7 +1807,7 @@ int extract_jar(int fd, const char **fil
- #endif
-
- /* If the entry was just a directory, don't write to file, etc */
-- if(strlen((const char *)start) == 0)
-+ if(*start == '\0')
- f_fd = -1;
-
- free(tmp_buff);
-@@ -1876,7 +1891,8 @@ int extract_jar(int fd, const char **fil
- exit(EXIT_FAILURE);
- }
-
-- close(f_fd);
-+ if (f_fd != -1)
-+ close(f_fd);
-
- if(verbose && dir == FALSE && handle)
- printf("%10s: %s\n",
diff --git a/source/d/gcc/fastjar-patches/1004-fastjar-man.patch b/source/d/gcc/fastjar-patches/1004-fastjar-man.patch
deleted file mode 100644
index 34bf704db..000000000
--- a/source/d/gcc/fastjar-patches/1004-fastjar-man.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-2010-03-24 Jan Kratochvil <jan.kratochvil@redhat.com>
-
- * Makefile.am (POD2MAN): Provide --date from ChangeLog.
- * Makefile.in: Regenerate.
-
---- fastjar-0.97/Makefile.am.jj 2008-10-16 04:24:55.000000000 -0400
-+++ fastjar-0.97/Makefile.am 2010-06-21 09:29:41.021398000 -0400
-@@ -39,7 +39,7 @@ EXTRA_DIST = \
- texi2pod.pl
-
- TEXI2POD = perl $(srcdir)/texi2pod.pl
--POD2MAN = pod2man --center="GNU" --release=@VERSION@
-+POD2MAN = pod2man --center="GNU" --release=@VERSION@ --date=$(shell sed -n '1s/ .*//p' <$(srcdir)/ChangeLog)
-
- .pod.1:
- -($(POD2MAN) --section=1 $< > $(@).T$$$$ && \
---- fastjar-0.97/Makefile.in.jj 2008-10-16 04:15:16.000000000 -0400
-+++ fastjar-0.97/Makefile.in 2010-06-21 09:30:15.882810000 -0400
-@@ -515,7 +515,7 @@ EXTRA_DIST = \
- texi2pod.pl
-
- TEXI2POD = perl $(srcdir)/texi2pod.pl
--POD2MAN = pod2man --center="GNU" --release=@VERSION@
-+POD2MAN = pod2man --center="GNU" --release=@VERSION@ --date=$(shell sed -n '1s/ .*//p' <$(srcdir)/ChangeLog)
-
- #SPLINT_FLAGS=-I . -I $(srcdir)/lib -I $(srcdir) -DHAVE_CONFIG_H +posixlib +weak
- SPLINT_FLAGS = -I . -I $(srcdir)/lib -I $(srcdir) -DHAVE_CONFIG_H -DPRIx32= -warnposix +weak
diff --git a/source/d/gcc/gcc.66782.diff b/source/d/gcc/gcc.66782.diff
deleted file mode 100644
index 0743f8853..000000000
--- a/source/d/gcc/gcc.66782.diff
+++ /dev/null
@@ -1,124 +0,0 @@
-Index: config/i386/i386.md
-===================================================================
---- config/i386/i386.md (revision 225539)
-+++ config/i386/i386.md (working copy)
-@@ -108,6 +108,7 @@
- UNSPEC_LD_MPIC ; load_macho_picbase
- UNSPEC_TRUNC_NOOP
- UNSPEC_DIV_ALREADY_SPLIT
-+ UNSPEC_MS_TO_SYSV_CALL
- UNSPEC_PAUSE
- UNSPEC_LEA_ADDR
- UNSPEC_XBEGIN_ABORT
-@@ -11584,6 +11585,15 @@
- "* return ix86_output_call_insn (insn, operands[0]);"
- [(set_attr "type" "call")])
-
-+(define_insn "*call_rex64_ms_sysv"
-+ [(match_parallel 2 "call_rex64_ms_sysv_operation"
-+ [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rBwBz"))
-+ (match_operand 1))
-+ (unspec [(const_int 0)] UNSPEC_MS_TO_SYSV_CALL)])]
-+ "TARGET_64BIT && !SIBLING_CALL_P (insn)"
-+ "* return ix86_output_call_insn (insn, operands[0]);"
-+ [(set_attr "type" "call")])
-+
- (define_insn "*sibcall"
- [(call (mem:QI (match_operand:W 0 "sibcall_insn_operand" "UBsBz"))
- (match_operand 1))]
-@@ -11808,6 +11818,16 @@
- (match_dup 3)))
- (unspec [(const_int 0)] UNSPEC_PEEPSIB)])])
-
-+(define_insn "*call_value_rex64_ms_sysv"
-+ [(match_parallel 3 "call_rex64_ms_sysv_operation"
-+ [(set (match_operand 0)
-+ (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rBwBz"))
-+ (match_operand 2)))
-+ (unspec [(const_int 0)] UNSPEC_MS_TO_SYSV_CALL)])]
-+ "TARGET_64BIT && !SIBLING_CALL_P (insn)"
-+ "* return ix86_output_call_insn (insn, operands[1]);"
-+ [(set_attr "type" "callv")])
-+
- (define_expand "call_value_pop"
- [(parallel [(set (match_operand 0)
- (call (match_operand:QI 1)
-Index: config/i386/predicates.md
-===================================================================
---- config/i386/predicates.md (revision 225533)
-+++ config/i386/predicates.md (working copy)
-@@ -616,6 +616,36 @@
- && XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL);
- })
-
-+;; Return true if OP is a call from MS ABI to SYSV ABI function.
-+(define_predicate "call_rex64_ms_sysv_operation"
-+ (match_code "parallel")
-+{
-+ unsigned creg_size = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
-+ unsigned i;
-+
-+ if ((unsigned) XVECLEN (op, 0) != creg_size + 2)
-+ return false;
-+
-+ for (i = 0; i < creg_size; i++)
-+ {
-+ rtx elt = XVECEXP (op, 0, i+2);
-+ enum machine_mode mode;
-+ unsigned regno;
-+
-+ if (GET_CODE (elt) != CLOBBER
-+ || GET_CODE (SET_DEST (elt)) != REG)
-+ return false;
-+
-+ regno = x86_64_ms_sysv_extra_clobbered_registers[i];
-+ mode = SSE_REGNO_P (regno) ? TImode : DImode;
-+
-+ if (GET_MODE (SET_DEST (elt)) != mode
-+ || REGNO (SET_DEST (elt)) != regno)
-+ return false;
-+ }
-+ return true;
-+})
-+
- ;; Match exactly zero.
- (define_predicate "const0_operand"
- (match_code "const_int,const_wide_int,const_double,const_vector")
-Index: config/i386/i386.c
-===================================================================
---- config/i386/i386.c (revision 225533)
-+++ config/i386/i386.c (working copy)
-@@ -25639,7 +25639,9 @@
- rtx callarg2,
- rtx pop, bool sibcall)
- {
-- rtx vec[3];
-+ unsigned int const cregs_size
-+ = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
-+ rtx vec[3 + cregs_size];
- rtx use = NULL, call;
- unsigned int vec_len = 0;
-
-@@ -25742,16 +25744,18 @@
- if (TARGET_64BIT_MS_ABI
- && (!callarg2 || INTVAL (callarg2) != -2))
- {
-- int const cregs_size
-- = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
-- int i;
-+ unsigned i;
-
-+ vec[vec_len++] = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, const0_rtx),
-+ UNSPEC_MS_TO_SYSV_CALL);
-+
- for (i = 0; i < cregs_size; i++)
- {
- int regno = x86_64_ms_sysv_extra_clobbered_registers[i];
- machine_mode mode = SSE_REGNO_P (regno) ? TImode : DImode;
-
-- clobber_reg (&use, gen_rtx_REG (mode, regno));
-+ vec[vec_len++]
-+ = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (mode, regno));
- }
- }
-
diff --git a/source/d/gcc/gcc.69140.diff b/source/d/gcc/gcc.69140.diff
deleted file mode 100644
index ace60ebdd..000000000
--- a/source/d/gcc/gcc.69140.diff
+++ /dev/null
@@ -1,13 +0,0 @@
---- ./gcc/config/i386/i386.c.orig 2015-11-18 09:45:26.000000000 -0600
-+++ ./gcc/config/i386/i386.c 2016-02-05 13:50:07.202981920 -0600
-@@ -9677,6 +9677,10 @@
- if (TARGET_64BIT_MS_ABI && get_frame_size () > SEH_MAX_FRAME_SIZE)
- return true;
-
-+ /* SSE saves require frame-pointer when stack is misaligned. */
-+ if (TARGET_64BIT_MS_ABI && ix86_incoming_stack_boundary < 128)
-+ return true;
-+
- /* In ix86_option_override_internal, TARGET_OMIT_LEAF_FRAME_POINTER
- turns off the frame pointer by default. Turn it back on now if
- we've not got a leaf function. */
diff --git a/source/d/gcc/gcc.SlackBuild b/source/d/gcc/gcc.SlackBuild
index f23ed5215..f16f923cd 100755
--- a/source/d/gcc/gcc.SlackBuild
+++ b/source/d/gcc/gcc.SlackBuild
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
# GCC package build script (written by volkerdi@slackware.com)
#
# Copyright 2003, 2004 Slackware Linux, Inc., Concord, California, USA
-# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -52,6 +52,8 @@
# efficient on modern CPUs running in 32-bit mode than the alternate i586
# instructions. No need to throw i586 CPUs under the bus (yet).
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=gcc
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-3}
@@ -70,6 +72,20 @@ if [ -z "$ARCH" ]; then
export ARCH
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "gcc-$VERSION-$ARCH-$BUILD.txz"
+ echo "gcc-g++-$VERSION-$ARCH-$BUILD.txz"
+ echo "gcc-gfortran-$VERSION-$ARCH-$BUILD.txz"
+ echo "gcc-gnat-$VERSION-$ARCH-$BUILD.txz"
+ echo "gcc-objc-$VERSION-$ARCH-$BUILD.txz"
+ echo "gcc-go-$VERSION-$ARCH-$BUILD.txz"
+ echo "gcc-brig-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
if [ "$ARCH" = "i386" ]; then
SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
LIBDIRSUFFIX=""
@@ -109,10 +125,8 @@ case "$ARCH" in
*) TARGET=$ARCH-slackware-linux ;;
esac
-CWD=$(pwd)
-# Temporary build location. This should *NOT* be a directory
-# path a non-root user could create later...
-TMP=${TMP:-"/gcc-$(mcookie)"}
+# Temporary build location:
+TMP=${TMP:-/tmp}
# This is the main DESTDIR target:
PKG1=$TMP/package-gcc
@@ -120,55 +134,44 @@ PKG1=$TMP/package-gcc
PKG2=$TMP/package-gcc-g++
PKG3=$TMP/package-gcc-gfortran
PKG4=$TMP/package-gcc-gnat
-PKG5=$TMP/package-gcc-java
PKG6=$TMP/package-gcc-objc
-PKG7=$TMP/package-gcc-g++-gch
+#PKG7=$TMP/package-gcc-g++-gch
PKG8=$TMP/package-gcc-go
+PKG9=$TMP/package-gcc-brig
# Clear the build locations:
-if [ -d $TMP ]; then
- rm -rf $TMP
-fi
-mkdir -p $PKG{1,2,3,4,5,6,7,8}/usr/doc/gcc-$VERSION
+rm -rf $TMP/gcc.build.lnx
+rm -rf $PKG{1,2,3,4,6,8,9}
+mkdir -p $PKG{1,2,3,4,6,8,9}/usr/doc/gcc-$VERSION
# Insert package descriptions:
-mkdir -p $PKG{1,2,3,4,5,6,7,8}/install
+mkdir -p $PKG{1,2,3,4,6,8,9}/install
cat $CWD/slack-desc.gcc > $PKG1/install/slack-desc
cat $CWD/slack-desc.gcc-g++ > $PKG2/install/slack-desc
cat $CWD/slack-desc.gcc-gfortran > $PKG3/install/slack-desc
cat $CWD/slack-desc.gcc-gnat > $PKG4/install/slack-desc
-cat $CWD/slack-desc.gcc-java > $PKG5/install/slack-desc
cat $CWD/slack-desc.gcc-objc > $PKG6/install/slack-desc
-# cat $CWD/slack-desc.gcc-g++-gch > $PKG7/install/slack-desc
+#cat $CWD/slack-desc.gcc-g++-gch > $PKG7/install/slack-desc
cat $CWD/slack-desc.gcc-go > $PKG8/install/slack-desc
+cat $CWD/slack-desc.gcc-brig > $PKG9/install/slack-desc
cd $TMP
-tar xvf $CWD/gcc-$VERSION.tar.?z*
-
-( cd gcc-$VERSION/gcc
- zcat $CWD/gcc.66782.diff.gz | patch -p0 --verbose || exit 1
- zcat $CWD/gcc.69140.diff.gz | patch -p2 --verbose || exit 1
-) || exit 1
-
-# Copy ecj.jar into the TLD of the source. Needed for java compiler.
-# This can be retrieved from ftp://sourceware.org/pub/java
-cp $CWD/ecj-4.9.jar gcc-$VERSION/ecj.jar
+rm -rf gcc-$VERSION
+tar xvf $CWD/gcc-$VERSION.tar.xz || exit 1
-# Use an antlr runtime to compile javadoc.
-# The runtime can be obtained from:
-#https://oss.sonatype.org/content/repositories/releases/org/antlr/antlr-runtime/
-ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
+( cd gcc-$VERSION || exit 1
-# install docs
-( cd gcc-$VERSION
# Smite the fixincludes:
zcat $CWD/gcc-no_fixincludes.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
- # Fix perms/owners
+
+ # Fix perms/owners:
chown -R root:root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 754 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
+
+ # Install docs:
mkdir -p $PKG1/usr/doc/gcc-$VERSION
cp -a \
COPYING* ChangeLog* FAQ INSTALL \
@@ -189,13 +192,13 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
fi
mkdir -p $PKG1/usr/doc/gcc-${VERSION}/gcc
- ( cd gcc
+ ( cd gcc || exit 0
cp -a \
ABOUT* COPYING* DATESTAMP DEV-PHASE LANG* ONEWS README* SERVICE \
$PKG1/usr/doc/gcc-$VERSION/gcc
mkdir -p $PKG3/usr/doc/gcc-${VERSION}/gcc/fortran
- ( cd fortran
+ ( cd fortran || exit 0
if [ -r ChangeLog ]; then
cat ChangeLog | head -n 1000 > $PKG3/usr/doc/gcc-$VERSION/gcc/fortran/ChangeLog
touch -r ChangeLog $PKG3/usr/doc/gcc-$VERSION/gcc/fortran/ChangeLog
@@ -203,7 +206,7 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
)
mkdir -p $PKG4/usr/doc/gcc-${VERSION}/gcc/ada
- ( cd ada
+ ( cd ada || exit 0
cp -a \
ChangeLog.tree-ssa \
$PKG4/usr/doc/gcc-$VERSION/gcc/ada
@@ -213,19 +216,8 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
fi
)
- mkdir -p $PKG5/usr/doc/gcc-${VERSION}/gcc/java
- ( cd java
- cp -a \
- ChangeLog.tree-ssa \
- $PKG5/usr/doc/gcc-${VERSION}/gcc/java
- if [ -r ChangeLog ]; then
- cat ChangeLog | head -n 1000 > $PKG5/usr/doc/gcc-${VERSION}/gcc/java/ChangeLog
- touch -r ChangeLog $PKG5/usr/doc/gcc-${VERSION}/gcc/java/ChangeLog
- fi
- )
-
mkdir -p $PKG6/usr/doc/gcc-${VERSION}/gcc/objc
- ( cd objc
+ ( cd objc || exit 0
cp -a \
README* \
$PKG6/usr/doc/gcc-${VERSION}/gcc/objc
@@ -236,7 +228,7 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
)
mkdir -p $PKG8/usr/doc/gcc-${VERSION}/gcc/go
- ( cd go
+ ( cd go || exit 0
if [ -r ChangeLog ]; then
cat ChangeLog | head -n 1000 > $PKG8/usr/doc/gcc-${VERSION}/gcc/go/ChangeLog
touch -r ChangeLog $PKG8/usr/doc/gcc-${VERSION}/gcc/go/ChangeLog
@@ -247,10 +239,18 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
$PKG8/usr/doc/gcc-${VERSION}/gcc/go
)
+ mkdir -p $PKG9/usr/doc/gcc-${VERSION}/gcc/brig
+ ( cd brig || exit 0
+ if [ -r ChangeLog ]; then
+ cat ChangeLog | head -n 1000 > $PKG9/usr/doc/gcc-${VERSION}/gcc/brig/ChangeLog
+ touch -r ChangeLog $PKG9/usr/doc/gcc-${VERSION}/gcc/brig/ChangeLog
+ fi
+ )
+
) || exit 1
mkdir -p $PKG3/usr/doc/gcc-${VERSION}/libgfortran
- ( cd libgfortran
+ ( cd libgfortran || exit 0
if [ -r ChangeLog ]; then
cat ChangeLog | head -n 1000 > $PKG3/usr/doc/gcc-${VERSION}/libgfortran/ChangeLog
touch -r ChangeLog $PKG3/usr/doc/gcc-${VERSION}/libgfortran/ChangeLog
@@ -258,47 +258,15 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
)
mkdir -p $PKG4/usr/doc/gcc-${VERSION}/libada
- ( cd libada
+ ( cd libada || exit 0
if [ -r ChangeLog ]; then
cat ChangeLog | head -n 1000 > $PKG4/usr/doc/gcc-${VERSION}/libada/ChangeLog
touch -r ChangeLog $PKG4/usr/doc/gcc-${VERSION}/libada/ChangeLog
fi
)
- mkdir -p $PKG5/usr/doc/gcc-${VERSION}/libffi
- ( cd libffi
- cp -a \
- ChangeLog.libgcj ChangeLog.v1 \
- LICENSE* README* \
- $PKG5/usr/doc/gcc-${VERSION}/libffi
- if [ -r ChangeLog ]; then
- cat ChangeLog | head -n 1000 > $PKG5/usr/doc/gcc-${VERSION}/libffi/ChangeLog
- touch -r ChangeLog $PKG5/usr/doc/gcc-${VERSION}/libffi/ChangeLog
- fi
- )
-
- mkdir -p $PKG5/usr/doc/gcc-${VERSION}/libjava
- ( cd libjava
- cp -a \
- COPYING* HACKING LIBGCJ_LICENSE \
- NEWS README* THANKS \
- $PKG5/usr/doc/gcc-${VERSION}/libjava
- if [ -r ChangeLog ]; then
- cat ChangeLog | head -n 1000 > $PKG5/usr/doc/gcc-${VERSION}/libjava/ChangeLog
- touch -r ChangeLog $PKG5/usr/doc/gcc-${VERSION}/libjava/ChangeLog
- fi
- )
-
- mkdir -p $PKG1/usr/doc/gcc-${VERSION}/libmudflap
- ( cd libmudflap
- if [ -r ChangeLog ]; then
- cat ChangeLog | head -n 1000 > $PKG1/usr/doc/gcc-${VERSION}/libmudflap/ChangeLog
- touch -r ChangeLog $PKG1/usr/doc/gcc-${VERSION}/libmudflap/ChangeLog
- fi
- )
-
mkdir -p $PKG1/usr/doc/gcc-${VERSION}/libgomp
- ( cd libgomp
+ ( cd libgomp || exit 0
if [ -r ChangeLog ]; then
cat ChangeLog | head -n 1000 > $PKG1/usr/doc/gcc-${VERSION}/libgomp/ChangeLog
touch -r ChangeLog $PKG1/usr/doc/gcc-${VERSION}/libgomp/ChangeLog
@@ -306,7 +274,7 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
)
mkdir -p $PKG6/usr/doc/gcc-${VERSION}/libobjc
- ( cd libobjc
+ ( cd libobjc || exit 0
if [ -r ChangeLog ]; then
cat ChangeLog | head -n 1000 > $PKG6/usr/doc/gcc-${VERSION}/libobjc/ChangeLog
touch -r ChangeLog $PKG6/usr/doc/gcc-${VERSION}/libobjc/ChangeLog
@@ -317,7 +285,7 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
)
mkdir -p $PKG2/usr/doc/gcc-${VERSION}/libstdc++-v3
- ( cd libstdc++-v3
+ ( cd libstdc++-v3 || exit 0
cp -a \
README* \
doc/html/faq.html \
@@ -330,77 +298,10 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
)
-# Add fastjar to the gcc-java package:
-( cd $TMP
- FASTJARVER=$(echo $CWD/fastjar-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
- echo
- echo "Building fastjar-$FASTJARVER first"
- echo
- rm -rf fastjar-$FASTJARVER
- tar xvf $CWD/fastjar-$FASTJARVER.tar.xz || exit 1
- cd fastjar-$FASTJARVER || exit 1
- chown -R root:root .
- find . \
- \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
- -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
- -exec chmod 644 {} \;
- for patch in $CWD/fastjar-patches/*.gz ; do
- zcat $patch | patch -p1 --verbose || exit 1
- done
- CFLAGS="$SLKCFLAGS" \
- CXXFLAGS="$SLKCFLAGS" \
- ./configure \
- --prefix=/usr \
- --libdir=/usr/lib$LIBDIRSUFFIX \
- --mandir=/usr/man \
- --infodir=/usr/info \
- --build=$TARGET
- make $NUMJOBS || exit 1
- make install DESTDIR=$PKG5 || exit 1
- mkdir -p $PKG5/usr/doc/fastjar-$FASTJARVER
- cp -a \
- AUTHORS CHANGES COPYING* INSTALL NEWS README* TODO \
- $PKG5/usr/doc/fastjar-$FASTJARVER
- # If there's a ChangeLog, installing at least part of the recent history
- # is useful, but don't let it get totally out of control:
- if [ -r ChangeLog ]; then
- DOCSDIR=$(echo $PKG5/usr/doc/fastjar-$FASTJARVER)
- cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
- touch -r ChangeLog $DOCSDIR/ChangeLog
- fi
- find $PKG5 | xargs file | grep -e "executable" -e "shared object" | grep ELF \
- | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
- # Compress and if needed symlink the man pages:
- if [ -d $PKG5/usr/man ]; then
- ( cd $PKG5/usr/man
- for manpagedir in $(find . -type d -name "man*") ; do
- ( cd $manpagedir
- for eachpage in $( find . -type l -maxdepth 1) ; do
- ln -s $( readlink $eachpage ).gz $eachpage.gz
- rm $eachpage
- done
- gzip -9 *.?
- )
- done
- )
- fi
- # Compress info files, if any:
- if [ -d $PKG5/usr/info ]; then
- ( cd $PKG5/usr/info
- rm -f dir
- gzip -9 *
- )
- fi
- echo
-) || exit 1
-
# build gcc
( mkdir gcc.build.lnx;
cd gcc.build.lnx;
- # If enough people need "treelang" support for it may be considered.
- # --enable-languages=ada,c,c++,fortran,java,objc,treelang
# I think it's incorrect to include this option (as it'll end up set
# to i586 on x86 platforms), and we want to tune the binary structure
# for i686, as that's where almost all of the optimization speedups
@@ -414,9 +315,6 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
GCC_ARCHOPTS="--disable-multilib"
fi
- # NOTE: For Slackware 15.0, look into removing --with-default-libstdcxx-abi=gcc4-compatible,
- # which will then require rebuilding all C++ libraries. That is, if there's any benefit.
-
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
../gcc-$VERSION/configure --prefix=/usr \
@@ -425,14 +323,13 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
--infodir=/usr/info \
--enable-shared \
--enable-bootstrap \
- --enable-languages=ada,c,c++,fortran,go,java,lto,objc \
+ --enable-languages=ada,brig,c,c++,fortran,go,lto,objc \
--enable-threads=posix \
--enable-checking=release \
--enable-objc-gc \
--with-system-zlib \
- --with-python-dir=/lib$LIBDIRSUFFIX/python2.7/site-packages \
--enable-libstdcxx-dual-abi \
- --with-default-libstdcxx-abi=gcc4-compatible \
+ --with-default-libstdcxx-abi=new \
--disable-libunwind-exceptions \
--enable-__cxa_atexit \
--enable-libssp \
@@ -440,13 +337,7 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
--disable-install-libiberty \
--with-gnu-ld \
--verbose \
- --enable-java-home \
- --with-java-home=/usr/lib$LIBDIRSUFFIX/jvm/jre \
- --with-jvm-root-dir=/usr/lib$LIBDIRSUFFIX/jvm \
- --with-jvm-jar-dir=/usr/lib$LIBDIRSUFFIX/jvm/jvm-exports \
--with-arch-directory=$LIB_ARCH \
- --with-antlr-jar=$ANTLJAR \
- --enable-java-awt=gtk \
--disable-gtktest \
$GCC_ARCHOPTS \
--target=${TARGET} \
@@ -456,108 +347,123 @@ ANTLJAR=$(echo $CWD/antlr-*.jar | tail -1)
# Start the build:
# Include all debugging info (for now):
- make $NUMJOBS bootstrap;
+ make $NUMJOBS bootstrap || exit 1
( cd gcc
- make $NUMJOBS gnatlib GNATLIBCFLAGS="$SLKCFLAGS"
+ make $NUMJOBS gnatlib GNATLIBCFLAGS="$SLKCFLAGS" || exit 1
# This wants a shared -ladd2line?
- #make gnatlib-shared
+ #make gnatlib-shared || exit 1
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
- make $NUMJOBS gnattools
- )
- make info
+ make $NUMJOBS gnattools || exit 1
+ ) || exit 1
+ make info || exit 1
# Set GCCCHECK=something to run the tests
if [ ! -z $GCCCHECK ]; then
- make $NUMJOBS check
+ make $NUMJOBS check || exit 1
fi
- make install DESTDIR=$PKG1
+ make install DESTDIR=$PKG1 || exit 1
-# KLUDGE ALERT
-# These *gdb.py files are causing ldconfig to complain, so they are going
-# to be REMOVED for now... at some point, they might be moved somewhere
-# else, in which case things should Just Work(tm). Keep an eye on it.
-rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/*gdb.py
+ # Move gdb pretty printers to the correct place
+ mkdir -p $PKG1/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX
+ mv $PKG1/usr/lib$LIBDIRSUFFIX/*-gdb.py \
+ $PKG1/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX/
-# Be sure the "specs" file is installed.
-if [ ! -r $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${TARGET}/${VERSION}/specs ]; then
- cat stage1-gcc/specs > $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${TARGET}/${VERSION}/specs
-fi
+ # Be sure the "specs" file is installed.
+ if [ ! -r $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${TARGET}/${VERSION}/specs ]; then
+ cat stage1-gcc/specs > $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${TARGET}/${VERSION}/specs
+ fi
-# Make our 64bit gcc look for 32bit gcc binaries in ./32 subdirectory:
-if [ "$ARCH" = "x86_64" ]; then
- sed -i 's#;.\(:../lib !m64 m32;\)$#;32\1#' \
- $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${TARGET}/${VERSION}/specs
-fi
+ # Make our 64bit gcc look for 32bit gcc binaries in ./32 subdirectory:
+ if [ "$ARCH" = "x86_64" ]; then
+ sed -i 's#;.\(:../lib !m64 m32;\)$#;32\1#' \
+ $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${TARGET}/${VERSION}/specs
+ fi
+
+ # make ada.install-common DESTDIR=$PKG1 || exit 1
+ # make install-gnatlib DESTDIR=$PKG1 || exit 1
+ make -i install-info DESTDIR=$PKG1 || exit 1
+
+ chmod 755 $PKG1/usr/lib${LIBDIRSUFFIX}/libgcc_s.so.1
+
+ # Fix stuff up:
+ ( cd $PKG1/usr/info ; rm dir ; gzip -9 * )
+ ( cd $PKG1
+ # *not* ${LIBDIRSUFFIX}
+ mkdir -p lib
+ cd lib
+ ln -sf /usr/bin/cpp .
+ )
+
+ ( cd $PKG1/usr/bin
+ mv g++ g++-gcc-$VERSION
+ mv gcc gcc-$VERSION
+ mv ${TARGET}-gfortran gfortran-gcc-$VERSION
+ ln -sf g++-gcc-$VERSION g++
+ ln -sf gcc-$VERSION gcc
+ ln -sf g++ c++
+ ln -sf gcc cc
+ ln -sf gcc-$VERSION ${TARGET}-gcc
+ ln -sf gcc-$VERSION ${TARGET}-gcc-$VERSION
+ ln -sf gcc-ar ${TARGET}-gcc-ar
+ ln -sf gcc-nm ${TARGET}-gcc-nm
+ ln -sf gcc-ranlib ${TARGET}-gcc-ranlib
+ ln -sf g++-gcc-$VERSION ${TARGET}-c++
+ ln -sf g++-gcc-$VERSION ${TARGET}-g++
+ ln -sf gfortran-gcc-$VERSION gfortran
+ ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran
+ ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran-$VERSION
+ ln -sf gfortran-gcc-$VERSION ${TARGET}-g95
+ ln -sf gfortran g95
+ ln -sf gfortran f95
+ ln -sf gfortran-gcc-$VERSION ${TARGET}-g77
+ ln -sf gfortran g77
+ ln -sf gfortran f77
+ cat $CWD/c89.sh > c89
+ cat $CWD/c99.sh > c99
+ chmod 755 c89 c99
+ )
-# make ada.install-common DESTDIR=$PKG1
-# make install-gnatlib DESTDIR=$PKG1
-make -i install-info DESTDIR=$PKG1
+ ( cd $PKG1/usr/man
+ gzip -9 */*
+ cd man1
+ ln -sf g++.1.gz c++.1.gz
+ ln -sf gcc.1.gz cc.1.gz
+ )
-chmod 755 $PKG1/usr/lib${LIBDIRSUFFIX}/libgcc_s.so.1
+ ## build an all-in-one txz package:
+ #(
+ # cd $PKG1;
+ # makepkg -l y -c n $TMP/gcc-$VERSION-$ARCH-$BUILD.txz
+ #)
-# The (huge) static GNU java libraries are not packaged. In nearly all
-# cases one or more dependencies will not be available as static anyway.
-rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj.a
-rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj-tools.a
+# keep a log:
+) 2>&1 | tee $TMP/gcc.build.log
-# Fix stuff up:
-( cd $PKG1/usr/info ; rm dir ; gzip -9 * )
+# Filter all .la files (thanks much to Mark Post for the sed script):
( cd $PKG1
- # *not* ${LIBDIRSUFFIX}
- mkdir -p lib
- cd lib
- ln -sf /usr/bin/cpp .
+ for file in $(find . -type f -name "*.la") ; do
+ cat $file | sed -e 's%-L/gcc-[[:graph:]]* % %g' > $TMP/tmp-la-file
+ cat $TMP/tmp-la-file > $file
+ done
+ rm $TMP/tmp-la-file
)
-( cd $PKG1/usr/bin
- mv g++ g++-gcc-$VERSION
- mv gcc gcc-$VERSION
- mv ${TARGET}-gfortran gfortran-gcc-$VERSION
- ln -sf g++-gcc-$VERSION g++
- ln -sf gcc-$VERSION gcc
- ln -sf g++ c++
- ln -sf gcc cc
- ln -sf gcc-$VERSION ${TARGET}-gcc
- ln -sf gcc-$VERSION ${TARGET}-gcc-$VERSION
- ln -sf gcc-ar ${TARGET}-gcc-ar
- ln -sf gcc-nm ${TARGET}-gcc-nm
- ln -sf gcc-ranlib ${TARGET}-gcc-ranlib
- ln -sf gcj ${TARGET}-gcj
- ln -sf gcjh ${TARGET}-gcjh
- ln -sf g++-gcc-$VERSION ${TARGET}-c++
- ln -sf g++-gcc-$VERSION ${TARGET}-g++
- ln -sf gfortran-gcc-$VERSION gfortran
- ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran
- ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran-$VERSION
- ln -sf gfortran-gcc-$VERSION ${TARGET}-g95
- ln -sf gfortran g95
- ln -sf gfortran f95
- ln -sf gfortran-gcc-$VERSION ${TARGET}-g77
- ln -sf gfortran g77
- ln -sf gfortran f77
- cat $CWD/c89.sh > c89
- cat $CWD/c99.sh > c99
- chmod 755 c89 c99
-)
+# Don't ship .la files in /{,usr/}lib${LIBDIRSUFFIX}:
+rm -f $PKG1/{,usr/}lib${LIBDIRSUFFIX}/*.la
-( cd $PKG1/usr/man
- gzip -9 */*
- cd man1
- ln -sf g++.1.gz c++.1.gz
- ln -sf gcc.1.gz cc.1.gz
-)
-
-## build the txz package
-#(
-# cd $PKG1;
-# makepkg -l y -c n $TMP/gcc-$VERSION-$ARCH-$BUILD.txz
-#)
-# keep a log
-) 2>&1 | tee $TMP/gcc.build.log
+# Strip bloated binaries and libraries:
+( cd $PKG1
+ find . -name "lib*so*" -exec strip --strip-unneeded "{}" \;
+ find . -name "lib*so*" -exec patchelf --remove-rpath "{}" \;
+ find . -name "lib*a" -exec strip -g "{}" \;
+ strip --strip-unneeded usr/bin/* 2> /dev/null
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+)
# OK, time to split the big package where needed:
@@ -573,6 +479,10 @@ rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj-tools.a
mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/cc1plus usr/libexec/gcc/$TARGET/$VERSION/cc1plus
mkdir -p usr/man/man1
mv $PKG1/usr/man/man1/*++* usr/man/man1
+ mkdir -p usr/share
+ mv $PKG1/usr/share/gdb usr/share
+ mkdir -p usr/share/gcc-$VERSION/python
+ mv $PKG1/usr/share/gcc-$VERSION/python/libstdcxx usr/share/gcc-$VERSION/python
)
# gcc-gfortran:
@@ -598,11 +508,6 @@ rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj-tools.a
)
# gcc-gnat:
-# First, relocate usr/bin/gnative2ascii to the gcc-java package so it
-# isn't matched and accidentally put in gcc-gnat:
-mkdir -p $PKG5/usr/bin
-mv $PKG1/usr/bin/gnative2ascii $PKG5/usr/bin
-# Now make the gcc-gnat package tree:
( cd $PKG4
mkdir -p usr/bin
mv $PKG1/usr/bin/gnat* usr/bin
@@ -616,117 +521,6 @@ mv $PKG1/usr/bin/gnative2ascii $PKG5/usr/bin
mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/adalib usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION
)
-# gcc-java:
-( cd $PKG5
- mkdir -p usr/bin
- mv $PKG1/usr/bin/aot-compile usr/bin
- mv $PKG1/usr/bin/addr2name.awk usr/bin
- # mv $PKG1/usr/bin/fastjar usr/bin
- mv $PKG1/usr/bin/gappletviewer usr/bin
- mv $PKG1/usr/bin/gc-analyze usr/bin
- mv $PKG1/usr/bin/*gcj* usr/bin
- mv $PKG1/usr/bin/gij usr/bin
- mv $PKG1/usr/bin/gjar usr/bin
- mv $PKG1/usr/bin/gjarsigner usr/bin
- mv $PKG1/usr/bin/gjdoc usr/bin
- mv $PKG1/usr/bin/gkeytool usr/bin
- mv $PKG1/usr/bin/grepjar usr/bin
- mv $PKG1/usr/bin/grmid usr/bin
- mv $PKG1/usr/bin/grmic usr/bin
- mv $PKG1/usr/bin/grmiregistry usr/bin
- mv $PKG1/usr/bin/gserialver usr/bin
- mv $PKG1/usr/bin/gtnameserv usr/bin
- mv $PKG1/usr/bin/gjavah usr/bin
- mv $PKG1/usr/bin/gorbd usr/bin
- mv $PKG1/usr/bin/jar usr/bin
- mv $PKG1/usr/bin/jcf-dump usr/bin
- mv $PKG1/usr/bin/jv-* usr/bin
- mv $PKG1/usr/bin/rmi* usr/bin
- mkdir -p usr/include/c++/$VERSION
- # Move some Java only C++ headers from the C++ package:
- mv $PKG2/usr/include/c++/$VERSION/{gcj,gnu,java,javax,org,sun} usr/include/c++/$VERSION
- mv $PKG1/usr/include/ffi.h usr/include
- mkdir -p usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jawt.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/ffi.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/ffitarget.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jawt_md.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jni.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jni_md.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jvmpi.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/libffi usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- # aot-compile Python plugins:
- if [ ! -d $PKG1/usr/lib${LIBDIRSUFFIX}/python2.7 ]; then
- echo "NO $PKG1/usr/lib${LIBDIRSUFFIX}/python2.7 !"
- exit 1
- fi
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/python2.7 usr/lib${LIBDIRSUFFIX}
- mkdir -p usr/info
- mv $PKG1/usr/info/gcj.* usr/info
- # mv $PKG1/usr/info/fastjar.* usr/info
- mkdir -p usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/libffi* usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/logging.properties usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcj* usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj* usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/libgij* usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/lib-org* usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/security usr/lib${LIBDIRSUFFIX}
- mkdir -p usr/lib${LIBDIRSUFFIX}/pkgconfig
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/pkgconfig/libgcj*.pc usr/lib${LIBDIRSUFFIX}/pkgconfig
- rmdir $PKG1/usr/lib${LIBDIRSUFFIX}/pkgconfig 2> /dev/null
- mkdir -p usr/libexec/gcc/$TARGET/$VERSION
- mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/jc1 usr/libexec/gcc/$TARGET/$VERSION
- mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/ecj1 usr/libexec/gcc/$TARGET/$VERSION
- mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/jvgenmain usr/libexec/gcc/$TARGET/$VERSION
- mkdir -p usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/gcj usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include
- mkdir -p usr/man/man1
- mv $PKG1/usr/man/man1/aot-compile.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gappletviewer.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gc-analyze.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gcj.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gcjh.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gcj-dbtool.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gij.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gjar.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gjarsigner.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gjavah.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gjdoc.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gjnih.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gkeytool.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gnative2ascii.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gorbd.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/grmic.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/grmid.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/grmiregistry.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gserialver.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/gtnameserv.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/jcf-dump.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/jv-convert.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/jv-scan.1.gz usr/man/man1
- mv $PKG1/usr/man/man1/rebuild-gcj-db.1.gz usr/man/man1
- mkdir -p usr/man/man3
- mv $PKG1/usr/man/man3/ffi* usr/man/man3
- mkdir -p usr/share
- mv $PKG1/usr/share/java usr/share
- # The ecj wrapper script:
- cat $CWD/ecj.sh | sed -e "s,@JAVADIR@,/usr/share/java," > usr/bin/ecj
- chmod 755 usr/bin/ecj
- # The JAVA_HOME compatibility links.
- # Caution: non-multilib arch-independent stuff! No lib64 here.
- mkdir -p usr/lib$LIBDIRSUFFIX
- mv $PKG1/usr/lib$LIBDIRSUFFIX/jvm* usr/lib$LIBDIRSUFFIX
- # And add the missing javac symlink:
- ln -s ../../../bin/ecj usr/lib$LIBDIRSUFFIX/jvm/bin/javac
- # Don't package libffi stuff anymore. GCC will link the internal version
- # statically, and we'll need a newer one elsewhere.
- find . -name "ffi*.h" | xargs rm
- find . -name "libffi*" | xargs rm
- rm -f usr/man/man3/ffi*
- rm -f usr/info/libffi*
-)
-
# gcc-objc:
( cd $PKG6
mkdir -p usr/lib${LIBDIRSUFFIX}
@@ -756,37 +550,29 @@ mv $PKG1/usr/bin/gnative2ascii $PKG5/usr/bin
mv $PKG1/usr/info/gccgo.info.gz usr/info
mkdir -p usr/lib${LIBDIRSUFFIX}
mv $PKG1/usr/lib${LIBDIRSUFFIX}/go usr/lib${LIBDIRSUFFIX}
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/{libgo.la,libgo.so*,libgobegin.a,libgolibbegin.a,libnetgo.a} usr/lib${LIBDIRSUFFIX} || exit 1
- # Ordinarily Slackware doesn't package static libraries, but in this case
- # it is useful for deploying compiled binaries on machines that do not yet
- # have libgo.so.0.0.0.
- mv $PKG1/usr/lib${LIBDIRSUFFIX}/libgo.a usr/lib${LIBDIRSUFFIX}
+ if [ -r $PKG1/usr/lib${LIBDIRSUFFIX}/libgo.la ]; then
+ mv $PKG1/usr/lib${LIBDIRSUFFIX}/libgo.la usr/lib${LIBDIRSUFFIX}
+ fi
+ mv $PKG1/usr/lib${LIBDIRSUFFIX}/{libgo.so*,libgobegin.a,libgolibbegin.a} usr/lib${LIBDIRSUFFIX} || exit 1
+ # Don't package the (bloated) libgo.a. As a rule, we don't package static libraries.
+ rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libgo.a
mkdir -p usr/man/man1
mv $PKG1/usr/man/man1/gccgo.1.gz usr/man/man1
mv $PKG1/usr/man/man1/go.1.gz usr/man/man1
mv $PKG1/usr/man/man1/gofmt.1.gz usr/man/man1
) || exit 1
-# Filter all .la files (thanks much to Mark Post for the sed script):
-( cd $TMP
- for file in $(find . -type f -name "*.la") ; do
- cat $file | sed -e 's%-L/gcc-[[:graph:]]* % %g' > $TMP/tmp-la-file
- cat $TMP/tmp-la-file > $file
- done
- rm $TMP/tmp-la-file
+# gcc-brig:
+( cd $PKG9
+ mkdir -p usr/bin
+ mv $PKG1/usr/bin/*brig* usr/bin
+ mkdir -p usr/lib${LIBDIRSUFFIX}
+ mv $PKG1/usr/lib${LIBDIRSUFFIX}/libhsail* usr/lib${LIBDIRSUFFIX}
+ mkdir -p usr/libexec/gcc/$TARGET/$VERSION
+ mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/brig1 usr/libexec/gcc/$TARGET/$VERSION
)
-## Strip bloated binaries and libraries:
-for dir in $PKG{1,2,3,4,5,6,8}; do
- ( cd $dir
- find . -name "lib*so*" -exec strip --strip-unneeded "{}" \;
- find . -name "lib*a" -exec strip -g "{}" \;
- strip --strip-unneeded usr/bin/* 2> /dev/null
- find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
- find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
- )
-done
-
+# Generate packages:
( cd $PKG1
makepkg -l y -c n $TMP/gcc-$VERSION-$ARCH-$BUILD.txz )
( cd $PKG2
@@ -795,14 +581,12 @@ done
makepkg -l y -c n $TMP/gcc-gfortran-$VERSION-$ARCH-$BUILD.txz )
( cd $PKG4
makepkg -l y -c n $TMP/gcc-gnat-$VERSION-$ARCH-$BUILD.txz )
-( cd $PKG5
- makepkg -l y -c n $TMP/gcc-java-$VERSION-$ARCH-$BUILD.txz )
( cd $PKG6
makepkg -l y -c n $TMP/gcc-objc-$VERSION-$ARCH-$BUILD.txz )
-#( cd $PKG7
-# makepkg -l y -c n $TMP/gcc-g++-gch-$VERSION-$ARCH-$BUILD.txz )
( cd $PKG8
makepkg -l y -c n $TMP/gcc-go-$VERSION-$ARCH-$BUILD.txz )
+( cd $PKG9
+ makepkg -l y -c n $TMP/gcc-brig-$VERSION-$ARCH-$BUILD.txz )
echo
echo "Slackware GCC package build complete!"
diff --git a/source/d/gcc/slack-desc.gcc b/source/d/gcc/slack-desc.gcc
index 72e33b464..1c00df83a 100644
--- a/source/d/gcc/slack-desc.gcc
+++ b/source/d/gcc/slack-desc.gcc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,7 +11,7 @@ gcc:
gcc: GCC is the GNU Compiler Collection.
gcc:
gcc: This package contains those parts of the compiler collection needed to
-gcc: compile C code. Other packages add Ada, C++, Fortran, Go,
+gcc: compile C code. Other packages add Ada, C++, Fortran, Go,
gcc: Objective-C, and Java support to the compiler core.
gcc:
gcc:
diff --git a/source/d/gcc/slack-desc.gcc-brig b/source/d/gcc/slack-desc.gcc-brig
new file mode 100644
index 000000000..e9496b8bd
--- /dev/null
+++ b/source/d/gcc/slack-desc.gcc-brig
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|' on
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
+# leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+gcc-brig: gcc-brig (BRIG support for GCC)
+gcc-brig:
+gcc-brig: BRIG support for the GNU Compiler Collection.
+gcc-brig:
+gcc-brig: BRIG is the binary form of the Heterogeneous System Architecture
+gcc-brig: Intermediate Language (HSA IL), which is a virtual instruction set for
+gcc-brig: parallel programs. While similar in some ways to OpenCL or CUDA, HSA
+gcc-brig: is designed to ease the burden on the programmer by automatically
+gcc-brig: handling the offloading of tasks and moving of data.
+gcc-brig:
+gcc-brig:
diff --git a/source/d/gcc/slack-desc.gcc-g++ b/source/d/gcc/slack-desc.gcc-g++
index 3cbabac16..fa9b4f1ca 100644
--- a/source/d/gcc/slack-desc.gcc-g++
+++ b/source/d/gcc/slack-desc.gcc-g++
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,7 +11,7 @@ gcc-g++:
gcc-g++: C++ support for the GNU Compiler Collection.
gcc-g++:
gcc-g++: This package contains those parts of the compiler collection needed to
-gcc-g++: compile C++ code. The base gcc package is also required.
+gcc-g++: compile C++ code. The base gcc package is also required.
gcc-g++:
gcc-g++:
gcc-g++:
diff --git a/source/d/gcc/slack-desc.gcc-gfortran b/source/d/gcc/slack-desc.gcc-gfortran
index 5141cb02c..111dcb1f7 100644
--- a/source/d/gcc/slack-desc.gcc-gfortran
+++ b/source/d/gcc/slack-desc.gcc-gfortran
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
gcc-gfortran: gcc-gfortran (Fortran support for GCC)
gcc-gfortran:
gcc-gfortran: The GNU Fortran compiler is fully compliant with the Fortran 95
-gcc-gfortran: Standard and includes legacy F77 support. In addition, a significant
+gcc-gfortran: Standard and includes legacy F77 support. In addition, a significant
gcc-gfortran: number of Fortran 2003 and Fortran 2008 features are implemented.
gcc-gfortran: GNU Fortran also contains many standard and extensions and can be
gcc-gfortran: used to run real-world programs.
gcc-gfortran:
gcc-gfortran: This package contains those parts of the compiler collection
-gcc-gfortran: needed to compile Fortran code. The gcc package is also required.
+gcc-gfortran: needed to compile Fortran code. The gcc package is also required.
gcc-gfortran:
diff --git a/source/d/gcc/slack-desc.gcc-gnat b/source/d/gcc/slack-desc.gcc-gnat
index 9aa4b3c4e..8ffa7ac04 100644
--- a/source/d/gcc/slack-desc.gcc-gnat
+++ b/source/d/gcc/slack-desc.gcc-gnat
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,9 +11,9 @@ gcc-gnat:
gcc-gnat: Ada support for the GNU Compiler Collection.
gcc-gnat:
gcc-gnat: This package contains those parts of the compiler collection needed to
-gcc-gnat: compile Ada code. GNAT implements Ada 95, Ada 2005 and Ada 2012, and
-gcc-gnat: it may also be invoked in Ada 83 compatibility mode. By default, GNAT
-gcc-gnat: assumes Ada 2012. The base gcc package is also required.
+gcc-gnat: compile Ada code. GNAT implements Ada 95, Ada 2005 and Ada 2012, and
+gcc-gnat: it may also be invoked in Ada 83 compatibility mode. By default, GNAT
+gcc-gnat: assumes Ada 2012. The base gcc package is also required.
gcc-gnat:
gcc-gnat:
gcc-gnat:
diff --git a/source/d/gcc/slack-desc.gcc-go b/source/d/gcc/slack-desc.gcc-go
index cdd859bc1..0c518b18c 100644
--- a/source/d/gcc/slack-desc.gcc-go
+++ b/source/d/gcc/slack-desc.gcc-go
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
gcc-go: gcc-go (Go support for GCC)
gcc-go:
gcc-go: Go is a compiled, garbage-collected, concurrent programming language
-gcc-go: developed by Google Inc. The initial design of Go was started in
+gcc-go: developed by Google Inc. The initial design of Go was started in
gcc-go: September 2007 by Robert Griesemer, Rob Pike, and Ken Thompson.
gcc-go: Rob Pike has stated that Go is being used "for real stuff" at Google.
gcc-go: Go's "gc" compiler targets the Linux, Mac OS X, FreeBSD, OpenBSD and
gcc-go: Microsoft Windows operating systems, and the i386, amd64, and ARM
gcc-go: processor architectures.
gcc-go:
-gcc-go: Homepage: http://golang.org
+gcc-go: Homepage: http://golang.org
diff --git a/source/d/gcc/slack-desc.gcc-java b/source/d/gcc/slack-desc.gcc-java
deleted file mode 100644
index b65ca5554..000000000
--- a/source/d/gcc/slack-desc.gcc-java
+++ /dev/null
@@ -1,19 +0,0 @@
-# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
-# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
-# leave one space after the ':'.
-
- |-----handy-ruler------------------------------------------------------|
-gcc-java: gcc-java (Java support for GCC)
-gcc-java:
-gcc-java: Java support for the GNU Compiler Collection.
-gcc-java:
-gcc-java: This package contains those parts of the compiler collection needed to
-gcc-java: compile programs written in the Java programming language. The base
-gcc-java: gcc package is also required.
-gcc-java:
-gcc-java:
-gcc-java:
-gcc-java:
diff --git a/source/d/gcc/slack-desc.gcc-objc b/source/d/gcc/slack-desc.gcc-objc
index c01b79e37..174418434 100644
--- a/source/d/gcc/slack-desc.gcc-objc
+++ b/source/d/gcc/slack-desc.gcc-objc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,7 +11,7 @@ gcc-objc:
gcc-objc: Objective-C support for the GNU Compiler Collection.
gcc-objc:
gcc-objc: This package contains those parts of the compiler collection needed to
-gcc-objc: compile code written in Objective-C. Objective-C was originally
+gcc-objc: compile code written in Objective-C. Objective-C was originally
gcc-objc: developed to add object-oriented extensions to the C language, and is
gcc-objc: best known as the native language of the NeXT computer.
gcc-objc:
diff --git a/source/d/gdb/gdb.SlackBuild b/source/d/gdb/gdb.SlackBuild
index 41f6abfd6..9c20588f1 100755
--- a/source/d/gdb/gdb.SlackBuild
+++ b/source/d/gdb/gdb.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011, 2012, 2014, 2016 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2011, 2012, 2014, 2016, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=gdb
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -37,13 +38,20 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
if [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-gdb
@@ -61,17 +69,25 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# Currently broken in this version, but keep trying:
+if [ "$VERSION" = "8.0.1" -o "$VERSION" = "8.1" ]; then
+ GUILE_OPTION="--without-guile"
+else
+ # Might as well try it to see if it compiles this time:
+ GUILE_OPTION="--with-guile"
+fi
+
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--infodir=/usr/info \
- --with-guile \
- --with-python \
+ $GUILE_OPTION \
+ --with-python=/usr/bin/python3 \
+ --with-system-readline \
+ --with-system-zlib \
--build=$ARCH-slackware-linux || exit 1
-( cd readline ; make )
-
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
@@ -81,10 +97,6 @@ rmdir $PKG/usr/lib${LIBDIRSUFFIX} 2> /dev/null
rm -f $PKG/usr/info/{annotate*,bfd*,configure*,standards*}
rm -rf $PKG/usr/include
-# Use the -tui option if you want this.
-# Including a whole extra copy of the gdb binary is obnoxious:
-rm -f $PKG/usr/bin/gdbtui $PKG/usr/man/man1/gdbtui.1*
-
mkdir -p $PKG/usr/doc/gdb-$VERSION/gdb
cp -a COPYING* README $PKG/usr/doc/gdb-$VERSION
cd gdb
diff --git a/source/d/gdb/slack-desc b/source/d/gdb/slack-desc
index bd6b78a64..f68e41f9c 100644
--- a/source/d/gdb/slack-desc
+++ b/source/d/gdb/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
gdb: gdb (the GNU symbolic debugger)
gdb: GDB, the GNU Project debugger, allows you to see what is going on
-gdb: inside another program while it executes -- or what another program
-gdb: was doing at the moment it crashed. GDB can do four main kinds of
-gdb: things to help you catch bugs in the act: 1) Start your program,
-gdb: specifying anything that might affect its behavior. 2) Make your
-gdb: program stop on specified conditions. 3) Examine what has happened,
-gdb: when your program has stopped. 4) Change things in your program, so
+gdb: inside another program while it executes - or what another program
+gdb: was doing at the moment it crashed. GDB can do four main kinds of
+gdb: things to help you catch bugs in the act: 1) Start your program,
+gdb: specifying anything that might affect its behavior. 2) Make your
+gdb: program stop on specified conditions. 3) Examine what has happened,
+gdb: when your program has stopped. 4) Change things in your program, so
gdb: you can experiment with correcting the effects of one bug and go on
-gdb: to learn about another. The program being debugged can be written in
+gdb: to learn about another. The program being debugged can be written in
gdb: Ada, C, C++, Objective-C, Pascal and many other languages.
diff --git a/source/d/git/git-2.17.0.tar.sign b/source/d/git/git-2.17.0.tar.sign
new file mode 100644
index 000000000..e0bd837b7
--- /dev/null
+++ b/source/d/git/git-2.17.0.tar.sign
Binary files differ
diff --git a/source/d/git/git-2.9.0.tar.sign b/source/d/git/git-2.9.0.tar.sign
deleted file mode 100644
index 47cdfdf4f..000000000
--- a/source/d/git/git-2.9.0.tar.sign
+++ /dev/null
Binary files differ
diff --git a/source/d/git/git.SlackBuild b/source/d/git/git.SlackBuild
index 3a947c597..b652b50c9 100755
--- a/source/d/git/git.SlackBuild
+++ b/source/d/git/git.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011, 2016 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010, 2011, 2016, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,12 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-BUILD=${BUILD:-1}
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=git
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
+BUILD=${BUILD:-3}
+
NUMJOBS=${NUMJOBS:-" -j7 "}
# Automatically determine the architecture we're building on:
@@ -36,6 +38,14 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
eval $(perl '-V:installvendorlib')
PERLDIR=$installvendorlib/$ARCH-linux-thread-multi/auto
@@ -58,7 +68,6 @@ else
SLKCFLAGS="-O2"
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-git
@@ -68,7 +77,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf git-$VERSION
tar xvf $CWD/git-$VERSION.tar.?z* || exit 1
-cd git-$VERSION
+cd git-$VERSION || exit 1
chown -R root:root .
find . \
diff --git a/source/d/git/slack-desc b/source/d/git/slack-desc
index 271b863a2..0e68a383f 100644
--- a/source/d/git/slack-desc
+++ b/source/d/git/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
diff --git a/source/d/gnu-cobol/slack-desc b/source/d/gnu-cobol/slack-desc
deleted file mode 100644
index 9a6c9b4f7..000000000
--- a/source/d/gnu-cobol/slack-desc
+++ /dev/null
@@ -1,19 +0,0 @@
-# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
-# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
-# customary to leave one space after the ':'.
-
- |-----handy-ruler------------------------------------------------------|
-gnu-cobol: gnu-cobol (open source COBOL compiler)
-gnu-cobol:
-gnu-cobol: GNU Cobol is an open source COBOL compiler. GNU Cobol implements a
-gnu-cobol: substantial part of the COBOL 85 and COBOL 2002 standards, as well as
-gnu-cobol: many extensions of the existent COBOL compilers. GNU Cobol translates
-gnu-cobol: COBOL into C and compiles the translated code using the native C
-gnu-cobol: compiler. GNU Cobol was written by Roger While and Keisuke Nishida,
-gnu-cobol: with the invaluable assistance of many others.
-gnu-cobol:
-gnu-cobol: Homepage: http://opencobol.add1tocobol.com/gnucobol
-gnu-cobol:
diff --git a/source/d/gnu-cobol/gnu-cobol.SlackBuild b/source/d/gnucobol/gnucobol.SlackBuild
index 142c5cf7b..e297a6403 100755
--- a/source/d/gnu-cobol/gnu-cobol.SlackBuild
+++ b/source/d/gnucobol/gnucobol.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2013, 2014 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2013, 2014, 2017, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,15 +20,16 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
-PKGNAM=gnu-cobol
-VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+PKGNAM=gnucobol
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
- i?86) ARCH=i486 ;;
+ i?86) ARCH=i586 ;;
arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$(uname -m) ;;
@@ -36,15 +37,17 @@ if [ -z "$ARCH" ]; then
export ARCH
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-if [ "$ARCH" = "i386" ]; then
- SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "i586" ]; then
+if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
@@ -64,7 +67,6 @@ else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
@@ -73,8 +75,8 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf $PKGNAM-$VERSION
-tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
-cd $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1
+cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
@@ -91,12 +93,15 @@ CFLAGS="$SLKCFLAGS" \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--infodir=/usr/info \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
# Build and install:
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
# Strip binaries:
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
@@ -106,7 +111,7 @@ make install DESTDIR=$PKG || exit 1
# Add a documentation directory:
mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
cp -a \
- ABOUT-NLS AUTHORS COPYING* ChangeLog INSTALL NEWS README* THANKS TODO \
+ ABOUT-NLS AUTHORS COPYING* ChangeLog INSTALL NEWS* README* THANKS TODO \
$PKG/usr/doc/${PKGNAM}-$VERSION
# Compress info files, if any:
diff --git a/source/d/gnucobol/slack-desc b/source/d/gnucobol/slack-desc
new file mode 100644
index 000000000..58bdb56ed
--- /dev/null
+++ b/source/d/gnucobol/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+gnucobol: gnucobol (open source COBOL compiler)
+gnucobol:
+gnucobol: GNU Cobol is an open source COBOL compiler. GNU Cobol implements a
+gnucobol: substantial part of the COBOL 85, COBOL 2002, and COBOL 2014
+gnucobol: standards, as well as many extensions of the existent COBOL compilers.
+gnucobol: GNU Cobol translates COBOL into C and compiles the translated code
+gnucobol: using the native C compiler. GNU Cobol was written by Roger While and
+gnucobol: Keisuke Nishida, with the invaluable assistance of many others.
+gnucobol:
+gnucobol: Homepage: ftp://ftp.gnu.org/gnu/gnucobol
+gnucobol:
diff --git a/source/d/gperf/gperf.SlackBuild b/source/d/gperf/gperf.SlackBuild
index 62062dff0..960df9153 100755
--- a/source/d/gperf/gperf.SlackBuild
+++ b/source/d/gperf/gperf.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2006, 2007, 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006, 2007, 2008, 2009, 2010, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,31 +20,39 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=gperf
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
rm -rf $PKG
mkdir -p $TMP $PKG
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
@@ -74,7 +82,7 @@ CFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=/usr/doc/gperf-$VERSION \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
# Build and install:
make $NUMJOBS || make || exit 1
diff --git a/source/d/gperf/slack-desc b/source/d/gperf/slack-desc
index 9451a6f87..e6963daff 100644
--- a/source/d/gperf/slack-desc
+++ b/source/d/gperf/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -10,7 +10,7 @@ gperf: gperf (a perfect hash function generator)
gperf:
gperf: gperf is a perfect hash function generator written in C++.
gperf: It transforms an n element user-specified keyword set W into a
-gperf: perfect hash function F. gperf currently generates the reserved
+gperf: perfect hash function F. gperf currently generates the reserved
gperf: keyword recognizer for lexical analyzers in several production and
gperf: research compilers and language processing tools, including GNU C,
gperf: GNU C++, GNU Java, GNU Pascal, GNU Modula 3, and GNU indent.
diff --git a/source/d/guile/guile.SlackBuild b/source/d/guile/guile.SlackBuild
index ef6cdd1a7..e71c701e5 100755
--- a/source/d/guile/guile.SlackBuild
+++ b/source/d/guile/guile.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2011, 2013, 2016, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,31 +20,39 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=guile
-VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-guile
rm -rf $PKG
mkdir -p $PKG/usr
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
@@ -59,8 +67,9 @@ fi
cd $TMP
rm -rf guile-$VERSION
-tar xvf $CWD/guile-$VERSION.tar.xz || exit 1
+tar xvf $CWD/guile-$VERSION.tar.?z || exit 1
cd guile-$VERSION || exit 1
+
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -78,17 +87,26 @@ CFLAGS="$SLKCFLAGS" \
--disable-static \
--disable-rpath \
--disable-error-on-warning \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
# Does not like parallel make...
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
# Move libguile*-gdb.scm to GDB's autoload directory to avoid
# getting "not an ELF file" errors from ldconfig:
mkdir -p $PKG/usr/share/gdb/auto-load/usr/lib${LIBDIRSUFFIX}
mv $PKG/usr/lib${LIBDIRSUFFIX}/libguile*-gdb.scm $PKG/usr/share/gdb/auto-load/usr/lib${LIBDIRSUFFIX} || exit 1
+# Change timestamps on *.go and *.scm files, otherwise on multilib systems
+# the compiled (go) files may be detected as older than the source (scm)
+# files, causing guile to attempt to recompile itself with every use:
+find $PKG/usr/lib${LIBDIRSUFFIX} -name "*.go" -exec touch -r $CWD/guile.SlackBuild "{}" \;
+find $PKG/usr/share -name "*.scm" -exec touch -r $CWD/guile.SlackBuild "{}" \;
+
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
diff --git a/source/d/guile/slack-desc b/source/d/guile/slack-desc
index 2c23793f7..c15b525f1 100644
--- a/source/d/guile/slack-desc
+++ b/source/d/guile/slack-desc
@@ -1,16 +1,16 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
guile: guile (GNU extension language library)
guile:
-guile: This is Guile, Project GNU's extension language library. Guile is an
+guile: This is Guile, Project GNU's extension language library. Guile is an
guile: interpreter for Scheme, packaged as a library that you can link into
-guile: your applications to give them their own scripting language. Guile
+guile: your applications to give them their own scripting language. Guile
guile: will eventually support other languages as well, giving users of
guile: Guile-based applications a choice of languages.
guile:
diff --git a/source/d/help2man/help2man.SlackBuild b/source/d/help2man/help2man.SlackBuild
index 7c21dc6f0..00469327c 100755
--- a/source/d/help2man/help2man.SlackBuild
+++ b/source/d/help2man/help2man.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2013, 2015 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2013, 2015, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,15 +20,16 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=help2man
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
- i?86) ARCH=i486 ;;
+ i?86) ARCH=i586 ;;
arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$(uname -m) ;;
@@ -36,6 +37,14 @@ if [ -z "$ARCH" ]; then
export ARCH
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i386" ]; then
@@ -64,7 +73,6 @@ else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
@@ -74,7 +82,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf $PKGNAM-$VERSION
tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1
-cd $PKGNAM-$VERSION
+cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
@@ -92,7 +100,7 @@ CFLAGS="$SLKCFLAGS" \
--infodir=/usr/info \
--mandir=/usr/man \
--localstatedir=/var \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
# Build and install:
make $NUMJOBS || make || exit 1
diff --git a/source/d/help2man/slack-desc b/source/d/help2man/slack-desc
index 421736399..7fc5ff16e 100644
--- a/source/d/help2man/slack-desc
+++ b/source/d/help2man/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,7 +11,7 @@ help2man:
help2man: help2man is a tool for automatically generating simple manual pages
help2man: from program output.
help2man:
-help2man: Homepage: http://www.gnu.org/software/help2man
+help2man: Homepage: http://www.gnu.org/software/help2man
help2man:
help2man:
help2man:
diff --git a/source/d/indent/indent.SlackBuild b/source/d/indent/indent.SlackBuild
index d8bdbf192..169bcb97e 100755
--- a/source/d/indent/indent.SlackBuild
+++ b/source/d/indent/indent.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,22 +20,32 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+PKGNAM=indent
VERSION=${VERSION:-2.2.10}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
@@ -48,7 +58,6 @@ fi
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-indent
rm -rf $PKG
@@ -57,7 +66,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf indent-$VERSION
tar xvf $CWD/indent-$VERSION.tar.bz2 || exit 1
-cd indent-$VERSION
+cd indent-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -76,10 +85,10 @@ CXXFLAGS="$SLKCFLAGS" \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG
+make install DESTDIR=$PKG || exit 1
# I'm not sure why this man page fails, but...
if find $PKG -type f -size 0c -name indent.1 ; then
diff --git a/source/d/indent/slack-desc b/source/d/indent/slack-desc
index fd1d0712b..8274a0e54 100644
--- a/source/d/indent/slack-desc
+++ b/source/d/indent/slack-desc
@@ -1,15 +1,15 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
indent: indent (changes the appearance of a C program)
indent:
indent: GNU indent changes the appearance of a C program by inserting or
-indent: deleting whitespace according to a plethora of options. Some canned
+indent: deleting whitespace according to a plethora of options. Some canned
indent: styles of formatting (like the GNU style, Kernighan & Ritchie style,
indent: and original Berkeley style) are supported as well.
indent:
diff --git a/source/d/intltool/intltool.SlackBuild b/source/d/intltool/intltool.SlackBuild
index bf5a8f72d..427f48b77 100755
--- a/source/d/intltool/intltool.SlackBuild
+++ b/source/d/intltool/intltool.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2012, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2012, 2015, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=intltool
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-4}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -37,7 +38,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
@@ -69,6 +77,9 @@ find . \
# Compatability with perl 5.22:
zcat $CWD/intltool-0.51.0-perl-5.22.patch.gz | patch -p1 --verbose || exit 1
+# Fix build issues when used with automake >= 1.15:
+zcat $CWD/no-guess-builddir.diff.gz | patch -p0 --verbose || exit 1
+
# Configure:
CFLAGS="$SLKCFLAGS" \
./configure \
diff --git a/source/d/intltool/no-guess-builddir.diff b/source/d/intltool/no-guess-builddir.diff
new file mode 100644
index 000000000..3670ee523
--- /dev/null
+++ b/source/d/intltool/no-guess-builddir.diff
@@ -0,0 +1,31 @@
+=== modified file 'intltool-update.in'
+--- intltool-update.in 2014-05-14 02:15:53 +0000
++++ intltool-update.in 2015-02-03 15:05:59 +0000
+@@ -620,6 +620,14 @@
+
+ my @result;
+
++ # If the builddir is a subdir of srcdir, the list of files found will be prefixed with
++ # an additional prefix (e.g. "_build/sub" for automake 1.15 make distcheck). Try to
++ # handle that, by removing those matches as well.
++ my $absbuilddir = Cwd::abs_path("..\/");
++ my $abssrcdir = Cwd::abs_path("$SRCDIR/..");
++ # Check if builddir is a subdir of srcdir
++ my ($abspath,$relpath) = split /\s*$abssrcdir\/\s*/, $absbuilddir, 2;
++
+ foreach (@buf_allfiles_sorted)
+ {
+ my $dummy = $_;
+@@ -628,7 +636,10 @@
+ $srcdir =~ s#^../##;
+ $dummy =~ s#^$srcdir/../##;
+ $dummy =~ s#^$srcdir/##;
+- $dummy =~ s#_build/##;
++ if ($relpath)
++ {
++ $dummy =~ s#^$relpath/##;
++ }
+ if (!exists($in2{$dummy}))
+ {
+ push @result, $dummy
+
diff --git a/source/d/intltool/slack-desc b/source/d/intltool/slack-desc
index 6741f290e..905027b34 100644
--- a/source/d/intltool/slack-desc
+++ b/source/d/intltool/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,7 +11,7 @@ intltool:
intltool: This package contains scripts and autoconf files for
intltool: internationalizing data.
intltool:
-intltool:
+intltool: Homepage: https://edge.launchpad.net/intltool
intltool:
intltool:
intltool:
diff --git a/source/d/kernel-headers/slack-desc b/source/d/kernel-headers/slack-desc
deleted file mode 100644
index 1593f4df2..000000000
--- a/source/d/kernel-headers/slack-desc
+++ /dev/null
@@ -1,19 +0,0 @@
-# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
-# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
-# customary to leave one space after the ':'.
-
- |-----handy-ruler------------------------------------------------------|
-kernel-headers: kernel-headers (Linux kernel include files)
-kernel-headers:
-kernel-headers: These are the include files from the Linux kernel.
-kernel-headers:
-kernel-headers: You'll need these to compile most system software for Linux.
-kernel-headers:
-kernel-headers:
-kernel-headers:
-kernel-headers:
-kernel-headers:
-kernel-headers:
diff --git a/source/d/libtool/libtool.SlackBuild b/source/d/libtool/libtool.SlackBuild
index 448109323..0d77480eb 100755
--- a/source/d/libtool/libtool.SlackBuild
+++ b/source/d/libtool/libtool.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2013, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2013, 2015, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,8 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=libtool
VERSION=${VERSION:-$(echo libtool-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-4}
+BUILD=${BUILD:-7}
NUMJOBS=${NUMJOBS:--j6}
@@ -35,7 +38,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-libtool
@@ -82,6 +92,12 @@ CFLAGS="$SLKCFLAGS" \
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
+# Don't package the static libraries:
+rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.a
+
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
diff --git a/source/d/libtool/slack-desc b/source/d/libtool/slack-desc
index 7bf0e8d32..88866a498 100644
--- a/source/d/libtool/slack-desc
+++ b/source/d/libtool/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -10,8 +10,8 @@ libtool: libtool (a generic library support script)
libtool:
libtool: This is GNU Libtool, a generic library support script. Libtool hides
libtool: the complexity of using shared libraries behind a consistent, portable
-libtool: interface. To use libtool, add the new generic library building
-libtool: commands to your Makefile, Makefile.in, or Makefile.am. See the
+libtool: interface. To use libtool, add the new generic library building
+libtool: commands to your Makefile, Makefile.in, or Makefile.am. See the
libtool: documentation for details.
libtool:
libtool: You must install the "m4" package to be able to use libtool.
diff --git a/source/d/llvm/clang.toolchains.i586.triple.diff b/source/d/llvm/clang.toolchains.i586.triple.diff
index 3795f5e09..01b87c68a 100644
--- a/source/d/llvm/clang.toolchains.i586.triple.diff
+++ b/source/d/llvm/clang.toolchains.i586.triple.diff
@@ -1,11 +1,13 @@
---- ./tools/clang/lib/Driver/ToolChains.cpp.orig 2015-09-13 13:30:39.748069603 -0500
-+++ ./tools/clang/lib/Driver/ToolChains.cpp 2015-09-13 13:32:16.584075557 -0500
-@@ -1296,7 +1296,7 @@
+--- ./tools/clang/lib/Driver/ToolChains/Gnu.cpp.orig 2017-08-10 20:47:32.000000000 -0500
++++ ./tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-09-07 14:41:16.170110145 -0500
+@@ -1834,8 +1834,8 @@
"i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
"i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux",
"i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
- "i486-slackware-linux", "i686-montavista-linux", "i686-linux-android",
-+ "i486-slackware-linux", "i586-slackware-linux", "i686-montavista-linux", "i686-linux-android",
- "i586-linux-gnu"};
+- "i586-linux-gnu"};
++ "i486-slackware-linux", "i586-slackware-linux", "i686-montavista-linux",
++ "i686-linux-android", "i586-linux-gnu"};
static const char *const MIPSLibDirs[] = {"/lib"};
+ static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
diff --git a/source/d/llvm/clang_disable_pgo.patch b/source/d/llvm/clang_disable_pgo.patch
new file mode 100644
index 000000000..c3998798d
--- /dev/null
+++ b/source/d/llvm/clang_disable_pgo.patch
@@ -0,0 +1,14 @@
+--- ./tools/clang/lib/CodeGen/CodeGenPGO.cpp.orig 2018-03-08 19:50:01.115345121 -0600
++++ ./tools/clang/lib/CodeGen/CodeGenPGO.cpp 2018-03-08 19:52:24.016358481 -0600
+@@ -22,10 +22,7 @@
+ #include "llvm/Support/FileSystem.h"
+ #include "llvm/Support/MD5.h"
+
+-static llvm::cl::opt<bool>
+- EnableValueProfiling("enable-value-profiling", llvm::cl::ZeroOrMore,
+- llvm::cl::desc("Enable value profiling"),
+- llvm::cl::Hidden, llvm::cl::init(false));
++static bool EnableValueProfiling = false;
+
+ using namespace clang;
+ using namespace CodeGen;
diff --git a/source/d/llvm/llvm.SlackBuild b/source/d/llvm/llvm.SlackBuild
index 4d15ffaa9..4fb47ac4e 100755
--- a/source/d/llvm/llvm.SlackBuild
+++ b/source/d/llvm/llvm.SlackBuild
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for llvm
-# Copyright 2008-2015 Heinz Wiesinger, Amsterdam, The Netherlands
+# Copyright 2008-2016 Heinz Wiesinger, Amsterdam, The Netherlands
# Copyright 2012, 2013, 2014, 2015, 2016 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
@@ -23,6 +23,8 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=llvm
VERSION=${VERSION:-$(echo llvm-*.tar.xz | rev | cut -f 4- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-2}
@@ -37,7 +39,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
@@ -64,6 +73,8 @@ tar xvf $CWD/$PKGNAM-$VERSION.src.tar.xz || exit 1
cd $PKGNAM-${VERSION}/tools || cd $PKGNAM-${VERSION}.src/tools || exit 1
tar xvf $CWD/cfe-$VERSION.src.tar.xz || exit 1
mv cfe-${VERSION} clang 2>/dev/null || mv cfe-${VERSION}.src clang || exit 1
+ tar xvf $CWD/lldb-$VERSION.src.tar.xz || exit 1
+ mv lldb-${VERSION} lldb 2>/dev/null || mv lldb-${VERSION}.src lldb || exit 1
cd ../
cd tools/clang/tools || exit 1
@@ -76,14 +87,25 @@ cd projects || exit 1
tar xvf $CWD/compiler-rt-$VERSION.src.tar.xz || exit 1
mv compiler-rt-${VERSION} compiler-rt 2>/dev/null \
|| mv compiler-rt-${VERSION}.src compiler-rt || exit 1
+ tar xvf $CWD/openmp-$VERSION.src.tar.xz || exit 1
+ mv openmp-${VERSION} openmp 2>/dev/null \
+ || mv openmp-${VERSION}.src openmp || exit 1
+ tar xvf $CWD/libcxx-${VERSION}.src.tar.xz || exit 1
+ mv libcxx-${VERSION} libcxx 2>/dev/null \
+ || mv libcxx-${VERSION}.src libcxx || exit 1
+ tar xvf $CWD/libcxxabi-${VERSION}.src.tar.xz || exit 1
+ mv libcxxabi-${VERSION} libcxxabi 2>/dev/null \
+ || mv libcxxabi-${VERSION}.src libcxxabi || exit 1
cd ../
# Support GCC built for i586-slackware-linux:
zcat $CWD/clang.toolchains.i586.triple.diff.gz | patch -p1 --verbose || exit 1
-# Use i586 $ARCH on 32-bit x86:
-sed -r "/ifeq.*CompilerTargetArch/s#i386#i586#g" \
- -i projects/compiler-rt/make/platform/clang_linux.mk
+## This seems obsolete, so commenting it out:
+#
+## Use i586 $ARCH on 32-bit x86:
+#sed -r "/ifeq.*CompilerTargetArch/s#i386#i586#g" \
+# -i projects/compiler-rt/make/platform/clang_linux.mk
chown -R root:root .
find . \
@@ -92,6 +114,10 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# disable value profiling until https://llvm.org/bugs/show_bug.cgi?id=30587
+# is fixed.
+zcat $CWD/clang_disable_pgo.patch.gz | patch -p1 --verbose || exit 1
+
# need to disable assertions to make llvm thread-safe
# clang resource dir is a relative path based on the location of the clang binary
mkdir build
@@ -112,7 +138,7 @@ cd build
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_BINUTILS_INCDIR=/usr/include \
-DCLANG_RESOURCE_DIR="../lib${LIBDIRSUFFIX}/clang/${VERSION}" \
- ..
+ .. || exit 1
# breaks with one of the patches above. Maybe revisit later
# -DBUILD_SHARED_LIBS=ON \
@@ -133,26 +159,25 @@ for i in ccc c++; do
$PKG/usr/bin/$i-analyzer || exit 1
done
-## Fix paths in scan-build
-#sed -i "s|\$RealBin/bin|/usr/bin|" \
-# $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
-#sed -i "s|\$RealBin/sorttable.js|/usr/lib${LIBDIRSUFFIX}/clang-analyzer/scan-build/sorttable.js|" \
-# $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
-#sed -i "s|\$RealBin/scanview.css|/usr/lib${LIBDIRSUFFIX}/clang-analyzer/scan-build/scanview.css|" \
-# $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build/scan-build
-#
-## fix strange permissions
-#chmod 755 $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-build
-#chmod 755 $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-view
-#chmod 755 $PKG/usr/lib$LIBDIRSUFFIX/clang-analyzer/scan-view/Resources
+# Remove symlink to libgomp, which is already provided by gcc
+rm -f $PKG/usr/lib$LIBDIRSUFFIX/libgomp.so
# Install Python bindings
mkdir -p "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages"
cp -a tools/clang/bindings/python/clang "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/"
+# Remove bundled python-six
+rm -f "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/six.py"
+
# Compile Python scripts
python -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/clang"
python -O -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/clang"
+python -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/lldb"
+python -O -m compileall "$PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/lldb"
+python -m compileall "$PKG/usr/share/scan-view"
+python -O -m compileall "$PKG/usr/share/scan-view"
+python -m compileall "$PKG/usr/share/clang"
+python -O -m compileall "$PKG/usr/share/clang"
# Move man page directory:
mv $PKG/usr/share/man $PKG/usr/
@@ -170,10 +195,18 @@ for i in $( find $PKG/usr/man -type l ) ; do
rm $i
done
-mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/clang
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/{clang,lldb,clang-tools-extra,compiler-rt,openmp}
cp -a CREDITS* LICENSE* README* $PKG/usr/doc/$PKGNAM-$VERSION
cp -a tools/clang/{INSTALL,LICENSE,NOTES,README}* \
$PKG/usr/doc/$PKGNAM-$VERSION/clang
+cp -a tools/lldb/{CODE_OWNERS,INSTALL,LICENSE}* \
+ $PKG/usr/doc/$PKGNAM-$VERSION/lldb
+cp -a tools/clang/tools/extra/{CODE_OWNERS,LICENSE,README}* \
+ $PKG/usr/doc/$PKGNAM-$VERSION/clang-tools-extra
+cp -a projects/compiler-rt/{CODE_OWNERS,CREDITS,LICENSE,README}* \
+ $PKG/usr/doc/$PKGNAM-$VERSION/compiler-rt
+cp -a projects/openmp/{CREDITS,LICENSE}* \
+ $PKG/usr/doc/$PKGNAM-$VERSION/openmp
mv $PKG/usr/docs/llvm/* $PKG/usr/doc/$PKGNAM-$VERSION
rm -rf $PKG/usr/docs
diff --git a/source/d/llvm/llvm.url b/source/d/llvm/llvm.url
index f276cfe18..c92e44e2f 100644
--- a/source/d/llvm/llvm.url
+++ b/source/d/llvm/llvm.url
@@ -1,4 +1,8 @@
-http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz
-http://llvm.org/releases/3.8.0/cfe-3.8.0.src.tar.xz
-http://llvm.org/releases/3.8.0/clang-tools-extra-3.8.0.src.tar.xz
-http://llvm.org/releases/3.8.0/compiler-rt-3.8.0.src.tar.xz
+http://llvm.org/releases/6.0.0/llvm-6.0.0.src.tar.xz
+http://llvm.org/releases/6.0.0/cfe-6.0.0.src.tar.xz
+http://llvm.org/releases/6.0.0/clang-tools-extra-6.0.0.src.tar.xz
+http://llvm.org/releases/6.0.0/compiler-rt-6.0.0.src.tar.xz
+http://llvm.org/releases/6.0.0/lldb-6.0.0.src.tar.xz
+http://llvm.org/releases/6.0.0/openmp-6.0.0.src.tar.xz
+http://llvm.org/releases/6.0.0/libcxx-6.0.0.src.tar.xz
+http://llvm.org/releases/6.0.0/libcxxabi-6.0.0.src.tar.xz
diff --git a/source/d/llvm/slack-desc b/source/d/llvm/slack-desc
index b466d361a..76280c242 100644
--- a/source/d/llvm/slack-desc
+++ b/source/d/llvm/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
@@ -12,7 +12,7 @@ llvm: Low Level Virtual Machine is a toolkit for the construction of highly
llvm: optimized compilers, optimizers, and runtime environments.
llvm:
llvm: This package also includes the clang frontend for the C family of
-llvm: languages: C, C++, Objective-C, and Objective-C++
+llvm: languages: C, C++, Objective-C, and Objective-C++
llvm:
llvm:
llvm: Homepage: http://llvm.org/
diff --git a/source/d/m4/m4.SlackBuild b/source/d/m4/m4.SlackBuild
index 5623854c4..0bc3f10fc 100755
--- a/source/d/m4/m4.SlackBuild
+++ b/source/d/m4/m4.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010, 2011, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,27 +20,36 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=m4
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j7 "}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-m4
-if [ "$ARCH" = "i486" ]; then
+if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
@@ -106,7 +115,7 @@ fi
# ansi2knr is no longer part of the m4 sources.
# Geez, I'm gonna have to learn ANSI C now...
#
-#( cd src ; make ansi2knr )
+#( cd src ; make ansi2knr || exit 1) || exit 1
#gzip -9 $PKG/usr/info/m4.info.gz
#cat src/m4 > $PKG/usr/bin/m4
#chmod 755 $PKG/usr/bin/*
diff --git a/source/d/m4/slack-desc b/source/d/m4/slack-desc
index 7951b9bd8..760e2d381 100644
--- a/source/d/m4/slack-desc
+++ b/source/d/m4/slack-desc
@@ -1,17 +1,17 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
m4: m4 (an implementation of the UNIX macro processor)
m4:
m4: This is GNU m4, a program which copies its input to the output,
-m4: expanding macros as it goes. m4 has built-in functions for including
+m4: expanding macros as it goes. m4 has built-in functions for including
m4: named files, running commands, doing integer arithmetic, manipulating
-m4: text in various ways, recursion, etc... Macros can also be user-
+m4: text in various ways, recursion, etc... Macros can also be user-
m4: defined, and can take any number of arguments.
m4:
m4: GNU 'm4' was originally written by Rene Seindal, from Denmark.
diff --git a/source/d/make/make.SlackBuild b/source/d/make/make.SlackBuild
index 66f60f0b2..e31e5798b 100755
--- a/source/d/make/make.SlackBuild
+++ b/source/d/make/make.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2005-2016 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2005-2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=make
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.bz2 | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -35,9 +36,16 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-make
@@ -69,6 +77,11 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+zcat $CWD/make.guile22.diff.gz | patch -p1 --verbose || exit 1
+zcat $CWD/make.glibc-2.27.glob.diff.gz | patch -p1 --verbose || exit 1
+
+autoreconf -vif
+
# Configure:
CFLAGS="$SLKCFLAGS" \
./configure \
diff --git a/source/d/make/make.glibc-2.27.glob.diff b/source/d/make/make.glibc-2.27.glob.diff
new file mode 100644
index 000000000..8d795f899
--- /dev/null
+++ b/source/d/make/make.glibc-2.27.glob.diff
@@ -0,0 +1,32 @@
+diff -u -r make-4.2.1.orig/glob/glob.c make-4.2.1/glob/glob.c
+--- make-4.2.1.orig/glob/glob.c 2013-10-20 12:14:38.000000000 -0500
++++ make-4.2.1/glob/glob.c 2018-02-16 14:41:18.956182332 -0600
+@@ -208,28 +208,9 @@
+ #endif /* __GNU_LIBRARY__ || __DJGPP__ */
+
+
+-#if !defined __alloca && !defined __GNU_LIBRARY__
+-
+-# ifdef __GNUC__
+-# undef alloca
+-# define alloca(n) __builtin_alloca (n)
+-# else /* Not GCC. */
+-# ifdef HAVE_ALLOCA_H
+ # include <alloca.h>
+-# else /* Not HAVE_ALLOCA_H. */
+-# ifndef _AIX
+-# ifdef WINDOWS32
+-# include <malloc.h>
+-# else
+-extern char *alloca ();
+-# endif /* WINDOWS32 */
+-# endif /* Not _AIX. */
+-# endif /* sparc or HAVE_ALLOCA_H. */
+-# endif /* GCC. */
+-
+ # define __alloca alloca
+
+-#endif
+
+ #ifndef __GNU_LIBRARY__
+ # define __stat stat
diff --git a/source/d/make/make.guile22.diff b/source/d/make/make.guile22.diff
new file mode 100644
index 000000000..b3a3a276b
--- /dev/null
+++ b/source/d/make/make.guile22.diff
@@ -0,0 +1,13 @@
+--- ./configure.ac.orig 2016-06-06 07:27:31.000000000 -0500
++++ ./configure.ac 2017-12-02 12:21:41.682170019 -0600
+@@ -168,8 +168,8 @@
+ # comes with it's own PC file so we have to specify them as individual
+ # packages. Ugh.
+ AS_IF([test "x$with_guile" != xno],
+-[ PKG_CHECK_MODULES([GUILE], [guile-2.0], [have_guile=yes],
+- [PKG_CHECK_MODULES([GUILE], [guile-1.8], [have_guile=yes],
++[ PKG_CHECK_MODULES([GUILE], [guile-2.2], [have_guile=yes],
++ [PKG_CHECK_MODULES([GUILE], [guile-2.0], [have_guile=yes],
+ [have_guile=no])])
+ ])
+
diff --git a/source/d/make/slack-desc b/source/d/make/slack-desc
index ef19ca33a..883506fb4 100644
--- a/source/d/make/slack-desc
+++ b/source/d/make/slack-desc
@@ -1,17 +1,17 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
make: make (GNU make utility to maintain groups of programs)
make:
make: This is the GNU implementation of make, which was written by Richard
-make: Stallman and Roland McGrath. The purpose of the make utility is to
+make: Stallman and Roland McGrath. The purpose of the make utility is to
make: determine automatically which pieces of a large program need to be
-make: recompiled, and issue the commands to recompile them.
+make: recompiled, and issue the commands to recompile them.
make:
make: This is needed to compile just about any major C program, including
make: the Linux kernel.
diff --git a/source/d/mercurial/mercurial.SlackBuild b/source/d/mercurial/mercurial.SlackBuild
index b1629a651..ef09827bb 100755
--- a/source/d/mercurial/mercurial.SlackBuild
+++ b/source/d/mercurial/mercurial.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,8 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=${VERSION:-$(echo mercurial-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD-1}
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=mercurial
+VERSION=${VERSION:-$(echo mercurial-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -33,7 +36,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-mercurial
@@ -42,8 +52,9 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf mercurial-$VERSION
-tar xvf $CWD/mercurial-$VERSION.tar.?z* || exit 1
-cd mercurial-$VERSION
+tar xvf $CWD/mercurial-$VERSION.tar.?z || exit 1
+cd mercurial-$VERSION || exit 1
+
chown -R root.root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
diff --git a/source/d/mercurial/mercurial.url b/source/d/mercurial/mercurial.url
new file mode 100644
index 000000000..78e147980
--- /dev/null
+++ b/source/d/mercurial/mercurial.url
@@ -0,0 +1 @@
+https://www.mercurial-scm.org/release
diff --git a/source/d/mercurial/slack-desc b/source/d/mercurial/slack-desc
index e770f6c31..af82c7afd 100644
--- a/source/d/mercurial/slack-desc
+++ b/source/d/mercurial/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
# This article is licensed under the GNU Free Documentation License.
@@ -12,11 +12,11 @@
mercurial: mercurial (a distributed source management system)
mercurial:
mercurial: Mercurial is a cross-platform, distributed source management tool for
-mercurial: software developers. It is written in Python, with a binary diff
-mercurial: implementation written in C. Its major features include high-
-mercurial: performance; serverless, fully distributed collaborative development;
-mercurial: robust handling of both plain text and binary files; advanced
-mercurial: branching and merging capabilities; and full source code available
+mercurial: software developers. It is written in Python, with a binary diff
+mercurial: implementation written in C. Its major features include high-
+mercurial: performance; serverless, fully distributed collaborative development;
+mercurial: robust handling of both plain text and binary files; advanced
+mercurial: branching and merging capabilities; and full source code available
mercurial: under the terms of the LGPL.
mercurial:
mercurial: Mercurial was written by Matt Mackall and other contributors.
diff --git a/source/d/meson/meson.SlackBuild b/source/d/meson/meson.SlackBuild
new file mode 100755
index 000000000..381933778
--- /dev/null
+++ b/source/d/meson/meson.SlackBuild
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+# Copyright 2017 Heinz Wiesinger, Amsterdam, NL
+# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=meson
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
+cd $PKGNAM-$VERSION || exit 1
+
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+python3 setup.py install --root=$PKG || exit 1
+
+mv $PKG/usr/share/man $PKG/usr/
+rmdir $PKG/usr/share 2> /dev/null
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a contributing.txt COPYING PKG-INFO README* \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+find $PKG/usr/doc/$PKGNAM-$VERSION -type f -exec chmod 0644 {} \;
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/d/meson/meson.url b/source/d/meson/meson.url
new file mode 100644
index 000000000..216644274
--- /dev/null
+++ b/source/d/meson/meson.url
@@ -0,0 +1 @@
+https://github.com/mesonbuild/meson/releases/download/0.46.1/meson-0.46.1.tar.gz
diff --git a/source/d/meson/slack-desc b/source/d/meson/slack-desc
new file mode 100644
index 000000000..17469f9bb
--- /dev/null
+++ b/source/d/meson/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+meson: meson (A high performance build system)
+meson:
+meson: Meson is a cross-platform build system designed to be both as fast
+meson: and as user friendly as possible. It supports many languages and
+meson: compilers, including GCC and Clang. Its build definitions are written
+meson: in a simple non-turing complete domain specific language.
+meson:
+meson: Homepage: http://mesonbuild.com/
+meson:
+meson:
+meson:
diff --git a/source/d/nasm/nasm.SlackBuild b/source/d/nasm/nasm.SlackBuild
index 63f80748d..f52d2aa53 100755
--- a/source/d/nasm/nasm.SlackBuild
+++ b/source/d/nasm/nasm.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010, 2011, 2017, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,10 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=nasm
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -35,13 +36,20 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
if [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
else
SLKCFLAGS="-O2"
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-nasm
@@ -50,7 +58,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf nasm-$VERSION
tar xvf $CWD/nasm-$VERSION.tar.?z* || exit 1
-cd nasm-$VERSION
+cd nasm-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -65,11 +73,12 @@ CFLAGS="$SLKCFLAGS" \
--build=${ARCH}-slackware-linux || exit 1
make || exit 1
-make -C doc || exit 1
-
-mkdir -p $PKG/usr/bin $PKG/usr/man/man1 $PKG/usr/info
+( cd doc
+ make nasmdoc.txt || exit 1
+ mkdir -p $PKG/usr/doc/nasm-$VERSION
+ cp nasmdoc.txt $PKG/usr/doc/nasm-$VERSION
+) || exit 1
make install INSTALLROOT=$PKG || exit 1
-cp -a doc/info/* $PKG/usr/info
find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
@@ -80,7 +89,6 @@ cp -a \
$PKG/usr/doc/nasm-$VERSION
gzip -9 $PKG/usr/man/man?/*
-gzip -9 $PKG/usr/info/*
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
diff --git a/source/d/nasm/slack-desc b/source/d/nasm/slack-desc
index 6fd4778f2..8c7c44d72 100644
--- a/source/d/nasm/slack-desc
+++ b/source/d/nasm/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -14,6 +14,6 @@ nasm: instruction mnemonics and syntax.
nasm:
nasm: NASM was written by Simon Tatham and Julian Hall.
nasm:
-nasm:
+nasm: Homepage: http://www.nasm.us
nasm:
nasm:
diff --git a/source/d/ninja/ninja.SlackBuild b/source/d/ninja/ninja.SlackBuild
new file mode 100755
index 000000000..007cc6d1d
--- /dev/null
+++ b/source/d/ninja/ninja.SlackBuild
@@ -0,0 +1,132 @@
+#!/bin/bash
+
+# Copyright 2016, 2017 Eric Hameleers, Eindhoven, NL
+# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=ninja
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-2}
+
+NUMJOBS=${NUMJOBS:--j7}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$(uname -m)" in
+ i?86) ARCH=i586 ;;
+ arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$(uname -m) ;;
+ esac
+ export ARCH
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ SLKLDFLAGS="-L/usr/lib64"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+fi
+
+case "$ARCH" in
+ arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
+ *) TARGET=$ARCH-slackware-linux ;;
+esac
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
+cd $PKGNAM-$VERSION || exit 1
+
+# Fix bogus permissions:
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Build the program:
+LDFLAGS="$SLKLDFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+CFLAGS="$SLKCFLAGS" \
+ python3 configure.py --bootstrap || exit 1
+
+# Manually install stuff:
+install -D -m0755 ninja $PKG/usr/bin/ninja || exit 1
+install -D -m0644 misc/bash-completion $PKG/usr/share/bash-completion/completions/ninja || exit 1
+install -D -m0644 misc/zsh-completion $PKG/usr/share/zsh/site-functions/_ninja || exit 1
+install -D -m0644 misc/ninja.vim $PKG/usr/share/vim/vimfiles/syntax/ninja.vim || exit 1
+install -D -m0644 misc/ninja-mode.el $PKG/usr/share/emacs/site-lisp/ninja-mode.el || exit 1
+
+# Compiling the .el should be optional...
+#emacs -Q --batch -f batch-byte-compile misc/ninja-mode.el || exit 1
+#install -D -m0644 misc/ninja-mode.elc $PKG/usr/share/emacs/site-lisp/ninja-mode.elc || exit 1
+
+# Compress the man page(s):
+if [ -d $PKG/usr/man ]; then
+ find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
+ for i in $(find $PKG/usr/man -type l -name "*.?") ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+fi
+
+# Strip binaries (if any):
+find $PKG | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a \
+ COPYING* HACKING* README* RELEASING \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+
+# Add a package description:
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Build the package:
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/d/ninja/ninja.url b/source/d/ninja/ninja.url
new file mode 100644
index 000000000..c282f2a9e
--- /dev/null
+++ b/source/d/ninja/ninja.url
@@ -0,0 +1 @@
+https://github.com/ninja-build/ninja/archive/v1.8.2/ninja-1.8.2.tar.gz
diff --git a/source/d/ninja/slack-desc b/source/d/ninja/slack-desc
new file mode 100644
index 000000000..4dd38021b
--- /dev/null
+++ b/source/d/ninja/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+ninja: ninja (build system with a focus on speed)
+ninja:
+ninja: Ninja is a small build system with a focus on speed. It differs from
+ninja: other build systems in two major respects: it is designed to have its
+ninja: input files generated by a higher-level build system, and it is
+ninja: designed to run builds as fast as possible.
+ninja:
+ninja: ninja home: https://ninja-build.org/
+ninja:
+ninja:
+ninja:
diff --git a/source/d/opencl-headers/LICENSE.txt b/source/d/opencl-headers/LICENSE.txt
new file mode 100644
index 000000000..a89e4f5c0
--- /dev/null
+++ b/source/d/opencl-headers/LICENSE.txt
@@ -0,0 +1,20 @@
+ * Copyright (c) 2008-2010 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
diff --git a/source/d/opencl-headers/cl.hpp b/source/d/opencl-headers/cl.hpp
new file mode 100644
index 000000000..396b86719
--- /dev/null
+++ b/source/d/opencl-headers/cl.hpp
@@ -0,0 +1,12934 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2015 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ ******************************************************************************/
+
+/*! \file
+ *
+ * \brief C++ bindings for OpenCL 1.0 (rev 48), OpenCL 1.1 (rev 33) and
+ * OpenCL 1.2 (rev 15)
+ * \author Benedict R. Gaster, Laurent Morichetti and Lee Howes
+ *
+ * Additions and fixes from:
+ * Brian Cole, March 3rd 2010 and April 2012
+ * Matt Gruenke, April 2012.
+ * Bruce Merry, February 2013.
+ * Tom Deakin and Simon McIntosh-Smith, July 2013
+ *
+ * \version 1.2.8
+ * \date October 2015
+ *
+ * Optional extension support
+ *
+ * cl
+ * cl_ext_device_fission
+ * #define USE_CL_DEVICE_FISSION
+ */
+
+/*! \mainpage
+ * \section intro Introduction
+ * For many large applications C++ is the language of choice and so it seems
+ * reasonable to define C++ bindings for OpenCL.
+ *
+ *
+ * The interface is contained with a single C++ header file \em cl.hpp and all
+ * definitions are contained within the namespace \em cl. There is no additional
+ * requirement to include \em cl.h and to use either the C++ or original C
+ * bindings it is enough to simply include \em cl.hpp.
+ *
+ * The bindings themselves are lightweight and correspond closely to the
+ * underlying C API. Using the C++ bindings introduces no additional execution
+ * overhead.
+ *
+ * For detail documentation on the bindings see:
+ *
+ * The OpenCL C++ Wrapper API 1.2 (revision 09)
+ * http://www.khronos.org/registry/cl/specs/opencl-cplusplus-1.2.pdf
+ *
+ * \section example Example
+ *
+ * The following example shows a general use case for the C++
+ * bindings, including support for the optional exception feature and
+ * also the supplied vector and string classes, see following sections for
+ * decriptions of these features.
+ *
+ * \code
+ * #define __CL_ENABLE_EXCEPTIONS
+ *
+ * #if defined(__APPLE__) || defined(__MACOSX)
+ * #include <OpenCL/cl.hpp>
+ * #else
+ * #include <CL/cl.hpp>
+ * #endif
+ * #include <cstdio>
+ * #include <cstdlib>
+ * #include <iostream>
+ *
+ * const char * helloStr = "__kernel void "
+ * "hello(void) "
+ * "{ "
+ * " "
+ * "} ";
+ *
+ * int
+ * main(void)
+ * {
+ * cl_int err = CL_SUCCESS;
+ * try {
+ *
+ * std::vector<cl::Platform> platforms;
+ * cl::Platform::get(&platforms);
+ * if (platforms.size() == 0) {
+ * std::cout << "Platform size 0\n";
+ * return -1;
+ * }
+ *
+ * cl_context_properties properties[] =
+ * { CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), 0};
+ * cl::Context context(CL_DEVICE_TYPE_CPU, properties);
+ *
+ * std::vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
+ *
+ * cl::Program::Sources source(1,
+ * std::make_pair(helloStr,strlen(helloStr)));
+ * cl::Program program_ = cl::Program(context, source);
+ * program_.build(devices);
+ *
+ * cl::Kernel kernel(program_, "hello", &err);
+ *
+ * cl::Event event;
+ * cl::CommandQueue queue(context, devices[0], 0, &err);
+ * queue.enqueueNDRangeKernel(
+ * kernel,
+ * cl::NullRange,
+ * cl::NDRange(4,4),
+ * cl::NullRange,
+ * NULL,
+ * &event);
+ *
+ * event.wait();
+ * }
+ * catch (cl::Error err) {
+ * std::cerr
+ * << "ERROR: "
+ * << err.what()
+ * << "("
+ * << err.err()
+ * << ")"
+ * << std::endl;
+ * }
+ *
+ * return EXIT_SUCCESS;
+ * }
+ *
+ * \endcode
+ *
+ */
+#ifndef CL_HPP_
+#define CL_HPP_
+
+#ifdef _WIN32
+
+#include <malloc.h>
+
+#if defined(USE_DX_INTEROP)
+#include <CL/cl_d3d10.h>
+#include <CL/cl_dx9_media_sharing.h>
+#endif
+#endif // _WIN32
+
+#if defined(_MSC_VER)
+#include <intrin.h>
+#endif // _MSC_VER
+
+//
+#if defined(USE_CL_DEVICE_FISSION)
+#include <CL/cl_ext.h>
+#endif
+
+#if defined(__APPLE__) || defined(__MACOSX)
+#include <OpenCL/opencl.h>
+#else
+#include <CL/opencl.h>
+#endif // !__APPLE__
+
+#if (_MSC_VER >= 1700) || (__cplusplus >= 201103L)
+#define CL_HPP_RVALUE_REFERENCES_SUPPORTED
+#define CL_HPP_CPP11_ATOMICS_SUPPORTED
+#include <atomic>
+#endif
+
+#if (__cplusplus >= 201103L)
+#define CL_HPP_NOEXCEPT noexcept
+#else
+#define CL_HPP_NOEXCEPT
+#endif
+
+
+// To avoid accidentally taking ownership of core OpenCL types
+// such as cl_kernel constructors are made explicit
+// under OpenCL 1.2
+#if defined(CL_VERSION_1_2) && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+#define __CL_EXPLICIT_CONSTRUCTORS explicit
+#else // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+#define __CL_EXPLICIT_CONSTRUCTORS
+#endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+
+// Define deprecated prefixes and suffixes to ensure compilation
+// in case they are not pre-defined
+#if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
+#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+#endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
+#if !defined(CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED)
+#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+#endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
+
+#if !defined(CL_CALLBACK)
+#define CL_CALLBACK
+#endif //CL_CALLBACK
+
+#include <utility>
+#include <limits>
+#include <iterator>
+
+#if defined(__CL_ENABLE_EXCEPTIONS)
+#include <exception>
+#endif // #if defined(__CL_ENABLE_EXCEPTIONS)
+
+#if !defined(__NO_STD_VECTOR)
+#include <vector>
+#endif
+
+#if !defined(__NO_STD_STRING)
+#include <string>
+#endif
+
+#if defined(__ANDROID__) || defined(linux) || defined(__APPLE__) || defined(__MACOSX)
+#include <alloca.h>
+#endif // linux
+
+#include <cstring>
+
+
+/*! \namespace cl
+ *
+ * \brief The OpenCL C++ bindings are defined within this namespace.
+ *
+ */
+namespace cl {
+
+class Memory;
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
+#define __INIT_CL_EXT_FCN_PTR(name) \
+ if(!pfn_##name) { \
+ pfn_##name = (PFN_##name) \
+ clGetExtensionFunctionAddress(#name); \
+ if(!pfn_##name) { \
+ } \
+ }
+#endif // #if defined(CL_VERSION_1_1)
+
+#if defined(CL_VERSION_1_2)
+#define __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, name) \
+ if(!pfn_##name) { \
+ pfn_##name = (PFN_##name) \
+ clGetExtensionFunctionAddressForPlatform(platform, #name); \
+ if(!pfn_##name) { \
+ } \
+ }
+#endif // #if defined(CL_VERSION_1_1)
+
+class Program;
+class Device;
+class Context;
+class CommandQueue;
+class Memory;
+class Buffer;
+
+#if defined(__CL_ENABLE_EXCEPTIONS)
+/*! \brief Exception class
+ *
+ * This may be thrown by API functions when __CL_ENABLE_EXCEPTIONS is defined.
+ */
+class Error : public std::exception
+{
+private:
+ cl_int err_;
+ const char * errStr_;
+public:
+ /*! \brief Create a new CL error exception for a given error code
+ * and corresponding message.
+ *
+ * \param err error code value.
+ *
+ * \param errStr a descriptive string that must remain in scope until
+ * handling of the exception has concluded. If set, it
+ * will be returned by what().
+ */
+ Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr)
+ {}
+
+ ~Error() throw() {}
+
+ /*! \brief Get error string associated with exception
+ *
+ * \return A memory pointer to the error message string.
+ */
+ virtual const char * what() const throw ()
+ {
+ if (errStr_ == NULL) {
+ return "empty";
+ }
+ else {
+ return errStr_;
+ }
+ }
+
+ /*! \brief Get error code associated with exception
+ *
+ * \return The error code.
+ */
+ cl_int err(void) const { return err_; }
+};
+
+#define __ERR_STR(x) #x
+#else
+#define __ERR_STR(x) NULL
+#endif // __CL_ENABLE_EXCEPTIONS
+
+
+namespace detail
+{
+#if defined(__CL_ENABLE_EXCEPTIONS)
+static inline cl_int errHandler (
+ cl_int err,
+ const char * errStr = NULL)
+{
+ if (err != CL_SUCCESS) {
+ throw Error(err, errStr);
+ }
+ return err;
+}
+#else
+static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
+{
+ (void) errStr; // suppress unused variable warning
+ return err;
+}
+#endif // __CL_ENABLE_EXCEPTIONS
+}
+
+
+
+//! \cond DOXYGEN_DETAIL
+#if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
+#define __GET_DEVICE_INFO_ERR __ERR_STR(clGetDeviceInfo)
+#define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo)
+#define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs)
+#define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs)
+#define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo)
+#define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo)
+#define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo)
+#define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo)
+#define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo)
+#define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo)
+#define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo)
+#if defined(CL_VERSION_1_2)
+#define __GET_KERNEL_ARG_INFO_ERR __ERR_STR(clGetKernelArgInfo)
+#endif // #if defined(CL_VERSION_1_2)
+#define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo)
+#define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo)
+#define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo)
+#define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo)
+
+#define __CREATE_CONTEXT_ERR __ERR_STR(clCreateContext)
+#define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType)
+#define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats)
+
+#define __CREATE_BUFFER_ERR __ERR_STR(clCreateBuffer)
+#define __COPY_ERR __ERR_STR(cl::copy)
+#define __CREATE_SUBBUFFER_ERR __ERR_STR(clCreateSubBuffer)
+#define __CREATE_GL_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
+#define __CREATE_GL_RENDER_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
+#define __GET_GL_OBJECT_INFO_ERR __ERR_STR(clGetGLObjectInfo)
+#if defined(CL_VERSION_1_2)
+#define __CREATE_IMAGE_ERR __ERR_STR(clCreateImage)
+#define __CREATE_GL_TEXTURE_ERR __ERR_STR(clCreateFromGLTexture)
+#define __IMAGE_DIMENSION_ERR __ERR_STR(Incorrect image dimensions)
+#endif // #if defined(CL_VERSION_1_2)
+#define __CREATE_SAMPLER_ERR __ERR_STR(clCreateSampler)
+#define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR __ERR_STR(clSetMemObjectDestructorCallback)
+
+#define __CREATE_USER_EVENT_ERR __ERR_STR(clCreateUserEvent)
+#define __SET_USER_EVENT_STATUS_ERR __ERR_STR(clSetUserEventStatus)
+#define __SET_EVENT_CALLBACK_ERR __ERR_STR(clSetEventCallback)
+#define __WAIT_FOR_EVENTS_ERR __ERR_STR(clWaitForEvents)
+
+#define __CREATE_KERNEL_ERR __ERR_STR(clCreateKernel)
+#define __SET_KERNEL_ARGS_ERR __ERR_STR(clSetKernelArg)
+#define __CREATE_PROGRAM_WITH_SOURCE_ERR __ERR_STR(clCreateProgramWithSource)
+#define __CREATE_PROGRAM_WITH_BINARY_ERR __ERR_STR(clCreateProgramWithBinary)
+#if defined(CL_VERSION_1_2)
+#define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR __ERR_STR(clCreateProgramWithBuiltInKernels)
+#endif // #if defined(CL_VERSION_1_2)
+#define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
+#if defined(CL_VERSION_1_2)
+#define __COMPILE_PROGRAM_ERR __ERR_STR(clCompileProgram)
+#define __LINK_PROGRAM_ERR __ERR_STR(clLinkProgram)
+#endif // #if defined(CL_VERSION_1_2)
+#define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
+
+#define __CREATE_COMMAND_QUEUE_ERR __ERR_STR(clCreateCommandQueue)
+#define __SET_COMMAND_QUEUE_PROPERTY_ERR __ERR_STR(clSetCommandQueueProperty)
+#define __ENQUEUE_READ_BUFFER_ERR __ERR_STR(clEnqueueReadBuffer)
+#define __ENQUEUE_READ_BUFFER_RECT_ERR __ERR_STR(clEnqueueReadBufferRect)
+#define __ENQUEUE_WRITE_BUFFER_ERR __ERR_STR(clEnqueueWriteBuffer)
+#define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect)
+#define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer)
+#define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect)
+#define __ENQUEUE_FILL_BUFFER_ERR __ERR_STR(clEnqueueFillBuffer)
+#define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage)
+#define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage)
+#define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage)
+#define __ENQUEUE_FILL_IMAGE_ERR __ERR_STR(clEnqueueFillImage)
+#define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer)
+#define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage)
+#define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer)
+#define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage)
+#define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject)
+#define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel)
+#define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask)
+#define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel)
+#if defined(CL_VERSION_1_2)
+#define __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR __ERR_STR(clEnqueueMigrateMemObjects)
+#endif // #if defined(CL_VERSION_1_2)
+
+#define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects)
+#define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects)
+
+
+#define __RETAIN_ERR __ERR_STR(Retain Object)
+#define __RELEASE_ERR __ERR_STR(Release Object)
+#define __FLUSH_ERR __ERR_STR(clFlush)
+#define __FINISH_ERR __ERR_STR(clFinish)
+#define __VECTOR_CAPACITY_ERR __ERR_STR(Vector capacity error)
+
+/**
+ * CL 1.2 version that uses device fission.
+ */
+#if defined(CL_VERSION_1_2)
+#define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevices)
+#else
+#define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT)
+#endif // #if defined(CL_VERSION_1_2)
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
+#define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker)
+#define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents)
+#define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier)
+#define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler)
+#define __CREATE_GL_TEXTURE_2D_ERR __ERR_STR(clCreateFromGLTexture2D)
+#define __CREATE_GL_TEXTURE_3D_ERR __ERR_STR(clCreateFromGLTexture3D)
+#define __CREATE_IMAGE2D_ERR __ERR_STR(clCreateImage2D)
+#define __CREATE_IMAGE3D_ERR __ERR_STR(clCreateImage3D)
+#endif // #if defined(CL_VERSION_1_1)
+
+#endif // __CL_USER_OVERRIDE_ERROR_STRINGS
+//! \endcond
+
+/**
+ * CL 1.2 marker and barrier commands
+ */
+#if defined(CL_VERSION_1_2)
+#define __ENQUEUE_MARKER_WAIT_LIST_ERR __ERR_STR(clEnqueueMarkerWithWaitList)
+#define __ENQUEUE_BARRIER_WAIT_LIST_ERR __ERR_STR(clEnqueueBarrierWithWaitList)
+#endif // #if defined(CL_VERSION_1_2)
+
+#if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING)
+typedef std::string STRING_CLASS;
+#elif !defined(__USE_DEV_STRING)
+
+/*! \class string
+ * \brief Simple string class, that provides a limited subset of std::string
+ * functionality but avoids many of the issues that come with that class.
+
+ * \note Deprecated. Please use std::string as default or
+ * re-define the string class to match the std::string
+ * interface by defining STRING_CLASS
+ */
+class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED string CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+{
+private:
+ ::size_t size_;
+ char * str_;
+public:
+ //! \brief Constructs an empty string, allocating no memory.
+ string(void) : size_(0), str_(NULL)
+ {
+ }
+
+ /*! \brief Constructs a string populated from an arbitrary value of
+ * specified size.
+ *
+ * An extra '\0' is added, in case none was contained in str.
+ *
+ * \param str the initial value of the string instance. Note that '\0'
+ * characters receive no special treatment. If NULL,
+ * the string is left empty, with a size of 0.
+ *
+ * \param size the number of characters to copy from str.
+ */
+ string(const char * str, ::size_t size) :
+ size_(size),
+ str_(NULL)
+ {
+ if( size > 0 ) {
+ str_ = new char[size_+1];
+ if (str_ != NULL) {
+ memcpy(str_, str, size_ * sizeof(char));
+ str_[size_] = '\0';
+ }
+ else {
+ size_ = 0;
+ }
+ }
+ }
+
+ /*! \brief Constructs a string populated from a null-terminated value.
+ *
+ * \param str the null-terminated initial value of the string instance.
+ * If NULL, the string is left empty, with a size of 0.
+ */
+ string(const char * str) :
+ size_(0),
+ str_(NULL)
+ {
+ if( str ) {
+ size_= ::strlen(str);
+ }
+ if( size_ > 0 ) {
+ str_ = new char[size_ + 1];
+ if (str_ != NULL) {
+ memcpy(str_, str, (size_ + 1) * sizeof(char));
+ }
+ }
+ }
+
+ void resize( ::size_t n )
+ {
+ if( size_ == n ) {
+ return;
+ }
+ if (n == 0) {
+ if( str_ ) {
+ delete [] str_;
+ }
+ str_ = NULL;
+ size_ = 0;
+ }
+ else {
+ char *newString = new char[n + 1];
+ ::size_t copySize = n;
+ if( size_ < n ) {
+ copySize = size_;
+ }
+ size_ = n;
+
+ if(str_) {
+ memcpy(newString, str_, (copySize + 1) * sizeof(char));
+ }
+ if( copySize < size_ ) {
+ memset(newString + copySize, 0, size_ - copySize);
+ }
+ newString[size_] = '\0';
+
+ delete [] str_;
+ str_ = newString;
+ }
+ }
+
+ const char& operator[] ( ::size_t pos ) const
+ {
+ return str_[pos];
+ }
+
+ char& operator[] ( ::size_t pos )
+ {
+ return str_[pos];
+ }
+
+ /*! \brief Copies the value of another string to this one.
+ *
+ * \param rhs the string to copy.
+ *
+ * \returns a reference to the modified instance.
+ */
+ string& operator=(const string& rhs)
+ {
+ if (this == &rhs) {
+ return *this;
+ }
+
+ if( str_ != NULL ) {
+ delete [] str_;
+ str_ = NULL;
+ size_ = 0;
+ }
+
+ if (rhs.size_ == 0 || rhs.str_ == NULL) {
+ str_ = NULL;
+ size_ = 0;
+ }
+ else {
+ str_ = new char[rhs.size_ + 1];
+ size_ = rhs.size_;
+
+ if (str_ != NULL) {
+ memcpy(str_, rhs.str_, (size_ + 1) * sizeof(char));
+ }
+ else {
+ size_ = 0;
+ }
+ }
+
+ return *this;
+ }
+
+ /*! \brief Constructs a string by copying the value of another instance.
+ *
+ * \param rhs the string to copy.
+ */
+ string(const string& rhs) :
+ size_(0),
+ str_(NULL)
+ {
+ *this = rhs;
+ }
+
+ //! \brief Destructor - frees memory used to hold the current value.
+ ~string()
+ {
+ delete[] str_;
+ str_ = NULL;
+ }
+
+ //! \brief Queries the length of the string, excluding any added '\0's.
+ ::size_t size(void) const { return size_; }
+
+ //! \brief Queries the length of the string, excluding any added '\0's.
+ ::size_t length(void) const { return size(); }
+
+ /*! \brief Returns a pointer to the private copy held by this instance,
+ * or "" if empty/unset.
+ */
+ const char * c_str(void) const { return (str_) ? str_ : "";}
+};
+typedef cl::string STRING_CLASS;
+#endif // #elif !defined(__USE_DEV_STRING)
+
+#if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
+#define VECTOR_CLASS std::vector
+#elif !defined(__USE_DEV_VECTOR)
+#define VECTOR_CLASS cl::vector
+
+#if !defined(__MAX_DEFAULT_VECTOR_SIZE)
+#define __MAX_DEFAULT_VECTOR_SIZE 10
+#endif
+
+/*! \class vector
+ * \brief Fixed sized vector implementation that mirroring
+ *
+ * \note Deprecated. Please use std::vector as default or
+ * re-define the vector class to match the std::vector
+ * interface by defining VECTOR_CLASS
+
+ * \note Not recommended for use with custom objects as
+ * current implementation will construct N elements
+ *
+ * std::vector functionality.
+ * \brief Fixed sized vector compatible with std::vector.
+ *
+ * \note
+ * This differs from std::vector<> not just in memory allocation,
+ * but also in terms of when members are constructed, destroyed,
+ * and assigned instead of being copy constructed.
+ *
+ * \param T type of element contained in the vector.
+ *
+ * \param N maximum size of the vector.
+ */
+template <typename T, unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
+class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED vector
+{
+private:
+ T data_[N];
+ unsigned int size_;
+
+public:
+ //! \brief Constructs an empty vector with no memory allocated.
+ vector() :
+ size_(static_cast<unsigned int>(0))
+ {}
+
+ //! \brief Deallocates the vector's memory and destroys all of its elements.
+ ~vector()
+ {
+ clear();
+ }
+
+ //! \brief Returns the number of elements currently contained.
+ unsigned int size(void) const
+ {
+ return size_;
+ }
+
+ /*! \brief Empties the vector of all elements.
+ * \note
+ * This does not deallocate memory but will invoke destructors
+ * on contained elements.
+ */
+ void clear()
+ {
+ while(!empty()) {
+ pop_back();
+ }
+ }
+
+ /*! \brief Appends an element after the last valid element.
+ * Calling this on a vector that has reached capacity will throw an
+ * exception if exceptions are enabled.
+ */
+ void push_back (const T& x)
+ {
+ if (size() < N) {
+ new (&data_[size_]) T(x);
+ size_++;
+ } else {
+ detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
+ }
+ }
+
+ /*! \brief Removes the last valid element from the vector.
+ * Calling this on an empty vector will throw an exception
+ * if exceptions are enabled.
+ */
+ void pop_back(void)
+ {
+ if (size_ != 0) {
+ --size_;
+ data_[size_].~T();
+ } else {
+ detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
+ }
+ }
+
+ /*! \brief Constructs with a value copied from another.
+ *
+ * \param vec the vector to copy.
+ */
+ vector(const vector<T, N>& vec) :
+ size_(vec.size_)
+ {
+ if (size_ != 0) {
+ assign(vec.begin(), vec.end());
+ }
+ }
+
+ /*! \brief Constructs with a specified number of initial elements.
+ *
+ * \param size number of initial elements.
+ *
+ * \param val value of initial elements.
+ */
+ vector(unsigned int size, const T& val = T()) :
+ size_(0)
+ {
+ for (unsigned int i = 0; i < size; i++) {
+ push_back(val);
+ }
+ }
+
+ /*! \brief Overwrites the current content with that copied from another
+ * instance.
+ *
+ * \param rhs vector to copy.
+ *
+ * \returns a reference to this.
+ */
+ vector<T, N>& operator=(const vector<T, N>& rhs)
+ {
+ if (this == &rhs) {
+ return *this;
+ }
+
+ if (rhs.size_ != 0) {
+ assign(rhs.begin(), rhs.end());
+ } else {
+ clear();
+ }
+
+ return *this;
+ }
+
+ /*! \brief Tests equality against another instance.
+ *
+ * \param vec the vector against which to compare.
+ */
+ bool operator==(vector<T,N> &vec)
+ {
+ if (size() != vec.size()) {
+ return false;
+ }
+
+ for( unsigned int i = 0; i < size(); ++i ) {
+ if( operator[](i) != vec[i] ) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ //! \brief Conversion operator to T*.
+ operator T* () { return data_; }
+
+ //! \brief Conversion operator to const T*.
+ operator const T* () const { return data_; }
+
+ //! \brief Tests whether this instance has any elements.
+ bool empty (void) const
+ {
+ return size_==0;
+ }
+
+ //! \brief Returns the maximum number of elements this instance can hold.
+ unsigned int max_size (void) const
+ {
+ return N;
+ }
+
+ //! \brief Returns the maximum number of elements this instance can hold.
+ unsigned int capacity () const
+ {
+ return N;
+ }
+
+ //! \brief Resizes the vector to the given size
+ void resize(unsigned int newSize, T fill = T())
+ {
+ if (newSize > N)
+ {
+ detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
+ }
+ else
+ {
+ while (size_ < newSize)
+ {
+ new (&data_[size_]) T(fill);
+ size_++;
+ }
+ while (size_ > newSize)
+ {
+ --size_;
+ data_[size_].~T();
+ }
+ }
+ }
+
+ /*! \brief Returns a reference to a given element.
+ *
+ * \param index which element to access. *
+ * \note
+ * The caller is responsible for ensuring index is >= 0 and < size().
+ */
+ T& operator[](int index)
+ {
+ return data_[index];
+ }
+
+ /*! \brief Returns a const reference to a given element.
+ *
+ * \param index which element to access.
+ *
+ * \note
+ * The caller is responsible for ensuring index is >= 0 and < size().
+ */
+ const T& operator[](int index) const
+ {
+ return data_[index];
+ }
+
+ /*! \brief Assigns elements of the vector based on a source iterator range.
+ *
+ * \param start Beginning iterator of source range
+ * \param end Enditerator of source range
+ *
+ * \note
+ * Will throw an exception if exceptions are enabled and size exceeded.
+ */
+ template<class I>
+ void assign(I start, I end)
+ {
+ clear();
+ while(start != end) {
+ push_back(*start);
+ start++;
+ }
+ }
+
+ /*! \class iterator
+ * \brief Const iterator class for vectors
+ */
+ class iterator
+ {
+ private:
+ const vector<T,N> *vec_;
+ int index_;
+
+ /**
+ * Internal iterator constructor to capture reference
+ * to the vector it iterates over rather than taking
+ * the vector by copy.
+ */
+ iterator (const vector<T,N> &vec, int index) :
+ vec_(&vec)
+ {
+ if( !vec.empty() ) {
+ index_ = index;
+ } else {
+ index_ = -1;
+ }
+ }
+
+ public:
+ iterator(void) :
+ index_(-1),
+ vec_(NULL)
+ {
+ }
+
+ iterator(const iterator& rhs) :
+ vec_(rhs.vec_),
+ index_(rhs.index_)
+ {
+ }
+
+ ~iterator(void) {}
+
+ static iterator begin(const cl::vector<T,N> &vec)
+ {
+ iterator i(vec, 0);
+
+ return i;
+ }
+
+ static iterator end(const cl::vector<T,N> &vec)
+ {
+ iterator i(vec, vec.size());
+
+ return i;
+ }
+
+ bool operator==(iterator i)
+ {
+ return ((vec_ == i.vec_) &&
+ (index_ == i.index_));
+ }
+
+ bool operator!=(iterator i)
+ {
+ return (!(*this==i));
+ }
+
+ iterator& operator++()
+ {
+ ++index_;
+ return *this;
+ }
+
+ iterator operator++(int)
+ {
+ iterator retVal(*this);
+ ++index_;
+ return retVal;
+ }
+
+ iterator& operator--()
+ {
+ --index_;
+ return *this;
+ }
+
+ iterator operator--(int)
+ {
+ iterator retVal(*this);
+ --index_;
+ return retVal;
+ }
+
+ const T& operator *() const
+ {
+ return (*vec_)[index_];
+ }
+ };
+
+ iterator begin(void)
+ {
+ return iterator::begin(*this);
+ }
+
+ iterator begin(void) const
+ {
+ return iterator::begin(*this);
+ }
+
+ iterator end(void)
+ {
+ return iterator::end(*this);
+ }
+
+ iterator end(void) const
+ {
+ return iterator::end(*this);
+ }
+
+ T& front(void)
+ {
+ return data_[0];
+ }
+
+ T& back(void)
+ {
+ return data_[size_];
+ }
+
+ const T& front(void) const
+ {
+ return data_[0];
+ }
+
+ const T& back(void) const
+ {
+ return data_[size_-1];
+ }
+} CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
+#endif // #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
+
+
+
+
+
+namespace detail {
+#define __DEFAULT_NOT_INITIALIZED 1
+#define __DEFAULT_BEING_INITIALIZED 2
+#define __DEFAULT_INITIALIZED 4
+
+ /*
+ * Compare and exchange primitives are needed for handling of defaults
+ */
+
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ inline int compare_exchange(std::atomic<int> * dest, int exchange, int comparand)
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ inline int compare_exchange(volatile int * dest, int exchange, int comparand)
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ {
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ std::atomic_compare_exchange_strong(dest, &comparand, exchange);
+ return comparand;
+#elif _MSC_VER
+ return (int)(_InterlockedCompareExchange(
+ (volatile long*)dest,
+ (long)exchange,
+ (long)comparand));
+#else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ return (__sync_val_compare_and_swap(
+ dest,
+ comparand,
+ exchange));
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ }
+
+ inline void fence() {
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ std::atomic_thread_fence(std::memory_order_seq_cst);
+#elif _MSC_VER // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ _ReadWriteBarrier();
+#else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ __sync_synchronize();
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ }
+} // namespace detail
+
+
+/*! \brief class used to interface between C++ and
+ * OpenCL C calls that require arrays of size_t values, whose
+ * size is known statically.
+ */
+template <int N>
+class size_t
+{
+private:
+ ::size_t data_[N];
+
+public:
+ //! \brief Initialize size_t to all 0s
+ size_t()
+ {
+ for( int i = 0; i < N; ++i ) {
+ data_[i] = 0;
+ }
+ }
+
+ ::size_t& operator[](int index)
+ {
+ return data_[index];
+ }
+
+ const ::size_t& operator[](int index) const
+ {
+ return data_[index];
+ }
+
+ //! \brief Conversion operator to T*.
+ operator ::size_t* () { return data_; }
+
+ //! \brief Conversion operator to const T*.
+ operator const ::size_t* () const { return data_; }
+};
+
+namespace detail {
+
+// Generic getInfoHelper. The final parameter is used to guide overload
+// resolution: the actual parameter passed is an int, which makes this
+// a worse conversion sequence than a specialization that declares the
+// parameter as an int.
+template<typename Functor, typename T>
+inline cl_int getInfoHelper(Functor f, cl_uint name, T* param, long)
+{
+ return f(name, sizeof(T), param, NULL);
+}
+
+// Specialized getInfoHelper for VECTOR_CLASS params
+template <typename Func, typename T>
+inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param, long)
+{
+ ::size_t required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ T* value = (T*) alloca(required);
+ err = f(name, required, value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ param->assign(&value[0], &value[required/sizeof(T)]);
+ return CL_SUCCESS;
+}
+
+/* Specialization for reference-counted types. This depends on the
+ * existence of Wrapper<T>::cl_type, and none of the other types having the
+ * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
+ * does not work, because when using a derived type (e.g. Context) the generic
+ * template will provide a better match.
+ */
+template <typename Func, typename T>
+inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param, int, typename T::cl_type = 0)
+{
+ ::size_t required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ typename T::cl_type * value = (typename T::cl_type *) alloca(required);
+ err = f(name, required, value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ ::size_t elements = required / sizeof(typename T::cl_type);
+ param->assign(&value[0], &value[elements]);
+ for (::size_t i = 0; i < elements; i++)
+ {
+ if (value[i] != NULL)
+ {
+ err = (*param)[i].retain();
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ }
+ }
+ return CL_SUCCESS;
+}
+
+// Specialized for getInfo<CL_PROGRAM_BINARIES>
+template <typename Func>
+inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<char *>* param, int)
+{
+ cl_int err = f(name, param->size() * sizeof(char *), &(*param)[0], NULL);
+
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ return CL_SUCCESS;
+}
+
+// Specialized GetInfoHelper for STRING_CLASS params
+template <typename Func>
+inline cl_int getInfoHelper(Func f, cl_uint name, STRING_CLASS* param, long)
+{
+#if defined(__NO_STD_VECTOR) || defined(__NO_STD_STRING)
+ ::size_t required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ char* value = (char*)alloca(required);
+ err = f(name, required, value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ *param = value;
+ return CL_SUCCESS;
+#else
+ ::size_t required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ // std::string has a constant data member
+ // a char vector does not
+ VECTOR_CLASS<char> value(required);
+ err = f(name, required, value.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ if (param) {
+ param->assign(value.begin(), value.end());
+ }
+#endif
+ return CL_SUCCESS;
+}
+
+// Specialized GetInfoHelper for cl::size_t params
+template <typename Func, ::size_t N>
+inline cl_int getInfoHelper(Func f, cl_uint name, size_t<N>* param, long)
+{
+ ::size_t required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ ::size_t* value = (::size_t*) alloca(required);
+ err = f(name, required, value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ for(int i = 0; i < N; ++i) {
+ (*param)[i] = value[i];
+ }
+
+ return CL_SUCCESS;
+}
+
+template<typename T> struct ReferenceHandler;
+
+/* Specialization for reference-counted types. This depends on the
+ * existence of Wrapper<T>::cl_type, and none of the other types having the
+ * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
+ * does not work, because when using a derived type (e.g. Context) the generic
+ * template will provide a better match.
+ */
+template<typename Func, typename T>
+inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_type = 0)
+{
+ typename T::cl_type value;
+ cl_int err = f(name, sizeof(value), &value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ *param = value;
+ if (value != NULL)
+ {
+ err = param->retain();
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ }
+ return CL_SUCCESS;
+}
+
+#define __PARAM_NAME_INFO_1_0(F) \
+ F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \
+ \
+ F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
+ F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
+ F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
+ F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \
+ F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
+ F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
+ F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \
+ F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
+ F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \
+ F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
+ F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \
+ F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \
+ \
+ F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
+ F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \
+ F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \
+ \
+ F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
+ F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
+ F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
+ F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_int) \
+ \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
+ \
+ F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
+ F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
+ F(cl_mem_info, CL_MEM_SIZE, ::size_t) \
+ F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
+ F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
+ F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
+ F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
+ \
+ F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
+ F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \
+ F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \
+ F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \
+ F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \
+ F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \
+ F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \
+ \
+ F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
+ F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
+ F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_bool) \
+ F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_addressing_mode) \
+ F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_filter_mode) \
+ \
+ F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
+ F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
+ F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
+ F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<Device>) \
+ F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
+ F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
+ F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
+ \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \
+ \
+ F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \
+ F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
+ F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
+ F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
+ F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
+ \
+ F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \
+ F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \
+ F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
+ \
+ F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
+ F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
+ F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
+ F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
+
+#if defined(CL_VERSION_1_1)
+#define __PARAM_NAME_INFO_1_1(F) \
+ F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
+ F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
+ F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, STRING_CLASS) \
+ \
+ F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
+ F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
+ \
+ F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
+ F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
+ \
+ F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
+#endif // CL_VERSION_1_1
+
+
+#if defined(CL_VERSION_1_2)
+#define __PARAM_NAME_INFO_1_2(F) \
+ F(cl_image_info, CL_IMAGE_BUFFER, cl::Buffer) \
+ \
+ F(cl_program_info, CL_PROGRAM_NUM_KERNELS, ::size_t) \
+ F(cl_program_info, CL_PROGRAM_KERNEL_NAMES, STRING_CLASS) \
+ \
+ F(cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type) \
+ \
+ F(cl_kernel_info, CL_KERNEL_ATTRIBUTES, STRING_CLASS) \
+ \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier) \
+ \
+ F(cl_device_info, CL_DEVICE_PARENT_DEVICE, cl_device_id) \
+ F(cl_device_info, CL_DEVICE_PARTITION_PROPERTIES, VECTOR_CLASS<cl_device_partition_property>) \
+ F(cl_device_info, CL_DEVICE_PARTITION_TYPE, VECTOR_CLASS<cl_device_partition_property>) \
+ F(cl_device_info, CL_DEVICE_REFERENCE_COUNT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, ::size_t) \
+ F(cl_device_info, CL_DEVICE_PARTITION_AFFINITY_DOMAIN, cl_device_affinity_domain) \
+ F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS, STRING_CLASS)
+#endif // #if defined(CL_VERSION_1_2)
+
+#if defined(USE_CL_DEVICE_FISSION)
+#define __PARAM_NAME_DEVICE_FISSION(F) \
+ F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
+ F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
+ F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
+ F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
+ F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>)
+#endif // USE_CL_DEVICE_FISSION
+
+template <typename enum_type, cl_int Name>
+struct param_traits {};
+
+#define __CL_DECLARE_PARAM_TRAITS(token, param_name, T) \
+struct token; \
+template<> \
+struct param_traits<detail:: token,param_name> \
+{ \
+ enum { value = param_name }; \
+ typedef T param_type; \
+};
+
+__PARAM_NAME_INFO_1_0(__CL_DECLARE_PARAM_TRAITS)
+#if defined(CL_VERSION_1_1)
+__PARAM_NAME_INFO_1_1(__CL_DECLARE_PARAM_TRAITS)
+#endif // CL_VERSION_1_1
+#if defined(CL_VERSION_1_2)
+__PARAM_NAME_INFO_1_2(__CL_DECLARE_PARAM_TRAITS)
+#endif // CL_VERSION_1_1
+
+#if defined(USE_CL_DEVICE_FISSION)
+__PARAM_NAME_DEVICE_FISSION(__CL_DECLARE_PARAM_TRAITS);
+#endif // USE_CL_DEVICE_FISSION
+
+#ifdef CL_PLATFORM_ICD_SUFFIX_KHR
+__CL_DECLARE_PARAM_TRAITS(cl_platform_info, CL_PLATFORM_ICD_SUFFIX_KHR, STRING_CLASS)
+#endif
+
+#ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_PROFILING_TIMER_OFFSET_AMD, cl_ulong)
+#endif
+
+#ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_FREE_MEMORY_AMD, VECTOR_CLASS< ::size_t>)
+#endif
+#ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_SIMD_WIDTH_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WAVEFRONT_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_BANKS_AMD, cl_uint)
+#endif
+
+#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_REGISTERS_PER_BLOCK_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_WARP_SIZE_NV
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WARP_SIZE_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_GPU_OVERLAP_NV
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GPU_OVERLAP_NV, cl_bool)
+#endif
+#ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, cl_bool)
+#endif
+#ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
+__CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_INTEGRATED_MEMORY_NV, cl_bool)
+#endif
+
+// Convenience functions
+
+template <typename Func, typename T>
+inline cl_int
+getInfo(Func f, cl_uint name, T* param)
+{
+ return getInfoHelper(f, name, param, 0);
+}
+
+template <typename Func, typename Arg0>
+struct GetInfoFunctor0
+{
+ Func f_; const Arg0& arg0_;
+ cl_int operator ()(
+ cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
+ { return f_(arg0_, param, size, value, size_ret); }
+};
+
+template <typename Func, typename Arg0, typename Arg1>
+struct GetInfoFunctor1
+{
+ Func f_; const Arg0& arg0_; const Arg1& arg1_;
+ cl_int operator ()(
+ cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
+ { return f_(arg0_, arg1_, param, size, value, size_ret); }
+};
+
+template <typename Func, typename Arg0, typename T>
+inline cl_int
+getInfo(Func f, const Arg0& arg0, cl_uint name, T* param)
+{
+ GetInfoFunctor0<Func, Arg0> f0 = { f, arg0 };
+ return getInfoHelper(f0, name, param, 0);
+}
+
+template <typename Func, typename Arg0, typename Arg1, typename T>
+inline cl_int
+getInfo(Func f, const Arg0& arg0, const Arg1& arg1, cl_uint name, T* param)
+{
+ GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
+ return getInfoHelper(f0, name, param, 0);
+}
+
+template<typename T>
+struct ReferenceHandler
+{ };
+
+#if defined(CL_VERSION_1_2)
+/**
+ * OpenCL 1.2 devices do have retain/release.
+ */
+template <>
+struct ReferenceHandler<cl_device_id>
+{
+ /**
+ * Retain the device.
+ * \param device A valid device created using createSubDevices
+ * \return
+ * CL_SUCCESS if the function executed successfully.
+ * CL_INVALID_DEVICE if device was not a valid subdevice
+ * CL_OUT_OF_RESOURCES
+ * CL_OUT_OF_HOST_MEMORY
+ */
+ static cl_int retain(cl_device_id device)
+ { return ::clRetainDevice(device); }
+ /**
+ * Retain the device.
+ * \param device A valid device created using createSubDevices
+ * \return
+ * CL_SUCCESS if the function executed successfully.
+ * CL_INVALID_DEVICE if device was not a valid subdevice
+ * CL_OUT_OF_RESOURCES
+ * CL_OUT_OF_HOST_MEMORY
+ */
+ static cl_int release(cl_device_id device)
+ { return ::clReleaseDevice(device); }
+};
+#else // #if defined(CL_VERSION_1_2)
+/**
+ * OpenCL 1.1 devices do not have retain/release.
+ */
+template <>
+struct ReferenceHandler<cl_device_id>
+{
+ // cl_device_id does not have retain().
+ static cl_int retain(cl_device_id)
+ { return CL_SUCCESS; }
+ // cl_device_id does not have release().
+ static cl_int release(cl_device_id)
+ { return CL_SUCCESS; }
+};
+#endif // #if defined(CL_VERSION_1_2)
+
+template <>
+struct ReferenceHandler<cl_platform_id>
+{
+ // cl_platform_id does not have retain().
+ static cl_int retain(cl_platform_id)
+ { return CL_SUCCESS; }
+ // cl_platform_id does not have release().
+ static cl_int release(cl_platform_id)
+ { return CL_SUCCESS; }
+};
+
+template <>
+struct ReferenceHandler<cl_context>
+{
+ static cl_int retain(cl_context context)
+ { return ::clRetainContext(context); }
+ static cl_int release(cl_context context)
+ { return ::clReleaseContext(context); }
+};
+
+template <>
+struct ReferenceHandler<cl_command_queue>
+{
+ static cl_int retain(cl_command_queue queue)
+ { return ::clRetainCommandQueue(queue); }
+ static cl_int release(cl_command_queue queue)
+ { return ::clReleaseCommandQueue(queue); }
+};
+
+template <>
+struct ReferenceHandler<cl_mem>
+{
+ static cl_int retain(cl_mem memory)
+ { return ::clRetainMemObject(memory); }
+ static cl_int release(cl_mem memory)
+ { return ::clReleaseMemObject(memory); }
+};
+
+template <>
+struct ReferenceHandler<cl_sampler>
+{
+ static cl_int retain(cl_sampler sampler)
+ { return ::clRetainSampler(sampler); }
+ static cl_int release(cl_sampler sampler)
+ { return ::clReleaseSampler(sampler); }
+};
+
+template <>
+struct ReferenceHandler<cl_program>
+{
+ static cl_int retain(cl_program program)
+ { return ::clRetainProgram(program); }
+ static cl_int release(cl_program program)
+ { return ::clReleaseProgram(program); }
+};
+
+template <>
+struct ReferenceHandler<cl_kernel>
+{
+ static cl_int retain(cl_kernel kernel)
+ { return ::clRetainKernel(kernel); }
+ static cl_int release(cl_kernel kernel)
+ { return ::clReleaseKernel(kernel); }
+};
+
+template <>
+struct ReferenceHandler<cl_event>
+{
+ static cl_int retain(cl_event event)
+ { return ::clRetainEvent(event); }
+ static cl_int release(cl_event event)
+ { return ::clReleaseEvent(event); }
+};
+
+
+// Extracts version number with major in the upper 16 bits, minor in the lower 16
+static cl_uint getVersion(const char *versionInfo)
+{
+ int highVersion = 0;
+ int lowVersion = 0;
+ int index = 7;
+ while(versionInfo[index] != '.' ) {
+ highVersion *= 10;
+ highVersion += versionInfo[index]-'0';
+ ++index;
+ }
+ ++index;
+ while(versionInfo[index] != ' ' && versionInfo[index] != '\0') {
+ lowVersion *= 10;
+ lowVersion += versionInfo[index]-'0';
+ ++index;
+ }
+ return (highVersion << 16) | lowVersion;
+}
+
+static cl_uint getPlatformVersion(cl_platform_id platform)
+{
+ ::size_t size = 0;
+ clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size);
+ char *versionInfo = (char *) alloca(size);
+ clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, &versionInfo[0], &size);
+ return getVersion(versionInfo);
+}
+
+static cl_uint getDevicePlatformVersion(cl_device_id device)
+{
+ cl_platform_id platform;
+ clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform), &platform, NULL);
+ return getPlatformVersion(platform);
+}
+
+#if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+static cl_uint getContextPlatformVersion(cl_context context)
+{
+ // The platform cannot be queried directly, so we first have to grab a
+ // device and obtain its context
+ ::size_t size = 0;
+ clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size);
+ if (size == 0)
+ return 0;
+ cl_device_id *devices = (cl_device_id *) alloca(size);
+ clGetContextInfo(context, CL_CONTEXT_DEVICES, size, devices, NULL);
+ return getDevicePlatformVersion(devices[0]);
+}
+#endif // #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+
+template <typename T>
+class Wrapper
+{
+public:
+ typedef T cl_type;
+
+protected:
+ cl_type object_;
+
+public:
+ Wrapper() : object_(NULL) { }
+
+ Wrapper(const cl_type &obj) : object_(obj) { }
+
+ ~Wrapper()
+ {
+ if (object_ != NULL) { release(); }
+ }
+
+ Wrapper(const Wrapper<cl_type>& rhs)
+ {
+ object_ = rhs.object_;
+ if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT
+ {
+ object_ = rhs.object_;
+ rhs.object_ = NULL;
+ }
+#endif
+
+ Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ }
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ rhs.object_ = NULL;
+ }
+ return *this;
+ }
+#endif
+
+ Wrapper<cl_type>& operator = (const cl_type &rhs)
+ {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs;
+ return *this;
+ }
+
+ cl_type operator ()() const { return object_; }
+
+ cl_type& operator ()() { return object_; }
+
+protected:
+ template<typename Func, typename U>
+ friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
+
+ cl_int retain() const
+ {
+ return ReferenceHandler<cl_type>::retain(object_);
+ }
+
+ cl_int release() const
+ {
+ return ReferenceHandler<cl_type>::release(object_);
+ }
+};
+
+template <>
+class Wrapper<cl_device_id>
+{
+public:
+ typedef cl_device_id cl_type;
+
+protected:
+ cl_type object_;
+ bool referenceCountable_;
+
+ static bool isReferenceCountable(cl_device_id device)
+ {
+ bool retVal = false;
+ if (device != NULL) {
+ int version = getDevicePlatformVersion(device);
+ if(version > ((1 << 16) + 1)) {
+ retVal = true;
+ }
+ }
+ return retVal;
+ }
+
+public:
+ Wrapper() : object_(NULL), referenceCountable_(false)
+ {
+ }
+
+ Wrapper(const cl_type &obj) : object_(obj), referenceCountable_(false)
+ {
+ referenceCountable_ = isReferenceCountable(obj);
+ }
+
+ ~Wrapper()
+ {
+ if (object_ != NULL) { release(); }
+ }
+
+ Wrapper(const Wrapper<cl_type>& rhs)
+ {
+ object_ = rhs.object_;
+ referenceCountable_ = isReferenceCountable(object_);
+ if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT
+ {
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ rhs.object_ = NULL;
+ rhs.referenceCountable_ = false;
+ }
+#endif
+
+ Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ }
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ rhs.object_ = NULL;
+ rhs.referenceCountable_ = false;
+ }
+ return *this;
+ }
+#endif
+
+ Wrapper<cl_type>& operator = (const cl_type &rhs)
+ {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs;
+ referenceCountable_ = isReferenceCountable(object_);
+ return *this;
+ }
+
+ cl_type operator ()() const { return object_; }
+
+ cl_type& operator ()() { return object_; }
+
+protected:
+ template<typename Func, typename U>
+ friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
+
+ template<typename Func, typename U>
+ friend inline cl_int getInfoHelper(Func, cl_uint, VECTOR_CLASS<U>*, int, typename U::cl_type);
+
+ cl_int retain() const
+ {
+ if( referenceCountable_ ) {
+ return ReferenceHandler<cl_type>::retain(object_);
+ }
+ else {
+ return CL_SUCCESS;
+ }
+ }
+
+ cl_int release() const
+ {
+ if( referenceCountable_ ) {
+ return ReferenceHandler<cl_type>::release(object_);
+ }
+ else {
+ return CL_SUCCESS;
+ }
+ }
+};
+
+} // namespace detail
+//! \endcond
+
+/*! \stuct ImageFormat
+ * \brief Adds constructors and member functions for cl_image_format.
+ *
+ * \see cl_image_format
+ */
+struct ImageFormat : public cl_image_format
+{
+ //! \brief Default constructor - performs no initialization.
+ ImageFormat(){}
+
+ //! \brief Initializing constructor.
+ ImageFormat(cl_channel_order order, cl_channel_type type)
+ {
+ image_channel_order = order;
+ image_channel_data_type = type;
+ }
+
+ //! \brief Assignment operator.
+ ImageFormat& operator = (const ImageFormat& rhs)
+ {
+ if (this != &rhs) {
+ this->image_channel_data_type = rhs.image_channel_data_type;
+ this->image_channel_order = rhs.image_channel_order;
+ }
+ return *this;
+ }
+};
+
+/*! \brief Class interface for cl_device_id.
+ *
+ * \note Copies of these objects are inexpensive, since they don't 'own'
+ * any underlying resources or data structures.
+ *
+ * \see cl_device_id
+ */
+class Device : public detail::Wrapper<cl_device_id>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Device() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_device_id.
+ *
+ * This simply copies the device ID value, which is an inexpensive operation.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Device(const cl_device_id &device) : detail::Wrapper<cl_type>(device) { }
+
+ /*! \brief Returns the first device on the default context.
+ *
+ * \see Context::getDefault()
+ */
+ static Device getDefault(cl_int * err = NULL);
+
+ /*! \brief Assignment operator from cl_device_id.
+ *
+ * This simply copies the device ID value, which is an inexpensive operation.
+ */
+ Device& operator = (const cl_device_id& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device(const Device& dev) : detail::Wrapper<cl_type>(dev) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device& operator = (const Device &dev)
+ {
+ detail::Wrapper<cl_type>::operator=(dev);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device(Device&& dev) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(dev)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device& operator = (Device &&dev)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(dev));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ //! \brief Wrapper for clGetDeviceInfo().
+ template <typename T>
+ cl_int getInfo(cl_device_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetDeviceInfo, object_, name, param),
+ __GET_DEVICE_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetDeviceInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_device_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_device_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /**
+ * CL 1.2 version
+ */
+#if defined(CL_VERSION_1_2)
+ //! \brief Wrapper for clCreateSubDevicesEXT().
+ cl_int createSubDevices(
+ const cl_device_partition_property * properties,
+ VECTOR_CLASS<Device>* devices)
+ {
+ cl_uint n = 0;
+ cl_int err = clCreateSubDevices(object_, properties, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES);
+ }
+
+ cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
+ err = clCreateSubDevices(object_, properties, n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES);
+ }
+
+ devices->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+#endif // #if defined(CL_VERSION_1_2)
+
+/**
+ * CL 1.1 version that uses device fission.
+ */
+#if defined(CL_VERSION_1_1)
+#if defined(USE_CL_DEVICE_FISSION)
+ cl_int createSubDevices(
+ const cl_device_partition_property_ext * properties,
+ VECTOR_CLASS<Device>* devices)
+ {
+ typedef CL_API_ENTRY cl_int
+ ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
+ cl_device_id /*in_device*/,
+ const cl_device_partition_property_ext * /* properties */,
+ cl_uint /*num_entries*/,
+ cl_device_id * /*out_devices*/,
+ cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
+ __INIT_CL_EXT_FCN_PTR(clCreateSubDevicesEXT);
+
+ cl_uint n = 0;
+ cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES);
+ }
+
+ cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
+ err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES);
+ }
+
+ devices->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+#endif // #if defined(USE_CL_DEVICE_FISSION)
+#endif // #if defined(CL_VERSION_1_1)
+};
+
+/*! \brief Class interface for cl_platform_id.
+ *
+ * \note Copies of these objects are inexpensive, since they don't 'own'
+ * any underlying resources or data structures.
+ *
+ * \see cl_platform_id
+ */
+class Platform : public detail::Wrapper<cl_platform_id>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Platform() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_platform_id.
+ *
+ * This simply copies the platform ID value, which is an inexpensive operation.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Platform(const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { }
+
+ /*! \brief Assignment operator from cl_platform_id.
+ *
+ * This simply copies the platform ID value, which is an inexpensive operation.
+ */
+ Platform& operator = (const cl_platform_id& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetPlatformInfo().
+ cl_int getInfo(cl_platform_info name, STRING_CLASS* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetPlatformInfo, object_, name, param),
+ __GET_PLATFORM_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetPlatformInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_platform_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_platform_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /*! \brief Gets a list of devices for this platform.
+ *
+ * Wraps clGetDeviceIDs().
+ */
+ cl_int getDevices(
+ cl_device_type type,
+ VECTOR_CLASS<Device>* devices) const
+ {
+ cl_uint n = 0;
+ if( devices == NULL ) {
+ return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
+ }
+ cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
+ err = ::clGetDeviceIDs(object_, type, n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ devices->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+
+#if defined(USE_DX_INTEROP)
+ /*! \brief Get the list of available D3D10 devices.
+ *
+ * \param d3d_device_source.
+ *
+ * \param d3d_object.
+ *
+ * \param d3d_device_set.
+ *
+ * \param devices returns a vector of OpenCL D3D10 devices found. The cl::Device
+ * values returned in devices can be used to identify a specific OpenCL
+ * device. If \a devices argument is NULL, this argument is ignored.
+ *
+ * \return One of the following values:
+ * - CL_SUCCESS if the function is executed successfully.
+ *
+ * The application can query specific capabilities of the OpenCL device(s)
+ * returned by cl::getDevices. This can be used by the application to
+ * determine which device(s) to use.
+ *
+ * \note In the case that exceptions are enabled and a return value
+ * other than CL_SUCCESS is generated, then cl::Error exception is
+ * generated.
+ */
+ cl_int getDevices(
+ cl_d3d10_device_source_khr d3d_device_source,
+ void * d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ VECTOR_CLASS<Device>* devices) const
+ {
+ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
+ cl_platform_id platform,
+ cl_d3d10_device_source_khr d3d_device_source,
+ void * d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ cl_uint num_entries,
+ cl_device_id * devices,
+ cl_uint* num_devices);
+
+ if( devices == NULL ) {
+ return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
+ }
+
+ static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
+ __INIT_CL_EXT_FCN_PTR_PLATFORM(object_, clGetDeviceIDsFromD3D10KHR);
+
+ cl_uint n = 0;
+ cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
+ object_,
+ d3d_device_source,
+ d3d_object,
+ d3d_device_set,
+ 0,
+ NULL,
+ &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
+ err = pfn_clGetDeviceIDsFromD3D10KHR(
+ object_,
+ d3d_device_source,
+ d3d_object,
+ d3d_device_set,
+ n,
+ ids,
+ NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ devices->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+#endif
+
+ /*! \brief Gets a list of available platforms.
+ *
+ * Wraps clGetPlatformIDs().
+ */
+ static cl_int get(
+ VECTOR_CLASS<Platform>* platforms)
+ {
+ cl_uint n = 0;
+
+ if( platforms == NULL ) {
+ return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
+ }
+
+ cl_int err = ::clGetPlatformIDs(0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ cl_platform_id* ids = (cl_platform_id*) alloca(
+ n * sizeof(cl_platform_id));
+ err = ::clGetPlatformIDs(n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ platforms->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+
+ /*! \brief Gets the first available platform.
+ *
+ * Wraps clGetPlatformIDs(), returning the first result.
+ */
+ static cl_int get(
+ Platform * platform)
+ {
+ cl_uint n = 0;
+
+ if( platform == NULL ) {
+ return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
+ }
+
+ cl_int err = ::clGetPlatformIDs(0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ cl_platform_id* ids = (cl_platform_id*) alloca(
+ n * sizeof(cl_platform_id));
+ err = ::clGetPlatformIDs(n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ *platform = ids[0];
+ return CL_SUCCESS;
+ }
+
+ /*! \brief Gets the first available platform, returning it by value.
+ *
+ * Wraps clGetPlatformIDs(), returning the first result.
+ */
+ static Platform get(
+ cl_int * errResult = NULL)
+ {
+ Platform platform;
+ cl_uint n = 0;
+ cl_int err = ::clGetPlatformIDs(0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ if (errResult != NULL) {
+ *errResult = err;
+ }
+ return Platform();
+ }
+
+ cl_platform_id* ids = (cl_platform_id*) alloca(
+ n * sizeof(cl_platform_id));
+ err = ::clGetPlatformIDs(n, ids, NULL);
+
+ if (err != CL_SUCCESS) {
+ detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ if (errResult != NULL) {
+ *errResult = err;
+ }
+ return Platform();
+ }
+
+
+ return Platform(ids[0]);
+ }
+
+ static Platform getDefault(
+ cl_int *errResult = NULL )
+ {
+ return get(errResult);
+ }
+
+
+#if defined(CL_VERSION_1_2)
+ //! \brief Wrapper for clUnloadCompiler().
+ cl_int
+ unloadCompiler()
+ {
+ return ::clUnloadPlatformCompiler(object_);
+ }
+#endif // #if defined(CL_VERSION_1_2)
+}; // class Platform
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
+/**
+ * Unload the OpenCL compiler.
+ * \note Deprecated for OpenCL 1.2. Use Platform::unloadCompiler instead.
+ */
+inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int
+UnloadCompiler() CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
+inline cl_int
+UnloadCompiler()
+{
+ return ::clUnloadCompiler();
+}
+#endif // #if defined(CL_VERSION_1_1)
+
+/*! \brief Class interface for cl_context.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_context as the original. For details, see
+ * clRetainContext() and clReleaseContext().
+ *
+ * \see cl_context
+ */
+class Context
+ : public detail::Wrapper<cl_context>
+{
+private:
+
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static std::atomic<int> default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static volatile int default_initialized_;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static Context default_;
+ static volatile cl_int default_error_;
+public:
+ /*! \brief Constructs a context including a list of specified devices.
+ *
+ * Wraps clCreateContext().
+ */
+ Context(
+ const VECTOR_CLASS<Device>& devices,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ ::size_t,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ ::size_t numDevices = devices.size();
+ cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
+ for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ object_ = ::clCreateContext(
+ properties, (cl_uint) numDevices,
+ deviceIDs,
+ notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Context(
+ const Device& device,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ ::size_t,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ cl_device_id deviceID = device();
+
+ object_ = ::clCreateContext(
+ properties, 1,
+ &deviceID,
+ notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Constructs a context including all or a subset of devices of a specified type.
+ *
+ * Wraps clCreateContextFromType().
+ */
+ Context(
+ cl_device_type type,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ ::size_t,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+#if !defined(__APPLE__) && !defined(__MACOS)
+ cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
+
+ if (properties == NULL) {
+ // Get a valid platform ID as we cannot send in a blank one
+ VECTOR_CLASS<Platform> platforms;
+ error = Platform::get(&platforms);
+ if (error != CL_SUCCESS) {
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return;
+ }
+
+ // Check the platforms we found for a device of our specified type
+ cl_context_properties platform_id = 0;
+ for (unsigned int i = 0; i < platforms.size(); i++) {
+
+ VECTOR_CLASS<Device> devices;
+
+#if defined(__CL_ENABLE_EXCEPTIONS)
+ try {
+#endif
+
+ error = platforms[i].getDevices(type, &devices);
+
+#if defined(__CL_ENABLE_EXCEPTIONS)
+ } catch (Error) {}
+ // Catch if exceptions are enabled as we don't want to exit if first platform has no devices of type
+ // We do error checking next anyway, and can throw there if needed
+#endif
+
+ // Only squash CL_SUCCESS and CL_DEVICE_NOT_FOUND
+ if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) {
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ if (devices.size() > 0) {
+ platform_id = (cl_context_properties)platforms[i]();
+ break;
+ }
+ }
+
+ if (platform_id == 0) {
+ detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = CL_DEVICE_NOT_FOUND;
+ }
+ return;
+ }
+
+ prop[1] = platform_id;
+ properties = &prop[0];
+ }
+#endif
+ object_ = ::clCreateContextFromType(
+ properties, type, notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context(const Context& ctx) : detail::Wrapper<cl_type>(ctx) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context& operator = (const Context &ctx)
+ {
+ detail::Wrapper<cl_type>::operator=(ctx);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context(Context&& ctx) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(ctx)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context& operator = (Context &&ctx)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(ctx));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ /*! \brief Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.
+ *
+ * \note All calls to this function return the same cl_context as the first.
+ */
+ static Context getDefault(cl_int * err = NULL)
+ {
+ int state = detail::compare_exchange(
+ &default_initialized_,
+ __DEFAULT_BEING_INITIALIZED, __DEFAULT_NOT_INITIALIZED);
+
+ if (state & __DEFAULT_INITIALIZED) {
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+ }
+
+ if (state & __DEFAULT_BEING_INITIALIZED) {
+ // Assume writes will propagate eventually...
+ while(default_initialized_ != __DEFAULT_INITIALIZED) {
+ detail::fence();
+ }
+
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+ }
+
+ cl_int error;
+ default_ = Context(
+ CL_DEVICE_TYPE_DEFAULT,
+ NULL,
+ NULL,
+ NULL,
+ &error);
+
+ detail::fence();
+
+ default_error_ = error;
+ // Assume writes will propagate eventually...
+ default_initialized_ = __DEFAULT_INITIALIZED;
+
+ detail::fence();
+
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Context() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_context - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the cl_context
+ * into the new Context object.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Context(const cl_context& context) : detail::Wrapper<cl_type>(context) { }
+
+ /*! \brief Assignment operator from cl_context - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseContext() on the value previously held by this instance.
+ */
+ Context& operator = (const cl_context& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetContextInfo().
+ template <typename T>
+ cl_int getInfo(cl_context_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetContextInfo, object_, name, param),
+ __GET_CONTEXT_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetContextInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_context_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_context_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /*! \brief Gets a list of supported image formats.
+ *
+ * Wraps clGetSupportedImageFormats().
+ */
+ cl_int getSupportedImageFormats(
+ cl_mem_flags flags,
+ cl_mem_object_type type,
+ VECTOR_CLASS<ImageFormat>* formats) const
+ {
+ cl_uint numEntries;
+
+ if (!formats) {
+ return CL_SUCCESS;
+ }
+
+ cl_int err = ::clGetSupportedImageFormats(
+ object_,
+ flags,
+ type,
+ 0,
+ NULL,
+ &numEntries);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
+ }
+
+ if (numEntries > 0) {
+ ImageFormat* value = (ImageFormat*)
+ alloca(numEntries * sizeof(ImageFormat));
+ err = ::clGetSupportedImageFormats(
+ object_,
+ flags,
+ type,
+ numEntries,
+ (cl_image_format*)value,
+ NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
+ }
+
+ formats->assign(&value[0], &value[numEntries]);
+ }
+ else {
+ formats->clear();
+ }
+ return CL_SUCCESS;
+ }
+};
+
+inline Device Device::getDefault(cl_int * err)
+{
+ cl_int error;
+ Device device;
+
+ Context context = Context::getDefault(&error);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS) {
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ else {
+ device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+ if (err != NULL) {
+ *err = CL_SUCCESS;
+ }
+ }
+
+ return device;
+}
+
+
+#ifdef _WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) std::atomic<int> Context::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) Context Context::default_;
+__declspec(selectany) volatile cl_int Context::default_error_ = CL_SUCCESS;
+#else // !_WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) std::atomic<int> Context::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) Context Context::default_;
+__attribute__((weak)) volatile cl_int Context::default_error_ = CL_SUCCESS;
+#endif // !_WIN32
+
+/*! \brief Class interface for cl_event.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_event as the original. For details, see
+ * clRetainEvent() and clReleaseEvent().
+ *
+ * \see cl_event
+ */
+class Event : public detail::Wrapper<cl_event>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Event() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_event - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the cl_event
+ * into the new Event object.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Event(const cl_event& event) : detail::Wrapper<cl_type>(event) { }
+
+ /*! \brief Assignment operator from cl_event - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseEvent() on the value previously held by this instance.
+ */
+ Event& operator = (const cl_event& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetEventInfo().
+ template <typename T>
+ cl_int getInfo(cl_event_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetEventInfo, object_, name, param),
+ __GET_EVENT_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetEventInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_event_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_event_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ //! \brief Wrapper for clGetEventProfilingInfo().
+ template <typename T>
+ cl_int getProfilingInfo(cl_profiling_info name, T* param) const
+ {
+ return detail::errHandler(detail::getInfo(
+ &::clGetEventProfilingInfo, object_, name, param),
+ __GET_EVENT_PROFILE_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetEventProfilingInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_profiling_info, name>::param_type
+ getProfilingInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_profiling_info, name>::param_type param;
+ cl_int result = getProfilingInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /*! \brief Blocks the calling thread until this event completes.
+ *
+ * Wraps clWaitForEvents().
+ */
+ cl_int wait() const
+ {
+ return detail::errHandler(
+ ::clWaitForEvents(1, &object_),
+ __WAIT_FOR_EVENTS_ERR);
+ }
+
+#if defined(CL_VERSION_1_1)
+ /*! \brief Registers a user callback function for a specific command execution status.
+ *
+ * Wraps clSetEventCallback().
+ */
+ cl_int setCallback(
+ cl_int type,
+ void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *),
+ void * user_data = NULL)
+ {
+ return detail::errHandler(
+ ::clSetEventCallback(
+ object_,
+ type,
+ pfn_notify,
+ user_data),
+ __SET_EVENT_CALLBACK_ERR);
+ }
+#endif
+
+ /*! \brief Blocks the calling thread until every event specified is complete.
+ *
+ * Wraps clWaitForEvents().
+ */
+ static cl_int
+ waitForEvents(const VECTOR_CLASS<Event>& events)
+ {
+ return detail::errHandler(
+ ::clWaitForEvents(
+ (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
+ __WAIT_FOR_EVENTS_ERR);
+ }
+};
+
+#if defined(CL_VERSION_1_1)
+/*! \brief Class interface for user events (a subset of cl_event's).
+ *
+ * See Event for details about copy semantics, etc.
+ */
+class UserEvent : public Event
+{
+public:
+ /*! \brief Constructs a user event on a given context.
+ *
+ * Wraps clCreateUserEvent().
+ */
+ UserEvent(
+ const Context& context,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateUserEvent(
+ context(),
+ &error);
+
+ detail::errHandler(error, __CREATE_USER_EVENT_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ UserEvent() : Event() { }
+
+ /*! \brief Sets the execution status of a user event object.
+ *
+ * Wraps clSetUserEventStatus().
+ */
+ cl_int setStatus(cl_int status)
+ {
+ return detail::errHandler(
+ ::clSetUserEventStatus(object_,status),
+ __SET_USER_EVENT_STATUS_ERR);
+ }
+};
+#endif
+
+/*! \brief Blocks the calling thread until every event specified is complete.
+ *
+ * Wraps clWaitForEvents().
+ */
+inline static cl_int
+WaitForEvents(const VECTOR_CLASS<Event>& events)
+{
+ return detail::errHandler(
+ ::clWaitForEvents(
+ (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
+ __WAIT_FOR_EVENTS_ERR);
+}
+
+/*! \brief Class interface for cl_mem.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_mem as the original. For details, see
+ * clRetainMemObject() and clReleaseMemObject().
+ *
+ * \see cl_mem
+ */
+class Memory : public detail::Wrapper<cl_mem>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Memory() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the cl_mem
+ * into the new Memory object.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Memory(const cl_mem& memory) : detail::Wrapper<cl_type>(memory) { }
+
+ /*! \brief Assignment operator from cl_mem - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseMemObject() on the value previously held by this instance.
+ */
+ Memory& operator = (const cl_mem& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory(const Memory& mem) : detail::Wrapper<cl_type>(mem) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory& operator = (const Memory &mem)
+ {
+ detail::Wrapper<cl_type>::operator=(mem);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory(Memory&& mem) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(mem)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory& operator = (Memory &&mem)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(mem));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ //! \brief Wrapper for clGetMemObjectInfo().
+ template <typename T>
+ cl_int getInfo(cl_mem_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
+ __GET_MEM_OBJECT_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetMemObjectInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_mem_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_mem_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+#if defined(CL_VERSION_1_1)
+ /*! \brief Registers a callback function to be called when the memory object
+ * is no longer needed.
+ *
+ * Wraps clSetMemObjectDestructorCallback().
+ *
+ * Repeated calls to this function, for a given cl_mem value, will append
+ * to the list of functions called (in reverse order) when memory object's
+ * resources are freed and the memory object is deleted.
+ *
+ * \note
+ * The registered callbacks are associated with the underlying cl_mem
+ * value - not the Memory class instance.
+ */
+ cl_int setDestructorCallback(
+ void (CL_CALLBACK * pfn_notify)(cl_mem, void *),
+ void * user_data = NULL)
+ {
+ return detail::errHandler(
+ ::clSetMemObjectDestructorCallback(
+ object_,
+ pfn_notify,
+ user_data),
+ __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
+ }
+#endif
+
+};
+
+// Pre-declare copy functions
+class Buffer;
+template< typename IteratorType >
+cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
+template< typename IteratorType >
+cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
+template< typename IteratorType >
+cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
+template< typename IteratorType >
+cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
+
+
+/*! \brief Class interface for Buffer Memory Objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Buffer : public Memory
+{
+public:
+
+ /*! \brief Constructs a Buffer in a specified context.
+ *
+ * Wraps clCreateBuffer().
+ *
+ * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was
+ * specified. Note alignment & exclusivity requirements.
+ */
+ Buffer(
+ const Context& context,
+ cl_mem_flags flags,
+ ::size_t size,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Constructs a Buffer in the default context.
+ *
+ * Wraps clCreateBuffer().
+ *
+ * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was
+ * specified. Note alignment & exclusivity requirements.
+ *
+ * \see Context::getDefault()
+ */
+ Buffer(
+ cl_mem_flags flags,
+ ::size_t size,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ Context context = Context::getDefault(err);
+
+ object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*!
+ * \brief Construct a Buffer from a host container via iterators.
+ * IteratorType must be random access.
+ * If useHostPtr is specified iterators must represent contiguous data.
+ */
+ template< typename IteratorType >
+ Buffer(
+ IteratorType startIterator,
+ IteratorType endIterator,
+ bool readOnly,
+ bool useHostPtr = false,
+ cl_int* err = NULL)
+ {
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ cl_mem_flags flags = 0;
+ if( readOnly ) {
+ flags |= CL_MEM_READ_ONLY;
+ }
+ else {
+ flags |= CL_MEM_READ_WRITE;
+ }
+ if( useHostPtr ) {
+ flags |= CL_MEM_USE_HOST_PTR;
+ }
+
+ ::size_t size = sizeof(DataType)*(endIterator - startIterator);
+
+ Context context = Context::getDefault(err);
+
+ if( useHostPtr ) {
+ object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
+ } else {
+ object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
+ }
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ if( !useHostPtr ) {
+ error = cl::copy(startIterator, endIterator, *this);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ }
+
+ /*!
+ * \brief Construct a Buffer from a host container via iterators using a specified context.
+ * IteratorType must be random access.
+ * If useHostPtr is specified iterators must represent contiguous data.
+ */
+ template< typename IteratorType >
+ Buffer(const Context &context, IteratorType startIterator, IteratorType endIterator,
+ bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
+
+ /*!
+ * \brief Construct a Buffer from a host container via iterators using a specified queue.
+ * If useHostPtr is specified iterators must represent contiguous data.
+ */
+ template< typename IteratorType >
+ Buffer(const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
+ bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
+
+ //! \brief Default constructor - initializes to NULL.
+ Buffer() : Memory() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Buffer(const cl_mem& buffer) : Memory(buffer) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Buffer& operator = (const cl_mem& rhs)
+ {
+ Memory::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer(const Buffer& buf) : Memory(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer& operator = (const Buffer &buf)
+ {
+ Memory::operator=(buf);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer(Buffer&& buf) CL_HPP_NOEXCEPT : Memory(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer& operator = (Buffer &&buf)
+ {
+ Memory::operator=(std::move(buf));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+#if defined(CL_VERSION_1_1)
+ /*! \brief Creates a new buffer object from this.
+ *
+ * Wraps clCreateSubBuffer().
+ */
+ Buffer createSubBuffer(
+ cl_mem_flags flags,
+ cl_buffer_create_type buffer_create_type,
+ const void * buffer_create_info,
+ cl_int * err = NULL)
+ {
+ Buffer result;
+ cl_int error;
+ result.object_ = ::clCreateSubBuffer(
+ object_,
+ flags,
+ buffer_create_type,
+ buffer_create_info,
+ &error);
+
+ detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ return result;
+ }
+#endif
+};
+
+#if defined (USE_DX_INTEROP)
+/*! \brief Class interface for creating OpenCL buffers from ID3D10Buffer's.
+ *
+ * This is provided to facilitate interoperability with Direct3D.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class BufferD3D10 : public Buffer
+{
+public:
+ typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
+ cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
+ cl_int* errcode_ret);
+
+ /*! \brief Constructs a BufferD3D10, in a specified context, from a
+ * given ID3D10Buffer.
+ *
+ * Wraps clCreateFromD3D10BufferKHR().
+ */
+ BufferD3D10(
+ const Context& context,
+ cl_mem_flags flags,
+ ID3D10Buffer* bufobj,
+ cl_int * err = NULL)
+ {
+ static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
+
+#if defined(CL_VERSION_1_2)
+ vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
+ cl_platform platform = -1;
+ for( int i = 0; i < props.size(); ++i ) {
+ if( props[i] == CL_CONTEXT_PLATFORM ) {
+ platform = props[i+1];
+ }
+ }
+ __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clCreateFromD3D10BufferKHR);
+#endif
+#if defined(CL_VERSION_1_1)
+ __INIT_CL_EXT_FCN_PTR(clCreateFromD3D10BufferKHR);
+#endif
+
+ cl_int error;
+ object_ = pfn_clCreateFromD3D10BufferKHR(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ BufferD3D10() : Buffer() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS BufferD3D10(const cl_mem& buffer) : Buffer(buffer) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ BufferD3D10& operator = (const cl_mem& rhs)
+ {
+ Buffer::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10(const BufferD3D10& buf) : Buffer(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10& operator = (const BufferD3D10 &buf)
+ {
+ Buffer::operator=(buf);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10& operator = (BufferD3D10 &&buf)
+ {
+ Buffer::operator=(std::move(buf));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+#endif
+
+/*! \brief Class interface for GL Buffer Memory Objects.
+ *
+ * This is provided to facilitate interoperability with OpenGL.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class BufferGL : public Buffer
+{
+public:
+ /*! \brief Constructs a BufferGL in a specified context, from a given
+ * GL buffer.
+ *
+ * Wraps clCreateFromGLBuffer().
+ */
+ BufferGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLBuffer(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ BufferGL() : Buffer() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS BufferGL(const cl_mem& buffer) : Buffer(buffer) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ BufferGL& operator = (const cl_mem& rhs)
+ {
+ Buffer::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL(const BufferGL& buf) : Buffer(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL& operator = (const BufferGL &buf)
+ {
+ Buffer::operator=(buf);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL(BufferGL&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL& operator = (BufferGL &&buf)
+ {
+ Buffer::operator=(std::move(buf));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ //! \brief Wrapper for clGetGLObjectInfo().
+ cl_int getObjectInfo(
+ cl_gl_object_type *type,
+ cl_GLuint * gl_object_name)
+ {
+ return detail::errHandler(
+ ::clGetGLObjectInfo(object_,type,gl_object_name),
+ __GET_GL_OBJECT_INFO_ERR);
+ }
+};
+
+/*! \brief C++ base class for Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image : public Memory
+{
+protected:
+ //! \brief Default constructor - initializes to NULL.
+ Image() : Memory() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Image(const cl_mem& image) : Memory(image) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image& operator = (const cl_mem& rhs)
+ {
+ Memory::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image(const Image& img) : Memory(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image& operator = (const Image &img)
+ {
+ Memory::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image(Image&& img) CL_HPP_NOEXCEPT : Memory(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image& operator = (Image &&img)
+ {
+ Memory::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+public:
+ //! \brief Wrapper for clGetImageInfo().
+ template <typename T>
+ cl_int getImageInfo(cl_image_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetImageInfo, object_, name, param),
+ __GET_IMAGE_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetImageInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_image_info, name>::param_type
+ getImageInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_image_info, name>::param_type param;
+ cl_int result = getImageInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+};
+
+#if defined(CL_VERSION_1_2)
+/*! \brief Class interface for 1D Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image1D : public Image
+{
+public:
+ /*! \brief Constructs a 1D Image in a specified context.
+ *
+ * Wraps clCreateImage().
+ */
+ Image1D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t width,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE1D,
+ width,
+ 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image1D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Image1D(const cl_mem& image1D) : Image(image1D) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image1D& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D(const Image1D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D& operator = (const Image1D &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D(Image1D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D& operator = (Image1D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+
+/*! \class Image1DBuffer
+ * \brief Image interface for 1D buffer images.
+ */
+class Image1DBuffer : public Image
+{
+public:
+ Image1DBuffer(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t width,
+ const Buffer &buffer,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE1D_BUFFER,
+ width,
+ 0, 0, 0, 0, 0, 0, 0,
+ buffer()
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ NULL,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image1DBuffer() { }
+
+ __CL_EXPLICIT_CONSTRUCTORS Image1DBuffer(const cl_mem& image1D) : Image(image1D) { }
+
+ Image1DBuffer& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer(const Image1DBuffer& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer& operator = (const Image1DBuffer &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer(Image1DBuffer&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer& operator = (Image1DBuffer &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+
+/*! \class Image1DArray
+ * \brief Image interface for arrays of 1D images.
+ */
+class Image1DArray : public Image
+{
+public:
+ Image1DArray(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t arraySize,
+ ::size_t width,
+ ::size_t rowPitch,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE1D_ARRAY,
+ width,
+ 0, 0, // height, depth (unused)
+ arraySize,
+ rowPitch,
+ 0, 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image1DArray() { }
+
+ __CL_EXPLICIT_CONSTRUCTORS Image1DArray(const cl_mem& imageArray) : Image(imageArray) { }
+
+ Image1DArray& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray(const Image1DArray& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray& operator = (const Image1DArray &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray(Image1DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray& operator = (Image1DArray &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+#endif // #if defined(CL_VERSION_1_2)
+
+
+/*! \brief Class interface for 2D Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image2D : public Image
+{
+public:
+ /*! \brief Constructs a 1D Image in a specified context.
+ *
+ * Wraps clCreateImage().
+ */
+ Image2D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t width,
+ ::size_t height,
+ ::size_t row_pitch = 0,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ bool useCreateImage;
+
+#if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
+ }
+#elif defined(CL_VERSION_1_2)
+ useCreateImage = true;
+#else
+ useCreateImage = false;
+#endif
+
+#if defined(CL_VERSION_1_2)
+ if (useCreateImage)
+ {
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE2D,
+ width,
+ height,
+ 0, 0, // depth, array size (unused)
+ row_pitch,
+ 0, 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // #if defined(CL_VERSION_1_2)
+#if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ if (!useCreateImage)
+ {
+ object_ = ::clCreateImage2D(
+ context(), flags,&format, width, height, row_pitch, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_IMAGE2D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image2D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Image2D(const cl_mem& image2D) : Image(image2D) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image2D& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D(const Image2D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D& operator = (const Image2D &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D(Image2D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D& operator = (Image2D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+
+
+#if !defined(CL_VERSION_1_2)
+/*! \brief Class interface for GL 2D Image Memory objects.
+ *
+ * This is provided to facilitate interoperability with OpenGL.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ * \note Deprecated for OpenCL 1.2. Please use ImageGL instead.
+ */
+class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED Image2DGL CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED : public Image2D
+{
+public:
+ /*! \brief Constructs an Image2DGL in a specified context, from a given
+ * GL Texture.
+ *
+ * Wraps clCreateFromGLTexture2D().
+ */
+ Image2DGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture2D(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image2DGL() : Image2D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Image2DGL(const cl_mem& image) : Image2D(image) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image2DGL& operator = (const cl_mem& rhs)
+ {
+ Image2D::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL(const Image2DGL& img) : Image2D(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL& operator = (const Image2DGL &img)
+ {
+ Image2D::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL(Image2DGL&& img) CL_HPP_NOEXCEPT : Image2D(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL& operator = (Image2DGL &&img)
+ {
+ Image2D::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+#endif // #if !defined(CL_VERSION_1_2)
+
+#if defined(CL_VERSION_1_2)
+/*! \class Image2DArray
+ * \brief Image interface for arrays of 2D images.
+ */
+class Image2DArray : public Image
+{
+public:
+ Image2DArray(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t arraySize,
+ ::size_t width,
+ ::size_t height,
+ ::size_t rowPitch,
+ ::size_t slicePitch,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE2D_ARRAY,
+ width,
+ height,
+ 0, // depth (unused)
+ arraySize,
+ rowPitch,
+ slicePitch,
+ 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image2DArray() { }
+
+ __CL_EXPLICIT_CONSTRUCTORS Image2DArray(const cl_mem& imageArray) : Image(imageArray) { }
+
+ Image2DArray& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray(const Image2DArray& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray& operator = (const Image2DArray &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray(Image2DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray& operator = (Image2DArray &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+#endif // #if defined(CL_VERSION_1_2)
+
+/*! \brief Class interface for 3D Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image3D : public Image
+{
+public:
+ /*! \brief Constructs a 3D Image in a specified context.
+ *
+ * Wraps clCreateImage().
+ */
+ Image3D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t width,
+ ::size_t height,
+ ::size_t depth,
+ ::size_t row_pitch = 0,
+ ::size_t slice_pitch = 0,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ bool useCreateImage;
+
+#if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
+ }
+#elif defined(CL_VERSION_1_2)
+ useCreateImage = true;
+#else
+ useCreateImage = false;
+#endif
+
+#if defined(CL_VERSION_1_2)
+ if (useCreateImage)
+ {
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE3D,
+ width,
+ height,
+ depth,
+ 0, // array size (unused)
+ row_pitch,
+ slice_pitch,
+ 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // #if defined(CL_VERSION_1_2)
+#if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ if (!useCreateImage)
+ {
+ object_ = ::clCreateImage3D(
+ context(), flags, &format, width, height, depth, row_pitch,
+ slice_pitch, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_IMAGE3D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image3D() : Image() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Image3D(const cl_mem& image3D) : Image(image3D) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image3D& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D(const Image3D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D& operator = (const Image3D &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D(Image3D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D& operator = (Image3D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+
+#if !defined(CL_VERSION_1_2)
+/*! \brief Class interface for GL 3D Image Memory objects.
+ *
+ * This is provided to facilitate interoperability with OpenGL.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image3DGL : public Image3D
+{
+public:
+ /*! \brief Constructs an Image3DGL in a specified context, from a given
+ * GL Texture.
+ *
+ * Wraps clCreateFromGLTexture3D().
+ */
+ Image3DGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture3D(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image3DGL() : Image3D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Image3DGL(const cl_mem& image) : Image3D(image) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image3DGL& operator = (const cl_mem& rhs)
+ {
+ Image3D::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL(const Image3DGL& img) : Image3D(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL& operator = (const Image3DGL &img)
+ {
+ Image3D::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL(Image3DGL&& img) CL_HPP_NOEXCEPT : Image3D(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL& operator = (Image3DGL &&img)
+ {
+ Image3D::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+#endif // #if !defined(CL_VERSION_1_2)
+
+#if defined(CL_VERSION_1_2)
+/*! \class ImageGL
+ * \brief general image interface for GL interop.
+ * We abstract the 2D and 3D GL images into a single instance here
+ * that wraps all GL sourced images on the grounds that setup information
+ * was performed by OpenCL anyway.
+ */
+class ImageGL : public Image
+{
+public:
+ ImageGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_TEXTURE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ ImageGL() : Image() { }
+
+ __CL_EXPLICIT_CONSTRUCTORS ImageGL(const cl_mem& image) : Image(image) { }
+
+ ImageGL& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL(const ImageGL& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL& operator = (const ImageGL &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL(ImageGL&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL& operator = (ImageGL &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+};
+#endif // #if defined(CL_VERSION_1_2)
+
+/*! \brief Class interface for GL Render Buffer Memory Objects.
+*
+* This is provided to facilitate interoperability with OpenGL.
+*
+* See Memory for details about copy semantics, etc.
+*
+* \see Memory
+*/
+class BufferRenderGL :
+#if defined(CL_VERSION_1_2)
+ public ImageGL
+#else // #if defined(CL_VERSION_1_2)
+ public Image2DGL
+#endif //#if defined(CL_VERSION_1_2)
+{
+public:
+ /*! \brief Constructs a BufferRenderGL in a specified context, from a given
+ * GL Renderbuffer.
+ *
+ * Wraps clCreateFromGLRenderbuffer().
+ */
+ BufferRenderGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLRenderbuffer(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+#if defined(CL_VERSION_1_2)
+ BufferRenderGL() : ImageGL() {};
+#else // #if defined(CL_VERSION_1_2)
+ BufferRenderGL() : Image2DGL() {};
+#endif //#if defined(CL_VERSION_1_2)
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+#if defined(CL_VERSION_1_2)
+ __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : ImageGL(buffer) { }
+#else // #if defined(CL_VERSION_1_2)
+ __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : Image2DGL(buffer) { }
+#endif //#if defined(CL_VERSION_1_2)
+
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ BufferRenderGL& operator = (const cl_mem& rhs)
+ {
+#if defined(CL_VERSION_1_2)
+ ImageGL::operator=(rhs);
+#else // #if defined(CL_VERSION_1_2)
+ Image2DGL::operator=(rhs);
+#endif //#if defined(CL_VERSION_1_2)
+
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+#if defined(CL_VERSION_1_2)
+ BufferRenderGL(const BufferRenderGL& buf) : ImageGL(buf) {}
+#else // #if defined(CL_VERSION_1_2)
+ BufferRenderGL(const BufferRenderGL& buf) : Image2DGL(buf) {}
+#endif //#if defined(CL_VERSION_1_2)
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL& operator = (const BufferRenderGL &rhs)
+ {
+#if defined(CL_VERSION_1_2)
+ ImageGL::operator=(rhs);
+#else // #if defined(CL_VERSION_1_2)
+ Image2DGL::operator=(rhs);
+#endif //#if defined(CL_VERSION_1_2)
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+#if defined(CL_VERSION_1_2)
+ BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : ImageGL(std::move(buf)) {}
+#else // #if defined(CL_VERSION_1_2)
+ BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : Image2DGL(std::move(buf)) {}
+#endif //#if defined(CL_VERSION_1_2)
+
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL& operator = (BufferRenderGL &&buf)
+ {
+#if defined(CL_VERSION_1_2)
+ ImageGL::operator=(std::move(buf));
+#else // #if defined(CL_VERSION_1_2)
+ Image2DGL::operator=(std::move(buf));
+#endif //#if defined(CL_VERSION_1_2)
+
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ //! \brief Wrapper for clGetGLObjectInfo().
+ cl_int getObjectInfo(
+ cl_gl_object_type *type,
+ cl_GLuint * gl_object_name)
+ {
+ return detail::errHandler(
+ ::clGetGLObjectInfo(object_, type, gl_object_name),
+ __GET_GL_OBJECT_INFO_ERR);
+ }
+};
+
+/*! \brief Class interface for cl_sampler.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_sampler as the original. For details, see
+ * clRetainSampler() and clReleaseSampler().
+ *
+ * \see cl_sampler
+ */
+class Sampler : public detail::Wrapper<cl_sampler>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Sampler() { }
+
+ /*! \brief Constructs a Sampler in a specified context.
+ *
+ * Wraps clCreateSampler().
+ */
+ Sampler(
+ const Context& context,
+ cl_bool normalized_coords,
+ cl_addressing_mode addressing_mode,
+ cl_filter_mode filter_mode,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateSampler(
+ context(),
+ normalized_coords,
+ addressing_mode,
+ filter_mode,
+ &error);
+
+ detail::errHandler(error, __CREATE_SAMPLER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Constructor from cl_sampler - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the cl_sampler
+ * into the new Sampler object.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Sampler(const cl_sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
+
+ /*! \brief Assignment operator from cl_sampler - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseSampler() on the value previously held by this instance.
+ */
+ Sampler& operator = (const cl_sampler& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler(const Sampler& sam) : detail::Wrapper<cl_type>(sam) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler& operator = (const Sampler &sam)
+ {
+ detail::Wrapper<cl_type>::operator=(sam);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler(Sampler&& sam) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(sam)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler& operator = (Sampler &&sam)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(sam));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ //! \brief Wrapper for clGetSamplerInfo().
+ template <typename T>
+ cl_int getInfo(cl_sampler_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetSamplerInfo, object_, name, param),
+ __GET_SAMPLER_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetSamplerInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_sampler_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_sampler_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+};
+
+class Program;
+class CommandQueue;
+class Kernel;
+
+//! \brief Class interface for specifying NDRange values.
+class NDRange
+{
+private:
+ size_t<3> sizes_;
+ cl_uint dimensions_;
+
+public:
+ //! \brief Default constructor - resulting range has zero dimensions.
+ NDRange()
+ : dimensions_(0)
+ { }
+
+ //! \brief Constructs one-dimensional range.
+ NDRange(::size_t size0)
+ : dimensions_(1)
+ {
+ sizes_[0] = size0;
+ }
+
+ //! \brief Constructs two-dimensional range.
+ NDRange(::size_t size0, ::size_t size1)
+ : dimensions_(2)
+ {
+ sizes_[0] = size0;
+ sizes_[1] = size1;
+ }
+
+ //! \brief Constructs three-dimensional range.
+ NDRange(::size_t size0, ::size_t size1, ::size_t size2)
+ : dimensions_(3)
+ {
+ sizes_[0] = size0;
+ sizes_[1] = size1;
+ sizes_[2] = size2;
+ }
+
+ /*! \brief Conversion operator to const ::size_t *.
+ *
+ * \returns a pointer to the size of the first dimension.
+ */
+ operator const ::size_t*() const {
+ return (const ::size_t*) sizes_;
+ }
+
+ //! \brief Queries the number of dimensions in the range.
+ ::size_t dimensions() const { return dimensions_; }
+};
+
+//! \brief A zero-dimensional range.
+static const NDRange NullRange;
+
+//! \brief Local address wrapper for use with Kernel::setArg
+struct LocalSpaceArg
+{
+ ::size_t size_;
+};
+
+namespace detail {
+
+template <typename T>
+struct KernelArgumentHandler
+{
+ static ::size_t size(const T&) { return sizeof(T); }
+ static const T* ptr(const T& value) { return &value; }
+};
+
+template <>
+struct KernelArgumentHandler<LocalSpaceArg>
+{
+ static ::size_t size(const LocalSpaceArg& value) { return value.size_; }
+ static const void* ptr(const LocalSpaceArg&) { return NULL; }
+};
+
+}
+//! \endcond
+
+/*! __local
+ * \brief Helper function for generating LocalSpaceArg objects.
+ * Deprecated. Replaced with Local.
+ */
+inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED LocalSpaceArg
+__local(::size_t size) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
+inline LocalSpaceArg
+__local(::size_t size)
+{
+ LocalSpaceArg ret = { size };
+ return ret;
+}
+
+/*! Local
+ * \brief Helper function for generating LocalSpaceArg objects.
+ */
+inline LocalSpaceArg
+Local(::size_t size)
+{
+ LocalSpaceArg ret = { size };
+ return ret;
+}
+
+//class KernelFunctor;
+
+/*! \brief Class interface for cl_kernel.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_kernel as the original. For details, see
+ * clRetainKernel() and clReleaseKernel().
+ *
+ * \see cl_kernel
+ */
+class Kernel : public detail::Wrapper<cl_kernel>
+{
+public:
+ inline Kernel(const Program& program, const char* name, cl_int* err = NULL);
+
+ //! \brief Default constructor - initializes to NULL.
+ Kernel() { }
+
+ /*! \brief Constructor from cl_kernel - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the cl_kernel
+ * into the new Kernel object.
+ */
+ __CL_EXPLICIT_CONSTRUCTORS Kernel(const cl_kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
+
+ /*! \brief Assignment operator from cl_kernel - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseKernel() on the value previously held by this instance.
+ */
+ Kernel& operator = (const cl_kernel& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel& operator = (const Kernel &kernel)
+ {
+ detail::Wrapper<cl_type>::operator=(kernel);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel(Kernel&& kernel) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(kernel)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel& operator = (Kernel &&kernel)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(kernel));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ template <typename T>
+ cl_int getInfo(cl_kernel_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetKernelInfo, object_, name, param),
+ __GET_KERNEL_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+#if defined(CL_VERSION_1_2)
+ template <typename T>
+ cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetKernelArgInfo, object_, argIndex, name, param),
+ __GET_KERNEL_ARG_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_arg_info, name>::param_type
+ getArgInfo(cl_uint argIndex, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_arg_info, name>::param_type param;
+ cl_int result = getArgInfo(argIndex, name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+#endif // #if defined(CL_VERSION_1_2)
+
+ template <typename T>
+ cl_int getWorkGroupInfo(
+ const Device& device, cl_kernel_work_group_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetKernelWorkGroupInfo, object_, device(), name, param),
+ __GET_KERNEL_WORK_GROUP_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
+ getWorkGroupInfo(const Device& device, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_work_group_info, name>::param_type param;
+ cl_int result = getWorkGroupInfo(device, name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ template <typename T>
+ cl_int setArg(cl_uint index, const T &value)
+ {
+ return detail::errHandler(
+ ::clSetKernelArg(
+ object_,
+ index,
+ detail::KernelArgumentHandler<T>::size(value),
+ detail::KernelArgumentHandler<T>::ptr(value)),
+ __SET_KERNEL_ARGS_ERR);
+ }
+
+ cl_int setArg(cl_uint index, ::size_t size, const void* argPtr)
+ {
+ return detail::errHandler(
+ ::clSetKernelArg(object_, index, size, argPtr),
+ __SET_KERNEL_ARGS_ERR);
+ }
+};
+
+/*! \class Program
+ * \brief Program interface that implements cl_program.
+ */
+class Program : public detail::Wrapper<cl_program>
+{
+public:
+ typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > Binaries;
+ typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > Sources;
+
+ Program(
+ const STRING_CLASS& source,
+ bool build = false,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const char * strings = source.c_str();
+ const ::size_t length = source.size();
+
+ Context context = Context::getDefault(err);
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)1, &strings, &length, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+
+ if (error == CL_SUCCESS && build) {
+
+ error = ::clBuildProgram(
+ object_,
+ 0,
+ NULL,
+ "",
+ NULL,
+ NULL);
+
+ detail::errHandler(error, __BUILD_PROGRAM_ERR);
+ }
+
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Program(
+ const Context& context,
+ const STRING_CLASS& source,
+ bool build = false,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const char * strings = source.c_str();
+ const ::size_t length = source.size();
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)1, &strings, &length, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+
+ if (error == CL_SUCCESS && build) {
+
+ error = ::clBuildProgram(
+ object_,
+ 0,
+ NULL,
+ "",
+ NULL,
+ NULL);
+
+ detail::errHandler(error, __BUILD_PROGRAM_ERR);
+ }
+
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Program(
+ const Context& context,
+ const Sources& sources,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const ::size_t n = (::size_t)sources.size();
+ ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t));
+ const char** strings = (const char**) alloca(n * sizeof(const char*));
+
+ for (::size_t i = 0; i < n; ++i) {
+ strings[i] = sources[(int)i].first;
+ lengths[i] = sources[(int)i].second;
+ }
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)n, strings, lengths, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /**
+ * Construct a program object from a list of devices and a per-device list of binaries.
+ * \param context A valid OpenCL context in which to construct the program.
+ * \param devices A vector of OpenCL device objects for which the program will be created.
+ * \param binaries A vector of pairs of a pointer to a binary object and its length.
+ * \param binaryStatus An optional vector that on completion will be resized to
+ * match the size of binaries and filled with values to specify if each binary
+ * was successfully loaded.
+ * Set to CL_SUCCESS if the binary was successfully loaded.
+ * Set to CL_INVALID_VALUE if the length is 0 or the binary pointer is NULL.
+ * Set to CL_INVALID_BINARY if the binary provided is not valid for the matching device.
+ * \param err if non-NULL will be set to CL_SUCCESS on successful operation or one of the following errors:
+ * CL_INVALID_CONTEXT if context is not a valid context.
+ * CL_INVALID_VALUE if the length of devices is zero; or if the length of binaries does not match the length of devices;
+ * or if any entry in binaries is NULL or has length 0.
+ * CL_INVALID_DEVICE if OpenCL devices listed in devices are not in the list of devices associated with context.
+ * CL_INVALID_BINARY if an invalid program binary was encountered for any device. binaryStatus will return specific status for each device.
+ * CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
+ */
+ Program(
+ const Context& context,
+ const VECTOR_CLASS<Device>& devices,
+ const Binaries& binaries,
+ VECTOR_CLASS<cl_int>* binaryStatus = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const ::size_t numDevices = devices.size();
+
+ // Catch size mismatch early and return
+ if(binaries.size() != numDevices) {
+ error = CL_INVALID_VALUE;
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return;
+ }
+
+ ::size_t* lengths = (::size_t*) alloca(numDevices * sizeof(::size_t));
+ const unsigned char** images = (const unsigned char**) alloca(numDevices * sizeof(const unsigned char**));
+
+ for (::size_t i = 0; i < numDevices; ++i) {
+ images[i] = (const unsigned char*)binaries[i].first;
+ lengths[i] = binaries[(int)i].second;
+ }
+
+ cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
+ for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ if(binaryStatus) {
+ binaryStatus->resize(numDevices);
+ }
+
+ object_ = ::clCreateProgramWithBinary(
+ context(), (cl_uint) devices.size(),
+ deviceIDs,
+ lengths, images, (binaryStatus != NULL && numDevices > 0)
+ ? &binaryStatus->front()
+ : NULL, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+
+#if defined(CL_VERSION_1_2)
+ /**
+ * Create program using builtin kernels.
+ * \param kernelNames Semi-colon separated list of builtin kernel names
+ */
+ Program(
+ const Context& context,
+ const VECTOR_CLASS<Device>& devices,
+ const STRING_CLASS& kernelNames,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+
+ ::size_t numDevices = devices.size();
+ cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
+ for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ object_ = ::clCreateProgramWithBuiltInKernels(
+ context(),
+ (cl_uint) devices.size(),
+ deviceIDs,
+ kernelNames.c_str(),
+ &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // #if defined(CL_VERSION_1_2)
+
+ Program() { }
+
+ __CL_EXPLICIT_CONSTRUCTORS Program(const cl_program& program) : detail::Wrapper<cl_type>(program) { }
+
+ Program& operator = (const cl_program& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program(const Program& program) : detail::Wrapper<cl_type>(program) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program& operator = (const Program &program)
+ {
+ detail::Wrapper<cl_type>::operator=(program);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program(Program&& program) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(program)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program& operator = (Program &&program)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(program));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ cl_int build(
+ const VECTOR_CLASS<Device>& devices,
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL) const
+ {
+ ::size_t numDevices = devices.size();
+ cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
+ for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ return detail::errHandler(
+ ::clBuildProgram(
+ object_,
+ (cl_uint)
+ devices.size(),
+ deviceIDs,
+ options,
+ notifyFptr,
+ data),
+ __BUILD_PROGRAM_ERR);
+ }
+
+ cl_int build(
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL) const
+ {
+ return detail::errHandler(
+ ::clBuildProgram(
+ object_,
+ 0,
+ NULL,
+ options,
+ notifyFptr,
+ data),
+ __BUILD_PROGRAM_ERR);
+ }
+
+#if defined(CL_VERSION_1_2)
+ cl_int compile(
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL) const
+ {
+ return detail::errHandler(
+ ::clCompileProgram(
+ object_,
+ 0,
+ NULL,
+ options,
+ 0,
+ NULL,
+ NULL,
+ notifyFptr,
+ data),
+ __COMPILE_PROGRAM_ERR);
+ }
+#endif
+
+ template <typename T>
+ cl_int getInfo(cl_program_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetProgramInfo, object_, name, param),
+ __GET_PROGRAM_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_program_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_program_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ template <typename T>
+ cl_int getBuildInfo(
+ const Device& device, cl_program_build_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetProgramBuildInfo, object_, device(), name, param),
+ __GET_PROGRAM_BUILD_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_program_build_info, name>::param_type
+ getBuildInfo(const Device& device, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_program_build_info, name>::param_type param;
+ cl_int result = getBuildInfo(device, name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
+ {
+ cl_uint numKernels;
+ cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
+ }
+
+ Kernel* value = (Kernel*) alloca(numKernels * sizeof(Kernel));
+ err = ::clCreateKernelsInProgram(
+ object_, numKernels, (cl_kernel*) value, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
+ }
+
+ kernels->assign(&value[0], &value[numKernels]);
+ return CL_SUCCESS;
+ }
+};
+
+#if defined(CL_VERSION_1_2)
+inline Program linkProgram(
+ Program input1,
+ Program input2,
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+{
+ cl_int error_local = CL_SUCCESS;
+
+ cl_program programs[2] = { input1(), input2() };
+
+ Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>(&error_local);
+ if(error_local!=CL_SUCCESS) {
+ detail::errHandler(error_local, __LINK_PROGRAM_ERR);
+ }
+
+ cl_program prog = ::clLinkProgram(
+ ctx(),
+ 0,
+ NULL,
+ options,
+ 2,
+ programs,
+ notifyFptr,
+ data,
+ &error_local);
+
+ detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
+ if (err != NULL) {
+ *err = error_local;
+ }
+
+ return Program(prog);
+}
+
+inline Program linkProgram(
+ VECTOR_CLASS<Program> inputPrograms,
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+{
+ cl_int error_local = CL_SUCCESS;
+
+ cl_program * programs = (cl_program*) alloca(inputPrograms.size() * sizeof(cl_program));
+
+ if (programs != NULL) {
+ for (unsigned int i = 0; i < inputPrograms.size(); i++) {
+ programs[i] = inputPrograms[i]();
+ }
+ }
+
+ Context ctx;
+ if(inputPrograms.size() > 0) {
+ ctx = inputPrograms[0].getInfo<CL_PROGRAM_CONTEXT>(&error_local);
+ if(error_local!=CL_SUCCESS) {
+ detail::errHandler(error_local, __LINK_PROGRAM_ERR);
+ }
+ }
+ cl_program prog = ::clLinkProgram(
+ ctx(),
+ 0,
+ NULL,
+ options,
+ (cl_uint)inputPrograms.size(),
+ programs,
+ notifyFptr,
+ data,
+ &error_local);
+
+ detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
+ if (err != NULL) {
+ *err = error_local;
+ }
+
+ return Program(prog);
+}
+#endif
+
+template<>
+inline VECTOR_CLASS<char *> cl::Program::getInfo<CL_PROGRAM_BINARIES>(cl_int* err) const
+{
+ VECTOR_CLASS< ::size_t> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>();
+ VECTOR_CLASS<char *> binaries;
+ for (VECTOR_CLASS< ::size_t>::iterator s = sizes.begin(); s != sizes.end(); ++s)
+ {
+ char *ptr = NULL;
+ if (*s != 0)
+ ptr = new char[*s];
+ binaries.push_back(ptr);
+ }
+
+ cl_int result = getInfo(CL_PROGRAM_BINARIES, &binaries);
+ if (err != NULL) {
+ *err = result;
+ }
+ return binaries;
+}
+
+inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
+{
+ cl_int error;
+
+ object_ = ::clCreateKernel(program(), name, &error);
+ detail::errHandler(error, __CREATE_KERNEL_ERR);
+
+ if (err != NULL) {
+ *err = error;
+ }
+
+}
+
+/*! \class CommandQueue
+ * \brief CommandQueue interface for cl_command_queue.
+ */
+class CommandQueue : public detail::Wrapper<cl_command_queue>
+{
+private:
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static std::atomic<int> default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static volatile int default_initialized_;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static CommandQueue default_;
+ static volatile cl_int default_error_;
+public:
+ CommandQueue(
+ cl_command_queue_properties properties,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ Context context = Context::getDefault(&error);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS) {
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ else {
+ Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+
+ object_ = ::clCreateCommandQueue(
+ context(), device(), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ }
+ /*!
+ * \brief Constructs a CommandQueue for an implementation defined device in the given context
+ */
+ explicit CommandQueue(
+ const Context& context,
+ cl_command_queue_properties properties = 0,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ VECTOR_CLASS<cl::Device> devices;
+ error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
+
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS)
+ {
+ if (err != NULL) {
+ *err = error;
+ }
+ return;
+ }
+
+ object_ = ::clCreateCommandQueue(context(), devices[0](), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+
+ if (err != NULL) {
+ *err = error;
+ }
+
+ }
+
+ CommandQueue(
+ const Context& context,
+ const Device& device,
+ cl_command_queue_properties properties = 0,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateCommandQueue(
+ context(), device(), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue(const CommandQueue& queue) : detail::Wrapper<cl_type>(queue) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue& operator = (const CommandQueue &queue)
+ {
+ detail::Wrapper<cl_type>::operator=(queue);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue(CommandQueue&& queue) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(queue)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue& operator = (CommandQueue &&queue)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(queue));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ static CommandQueue getDefault(cl_int * err = NULL)
+ {
+ int state = detail::compare_exchange(
+ &default_initialized_,
+ __DEFAULT_BEING_INITIALIZED, __DEFAULT_NOT_INITIALIZED);
+
+ if (state & __DEFAULT_INITIALIZED) {
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+ }
+
+ if (state & __DEFAULT_BEING_INITIALIZED) {
+ // Assume writes will propagate eventually...
+ while(default_initialized_ != __DEFAULT_INITIALIZED) {
+ detail::fence();
+ }
+
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+ }
+
+ cl_int error;
+
+ Context context = Context::getDefault(&error);
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+
+ if (error != CL_SUCCESS) {
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ else {
+ Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+
+ default_ = CommandQueue(context, device, 0, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ detail::fence();
+
+ default_error_ = error;
+ // Assume writes will propagate eventually...
+ default_initialized_ = __DEFAULT_INITIALIZED;
+
+ detail::fence();
+
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+
+ }
+
+ CommandQueue() { }
+
+ __CL_EXPLICIT_CONSTRUCTORS CommandQueue(const cl_command_queue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
+
+ CommandQueue& operator = (const cl_command_queue& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_command_queue_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetCommandQueueInfo, object_, name, param),
+ __GET_COMMAND_QUEUE_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_command_queue_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_command_queue_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int enqueueReadBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ ::size_t offset,
+ ::size_t size,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReadBuffer(
+ object_, buffer(), blocking, offset, size,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_READ_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueWriteBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ ::size_t offset,
+ ::size_t size,
+ const void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueWriteBuffer(
+ object_, buffer(), blocking, offset, size,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_WRITE_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyBuffer(
+ const Buffer& src,
+ const Buffer& dst,
+ ::size_t src_offset,
+ ::size_t dst_offset,
+ ::size_t size,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyBuffer(
+ object_, src(), dst(), src_offset, dst_offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQEUE_COPY_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueReadBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const size_t<3>& buffer_offset,
+ const size_t<3>& host_offset,
+ const size_t<3>& region,
+ ::size_t buffer_row_pitch,
+ ::size_t buffer_slice_pitch,
+ ::size_t host_row_pitch,
+ ::size_t host_slice_pitch,
+ void *ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReadBufferRect(
+ object_,
+ buffer(),
+ blocking,
+ (const ::size_t *)buffer_offset,
+ (const ::size_t *)host_offset,
+ (const ::size_t *)region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_READ_BUFFER_RECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueWriteBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const size_t<3>& buffer_offset,
+ const size_t<3>& host_offset,
+ const size_t<3>& region,
+ ::size_t buffer_row_pitch,
+ ::size_t buffer_slice_pitch,
+ ::size_t host_row_pitch,
+ ::size_t host_slice_pitch,
+ void *ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueWriteBufferRect(
+ object_,
+ buffer(),
+ blocking,
+ (const ::size_t *)buffer_offset,
+ (const ::size_t *)host_offset,
+ (const ::size_t *)region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_WRITE_BUFFER_RECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyBufferRect(
+ const Buffer& src,
+ const Buffer& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ ::size_t src_row_pitch,
+ ::size_t src_slice_pitch,
+ ::size_t dst_row_pitch,
+ ::size_t dst_slice_pitch,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyBufferRect(
+ object_,
+ src(),
+ dst(),
+ (const ::size_t *)src_origin,
+ (const ::size_t *)dst_origin,
+ (const ::size_t *)region,
+ src_row_pitch,
+ src_slice_pitch,
+ dst_row_pitch,
+ dst_slice_pitch,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQEUE_COPY_BUFFER_RECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if defined(CL_VERSION_1_2)
+ /**
+ * Enqueue a command to fill a buffer object with a pattern
+ * of a given size. The pattern is specified a as vector.
+ * \tparam PatternType The datatype of the pattern field.
+ * The pattern type must be an accepted OpenCL data type.
+ */
+ template<typename PatternType>
+ cl_int enqueueFillBuffer(
+ const Buffer& buffer,
+ PatternType pattern,
+ ::size_t offset,
+ ::size_t size,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillBuffer(
+ object_,
+ buffer(),
+ static_cast<void*>(&pattern),
+ sizeof(PatternType),
+ offset,
+ size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // #if defined(CL_VERSION_1_2)
+
+ cl_int enqueueReadImage(
+ const Image& image,
+ cl_bool blocking,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t row_pitch,
+ ::size_t slice_pitch,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReadImage(
+ object_, image(), blocking, (const ::size_t *) origin,
+ (const ::size_t *) region, row_pitch, slice_pitch, ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_READ_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueWriteImage(
+ const Image& image,
+ cl_bool blocking,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t row_pitch,
+ ::size_t slice_pitch,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueWriteImage(
+ object_, image(), blocking, (const ::size_t *) origin,
+ (const ::size_t *) region, row_pitch, slice_pitch, ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_WRITE_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyImage(
+ const Image& src,
+ const Image& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyImage(
+ object_, src(), dst(), (const ::size_t *) src_origin,
+ (const ::size_t *)dst_origin, (const ::size_t *) region,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_COPY_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if defined(CL_VERSION_1_2)
+ /**
+ * Enqueue a command to fill an image object with a specified color.
+ * \param fillColor is the color to use to fill the image.
+ * This is a four component RGBA floating-point color value if
+ * the image channel data type is not an unnormalized signed or
+ * unsigned data type.
+ */
+ cl_int enqueueFillImage(
+ const Image& image,
+ cl_float4 fillColor,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillImage(
+ object_,
+ image(),
+ static_cast<void*>(&fillColor),
+ (const ::size_t *) origin,
+ (const ::size_t *) region,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueue a command to fill an image object with a specified color.
+ * \param fillColor is the color to use to fill the image.
+ * This is a four component RGBA signed integer color value if
+ * the image channel data type is an unnormalized signed integer
+ * type.
+ */
+ cl_int enqueueFillImage(
+ const Image& image,
+ cl_int4 fillColor,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillImage(
+ object_,
+ image(),
+ static_cast<void*>(&fillColor),
+ (const ::size_t *) origin,
+ (const ::size_t *) region,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueue a command to fill an image object with a specified color.
+ * \param fillColor is the color to use to fill the image.
+ * This is a four component RGBA unsigned integer color value if
+ * the image channel data type is an unnormalized unsigned integer
+ * type.
+ */
+ cl_int enqueueFillImage(
+ const Image& image,
+ cl_uint4 fillColor,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillImage(
+ object_,
+ image(),
+ static_cast<void*>(&fillColor),
+ (const ::size_t *) origin,
+ (const ::size_t *) region,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // #if defined(CL_VERSION_1_2)
+
+ cl_int enqueueCopyImageToBuffer(
+ const Image& src,
+ const Buffer& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& region,
+ ::size_t dst_offset,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyImageToBuffer(
+ object_, src(), dst(), (const ::size_t *) src_origin,
+ (const ::size_t *) region, dst_offset,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyBufferToImage(
+ const Buffer& src,
+ const Image& dst,
+ ::size_t src_offset,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyBufferToImage(
+ object_, src(), dst(), src_offset,
+ (const ::size_t *) dst_origin, (const ::size_t *) region,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ void* enqueueMapBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ ::size_t offset,
+ ::size_t size,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL) const
+ {
+ cl_event tmp;
+ cl_int error;
+ void * result = ::clEnqueueMapBuffer(
+ object_, buffer(), blocking, flags, offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ if (event != NULL && error == CL_SUCCESS)
+ *event = tmp;
+
+ return result;
+ }
+
+ void* enqueueMapImage(
+ const Image& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t * row_pitch,
+ ::size_t * slice_pitch,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL) const
+ {
+ cl_event tmp;
+ cl_int error;
+ void * result = ::clEnqueueMapImage(
+ object_, buffer(), blocking, flags,
+ (const ::size_t *) origin, (const ::size_t *) region,
+ row_pitch, slice_pitch,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ if (event != NULL && error == CL_SUCCESS)
+ *event = tmp;
+ return result;
+ }
+
+ cl_int enqueueUnmapMemObject(
+ const Memory& memory,
+ void* mapped_ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueUnmapMemObject(
+ object_, memory(), mapped_ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if defined(CL_VERSION_1_2)
+ /**
+ * Enqueues a marker command which waits for either a list of events to complete,
+ * or all previously enqueued commands to complete.
+ *
+ * Enqueues a marker command which waits for either a list of events to complete,
+ * or if the list is empty it waits for all commands previously enqueued in command_queue
+ * to complete before it completes. This command returns an event which can be waited on,
+ * i.e. this event can be waited on to insure that all events either in the event_wait_list
+ * or all previously enqueued commands, queued before this command to command_queue,
+ * have completed.
+ */
+ cl_int enqueueMarkerWithWaitList(
+ const VECTOR_CLASS<Event> *events = 0,
+ Event *event = 0)
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueMarkerWithWaitList(
+ object_,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_MARKER_WAIT_LIST_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * A synchronization point that enqueues a barrier operation.
+ *
+ * Enqueues a barrier command which waits for either a list of events to complete,
+ * or if the list is empty it waits for all commands previously enqueued in command_queue
+ * to complete before it completes. This command blocks command execution, that is, any
+ * following commands enqueued after it do not execute until it completes. This command
+ * returns an event which can be waited on, i.e. this event can be waited on to insure that
+ * all events either in the event_wait_list or all previously enqueued commands, queued
+ * before this command to command_queue, have completed.
+ */
+ cl_int enqueueBarrierWithWaitList(
+ const VECTOR_CLASS<Event> *events = 0,
+ Event *event = 0)
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueBarrierWithWaitList(
+ object_,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_BARRIER_WAIT_LIST_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueues a command to indicate with which device a set of memory objects
+ * should be associated.
+ */
+ cl_int enqueueMigrateMemObjects(
+ const VECTOR_CLASS<Memory> &memObjects,
+ cl_mem_migration_flags flags,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL
+ )
+ {
+ cl_event tmp;
+
+ cl_mem* localMemObjects = static_cast<cl_mem*>(alloca(memObjects.size() * sizeof(cl_mem)));
+ for( int i = 0; i < (int)memObjects.size(); ++i ) {
+ localMemObjects[i] = memObjects[i]();
+ }
+
+
+ cl_int err = detail::errHandler(
+ ::clEnqueueMigrateMemObjects(
+ object_,
+ (cl_uint)memObjects.size(),
+ static_cast<const cl_mem*>(localMemObjects),
+ flags,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // #if defined(CL_VERSION_1_2)
+
+ cl_int enqueueNDRangeKernel(
+ const Kernel& kernel,
+ const NDRange& offset,
+ const NDRange& global,
+ const NDRange& local = NullRange,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueNDRangeKernel(
+ object_, kernel(), (cl_uint) global.dimensions(),
+ offset.dimensions() != 0 ? (const ::size_t*) offset : NULL,
+ (const ::size_t*) global,
+ local.dimensions() != 0 ? (const ::size_t*) local : NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_NDRANGE_KERNEL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueTask(
+ const Kernel& kernel,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueTask(
+ object_, kernel(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_TASK_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueNativeKernel(
+ void (CL_CALLBACK *userFptr)(void *),
+ std::pair<void*, ::size_t> args,
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<const void*>* mem_locs = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
+ ? (cl_mem*) alloca(mem_objects->size() * sizeof(cl_mem))
+ : NULL;
+
+ if (mems != NULL) {
+ for (unsigned int i = 0; i < mem_objects->size(); i++) {
+ mems[i] = ((*mem_objects)[i])();
+ }
+ }
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueNativeKernel(
+ object_, userFptr, args.first, args.second,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ mems,
+ (mem_locs != NULL && mem_locs->size() > 0) ? (const void **) &mem_locs->front() : NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_NATIVE_KERNEL);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
+ CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+ cl_int enqueueMarker(Event* event = NULL) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueMarker(
+ object_,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_MARKER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+ cl_int enqueueWaitForEvents(const VECTOR_CLASS<Event>& events) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+ {
+ return detail::errHandler(
+ ::clEnqueueWaitForEvents(
+ object_,
+ (cl_uint) events.size(),
+ events.size() > 0 ? (const cl_event*) &events.front() : NULL),
+ __ENQUEUE_WAIT_FOR_EVENTS_ERR);
+ }
+#endif // #if defined(CL_VERSION_1_1)
+
+ cl_int enqueueAcquireGLObjects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueAcquireGLObjects(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_ACQUIRE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueReleaseGLObjects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReleaseGLObjects(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_RELEASE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if defined (USE_DX_INTEROP)
+typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
+ cl_command_queue command_queue, cl_uint num_objects,
+ const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list, cl_event* event);
+typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
+ cl_command_queue command_queue, cl_uint num_objects,
+ const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list, cl_event* event);
+
+ cl_int enqueueAcquireD3D10Objects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
+#if defined(CL_VERSION_1_2)
+ cl_context context = getInfo<CL_QUEUE_CONTEXT>();
+ cl::Device device(getInfo<CL_QUEUE_DEVICE>());
+ cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
+ __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueAcquireD3D10ObjectsKHR);
+#endif
+#if defined(CL_VERSION_1_1)
+ __INIT_CL_EXT_FCN_PTR(clEnqueueAcquireD3D10ObjectsKHR);
+#endif
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ pfn_clEnqueueAcquireD3D10ObjectsKHR(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_ACQUIRE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueReleaseD3D10Objects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
+#if defined(CL_VERSION_1_2)
+ cl_context context = getInfo<CL_QUEUE_CONTEXT>();
+ cl::Device device(getInfo<CL_QUEUE_DEVICE>());
+ cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
+ __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueReleaseD3D10ObjectsKHR);
+#endif // #if defined(CL_VERSION_1_2)
+#if defined(CL_VERSION_1_1)
+ __INIT_CL_EXT_FCN_PTR(clEnqueueReleaseD3D10ObjectsKHR);
+#endif // #if defined(CL_VERSION_1_1)
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ pfn_clEnqueueReleaseD3D10ObjectsKHR(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_RELEASE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
+ CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+ cl_int enqueueBarrier() const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+ {
+ return detail::errHandler(
+ ::clEnqueueBarrier(object_),
+ __ENQUEUE_BARRIER_ERR);
+ }
+#endif // #if defined(CL_VERSION_1_1)
+
+ cl_int flush() const
+ {
+ return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
+ }
+
+ cl_int finish() const
+ {
+ return detail::errHandler(::clFinish(object_), __FINISH_ERR);
+ }
+};
+
+#ifdef _WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) std::atomic<int> CommandQueue::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) CommandQueue CommandQueue::default_;
+__declspec(selectany) volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
+#else // !_WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) std::atomic<int> CommandQueue::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) CommandQueue CommandQueue::default_;
+__attribute__((weak)) volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
+#endif // !_WIN32
+
+template< typename IteratorType >
+Buffer::Buffer(
+ const Context &context,
+ IteratorType startIterator,
+ IteratorType endIterator,
+ bool readOnly,
+ bool useHostPtr,
+ cl_int* err)
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ cl_mem_flags flags = 0;
+ if( readOnly ) {
+ flags |= CL_MEM_READ_ONLY;
+ }
+ else {
+ flags |= CL_MEM_READ_WRITE;
+ }
+ if( useHostPtr ) {
+ flags |= CL_MEM_USE_HOST_PTR;
+ }
+
+ ::size_t size = sizeof(DataType)*(endIterator - startIterator);
+
+ if( useHostPtr ) {
+ object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
+ } else {
+ object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
+ }
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ if( !useHostPtr ) {
+ CommandQueue queue(context, 0, &error);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ error = cl::copy(queue, startIterator, endIterator, *this);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+}
+
+template< typename IteratorType >
+Buffer::Buffer(
+ const CommandQueue &queue,
+ IteratorType startIterator,
+ IteratorType endIterator,
+ bool readOnly,
+ bool useHostPtr,
+ cl_int* err)
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ cl_mem_flags flags = 0;
+ if (readOnly) {
+ flags |= CL_MEM_READ_ONLY;
+ }
+ else {
+ flags |= CL_MEM_READ_WRITE;
+ }
+ if (useHostPtr) {
+ flags |= CL_MEM_USE_HOST_PTR;
+ }
+
+ ::size_t size = sizeof(DataType)*(endIterator - startIterator);
+
+ Context context = queue.getInfo<CL_QUEUE_CONTEXT>();
+
+ if (useHostPtr) {
+ object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
+ }
+ else {
+ object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
+ }
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ if (!useHostPtr) {
+ error = cl::copy(queue, startIterator, endIterator, *this);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+}
+
+inline cl_int enqueueReadBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ ::size_t offset,
+ ::size_t size,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueReadBuffer(buffer, blocking, offset, size, ptr, events, event);
+}
+
+inline cl_int enqueueWriteBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ ::size_t offset,
+ ::size_t size,
+ const void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueWriteBuffer(buffer, blocking, offset, size, ptr, events, event);
+}
+
+inline void* enqueueMapBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ ::size_t offset,
+ ::size_t size,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ void * result = ::clEnqueueMapBuffer(
+ queue(), buffer(), blocking, flags, offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return result;
+}
+
+inline cl_int enqueueUnmapMemObject(
+ const Memory& memory,
+ void* mapped_ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueUnmapMemObject(
+ queue(), memory(), mapped_ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+}
+
+inline cl_int enqueueCopyBuffer(
+ const Buffer& src,
+ const Buffer& dst,
+ ::size_t src_offset,
+ ::size_t dst_offset,
+ ::size_t size,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyBuffer(src, dst, src_offset, dst_offset, size, events, event);
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Host to Device.
+ * Uses default command queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS)
+ return error;
+
+ return cl::copy(queue, startIterator, endIterator, buffer);
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Device to Host.
+ * Uses default command queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS)
+ return error;
+
+ return cl::copy(queue, buffer, startIterator, endIterator);
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Host to Device.
+ * Uses specified queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ ::size_t length = endIterator-startIterator;
+ ::size_t byteLength = length*sizeof(DataType);
+
+ DataType *pointer =
+ static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error));
+ // if exceptions enabled, enqueueMapBuffer will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+#if defined(_MSC_VER)
+ std::copy(
+ startIterator,
+ endIterator,
+ stdext::checked_array_iterator<DataType*>(
+ pointer, length));
+#else
+ std::copy(startIterator, endIterator, pointer);
+#endif
+ Event endEvent;
+ error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
+ // if exceptions enabled, enqueueUnmapMemObject will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+ endEvent.wait();
+ return CL_SUCCESS;
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Device to Host.
+ * Uses specified queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ ::size_t length = endIterator-startIterator;
+ ::size_t byteLength = length*sizeof(DataType);
+
+ DataType *pointer =
+ static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error));
+ // if exceptions enabled, enqueueMapBuffer will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+ std::copy(pointer, pointer + length, startIterator);
+ Event endEvent;
+ error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
+ // if exceptions enabled, enqueueUnmapMemObject will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+ endEvent.wait();
+ return CL_SUCCESS;
+}
+
+#if defined(CL_VERSION_1_1)
+inline cl_int enqueueReadBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const size_t<3>& buffer_offset,
+ const size_t<3>& host_offset,
+ const size_t<3>& region,
+ ::size_t buffer_row_pitch,
+ ::size_t buffer_slice_pitch,
+ ::size_t host_row_pitch,
+ ::size_t host_slice_pitch,
+ void *ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueReadBufferRect(
+ buffer,
+ blocking,
+ buffer_offset,
+ host_offset,
+ region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueWriteBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const size_t<3>& buffer_offset,
+ const size_t<3>& host_offset,
+ const size_t<3>& region,
+ ::size_t buffer_row_pitch,
+ ::size_t buffer_slice_pitch,
+ ::size_t host_row_pitch,
+ ::size_t host_slice_pitch,
+ void *ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueWriteBufferRect(
+ buffer,
+ blocking,
+ buffer_offset,
+ host_offset,
+ region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyBufferRect(
+ const Buffer& src,
+ const Buffer& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ ::size_t src_row_pitch,
+ ::size_t src_slice_pitch,
+ ::size_t dst_row_pitch,
+ ::size_t dst_slice_pitch,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyBufferRect(
+ src,
+ dst,
+ src_origin,
+ dst_origin,
+ region,
+ src_row_pitch,
+ src_slice_pitch,
+ dst_row_pitch,
+ dst_slice_pitch,
+ events,
+ event);
+}
+#endif
+
+inline cl_int enqueueReadImage(
+ const Image& image,
+ cl_bool blocking,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t row_pitch,
+ ::size_t slice_pitch,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueReadImage(
+ image,
+ blocking,
+ origin,
+ region,
+ row_pitch,
+ slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueWriteImage(
+ const Image& image,
+ cl_bool blocking,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t row_pitch,
+ ::size_t slice_pitch,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueWriteImage(
+ image,
+ blocking,
+ origin,
+ region,
+ row_pitch,
+ slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyImage(
+ const Image& src,
+ const Image& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyImage(
+ src,
+ dst,
+ src_origin,
+ dst_origin,
+ region,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyImageToBuffer(
+ const Image& src,
+ const Buffer& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& region,
+ ::size_t dst_offset,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyImageToBuffer(
+ src,
+ dst,
+ src_origin,
+ region,
+ dst_offset,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyBufferToImage(
+ const Buffer& src,
+ const Image& dst,
+ ::size_t src_offset,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyBufferToImage(
+ src,
+ dst,
+ src_offset,
+ dst_origin,
+ region,
+ events,
+ event);
+}
+
+
+inline cl_int flush(void)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.flush();
+}
+
+inline cl_int finish(void)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+
+ return queue.finish();
+}
+
+// Kernel Functor support
+// New interface as of September 2011
+// Requires the C++11 std::tr1::function (note do not support TR1)
+// Visual Studio 2010 and GCC 4.2
+
+struct EnqueueArgs
+{
+ CommandQueue queue_;
+ const NDRange offset_;
+ const NDRange global_;
+ const NDRange local_;
+ VECTOR_CLASS<Event> events_;
+
+ EnqueueArgs(NDRange global) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+
+ }
+
+ EnqueueArgs(NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(NDRange offset, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(Event e, NDRange global) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(Event e, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(Event e, NDRange offset, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange global) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange offset, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(offset),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, NDRange global) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, NDRange offset, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, Event e, NDRange global) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(CommandQueue &queue, Event e, NDRange offset, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange global) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange offset, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(offset),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+};
+
+namespace detail {
+
+class NullType {};
+
+template<int index, typename T0>
+struct SetArg
+{
+ static void set (Kernel kernel, T0 arg)
+ {
+ kernel.setArg(index, arg);
+ }
+};
+
+template<int index>
+struct SetArg<index, NullType>
+{
+ static void set (Kernel, NullType)
+ {
+ }
+};
+
+template <
+ typename T0, typename T1, typename T2, typename T3,
+ typename T4, typename T5, typename T6, typename T7,
+ typename T8, typename T9, typename T10, typename T11,
+ typename T12, typename T13, typename T14, typename T15,
+ typename T16, typename T17, typename T18, typename T19,
+ typename T20, typename T21, typename T22, typename T23,
+ typename T24, typename T25, typename T26, typename T27,
+ typename T28, typename T29, typename T30, typename T31
+>
+class KernelFunctorGlobal
+{
+private:
+ Kernel kernel_;
+
+public:
+ KernelFunctorGlobal(
+ Kernel kernel) :
+ kernel_(kernel)
+ {}
+
+ KernelFunctorGlobal(
+ const Program& program,
+ const STRING_CLASS name,
+ cl_int * err = NULL) :
+ kernel_(program, name.c_str(), err)
+ {}
+
+ Event operator() (
+ const EnqueueArgs& args,
+ T0 t0,
+ T1 t1 = NullType(),
+ T2 t2 = NullType(),
+ T3 t3 = NullType(),
+ T4 t4 = NullType(),
+ T5 t5 = NullType(),
+ T6 t6 = NullType(),
+ T7 t7 = NullType(),
+ T8 t8 = NullType(),
+ T9 t9 = NullType(),
+ T10 t10 = NullType(),
+ T11 t11 = NullType(),
+ T12 t12 = NullType(),
+ T13 t13 = NullType(),
+ T14 t14 = NullType(),
+ T15 t15 = NullType(),
+ T16 t16 = NullType(),
+ T17 t17 = NullType(),
+ T18 t18 = NullType(),
+ T19 t19 = NullType(),
+ T20 t20 = NullType(),
+ T21 t21 = NullType(),
+ T22 t22 = NullType(),
+ T23 t23 = NullType(),
+ T24 t24 = NullType(),
+ T25 t25 = NullType(),
+ T26 t26 = NullType(),
+ T27 t27 = NullType(),
+ T28 t28 = NullType(),
+ T29 t29 = NullType(),
+ T30 t30 = NullType(),
+ T31 t31 = NullType()
+ )
+ {
+ Event event;
+ SetArg<0, T0>::set(kernel_, t0);
+ SetArg<1, T1>::set(kernel_, t1);
+ SetArg<2, T2>::set(kernel_, t2);
+ SetArg<3, T3>::set(kernel_, t3);
+ SetArg<4, T4>::set(kernel_, t4);
+ SetArg<5, T5>::set(kernel_, t5);
+ SetArg<6, T6>::set(kernel_, t6);
+ SetArg<7, T7>::set(kernel_, t7);
+ SetArg<8, T8>::set(kernel_, t8);
+ SetArg<9, T9>::set(kernel_, t9);
+ SetArg<10, T10>::set(kernel_, t10);
+ SetArg<11, T11>::set(kernel_, t11);
+ SetArg<12, T12>::set(kernel_, t12);
+ SetArg<13, T13>::set(kernel_, t13);
+ SetArg<14, T14>::set(kernel_, t14);
+ SetArg<15, T15>::set(kernel_, t15);
+ SetArg<16, T16>::set(kernel_, t16);
+ SetArg<17, T17>::set(kernel_, t17);
+ SetArg<18, T18>::set(kernel_, t18);
+ SetArg<19, T19>::set(kernel_, t19);
+ SetArg<20, T20>::set(kernel_, t20);
+ SetArg<21, T21>::set(kernel_, t21);
+ SetArg<22, T22>::set(kernel_, t22);
+ SetArg<23, T23>::set(kernel_, t23);
+ SetArg<24, T24>::set(kernel_, t24);
+ SetArg<25, T25>::set(kernel_, t25);
+ SetArg<26, T26>::set(kernel_, t26);
+ SetArg<27, T27>::set(kernel_, t27);
+ SetArg<28, T28>::set(kernel_, t28);
+ SetArg<29, T29>::set(kernel_, t29);
+ SetArg<30, T30>::set(kernel_, t30);
+ SetArg<31, T31>::set(kernel_, t31);
+
+ args.queue_.enqueueNDRangeKernel(
+ kernel_,
+ args.offset_,
+ args.global_,
+ args.local_,
+ &args.events_,
+ &event);
+
+ return event;
+ }
+
+};
+
+//------------------------------------------------------------------------------------------------------
+
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24,
+ typename T25,
+ typename T26,
+ typename T27,
+ typename T28,
+ typename T29,
+ typename T30,
+ typename T31>
+struct functionImplementation_
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29,
+ T30,
+ T31> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 32))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29,
+ T30,
+ T31);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24,
+ T25 arg25,
+ T26 arg26,
+ T27 arg27,
+ T28 arg28,
+ T29 arg29,
+ T30 arg30,
+ T31 arg31)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24,
+ arg25,
+ arg26,
+ arg27,
+ arg28,
+ arg29,
+ arg30,
+ arg31);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24,
+ typename T25,
+ typename T26,
+ typename T27,
+ typename T28,
+ typename T29,
+ typename T30>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29,
+ T30,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29,
+ T30,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 31))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29,
+ T30);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24,
+ T25 arg25,
+ T26 arg26,
+ T27 arg27,
+ T28 arg28,
+ T29 arg29,
+ T30 arg30)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24,
+ arg25,
+ arg26,
+ arg27,
+ arg28,
+ arg29,
+ arg30);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24,
+ typename T25,
+ typename T26,
+ typename T27,
+ typename T28,
+ typename T29>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 30))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ T29);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24,
+ T25 arg25,
+ T26 arg26,
+ T27 arg27,
+ T28 arg28,
+ T29 arg29)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24,
+ arg25,
+ arg26,
+ arg27,
+ arg28,
+ arg29);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24,
+ typename T25,
+ typename T26,
+ typename T27,
+ typename T28>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 29))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ T28);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24,
+ T25 arg25,
+ T26 arg26,
+ T27 arg27,
+ T28 arg28)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24,
+ arg25,
+ arg26,
+ arg27,
+ arg28);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24,
+ typename T25,
+ typename T26,
+ typename T27>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 28))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ T27);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24,
+ T25 arg25,
+ T26 arg26,
+ T27 arg27)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24,
+ arg25,
+ arg26,
+ arg27);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24,
+ typename T25,
+ typename T26>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 27))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ T26);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24,
+ T25 arg25,
+ T26 arg26)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24,
+ arg25,
+ arg26);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24,
+ typename T25>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 26))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ T25);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24,
+ T25 arg25)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24,
+ arg25);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23,
+ typename T24>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 25))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ T24);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23,
+ T24 arg24)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23,
+ arg24);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22,
+ typename T23>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 24))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ T23);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22,
+ T23 arg23)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22,
+ arg23);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21,
+ typename T22>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 23))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ T22);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21,
+ T22 arg22)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21,
+ arg22);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20,
+ typename T21>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 22))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ T21);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20,
+ T21 arg21)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20,
+ arg21);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19,
+ typename T20>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 21))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ T20);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19,
+ T20 arg20)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19,
+ arg20);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18,
+ typename T19>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 20))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ T19);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18,
+ T19 arg19)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18,
+ arg19);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17,
+ typename T18>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 19))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ T18);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17,
+ T18 arg18)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17,
+ arg18);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16,
+ typename T17>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 18))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ T17);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16,
+ T17 arg17)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16,
+ arg17);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15,
+ typename T16>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 17))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ T16);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15,
+ T16 arg16)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15,
+ arg16);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14,
+ typename T15>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 16))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ T15);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14,
+ T15 arg15)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14,
+ arg15);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13,
+ typename T14>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 15))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ T14);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13,
+ T14 arg14)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13,
+ arg14);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12,
+ typename T13>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 14))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ T13);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12,
+ T13 arg13)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12,
+ arg13);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11,
+ typename T12>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 13))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ T12);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11,
+ T12 arg12)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11,
+ arg12);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10,
+ typename T11>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 12))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ T11);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10,
+ T11 arg11)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10,
+ arg11);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9,
+ typename T10>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 11))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ T10);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9,
+ T10 arg10)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9,
+ arg10);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8,
+ typename T9>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 10))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ T9);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8,
+ T9 arg9)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8,
+ arg9);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 9))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ T8);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7,
+ T8 arg8)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7,
+ arg8);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 8))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ T7);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6,
+ T7 arg7)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6,
+ arg7);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 7))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ T6);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5,
+ T6 arg6)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5,
+ arg6);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 6))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ T5);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4,
+ T5 arg5)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4,
+ arg5);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ T4,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 5))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3,
+ T4);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3,
+ T4 arg4)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3,
+ arg4);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2,
+ typename T3>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ T3,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ T3,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 4))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2,
+ T3);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2,
+ T3 arg3)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2,
+ arg3);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1,
+ typename T2>
+struct functionImplementation_
+< T0,
+ T1,
+ T2,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ T2,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 3))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1,
+ T2);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1,
+ T2 arg2)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1,
+ arg2);
+ }
+
+
+};
+
+template<
+ typename T0,
+ typename T1>
+struct functionImplementation_
+< T0,
+ T1,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ T1,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 2))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0,
+ T1);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0,
+ T1 arg1)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0,
+ arg1);
+ }
+
+
+};
+
+template<
+ typename T0>
+struct functionImplementation_
+< T0,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType>
+{
+ typedef detail::KernelFunctorGlobal<
+ T0,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType,
+ NullType> FunctorType;
+
+ FunctorType functor_;
+
+ functionImplementation_(const FunctorType &functor) :
+ functor_(functor)
+ {
+
+ #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 1))
+ // Fail variadic expansion for dev11
+ static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
+ #endif
+
+ }
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ T0);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ T0 arg0)
+ {
+ return functor_(
+ enqueueArgs,
+ arg0);
+ }
+
+
+};
+
+
+
+
+
+} // namespace detail
+
+//----------------------------------------------------------------------------------------------
+
+template <
+ typename T0, typename T1 = detail::NullType, typename T2 = detail::NullType,
+ typename T3 = detail::NullType, typename T4 = detail::NullType,
+ typename T5 = detail::NullType, typename T6 = detail::NullType,
+ typename T7 = detail::NullType, typename T8 = detail::NullType,
+ typename T9 = detail::NullType, typename T10 = detail::NullType,
+ typename T11 = detail::NullType, typename T12 = detail::NullType,
+ typename T13 = detail::NullType, typename T14 = detail::NullType,
+ typename T15 = detail::NullType, typename T16 = detail::NullType,
+ typename T17 = detail::NullType, typename T18 = detail::NullType,
+ typename T19 = detail::NullType, typename T20 = detail::NullType,
+ typename T21 = detail::NullType, typename T22 = detail::NullType,
+ typename T23 = detail::NullType, typename T24 = detail::NullType,
+ typename T25 = detail::NullType, typename T26 = detail::NullType,
+ typename T27 = detail::NullType, typename T28 = detail::NullType,
+ typename T29 = detail::NullType, typename T30 = detail::NullType,
+ typename T31 = detail::NullType
+>
+struct make_kernel :
+ public detail::functionImplementation_<
+ T0, T1, T2, T3,
+ T4, T5, T6, T7,
+ T8, T9, T10, T11,
+ T12, T13, T14, T15,
+ T16, T17, T18, T19,
+ T20, T21, T22, T23,
+ T24, T25, T26, T27,
+ T28, T29, T30, T31
+ >
+{
+public:
+ typedef detail::KernelFunctorGlobal<
+ T0, T1, T2, T3,
+ T4, T5, T6, T7,
+ T8, T9, T10, T11,
+ T12, T13, T14, T15,
+ T16, T17, T18, T19,
+ T20, T21, T22, T23,
+ T24, T25, T26, T27,
+ T28, T29, T30, T31
+ > FunctorType;
+
+ make_kernel(
+ const Program& program,
+ const STRING_CLASS name,
+ cl_int * err = NULL) :
+ detail::functionImplementation_<
+ T0, T1, T2, T3,
+ T4, T5, T6, T7,
+ T8, T9, T10, T11,
+ T12, T13, T14, T15,
+ T16, T17, T18, T19,
+ T20, T21, T22, T23,
+ T24, T25, T26, T27,
+ T28, T29, T30, T31
+ >(
+ FunctorType(program, name, err))
+ {}
+
+ make_kernel(
+ const Kernel kernel) :
+ detail::functionImplementation_<
+ T0, T1, T2, T3,
+ T4, T5, T6, T7,
+ T8, T9, T10, T11,
+ T12, T13, T14, T15,
+ T16, T17, T18, T19,
+ T20, T21, T22, T23,
+ T24, T25, T26, T27,
+ T28, T29, T30, T31
+ >(
+ FunctorType(kernel))
+ {}
+};
+
+
+//----------------------------------------------------------------------------------------------------------------------
+
+#undef __ERR_STR
+#if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
+#undef __GET_DEVICE_INFO_ERR
+#undef __GET_PLATFORM_INFO_ERR
+#undef __GET_DEVICE_IDS_ERR
+#undef __GET_CONTEXT_INFO_ERR
+#undef __GET_EVENT_INFO_ERR
+#undef __GET_EVENT_PROFILE_INFO_ERR
+#undef __GET_MEM_OBJECT_INFO_ERR
+#undef __GET_IMAGE_INFO_ERR
+#undef __GET_SAMPLER_INFO_ERR
+#undef __GET_KERNEL_INFO_ERR
+#undef __GET_KERNEL_ARG_INFO_ERR
+#undef __GET_KERNEL_WORK_GROUP_INFO_ERR
+#undef __GET_PROGRAM_INFO_ERR
+#undef __GET_PROGRAM_BUILD_INFO_ERR
+#undef __GET_COMMAND_QUEUE_INFO_ERR
+
+#undef __CREATE_CONTEXT_ERR
+#undef __CREATE_CONTEXT_FROM_TYPE_ERR
+#undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
+
+#undef __CREATE_BUFFER_ERR
+#undef __CREATE_SUBBUFFER_ERR
+#undef __CREATE_IMAGE2D_ERR
+#undef __CREATE_IMAGE3D_ERR
+#undef __CREATE_SAMPLER_ERR
+#undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
+
+#undef __CREATE_USER_EVENT_ERR
+#undef __SET_USER_EVENT_STATUS_ERR
+#undef __SET_EVENT_CALLBACK_ERR
+#undef __SET_PRINTF_CALLBACK_ERR
+
+#undef __WAIT_FOR_EVENTS_ERR
+
+#undef __CREATE_KERNEL_ERR
+#undef __SET_KERNEL_ARGS_ERR
+#undef __CREATE_PROGRAM_WITH_SOURCE_ERR
+#undef __CREATE_PROGRAM_WITH_BINARY_ERR
+#undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR
+#undef __BUILD_PROGRAM_ERR
+#undef __CREATE_KERNELS_IN_PROGRAM_ERR
+
+#undef __CREATE_COMMAND_QUEUE_ERR
+#undef __SET_COMMAND_QUEUE_PROPERTY_ERR
+#undef __ENQUEUE_READ_BUFFER_ERR
+#undef __ENQUEUE_WRITE_BUFFER_ERR
+#undef __ENQUEUE_READ_BUFFER_RECT_ERR
+#undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
+#undef __ENQEUE_COPY_BUFFER_ERR
+#undef __ENQEUE_COPY_BUFFER_RECT_ERR
+#undef __ENQUEUE_READ_IMAGE_ERR
+#undef __ENQUEUE_WRITE_IMAGE_ERR
+#undef __ENQUEUE_COPY_IMAGE_ERR
+#undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
+#undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
+#undef __ENQUEUE_MAP_BUFFER_ERR
+#undef __ENQUEUE_MAP_IMAGE_ERR
+#undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
+#undef __ENQUEUE_NDRANGE_KERNEL_ERR
+#undef __ENQUEUE_TASK_ERR
+#undef __ENQUEUE_NATIVE_KERNEL
+
+#undef __CL_EXPLICIT_CONSTRUCTORS
+
+#undef __UNLOAD_COMPILER_ERR
+#endif //__CL_USER_OVERRIDE_ERROR_STRINGS
+
+#undef __CL_FUNCTION_TYPE
+
+// Extensions
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_VERSION_1_1)
+#undef __INIT_CL_EXT_FCN_PTR
+#endif // #if defined(CL_VERSION_1_1)
+#undef __CREATE_SUB_DEVICES
+
+#if defined(USE_CL_DEVICE_FISSION)
+#undef __PARAM_NAME_DEVICE_FISSION
+#endif // USE_CL_DEVICE_FISSION
+
+#undef __DEFAULT_NOT_INITIALIZED
+#undef __DEFAULT_BEING_INITIALIZED
+#undef __DEFAULT_INITIALIZED
+
+#undef CL_HPP_RVALUE_REFERENCES_SUPPORTED
+#undef CL_HPP_NOEXCEPT
+
+} // namespace cl
+
+#endif // CL_HPP_
diff --git a/source/d/opencl-headers/cl2.hpp b/source/d/opencl-headers/cl2.hpp
new file mode 100644
index 000000000..0d6e805a0
--- /dev/null
+++ b/source/d/opencl-headers/cl2.hpp
@@ -0,0 +1,9570 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2016 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+ * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+ * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+ * https://www.khronos.org/registry/
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ ******************************************************************************/
+
+/*! \file
+ *
+ * \brief C++ bindings for OpenCL 1.0 (rev 48), OpenCL 1.1 (rev 33),
+ * OpenCL 1.2 (rev 15) and OpenCL 2.0 (rev 29)
+ * \author Lee Howes and Bruce Merry
+ *
+ * Derived from the OpenCL 1.x C++ bindings written by
+ * Benedict R. Gaster, Laurent Morichetti and Lee Howes
+ * With additions and fixes from:
+ * Brian Cole, March 3rd 2010 and April 2012
+ * Matt Gruenke, April 2012.
+ * Bruce Merry, February 2013.
+ * Tom Deakin and Simon McIntosh-Smith, July 2013
+ * James Price, 2015-
+ *
+ * \version 2.0.10
+ * \date 2016-07-20
+ *
+ * Optional extension support
+ *
+ * cl_ext_device_fission
+ * #define CL_HPP_USE_CL_DEVICE_FISSION
+ * cl_khr_d3d10_sharing
+ * #define CL_HPP_USE_DX_INTEROP
+ * cl_khr_sub_groups
+ * #define CL_HPP_USE_CL_SUB_GROUPS_KHR
+ *
+ * Doxygen documentation for this header is available here:
+ *
+ * http://khronosgroup.github.io/OpenCL-CLHPP/
+ *
+ * The latest version of this header can be found on the GitHub releases page:
+ *
+ * https://github.com/KhronosGroup/OpenCL-CLHPP/releases
+ *
+ * Bugs and patches can be submitted to the GitHub repository:
+ *
+ * https://github.com/KhronosGroup/OpenCL-CLHPP
+ */
+
+/*! \mainpage
+ * \section intro Introduction
+ * For many large applications C++ is the language of choice and so it seems
+ * reasonable to define C++ bindings for OpenCL.
+ *
+ * The interface is contained with a single C++ header file \em cl2.hpp and all
+ * definitions are contained within the namespace \em cl. There is no additional
+ * requirement to include \em cl.h and to use either the C++ or original C
+ * bindings; it is enough to simply include \em cl2.hpp.
+ *
+ * The bindings themselves are lightweight and correspond closely to the
+ * underlying C API. Using the C++ bindings introduces no additional execution
+ * overhead.
+ *
+ * There are numerous compatibility, portability and memory management
+ * fixes in the new header as well as additional OpenCL 2.0 features.
+ * As a result the header is not directly backward compatible and for this
+ * reason we release it as cl2.hpp rather than a new version of cl.hpp.
+ *
+ *
+ * \section compatibility Compatibility
+ * Due to the evolution of the underlying OpenCL API the 2.0 C++ bindings
+ * include an updated approach to defining supported feature versions
+ * and the range of valid underlying OpenCL runtime versions supported.
+ *
+ * The combination of preprocessor macros CL_HPP_TARGET_OPENCL_VERSION and
+ * CL_HPP_MINIMUM_OPENCL_VERSION control this range. These are three digit
+ * decimal values representing OpenCL runime versions. The default for
+ * the target is 200, representing OpenCL 2.0 and the minimum is also
+ * defined as 200. These settings would use 2.0 API calls only.
+ * If backward compatibility with a 1.2 runtime is required, the minimum
+ * version may be set to 120.
+ *
+ * Note that this is a compile-time setting, and so affects linking against
+ * a particular SDK version rather than the versioning of the loaded runtime.
+ *
+ * The earlier versions of the header included basic vector and string
+ * classes based loosely on STL versions. These were difficult to
+ * maintain and very rarely used. For the 2.0 header we now assume
+ * the presence of the standard library unless requested otherwise.
+ * We use std::array, std::vector, std::shared_ptr and std::string
+ * throughout to safely manage memory and reduce the chance of a
+ * recurrance of earlier memory management bugs.
+ *
+ * These classes are used through typedefs in the cl namespace:
+ * cl::array, cl::vector, cl::pointer and cl::string.
+ * In addition cl::allocate_pointer forwards to std::allocate_shared
+ * by default.
+ * In all cases these standard library classes can be replaced with
+ * custom interface-compatible versions using the CL_HPP_NO_STD_ARRAY,
+ * CL_HPP_NO_STD_VECTOR, CL_HPP_NO_STD_UNIQUE_PTR and
+ * CL_HPP_NO_STD_STRING macros.
+ *
+ * The OpenCL 1.x versions of the C++ bindings included a size_t wrapper
+ * class to interface with kernel enqueue. This caused unpleasant interactions
+ * with the standard size_t declaration and led to namespacing bugs.
+ * In the 2.0 version we have replaced this with a std::array-based interface.
+ * However, the old behaviour can be regained for backward compatibility
+ * using the CL_HPP_ENABLE_SIZE_T_COMPATIBILITY macro.
+ *
+ * Finally, the program construction interface used a clumsy vector-of-pairs
+ * design in the earlier versions. We have replaced that with a cleaner
+ * vector-of-vectors and vector-of-strings design. However, for backward
+ * compatibility old behaviour can be regained with the
+ * CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY macro.
+ *
+ * In OpenCL 2.0 OpenCL C is not entirely backward compatibility with
+ * earlier versions. As a result a flag must be passed to the OpenCL C
+ * compiled to request OpenCL 2.0 compilation of kernels with 1.2 as
+ * the default in the absence of the flag.
+ * In some cases the C++ bindings automatically compile code for ease.
+ * For those cases the compilation defaults to OpenCL C 2.0.
+ * If this is not wanted, the CL_HPP_CL_1_2_DEFAULT_BUILD macro may
+ * be specified to assume 1.2 compilation.
+ * If more fine-grained decisions on a per-kernel bases are required
+ * then explicit build operations that take the flag should be used.
+ *
+ *
+ * \section parameterization Parameters
+ * This header may be parameterized by a set of preprocessor macros.
+ *
+ * - CL_HPP_TARGET_OPENCL_VERSION
+ *
+ * Defines the target OpenCL runtime version to build the header
+ * against. Defaults to 200, representing OpenCL 2.0.
+ *
+ * - CL_HPP_NO_STD_STRING
+ *
+ * Do not use the standard library string class. cl::string is not
+ * defined and may be defined by the user before cl2.hpp is
+ * included.
+ *
+ * - CL_HPP_NO_STD_VECTOR
+ *
+ * Do not use the standard library vector class. cl::vector is not
+ * defined and may be defined by the user before cl2.hpp is
+ * included.
+ *
+ * - CL_HPP_NO_STD_ARRAY
+ *
+ * Do not use the standard library array class. cl::array is not
+ * defined and may be defined by the user before cl2.hpp is
+ * included.
+ *
+ * - CL_HPP_NO_STD_UNIQUE_PTR
+ *
+ * Do not use the standard library unique_ptr class. cl::pointer and
+ * the cl::allocate_pointer functions are not defined and may be
+ * defined by the user before cl2.hpp is included.
+ *
+ * - CL_HPP_ENABLE_DEVICE_FISSION
+ *
+ * Enables device fission for OpenCL 1.2 platforms.
+ *
+ * - CL_HPP_ENABLE_EXCEPTIONS
+ *
+ * Enable exceptions for use in the C++ bindings header. This is the
+ * preferred error handling mechanism but is not required.
+ *
+ * - CL_HPP_ENABLE_SIZE_T_COMPATIBILITY
+ *
+ * Backward compatibility option to support cl.hpp-style size_t
+ * class. Replaces the updated std::array derived version and
+ * removal of size_t from the namespace. Note that in this case the
+ * new size_t class is placed in the cl::compatibility namespace and
+ * thus requires an additional using declaration for direct backward
+ * compatibility.
+ *
+ * - CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY
+ *
+ * Enable older vector of pairs interface for construction of
+ * programs.
+ *
+ * - CL_HPP_CL_1_2_DEFAULT_BUILD
+ *
+ * Default to OpenCL C 1.2 compilation rather than OpenCL C 2.0
+ * applies to use of cl::Program construction and other program
+ * build variants.
+ *
+ *
+ * \section example Example
+ *
+ * The following example shows a general use case for the C++
+ * bindings, including support for the optional exception feature and
+ * also the supplied vector and string classes, see following sections for
+ * decriptions of these features.
+ *
+ * \code
+ #define CL_HPP_ENABLE_EXCEPTIONS
+ #define CL_HPP_TARGET_OPENCL_VERSION 200
+
+ #include <CL/cl2.hpp>
+ #include <iostream>
+ #include <vector>
+ #include <memory>
+ #include <algorithm>
+
+ const int numElements = 32;
+
+ int main(void)
+ {
+ // Filter for a 2.0 platform and set it as the default
+ std::vector<cl::Platform> platforms;
+ cl::Platform::get(&platforms);
+ cl::Platform plat;
+ for (auto &p : platforms) {
+ std::string platver = p.getInfo<CL_PLATFORM_VERSION>();
+ if (platver.find("OpenCL 2.") != std::string::npos) {
+ plat = p;
+ }
+ }
+ if (plat() == 0) {
+ std::cout << "No OpenCL 2.0 platform found.";
+ return -1;
+ }
+
+ cl::Platform newP = cl::Platform::setDefault(plat);
+ if (newP != plat) {
+ std::cout << "Error setting default platform.";
+ return -1;
+ }
+
+ // Use C++11 raw string literals for kernel source code
+ std::string kernel1{R"CLC(
+ global int globalA;
+ kernel void updateGlobal()
+ {
+ globalA = 75;
+ }
+ )CLC"};
+ std::string kernel2{R"CLC(
+ typedef struct { global int *bar; } Foo;
+ kernel void vectorAdd(global const Foo* aNum, global const int *inputA, global const int *inputB,
+ global int *output, int val, write_only pipe int outPipe, queue_t childQueue)
+ {
+ output[get_global_id(0)] = inputA[get_global_id(0)] + inputB[get_global_id(0)] + val + *(aNum->bar);
+ write_pipe(outPipe, &val);
+ queue_t default_queue = get_default_queue();
+ ndrange_t ndrange = ndrange_1D(get_global_size(0)/2, get_global_size(0)/2);
+
+ // Have a child kernel write into third quarter of output
+ enqueue_kernel(default_queue, CLK_ENQUEUE_FLAGS_WAIT_KERNEL, ndrange,
+ ^{
+ output[get_global_size(0)*2 + get_global_id(0)] =
+ inputA[get_global_size(0)*2 + get_global_id(0)] + inputB[get_global_size(0)*2 + get_global_id(0)] + globalA;
+ });
+
+ // Have a child kernel write into last quarter of output
+ enqueue_kernel(childQueue, CLK_ENQUEUE_FLAGS_WAIT_KERNEL, ndrange,
+ ^{
+ output[get_global_size(0)*3 + get_global_id(0)] =
+ inputA[get_global_size(0)*3 + get_global_id(0)] + inputB[get_global_size(0)*3 + get_global_id(0)] + globalA + 2;
+ });
+ }
+ )CLC"};
+
+ // New simpler string interface style
+ std::vector<std::string> programStrings {kernel1, kernel2};
+
+ cl::Program vectorAddProgram(programStrings);
+ try {
+ vectorAddProgram.build("-cl-std=CL2.0");
+ }
+ catch (...) {
+ // Print build info for all devices
+ cl_int buildErr = CL_SUCCESS;
+ auto buildInfo = vectorAddProgram.getBuildInfo<CL_PROGRAM_BUILD_LOG>(&buildErr);
+ for (auto &pair : buildInfo) {
+ std::cerr << pair.second << std::endl << std::endl;
+ }
+
+ return 1;
+ }
+
+ typedef struct { int *bar; } Foo;
+
+ // Get and run kernel that initializes the program-scope global
+ // A test for kernels that take no arguments
+ auto program2Kernel =
+ cl::KernelFunctor<>(vectorAddProgram, "updateGlobal");
+ program2Kernel(
+ cl::EnqueueArgs(
+ cl::NDRange(1)));
+
+ //////////////////
+ // SVM allocations
+
+ auto anSVMInt = cl::allocate_svm<int, cl::SVMTraitCoarse<>>();
+ *anSVMInt = 5;
+ cl::SVMAllocator<Foo, cl::SVMTraitCoarse<cl::SVMTraitReadOnly<>>> svmAllocReadOnly;
+ auto fooPointer = cl::allocate_pointer<Foo>(svmAllocReadOnly);
+ fooPointer->bar = anSVMInt.get();
+ cl::SVMAllocator<int, cl::SVMTraitCoarse<>> svmAlloc;
+ std::vector<int, cl::SVMAllocator<int, cl::SVMTraitCoarse<>>> inputA(numElements, 1, svmAlloc);
+ cl::coarse_svm_vector<int> inputB(numElements, 2, svmAlloc);
+
+ //
+ //////////////
+
+ // Traditional cl_mem allocations
+ std::vector<int> output(numElements, 0xdeadbeef);
+ cl::Buffer outputBuffer(begin(output), end(output), false);
+ cl::Pipe aPipe(sizeof(cl_int), numElements / 2);
+
+ // Default command queue, also passed in as a parameter
+ cl::DeviceCommandQueue defaultDeviceQueue = cl::DeviceCommandQueue::makeDefault(
+ cl::Context::getDefault(), cl::Device::getDefault());
+
+ auto vectorAddKernel =
+ cl::KernelFunctor<
+ decltype(fooPointer)&,
+ int*,
+ cl::coarse_svm_vector<int>&,
+ cl::Buffer,
+ int,
+ cl::Pipe&,
+ cl::DeviceCommandQueue
+ >(vectorAddProgram, "vectorAdd");
+
+ // Ensure that the additional SVM pointer is available to the kernel
+ // This one was not passed as a parameter
+ vectorAddKernel.setSVMPointers(anSVMInt);
+
+ // Hand control of coarse allocations to runtime
+ cl::enqueueUnmapSVM(anSVMInt);
+ cl::enqueueUnmapSVM(fooPointer);
+ cl::unmapSVM(inputB);
+ cl::unmapSVM(output2);
+
+ cl_int error;
+ vectorAddKernel(
+ cl::EnqueueArgs(
+ cl::NDRange(numElements/2),
+ cl::NDRange(numElements/2)),
+ fooPointer,
+ inputA.data(),
+ inputB,
+ outputBuffer,
+ 3,
+ aPipe,
+ defaultDeviceQueue,
+ error
+ );
+
+ cl::copy(outputBuffer, begin(output), end(output));
+ // Grab the SVM output vector using a map
+ cl::mapSVM(output2);
+
+ cl::Device d = cl::Device::getDefault();
+
+ std::cout << "Output:\n";
+ for (int i = 1; i < numElements; ++i) {
+ std::cout << "\t" << output[i] << "\n";
+ }
+ std::cout << "\n\n";
+
+ return 0;
+ }
+ *
+ * \endcode
+ *
+ */
+#ifndef CL_HPP_
+#define CL_HPP_
+
+/* Handle deprecated preprocessor definitions. In each case, we only check for
+ * the old name if the new name is not defined, so that user code can define
+ * both and hence work with either version of the bindings.
+ */
+#if !defined(CL_HPP_USE_DX_INTEROP) && defined(USE_DX_INTEROP)
+# pragma message("cl2.hpp: USE_DX_INTEROP is deprecated. Define CL_HPP_USE_DX_INTEROP instead")
+# define CL_HPP_USE_DX_INTEROP
+#endif
+#if !defined(CL_HPP_USE_CL_DEVICE_FISSION) && defined(USE_CL_DEVICE_FISSION)
+# pragma message("cl2.hpp: USE_CL_DEVICE_FISSION is deprecated. Define CL_HPP_USE_CL_DEVICE_FISSION instead")
+# define CL_HPP_USE_CL_DEVICE_FISSION
+#endif
+#if !defined(CL_HPP_ENABLE_EXCEPTIONS) && defined(__CL_ENABLE_EXCEPTIONS)
+# pragma message("cl2.hpp: __CL_ENABLE_EXCEPTIONS is deprecated. Define CL_HPP_ENABLE_EXCEPTIONS instead")
+# define CL_HPP_ENABLE_EXCEPTIONS
+#endif
+#if !defined(CL_HPP_NO_STD_VECTOR) && defined(__NO_STD_VECTOR)
+# pragma message("cl2.hpp: __NO_STD_VECTOR is deprecated. Define CL_HPP_NO_STD_VECTOR instead")
+# define CL_HPP_NO_STD_VECTOR
+#endif
+#if !defined(CL_HPP_NO_STD_STRING) && defined(__NO_STD_STRING)
+# pragma message("cl2.hpp: __NO_STD_STRING is deprecated. Define CL_HPP_NO_STD_STRING instead")
+# define CL_HPP_NO_STD_STRING
+#endif
+#if defined(VECTOR_CLASS)
+# pragma message("cl2.hpp: VECTOR_CLASS is deprecated. Alias cl::vector instead")
+#endif
+#if defined(STRING_CLASS)
+# pragma message("cl2.hpp: STRING_CLASS is deprecated. Alias cl::string instead.")
+#endif
+#if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS) && defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
+# pragma message("cl2.hpp: __CL_USER_OVERRIDE_ERROR_STRINGS is deprecated. Define CL_HPP_USER_OVERRIDE_ERROR_STRINGS instead")
+# define CL_HPP_USER_OVERRIDE_ERROR_STRINGS
+#endif
+
+/* Warn about features that are no longer supported
+ */
+#if defined(__USE_DEV_VECTOR)
+# pragma message("cl2.hpp: __USE_DEV_VECTOR is no longer supported. Expect compilation errors")
+#endif
+#if defined(__USE_DEV_STRING)
+# pragma message("cl2.hpp: __USE_DEV_STRING is no longer supported. Expect compilation errors")
+#endif
+
+/* Detect which version to target */
+#if !defined(CL_HPP_TARGET_OPENCL_VERSION)
+# pragma message("cl2.hpp: CL_HPP_TARGET_OPENCL_VERSION is not defined. It will default to 200 (OpenCL 2.0)")
+# define CL_HPP_TARGET_OPENCL_VERSION 200
+#endif
+#if CL_HPP_TARGET_OPENCL_VERSION != 100 && CL_HPP_TARGET_OPENCL_VERSION != 110 && CL_HPP_TARGET_OPENCL_VERSION != 120 && CL_HPP_TARGET_OPENCL_VERSION != 200
+# pragma message("cl2.hpp: CL_HPP_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120 or 200). It will be set to 200")
+# undef CL_HPP_TARGET_OPENCL_VERSION
+# define CL_HPP_TARGET_OPENCL_VERSION 200
+#endif
+
+#if !defined(CL_HPP_MINIMUM_OPENCL_VERSION)
+# define CL_HPP_MINIMUM_OPENCL_VERSION 200
+#endif
+#if CL_HPP_MINIMUM_OPENCL_VERSION != 100 && CL_HPP_MINIMUM_OPENCL_VERSION != 110 && CL_HPP_MINIMUM_OPENCL_VERSION != 120 && CL_HPP_MINIMUM_OPENCL_VERSION != 200
+# pragma message("cl2.hpp: CL_HPP_MINIMUM_OPENCL_VERSION is not a valid value (100, 110, 120 or 200). It will be set to 100")
+# undef CL_HPP_MINIMUM_OPENCL_VERSION
+# define CL_HPP_MINIMUM_OPENCL_VERSION 100
+#endif
+#if CL_HPP_MINIMUM_OPENCL_VERSION > CL_HPP_TARGET_OPENCL_VERSION
+# error "CL_HPP_MINIMUM_OPENCL_VERSION must not be greater than CL_HPP_TARGET_OPENCL_VERSION"
+#endif
+
+#if CL_HPP_MINIMUM_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS)
+# define CL_USE_DEPRECATED_OPENCL_1_0_APIS
+#endif
+#if CL_HPP_MINIMUM_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+# define CL_USE_DEPRECATED_OPENCL_1_1_APIS
+#endif
+#if CL_HPP_MINIMUM_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
+# define CL_USE_DEPRECATED_OPENCL_1_2_APIS
+#endif
+#if CL_HPP_MINIMUM_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS)
+# define CL_USE_DEPRECATED_OPENCL_2_0_APIS
+#endif
+
+#ifdef _WIN32
+
+#include <malloc.h>
+
+#if defined(CL_HPP_USE_DX_INTEROP)
+#include <CL/cl_d3d10.h>
+#include <CL/cl_dx9_media_sharing.h>
+#endif
+#endif // _WIN32
+
+#if defined(_MSC_VER)
+#include <intrin.h>
+#endif // _MSC_VER
+
+ // Check for a valid C++ version
+
+// Need to do both tests here because for some reason __cplusplus is not
+// updated in visual studio
+#if (!defined(_MSC_VER) && __cplusplus < 201103L) || (defined(_MSC_VER) && _MSC_VER < 1700)
+#error Visual studio 2013 or another C++11-supporting compiler required
+#endif
+
+//
+#if defined(CL_HPP_USE_CL_DEVICE_FISSION) || defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)
+#include <CL/cl_ext.h>
+#endif
+
+#if defined(__APPLE__) || defined(__MACOSX)
+#include <OpenCL/opencl.h>
+#else
+#include <CL/opencl.h>
+#endif // !__APPLE__
+
+#if (__cplusplus >= 201103L)
+#define CL_HPP_NOEXCEPT_ noexcept
+#else
+#define CL_HPP_NOEXCEPT_
+#endif
+
+#if defined(_MSC_VER)
+# define CL_HPP_DEFINE_STATIC_MEMBER_ __declspec(selectany)
+#else
+# define CL_HPP_DEFINE_STATIC_MEMBER_ __attribute__((weak))
+#endif // !_MSC_VER
+
+// Define deprecated prefixes and suffixes to ensure compilation
+// in case they are not pre-defined
+#if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
+#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+#endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
+#if !defined(CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED)
+#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+#endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
+
+#if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
+#define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
+#endif // #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
+#if !defined(CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED)
+#define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
+#endif // #if !defined(CL_EXT_PREFIX__VERSION_1_2_DEPRECATED)
+
+#if !defined(CL_CALLBACK)
+#define CL_CALLBACK
+#endif //CL_CALLBACK
+
+#include <utility>
+#include <limits>
+#include <iterator>
+#include <mutex>
+#include <cstring>
+#include <functional>
+
+
+// Define a size_type to represent a correctly resolved size_t
+#if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
+namespace cl {
+ using size_type = ::size_t;
+} // namespace cl
+#else // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
+namespace cl {
+ using size_type = size_t;
+} // namespace cl
+#endif // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
+
+
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+#include <exception>
+#endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
+
+#if !defined(CL_HPP_NO_STD_VECTOR)
+#include <vector>
+namespace cl {
+ template < class T, class Alloc = std::allocator<T> >
+ using vector = std::vector<T, Alloc>;
+} // namespace cl
+#endif // #if !defined(CL_HPP_NO_STD_VECTOR)
+
+#if !defined(CL_HPP_NO_STD_STRING)
+#include <string>
+namespace cl {
+ using string = std::string;
+} // namespace cl
+#endif // #if !defined(CL_HPP_NO_STD_STRING)
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+#if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
+#include <memory>
+namespace cl {
+ // Replace unique_ptr and allocate_pointer for internal use
+ // to allow user to replace them
+ template<class T, class D>
+ using pointer = std::unique_ptr<T, D>;
+} // namespace cl
+#endif
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if !defined(CL_HPP_NO_STD_ARRAY)
+#include <array>
+namespace cl {
+ template < class T, size_type N >
+ using array = std::array<T, N>;
+} // namespace cl
+#endif // #if !defined(CL_HPP_NO_STD_ARRAY)
+
+// Define size_type appropriately to allow backward-compatibility
+// use of the old size_t interface class
+#if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
+namespace cl {
+ namespace compatibility {
+ /*! \brief class used to interface between C++ and
+ * OpenCL C calls that require arrays of size_t values, whose
+ * size is known statically.
+ */
+ template <int N>
+ class size_t
+ {
+ private:
+ size_type data_[N];
+
+ public:
+ //! \brief Initialize size_t to all 0s
+ size_t()
+ {
+ for (int i = 0; i < N; ++i) {
+ data_[i] = 0;
+ }
+ }
+
+ size_t(const array<size_type, N> &rhs)
+ {
+ for (int i = 0; i < N; ++i) {
+ data_[i] = rhs[i];
+ }
+ }
+
+ size_type& operator[](int index)
+ {
+ return data_[index];
+ }
+
+ const size_type& operator[](int index) const
+ {
+ return data_[index];
+ }
+
+ //! \brief Conversion operator to T*.
+ operator size_type* () { return data_; }
+
+ //! \brief Conversion operator to const T*.
+ operator const size_type* () const { return data_; }
+
+ operator array<size_type, N>() const
+ {
+ array<size_type, N> ret;
+
+ for (int i = 0; i < N; ++i) {
+ ret[i] = data_[i];
+ }
+ return ret;
+ }
+ };
+ } // namespace compatibility
+
+ template<int N>
+ using size_t = compatibility::size_t<N>;
+} // namespace cl
+#endif // #if defined(CL_HPP_ENABLE_SIZE_T_COMPATIBILITY)
+
+// Helper alias to avoid confusing the macros
+namespace cl {
+ namespace detail {
+ using size_t_array = array<size_type, 3>;
+ } // namespace detail
+} // namespace cl
+
+
+/*! \namespace cl
+ *
+ * \brief The OpenCL C++ bindings are defined within this namespace.
+ *
+ */
+namespace cl {
+ class Memory;
+
+#define CL_HPP_INIT_CL_EXT_FCN_PTR_(name) \
+ if (!pfn_##name) { \
+ pfn_##name = (PFN_##name) \
+ clGetExtensionFunctionAddress(#name); \
+ if (!pfn_##name) { \
+ } \
+ }
+
+#define CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, name) \
+ if (!pfn_##name) { \
+ pfn_##name = (PFN_##name) \
+ clGetExtensionFunctionAddressForPlatform(platform, #name); \
+ if (!pfn_##name) { \
+ } \
+ }
+
+ class Program;
+ class Device;
+ class Context;
+ class CommandQueue;
+ class DeviceCommandQueue;
+ class Memory;
+ class Buffer;
+ class Pipe;
+
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ /*! \brief Exception class
+ *
+ * This may be thrown by API functions when CL_HPP_ENABLE_EXCEPTIONS is defined.
+ */
+ class Error : public std::exception
+ {
+ private:
+ cl_int err_;
+ const char * errStr_;
+ public:
+ /*! \brief Create a new CL error exception for a given error code
+ * and corresponding message.
+ *
+ * \param err error code value.
+ *
+ * \param errStr a descriptive string that must remain in scope until
+ * handling of the exception has concluded. If set, it
+ * will be returned by what().
+ */
+ Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr)
+ {}
+
+ ~Error() throw() {}
+
+ /*! \brief Get error string associated with exception
+ *
+ * \return A memory pointer to the error message string.
+ */
+ virtual const char * what() const throw ()
+ {
+ if (errStr_ == NULL) {
+ return "empty";
+ }
+ else {
+ return errStr_;
+ }
+ }
+
+ /*! \brief Get error code associated with exception
+ *
+ * \return The error code.
+ */
+ cl_int err(void) const { return err_; }
+ };
+#define CL_HPP_ERR_STR_(x) #x
+#else
+#define CL_HPP_ERR_STR_(x) NULL
+#endif // CL_HPP_ENABLE_EXCEPTIONS
+
+
+namespace detail
+{
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+static inline cl_int errHandler (
+ cl_int err,
+ const char * errStr = NULL)
+{
+ if (err != CL_SUCCESS) {
+ throw Error(err, errStr);
+ }
+ return err;
+}
+#else
+static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
+{
+ (void) errStr; // suppress unused variable warning
+ return err;
+}
+#endif // CL_HPP_ENABLE_EXCEPTIONS
+}
+
+
+
+//! \cond DOXYGEN_DETAIL
+#if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS)
+#define __GET_DEVICE_INFO_ERR CL_HPP_ERR_STR_(clGetDeviceInfo)
+#define __GET_PLATFORM_INFO_ERR CL_HPP_ERR_STR_(clGetPlatformInfo)
+#define __GET_DEVICE_IDS_ERR CL_HPP_ERR_STR_(clGetDeviceIDs)
+#define __GET_PLATFORM_IDS_ERR CL_HPP_ERR_STR_(clGetPlatformIDs)
+#define __GET_CONTEXT_INFO_ERR CL_HPP_ERR_STR_(clGetContextInfo)
+#define __GET_EVENT_INFO_ERR CL_HPP_ERR_STR_(clGetEventInfo)
+#define __GET_EVENT_PROFILE_INFO_ERR CL_HPP_ERR_STR_(clGetEventProfileInfo)
+#define __GET_MEM_OBJECT_INFO_ERR CL_HPP_ERR_STR_(clGetMemObjectInfo)
+#define __GET_IMAGE_INFO_ERR CL_HPP_ERR_STR_(clGetImageInfo)
+#define __GET_SAMPLER_INFO_ERR CL_HPP_ERR_STR_(clGetSamplerInfo)
+#define __GET_KERNEL_INFO_ERR CL_HPP_ERR_STR_(clGetKernelInfo)
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __GET_KERNEL_ARG_INFO_ERR CL_HPP_ERR_STR_(clGetKernelArgInfo)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __GET_KERNEL_WORK_GROUP_INFO_ERR CL_HPP_ERR_STR_(clGetKernelWorkGroupInfo)
+#define __GET_PROGRAM_INFO_ERR CL_HPP_ERR_STR_(clGetProgramInfo)
+#define __GET_PROGRAM_BUILD_INFO_ERR CL_HPP_ERR_STR_(clGetProgramBuildInfo)
+#define __GET_COMMAND_QUEUE_INFO_ERR CL_HPP_ERR_STR_(clGetCommandQueueInfo)
+
+#define __CREATE_CONTEXT_ERR CL_HPP_ERR_STR_(clCreateContext)
+#define __CREATE_CONTEXT_FROM_TYPE_ERR CL_HPP_ERR_STR_(clCreateContextFromType)
+#define __GET_SUPPORTED_IMAGE_FORMATS_ERR CL_HPP_ERR_STR_(clGetSupportedImageFormats)
+
+#define __CREATE_BUFFER_ERR CL_HPP_ERR_STR_(clCreateBuffer)
+#define __COPY_ERR CL_HPP_ERR_STR_(cl::copy)
+#define __CREATE_SUBBUFFER_ERR CL_HPP_ERR_STR_(clCreateSubBuffer)
+#define __CREATE_GL_BUFFER_ERR CL_HPP_ERR_STR_(clCreateFromGLBuffer)
+#define __CREATE_GL_RENDER_BUFFER_ERR CL_HPP_ERR_STR_(clCreateFromGLBuffer)
+#define __GET_GL_OBJECT_INFO_ERR CL_HPP_ERR_STR_(clGetGLObjectInfo)
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __CREATE_IMAGE_ERR CL_HPP_ERR_STR_(clCreateImage)
+#define __CREATE_GL_TEXTURE_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture)
+#define __IMAGE_DIMENSION_ERR CL_HPP_ERR_STR_(Incorrect image dimensions)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR CL_HPP_ERR_STR_(clSetMemObjectDestructorCallback)
+
+#define __CREATE_USER_EVENT_ERR CL_HPP_ERR_STR_(clCreateUserEvent)
+#define __SET_USER_EVENT_STATUS_ERR CL_HPP_ERR_STR_(clSetUserEventStatus)
+#define __SET_EVENT_CALLBACK_ERR CL_HPP_ERR_STR_(clSetEventCallback)
+#define __WAIT_FOR_EVENTS_ERR CL_HPP_ERR_STR_(clWaitForEvents)
+
+#define __CREATE_KERNEL_ERR CL_HPP_ERR_STR_(clCreateKernel)
+#define __SET_KERNEL_ARGS_ERR CL_HPP_ERR_STR_(clSetKernelArg)
+#define __CREATE_PROGRAM_WITH_SOURCE_ERR CL_HPP_ERR_STR_(clCreateProgramWithSource)
+#define __CREATE_PROGRAM_WITH_BINARY_ERR CL_HPP_ERR_STR_(clCreateProgramWithBinary)
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR CL_HPP_ERR_STR_(clCreateProgramWithBuiltInKernels)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __BUILD_PROGRAM_ERR CL_HPP_ERR_STR_(clBuildProgram)
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __COMPILE_PROGRAM_ERR CL_HPP_ERR_STR_(clCompileProgram)
+#define __LINK_PROGRAM_ERR CL_HPP_ERR_STR_(clLinkProgram)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __CREATE_KERNELS_IN_PROGRAM_ERR CL_HPP_ERR_STR_(clCreateKernelsInProgram)
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+#define __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR CL_HPP_ERR_STR_(clCreateCommandQueueWithProperties)
+#define __CREATE_SAMPLER_WITH_PROPERTIES_ERR CL_HPP_ERR_STR_(clCreateSamplerWithProperties)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+#define __SET_COMMAND_QUEUE_PROPERTY_ERR CL_HPP_ERR_STR_(clSetCommandQueueProperty)
+#define __ENQUEUE_READ_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueReadBuffer)
+#define __ENQUEUE_READ_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueReadBufferRect)
+#define __ENQUEUE_WRITE_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueWriteBuffer)
+#define __ENQUEUE_WRITE_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueWriteBufferRect)
+#define __ENQEUE_COPY_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueCopyBuffer)
+#define __ENQEUE_COPY_BUFFER_RECT_ERR CL_HPP_ERR_STR_(clEnqueueCopyBufferRect)
+#define __ENQUEUE_FILL_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueFillBuffer)
+#define __ENQUEUE_READ_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueReadImage)
+#define __ENQUEUE_WRITE_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueWriteImage)
+#define __ENQUEUE_COPY_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueCopyImage)
+#define __ENQUEUE_FILL_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueFillImage)
+#define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueCopyImageToBuffer)
+#define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueCopyBufferToImage)
+#define __ENQUEUE_MAP_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueMapBuffer)
+#define __ENQUEUE_MAP_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueMapImage)
+#define __ENQUEUE_UNMAP_MEM_OBJECT_ERR CL_HPP_ERR_STR_(clEnqueueUnMapMemObject)
+#define __ENQUEUE_NDRANGE_KERNEL_ERR CL_HPP_ERR_STR_(clEnqueueNDRangeKernel)
+#define __ENQUEUE_NATIVE_KERNEL CL_HPP_ERR_STR_(clEnqueueNativeKernel)
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR CL_HPP_ERR_STR_(clEnqueueMigrateMemObjects)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+#define __ENQUEUE_ACQUIRE_GL_ERR CL_HPP_ERR_STR_(clEnqueueAcquireGLObjects)
+#define __ENQUEUE_RELEASE_GL_ERR CL_HPP_ERR_STR_(clEnqueueReleaseGLObjects)
+
+#define __CREATE_PIPE_ERR CL_HPP_ERR_STR_(clCreatePipe)
+#define __GET_PIPE_INFO_ERR CL_HPP_ERR_STR_(clGetPipeInfo)
+
+
+#define __RETAIN_ERR CL_HPP_ERR_STR_(Retain Object)
+#define __RELEASE_ERR CL_HPP_ERR_STR_(Release Object)
+#define __FLUSH_ERR CL_HPP_ERR_STR_(clFlush)
+#define __FINISH_ERR CL_HPP_ERR_STR_(clFinish)
+#define __VECTOR_CAPACITY_ERR CL_HPP_ERR_STR_(Vector capacity error)
+
+/**
+ * CL 1.2 version that uses device fission.
+ */
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __CREATE_SUB_DEVICES_ERR CL_HPP_ERR_STR_(clCreateSubDevices)
+#else
+#define __CREATE_SUB_DEVICES_ERR CL_HPP_ERR_STR_(clCreateSubDevicesEXT)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+#define __ENQUEUE_MARKER_ERR CL_HPP_ERR_STR_(clEnqueueMarker)
+#define __ENQUEUE_WAIT_FOR_EVENTS_ERR CL_HPP_ERR_STR_(clEnqueueWaitForEvents)
+#define __ENQUEUE_BARRIER_ERR CL_HPP_ERR_STR_(clEnqueueBarrier)
+#define __UNLOAD_COMPILER_ERR CL_HPP_ERR_STR_(clUnloadCompiler)
+#define __CREATE_GL_TEXTURE_2D_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture2D)
+#define __CREATE_GL_TEXTURE_3D_ERR CL_HPP_ERR_STR_(clCreateFromGLTexture3D)
+#define __CREATE_IMAGE2D_ERR CL_HPP_ERR_STR_(clCreateImage2D)
+#define __CREATE_IMAGE3D_ERR CL_HPP_ERR_STR_(clCreateImage3D)
+#endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+
+/**
+ * Deprecated APIs for 2.0
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
+#define __CREATE_COMMAND_QUEUE_ERR CL_HPP_ERR_STR_(clCreateCommandQueue)
+#define __ENQUEUE_TASK_ERR CL_HPP_ERR_STR_(clEnqueueTask)
+#define __CREATE_SAMPLER_ERR CL_HPP_ERR_STR_(clCreateSampler)
+#endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+
+/**
+ * CL 1.2 marker and barrier commands
+ */
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#define __ENQUEUE_MARKER_WAIT_LIST_ERR CL_HPP_ERR_STR_(clEnqueueMarkerWithWaitList)
+#define __ENQUEUE_BARRIER_WAIT_LIST_ERR CL_HPP_ERR_STR_(clEnqueueBarrierWithWaitList)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+#endif // CL_HPP_USER_OVERRIDE_ERROR_STRINGS
+//! \endcond
+
+
+namespace detail {
+
+// Generic getInfoHelper. The final parameter is used to guide overload
+// resolution: the actual parameter passed is an int, which makes this
+// a worse conversion sequence than a specialization that declares the
+// parameter as an int.
+template<typename Functor, typename T>
+inline cl_int getInfoHelper(Functor f, cl_uint name, T* param, long)
+{
+ return f(name, sizeof(T), param, NULL);
+}
+
+// Specialized for getInfo<CL_PROGRAM_BINARIES>
+// Assumes that the output vector was correctly resized on the way in
+template <typename Func>
+inline cl_int getInfoHelper(Func f, cl_uint name, vector<vector<unsigned char>>* param, int)
+{
+ if (name != CL_PROGRAM_BINARIES) {
+ return CL_INVALID_VALUE;
+ }
+ if (param) {
+ // Create array of pointers, calculate total size and pass pointer array in
+ size_type numBinaries = param->size();
+ vector<unsigned char*> binariesPointers(numBinaries);
+
+ for (size_type i = 0; i < numBinaries; ++i)
+ {
+ binariesPointers[i] = (*param)[i].data();
+ }
+
+ cl_int err = f(name, numBinaries * sizeof(unsigned char*), binariesPointers.data(), NULL);
+
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ }
+
+
+ return CL_SUCCESS;
+}
+
+// Specialized getInfoHelper for vector params
+template <typename Func, typename T>
+inline cl_int getInfoHelper(Func f, cl_uint name, vector<T>* param, long)
+{
+ size_type required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ const size_type elements = required / sizeof(T);
+
+ // Temporary to avoid changing param on an error
+ vector<T> localData(elements);
+ err = f(name, required, localData.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ if (param) {
+ *param = std::move(localData);
+ }
+
+ return CL_SUCCESS;
+}
+
+/* Specialization for reference-counted types. This depends on the
+ * existence of Wrapper<T>::cl_type, and none of the other types having the
+ * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
+ * does not work, because when using a derived type (e.g. Context) the generic
+ * template will provide a better match.
+ */
+template <typename Func, typename T>
+inline cl_int getInfoHelper(
+ Func f, cl_uint name, vector<T>* param, int, typename T::cl_type = 0)
+{
+ size_type required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ const size_type elements = required / sizeof(typename T::cl_type);
+
+ vector<typename T::cl_type> value(elements);
+ err = f(name, required, value.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ if (param) {
+ // Assign to convert CL type to T for each element
+ param->resize(elements);
+
+ // Assign to param, constructing with retain behaviour
+ // to correctly capture each underlying CL object
+ for (size_type i = 0; i < elements; i++) {
+ (*param)[i] = T(value[i], true);
+ }
+ }
+ return CL_SUCCESS;
+}
+
+// Specialized GetInfoHelper for string params
+template <typename Func>
+inline cl_int getInfoHelper(Func f, cl_uint name, string* param, long)
+{
+ size_type required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ // std::string has a constant data member
+ // a char vector does not
+ if (required > 0) {
+ vector<char> value(required);
+ err = f(name, required, value.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ if (param) {
+ param->assign(begin(value), prev(end(value)));
+ }
+ }
+ else if (param) {
+ param->assign("");
+ }
+ return CL_SUCCESS;
+}
+
+// Specialized GetInfoHelper for clsize_t params
+template <typename Func, size_type N>
+inline cl_int getInfoHelper(Func f, cl_uint name, array<size_type, N>* param, long)
+{
+ size_type required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ size_type elements = required / sizeof(size_type);
+ vector<size_type> value(elements, 0);
+
+ err = f(name, required, value.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ // Bound the copy with N to prevent overruns
+ // if passed N > than the amount copied
+ if (elements > N) {
+ elements = N;
+ }
+ for (size_type i = 0; i < elements; ++i) {
+ (*param)[i] = value[i];
+ }
+
+ return CL_SUCCESS;
+}
+
+template<typename T> struct ReferenceHandler;
+
+/* Specialization for reference-counted types. This depends on the
+ * existence of Wrapper<T>::cl_type, and none of the other types having the
+ * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
+ * does not work, because when using a derived type (e.g. Context) the generic
+ * template will provide a better match.
+ */
+template<typename Func, typename T>
+inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_type = 0)
+{
+ typename T::cl_type value;
+ cl_int err = f(name, sizeof(value), &value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ *param = value;
+ if (value != NULL)
+ {
+ err = param->retain();
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+ }
+ return CL_SUCCESS;
+}
+
+#define CL_HPP_PARAM_NAME_INFO_1_0_(F) \
+ F(cl_platform_info, CL_PLATFORM_PROFILE, string) \
+ F(cl_platform_info, CL_PLATFORM_VERSION, string) \
+ F(cl_platform_info, CL_PLATFORM_NAME, string) \
+ F(cl_platform_info, CL_PLATFORM_VENDOR, string) \
+ F(cl_platform_info, CL_PLATFORM_EXTENSIONS, string) \
+ \
+ F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
+ F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, size_type) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, cl::vector<size_type>) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
+ F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, size_type) \
+ F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, size_type) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, size_type) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, size_type) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, size_type) \
+ F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
+ F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, size_type) \
+ F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
+ F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
+ F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, size_type) \
+ F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
+ F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
+ F(cl_device_info, CL_DEVICE_NAME, string) \
+ F(cl_device_info, CL_DEVICE_VENDOR, string) \
+ F(cl_device_info, CL_DRIVER_VERSION, string) \
+ F(cl_device_info, CL_DEVICE_PROFILE, string) \
+ F(cl_device_info, CL_DEVICE_VERSION, string) \
+ F(cl_device_info, CL_DEVICE_EXTENSIONS, string) \
+ \
+ F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
+ F(cl_context_info, CL_CONTEXT_DEVICES, cl::vector<Device>) \
+ F(cl_context_info, CL_CONTEXT_PROPERTIES, cl::vector<cl_context_properties>) \
+ \
+ F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
+ F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
+ F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
+ F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_int) \
+ \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
+ \
+ F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
+ F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
+ F(cl_mem_info, CL_MEM_SIZE, size_type) \
+ F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
+ F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
+ F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
+ F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
+ \
+ F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
+ F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, size_type) \
+ F(cl_image_info, CL_IMAGE_ROW_PITCH, size_type) \
+ F(cl_image_info, CL_IMAGE_SLICE_PITCH, size_type) \
+ F(cl_image_info, CL_IMAGE_WIDTH, size_type) \
+ F(cl_image_info, CL_IMAGE_HEIGHT, size_type) \
+ F(cl_image_info, CL_IMAGE_DEPTH, size_type) \
+ \
+ F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
+ F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
+ F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_bool) \
+ F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_addressing_mode) \
+ F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_filter_mode) \
+ \
+ F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
+ F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
+ F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
+ F(cl_program_info, CL_PROGRAM_DEVICES, cl::vector<Device>) \
+ F(cl_program_info, CL_PROGRAM_SOURCE, string) \
+ F(cl_program_info, CL_PROGRAM_BINARY_SIZES, cl::vector<size_type>) \
+ F(cl_program_info, CL_PROGRAM_BINARIES, cl::vector<cl::vector<unsigned char>>) \
+ \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, string) \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, string) \
+ \
+ F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, string) \
+ F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
+ F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
+ F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
+ F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
+ \
+ F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, size_type) \
+ F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::detail::size_t_array) \
+ F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
+ \
+ F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
+ F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
+ F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
+ F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
+
+
+#define CL_HPP_PARAM_NAME_INFO_1_1_(F) \
+ F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
+ F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, string) \
+ \
+ F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
+ F(cl_mem_info, CL_MEM_OFFSET, size_type) \
+ \
+ F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, size_type) \
+ F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
+ \
+ F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
+
+#define CL_HPP_PARAM_NAME_INFO_1_2_(F) \
+ F(cl_program_info, CL_PROGRAM_NUM_KERNELS, size_type) \
+ F(cl_program_info, CL_PROGRAM_KERNEL_NAMES, string) \
+ \
+ F(cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type) \
+ \
+ F(cl_kernel_info, CL_KERNEL_ATTRIBUTES, string) \
+ \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, string) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_NAME, string) \
+ F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier) \
+ \
+ F(cl_device_info, CL_DEVICE_PARENT_DEVICE, cl::Device) \
+ F(cl_device_info, CL_DEVICE_PARTITION_PROPERTIES, cl::vector<cl_device_partition_property>) \
+ F(cl_device_info, CL_DEVICE_PARTITION_TYPE, cl::vector<cl_device_partition_property>) \
+ F(cl_device_info, CL_DEVICE_REFERENCE_COUNT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, size_type) \
+ F(cl_device_info, CL_DEVICE_PARTITION_AFFINITY_DOMAIN, cl_device_affinity_domain) \
+ F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS, string) \
+ \
+ F(cl_image_info, CL_IMAGE_ARRAY_SIZE, size_type) \
+ F(cl_image_info, CL_IMAGE_NUM_MIP_LEVELS, cl_uint) \
+ F(cl_image_info, CL_IMAGE_NUM_SAMPLES, cl_uint)
+
+#define CL_HPP_PARAM_NAME_INFO_2_0_(F) \
+ F(cl_device_info, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, cl_command_queue_properties) \
+ F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, cl_command_queue_properties) \
+ F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_ON_DEVICE_QUEUES, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_ON_DEVICE_EVENTS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_PIPE_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PIPE_MAX_PACKET_SIZE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_SVM_CAPABILITIES, cl_device_svm_capabilities) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT, cl_uint) \
+ F(cl_command_queue_info, CL_QUEUE_SIZE, cl_uint) \
+ F(cl_mem_info, CL_MEM_USES_SVM_POINTER, cl_bool) \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE, size_type) \
+ F(cl_pipe_info, CL_PIPE_PACKET_SIZE, cl_uint) \
+ F(cl_pipe_info, CL_PIPE_MAX_PACKETS, cl_uint)
+
+#define CL_HPP_PARAM_NAME_DEVICE_FISSION_(F) \
+ F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
+ F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, cl::vector<cl_device_partition_property_ext>) \
+ F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, cl::vector<cl_device_partition_property_ext>) \
+ F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
+ F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, cl::vector<cl_device_partition_property_ext>)
+
+template <typename enum_type, cl_int Name>
+struct param_traits {};
+
+#define CL_HPP_DECLARE_PARAM_TRAITS_(token, param_name, T) \
+struct token; \
+template<> \
+struct param_traits<detail:: token,param_name> \
+{ \
+ enum { value = param_name }; \
+ typedef T param_type; \
+};
+
+CL_HPP_PARAM_NAME_INFO_1_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+CL_HPP_PARAM_NAME_INFO_1_1_(CL_HPP_DECLARE_PARAM_TRAITS_)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+CL_HPP_PARAM_NAME_INFO_1_2_(CL_HPP_DECLARE_PARAM_TRAITS_)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+CL_HPP_PARAM_NAME_INFO_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+
+
+// Flags deprecated in OpenCL 2.0
+#define CL_HPP_PARAM_NAME_INFO_1_0_DEPRECATED_IN_2_0_(F) \
+ F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties)
+
+#define CL_HPP_PARAM_NAME_INFO_1_1_DEPRECATED_IN_2_0_(F) \
+ F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool)
+
+#define CL_HPP_PARAM_NAME_INFO_1_2_DEPRECATED_IN_2_0_(F) \
+ F(cl_image_info, CL_IMAGE_BUFFER, cl::Buffer)
+
+// Include deprecated query flags based on versions
+// Only include deprecated 1.0 flags if 2.0 not active as there is an enum clash
+#if CL_HPP_TARGET_OPENCL_VERSION > 100 && CL_HPP_MINIMUM_OPENCL_VERSION < 200 && CL_HPP_TARGET_OPENCL_VERSION < 200
+CL_HPP_PARAM_NAME_INFO_1_0_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 110
+#if CL_HPP_TARGET_OPENCL_VERSION > 110 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+CL_HPP_PARAM_NAME_INFO_1_1_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
+#if CL_HPP_TARGET_OPENCL_VERSION > 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+CL_HPP_PARAM_NAME_INFO_1_2_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_)
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
+
+#if defined(CL_HPP_USE_CL_DEVICE_FISSION)
+CL_HPP_PARAM_NAME_DEVICE_FISSION_(CL_HPP_DECLARE_PARAM_TRAITS_);
+#endif // CL_HPP_USE_CL_DEVICE_FISSION
+
+#ifdef CL_PLATFORM_ICD_SUFFIX_KHR
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_platform_info, CL_PLATFORM_ICD_SUFFIX_KHR, string)
+#endif
+
+#ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_PROFILING_TIMER_OFFSET_AMD, cl_ulong)
+#endif
+
+#ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_FREE_MEMORY_AMD, vector<size_type>)
+#endif
+#ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_SIMD_WIDTH_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SIMD_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_WAVEFRONT_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD, cl_uint)
+#endif
+#ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_LOCAL_MEM_BANKS_AMD, cl_uint)
+#endif
+
+#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_REGISTERS_PER_BLOCK_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_WARP_SIZE_NV
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_WARP_SIZE_NV, cl_uint)
+#endif
+#ifdef CL_DEVICE_GPU_OVERLAP_NV
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_GPU_OVERLAP_NV, cl_bool)
+#endif
+#ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, cl_bool)
+#endif
+#ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
+CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_INTEGRATED_MEMORY_NV, cl_bool)
+#endif
+
+// Convenience functions
+
+template <typename Func, typename T>
+inline cl_int
+getInfo(Func f, cl_uint name, T* param)
+{
+ return getInfoHelper(f, name, param, 0);
+}
+
+template <typename Func, typename Arg0>
+struct GetInfoFunctor0
+{
+ Func f_; const Arg0& arg0_;
+ cl_int operator ()(
+ cl_uint param, size_type size, void* value, size_type* size_ret)
+ { return f_(arg0_, param, size, value, size_ret); }
+};
+
+template <typename Func, typename Arg0, typename Arg1>
+struct GetInfoFunctor1
+{
+ Func f_; const Arg0& arg0_; const Arg1& arg1_;
+ cl_int operator ()(
+ cl_uint param, size_type size, void* value, size_type* size_ret)
+ { return f_(arg0_, arg1_, param, size, value, size_ret); }
+};
+
+template <typename Func, typename Arg0, typename T>
+inline cl_int
+getInfo(Func f, const Arg0& arg0, cl_uint name, T* param)
+{
+ GetInfoFunctor0<Func, Arg0> f0 = { f, arg0 };
+ return getInfoHelper(f0, name, param, 0);
+}
+
+template <typename Func, typename Arg0, typename Arg1, typename T>
+inline cl_int
+getInfo(Func f, const Arg0& arg0, const Arg1& arg1, cl_uint name, T* param)
+{
+ GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
+ return getInfoHelper(f0, name, param, 0);
+}
+
+
+template<typename T>
+struct ReferenceHandler
+{ };
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+/**
+ * OpenCL 1.2 devices do have retain/release.
+ */
+template <>
+struct ReferenceHandler<cl_device_id>
+{
+ /**
+ * Retain the device.
+ * \param device A valid device created using createSubDevices
+ * \return
+ * CL_SUCCESS if the function executed successfully.
+ * CL_INVALID_DEVICE if device was not a valid subdevice
+ * CL_OUT_OF_RESOURCES
+ * CL_OUT_OF_HOST_MEMORY
+ */
+ static cl_int retain(cl_device_id device)
+ { return ::clRetainDevice(device); }
+ /**
+ * Retain the device.
+ * \param device A valid device created using createSubDevices
+ * \return
+ * CL_SUCCESS if the function executed successfully.
+ * CL_INVALID_DEVICE if device was not a valid subdevice
+ * CL_OUT_OF_RESOURCES
+ * CL_OUT_OF_HOST_MEMORY
+ */
+ static cl_int release(cl_device_id device)
+ { return ::clReleaseDevice(device); }
+};
+#else // CL_HPP_TARGET_OPENCL_VERSION >= 120
+/**
+ * OpenCL 1.1 devices do not have retain/release.
+ */
+template <>
+struct ReferenceHandler<cl_device_id>
+{
+ // cl_device_id does not have retain().
+ static cl_int retain(cl_device_id)
+ { return CL_SUCCESS; }
+ // cl_device_id does not have release().
+ static cl_int release(cl_device_id)
+ { return CL_SUCCESS; }
+};
+#endif // ! (CL_HPP_TARGET_OPENCL_VERSION >= 120)
+
+template <>
+struct ReferenceHandler<cl_platform_id>
+{
+ // cl_platform_id does not have retain().
+ static cl_int retain(cl_platform_id)
+ { return CL_SUCCESS; }
+ // cl_platform_id does not have release().
+ static cl_int release(cl_platform_id)
+ { return CL_SUCCESS; }
+};
+
+template <>
+struct ReferenceHandler<cl_context>
+{
+ static cl_int retain(cl_context context)
+ { return ::clRetainContext(context); }
+ static cl_int release(cl_context context)
+ { return ::clReleaseContext(context); }
+};
+
+template <>
+struct ReferenceHandler<cl_command_queue>
+{
+ static cl_int retain(cl_command_queue queue)
+ { return ::clRetainCommandQueue(queue); }
+ static cl_int release(cl_command_queue queue)
+ { return ::clReleaseCommandQueue(queue); }
+};
+
+template <>
+struct ReferenceHandler<cl_mem>
+{
+ static cl_int retain(cl_mem memory)
+ { return ::clRetainMemObject(memory); }
+ static cl_int release(cl_mem memory)
+ { return ::clReleaseMemObject(memory); }
+};
+
+template <>
+struct ReferenceHandler<cl_sampler>
+{
+ static cl_int retain(cl_sampler sampler)
+ { return ::clRetainSampler(sampler); }
+ static cl_int release(cl_sampler sampler)
+ { return ::clReleaseSampler(sampler); }
+};
+
+template <>
+struct ReferenceHandler<cl_program>
+{
+ static cl_int retain(cl_program program)
+ { return ::clRetainProgram(program); }
+ static cl_int release(cl_program program)
+ { return ::clReleaseProgram(program); }
+};
+
+template <>
+struct ReferenceHandler<cl_kernel>
+{
+ static cl_int retain(cl_kernel kernel)
+ { return ::clRetainKernel(kernel); }
+ static cl_int release(cl_kernel kernel)
+ { return ::clReleaseKernel(kernel); }
+};
+
+template <>
+struct ReferenceHandler<cl_event>
+{
+ static cl_int retain(cl_event event)
+ { return ::clRetainEvent(event); }
+ static cl_int release(cl_event event)
+ { return ::clReleaseEvent(event); }
+};
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
+// Extracts version number with major in the upper 16 bits, minor in the lower 16
+static cl_uint getVersion(const vector<char> &versionInfo)
+{
+ int highVersion = 0;
+ int lowVersion = 0;
+ int index = 7;
+ while(versionInfo[index] != '.' ) {
+ highVersion *= 10;
+ highVersion += versionInfo[index]-'0';
+ ++index;
+ }
+ ++index;
+ while(versionInfo[index] != ' ' && versionInfo[index] != '\0') {
+ lowVersion *= 10;
+ lowVersion += versionInfo[index]-'0';
+ ++index;
+ }
+ return (highVersion << 16) | lowVersion;
+}
+
+static cl_uint getPlatformVersion(cl_platform_id platform)
+{
+ size_type size = 0;
+ clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size);
+
+ vector<char> versionInfo(size);
+ clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, versionInfo.data(), &size);
+ return getVersion(versionInfo);
+}
+
+static cl_uint getDevicePlatformVersion(cl_device_id device)
+{
+ cl_platform_id platform;
+ clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform), &platform, NULL);
+ return getPlatformVersion(platform);
+}
+
+static cl_uint getContextPlatformVersion(cl_context context)
+{
+ // The platform cannot be queried directly, so we first have to grab a
+ // device and obtain its context
+ size_type size = 0;
+ clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size);
+ if (size == 0)
+ return 0;
+ vector<cl_device_id> devices(size/sizeof(cl_device_id));
+ clGetContextInfo(context, CL_CONTEXT_DEVICES, size, devices.data(), NULL);
+ return getDevicePlatformVersion(devices[0]);
+}
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
+
+template <typename T>
+class Wrapper
+{
+public:
+ typedef T cl_type;
+
+protected:
+ cl_type object_;
+
+public:
+ Wrapper() : object_(NULL) { }
+
+ Wrapper(const cl_type &obj, bool retainObject) : object_(obj)
+ {
+ if (retainObject) {
+ detail::errHandler(retain(), __RETAIN_ERR);
+ }
+ }
+
+ ~Wrapper()
+ {
+ if (object_ != NULL) { release(); }
+ }
+
+ Wrapper(const Wrapper<cl_type>& rhs)
+ {
+ object_ = rhs.object_;
+ detail::errHandler(retain(), __RETAIN_ERR);
+ }
+
+ Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT_
+ {
+ object_ = rhs.object_;
+ rhs.object_ = NULL;
+ }
+
+ Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+ {
+ if (this != &rhs) {
+ detail::errHandler(release(), __RELEASE_ERR);
+ object_ = rhs.object_;
+ detail::errHandler(retain(), __RETAIN_ERR);
+ }
+ return *this;
+ }
+
+ Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
+ {
+ if (this != &rhs) {
+ detail::errHandler(release(), __RELEASE_ERR);
+ object_ = rhs.object_;
+ rhs.object_ = NULL;
+ }
+ return *this;
+ }
+
+ Wrapper<cl_type>& operator = (const cl_type &rhs)
+ {
+ detail::errHandler(release(), __RELEASE_ERR);
+ object_ = rhs;
+ return *this;
+ }
+
+ const cl_type& operator ()() const { return object_; }
+
+ cl_type& operator ()() { return object_; }
+
+ const cl_type get() const { return object_; }
+
+ cl_type get() { return object_; }
+
+
+protected:
+ template<typename Func, typename U>
+ friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
+
+ cl_int retain() const
+ {
+ if (object_ != nullptr) {
+ return ReferenceHandler<cl_type>::retain(object_);
+ }
+ else {
+ return CL_SUCCESS;
+ }
+ }
+
+ cl_int release() const
+ {
+ if (object_ != nullptr) {
+ return ReferenceHandler<cl_type>::release(object_);
+ }
+ else {
+ return CL_SUCCESS;
+ }
+ }
+};
+
+template <>
+class Wrapper<cl_device_id>
+{
+public:
+ typedef cl_device_id cl_type;
+
+protected:
+ cl_type object_;
+ bool referenceCountable_;
+
+ static bool isReferenceCountable(cl_device_id device)
+ {
+ bool retVal = false;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ if (device != NULL) {
+ int version = getDevicePlatformVersion(device);
+ if(version > ((1 << 16) + 1)) {
+ retVal = true;
+ }
+ }
+#else // CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ retVal = true;
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+ return retVal;
+ }
+
+public:
+ Wrapper() : object_(NULL), referenceCountable_(false)
+ {
+ }
+
+ Wrapper(const cl_type &obj, bool retainObject) :
+ object_(obj),
+ referenceCountable_(false)
+ {
+ referenceCountable_ = isReferenceCountable(obj);
+
+ if (retainObject) {
+ detail::errHandler(retain(), __RETAIN_ERR);
+ }
+ }
+
+ ~Wrapper()
+ {
+ release();
+ }
+
+ Wrapper(const Wrapper<cl_type>& rhs)
+ {
+ object_ = rhs.object_;
+ referenceCountable_ = isReferenceCountable(object_);
+ detail::errHandler(retain(), __RETAIN_ERR);
+ }
+
+ Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT_
+ {
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ rhs.object_ = NULL;
+ rhs.referenceCountable_ = false;
+ }
+
+ Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+ {
+ if (this != &rhs) {
+ detail::errHandler(release(), __RELEASE_ERR);
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ detail::errHandler(retain(), __RETAIN_ERR);
+ }
+ return *this;
+ }
+
+ Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
+ {
+ if (this != &rhs) {
+ detail::errHandler(release(), __RELEASE_ERR);
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ rhs.object_ = NULL;
+ rhs.referenceCountable_ = false;
+ }
+ return *this;
+ }
+
+ Wrapper<cl_type>& operator = (const cl_type &rhs)
+ {
+ detail::errHandler(release(), __RELEASE_ERR);
+ object_ = rhs;
+ referenceCountable_ = isReferenceCountable(object_);
+ return *this;
+ }
+
+ const cl_type& operator ()() const { return object_; }
+
+ cl_type& operator ()() { return object_; }
+
+ const cl_type get() const { return object_; }
+
+ cl_type get() { return object_; }
+
+protected:
+ template<typename Func, typename U>
+ friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
+
+ template<typename Func, typename U>
+ friend inline cl_int getInfoHelper(Func, cl_uint, vector<U>*, int, typename U::cl_type);
+
+ cl_int retain() const
+ {
+ if( object_ != nullptr && referenceCountable_ ) {
+ return ReferenceHandler<cl_type>::retain(object_);
+ }
+ else {
+ return CL_SUCCESS;
+ }
+ }
+
+ cl_int release() const
+ {
+ if (object_ != nullptr && referenceCountable_) {
+ return ReferenceHandler<cl_type>::release(object_);
+ }
+ else {
+ return CL_SUCCESS;
+ }
+ }
+};
+
+template <typename T>
+inline bool operator==(const Wrapper<T> &lhs, const Wrapper<T> &rhs)
+{
+ return lhs() == rhs();
+}
+
+template <typename T>
+inline bool operator!=(const Wrapper<T> &lhs, const Wrapper<T> &rhs)
+{
+ return !operator==(lhs, rhs);
+}
+
+} // namespace detail
+//! \endcond
+
+
+using BuildLogType = vector<std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, CL_PROGRAM_BUILD_LOG>::param_type>>;
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+/**
+* Exception class for build errors to carry build info
+*/
+class BuildError : public Error
+{
+private:
+ BuildLogType buildLogs;
+public:
+ BuildError(cl_int err, const char * errStr, const BuildLogType &vec) : Error(err, errStr), buildLogs(vec)
+ {
+ }
+
+ BuildLogType getBuildLog() const
+ {
+ return buildLogs;
+ }
+};
+namespace detail {
+ static inline cl_int buildErrHandler(
+ cl_int err,
+ const char * errStr,
+ const BuildLogType &buildLogs)
+ {
+ if (err != CL_SUCCESS) {
+ throw BuildError(err, errStr, buildLogs);
+ }
+ return err;
+ }
+} // namespace detail
+
+#else
+namespace detail {
+ static inline cl_int buildErrHandler(
+ cl_int err,
+ const char * errStr,
+ const BuildLogType &buildLogs)
+ {
+ (void)buildLogs; // suppress unused variable warning
+ (void)errStr;
+ return err;
+ }
+} // namespace detail
+#endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
+
+
+/*! \stuct ImageFormat
+ * \brief Adds constructors and member functions for cl_image_format.
+ *
+ * \see cl_image_format
+ */
+struct ImageFormat : public cl_image_format
+{
+ //! \brief Default constructor - performs no initialization.
+ ImageFormat(){}
+
+ //! \brief Initializing constructor.
+ ImageFormat(cl_channel_order order, cl_channel_type type)
+ {
+ image_channel_order = order;
+ image_channel_data_type = type;
+ }
+
+ //! \brief Assignment operator.
+ ImageFormat& operator = (const ImageFormat& rhs)
+ {
+ if (this != &rhs) {
+ this->image_channel_data_type = rhs.image_channel_data_type;
+ this->image_channel_order = rhs.image_channel_order;
+ }
+ return *this;
+ }
+};
+
+/*! \brief Class interface for cl_device_id.
+ *
+ * \note Copies of these objects are inexpensive, since they don't 'own'
+ * any underlying resources or data structures.
+ *
+ * \see cl_device_id
+ */
+class Device : public detail::Wrapper<cl_device_id>
+{
+private:
+ static std::once_flag default_initialized_;
+ static Device default_;
+ static cl_int default_error_;
+
+ /*! \brief Create the default context.
+ *
+ * This sets @c default_ and @c default_error_. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefault();
+
+ /*! \brief Create the default platform from a provided platform.
+ *
+ * This sets @c default_. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefaultProvided(const Device &p) {
+ default_ = p;
+ }
+
+public:
+#ifdef CL_HPP_UNIT_TEST_ENABLE
+ /*! \brief Reset the default.
+ *
+ * This sets @c default_ to an empty value to support cleanup in
+ * the unit test framework.
+ * This function is not thread safe.
+ */
+ static void unitTestClearDefault() {
+ default_ = Device();
+ }
+#endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
+
+ //! \brief Default constructor - initializes to NULL.
+ Device() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_device_id.
+ *
+ * This simply copies the device ID value, which is an inexpensive operation.
+ */
+ explicit Device(const cl_device_id &device, bool retainObject = false) :
+ detail::Wrapper<cl_type>(device, retainObject) { }
+
+ /*! \brief Returns the first device on the default context.
+ *
+ * \see Context::getDefault()
+ */
+ static Device getDefault(
+ cl_int *errResult = NULL)
+ {
+ std::call_once(default_initialized_, makeDefault);
+ detail::errHandler(default_error_);
+ if (errResult != NULL) {
+ *errResult = default_error_;
+ }
+ return default_;
+ }
+
+ /**
+ * Modify the default device to be used by
+ * subsequent operations.
+ * Will only set the default if no default was previously created.
+ * @return updated default device.
+ * Should be compared to the passed value to ensure that it was updated.
+ */
+ static Device setDefault(const Device &default_device)
+ {
+ std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_device));
+ detail::errHandler(default_error_);
+ return default_;
+ }
+
+ /*! \brief Assignment operator from cl_device_id.
+ *
+ * This simply copies the device ID value, which is an inexpensive operation.
+ */
+ Device& operator = (const cl_device_id& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device(const Device& dev) : detail::Wrapper<cl_type>(dev) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device& operator = (const Device &dev)
+ {
+ detail::Wrapper<cl_type>::operator=(dev);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device(Device&& dev) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(dev)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device& operator = (Device &&dev)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(dev));
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetDeviceInfo().
+ template <typename T>
+ cl_int getInfo(cl_device_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetDeviceInfo, object_, name, param),
+ __GET_DEVICE_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetDeviceInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_device_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_device_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /**
+ * CL 1.2 version
+ */
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ //! \brief Wrapper for clCreateSubDevices().
+ cl_int createSubDevices(
+ const cl_device_partition_property * properties,
+ vector<Device>* devices)
+ {
+ cl_uint n = 0;
+ cl_int err = clCreateSubDevices(object_, properties, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
+ }
+
+ vector<cl_device_id> ids(n);
+ err = clCreateSubDevices(object_, properties, n, ids.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
+ }
+
+ // Cannot trivially assign because we need to capture intermediates
+ // with safe construction
+ if (devices) {
+ devices->resize(ids.size());
+
+ // Assign to param, constructing with retain behaviour
+ // to correctly capture each underlying CL object
+ for (size_type i = 0; i < ids.size(); i++) {
+ // We do not need to retain because this device is being created
+ // by the runtime
+ (*devices)[i] = Device(ids[i], false);
+ }
+ }
+
+ return CL_SUCCESS;
+ }
+#elif defined(CL_HPP_USE_CL_DEVICE_FISSION)
+
+/**
+ * CL 1.1 version that uses device fission extension.
+ */
+ cl_int createSubDevices(
+ const cl_device_partition_property_ext * properties,
+ vector<Device>* devices)
+ {
+ typedef CL_API_ENTRY cl_int
+ ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
+ cl_device_id /*in_device*/,
+ const cl_device_partition_property_ext * /* properties */,
+ cl_uint /*num_entries*/,
+ cl_device_id * /*out_devices*/,
+ cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
+ CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateSubDevicesEXT);
+
+ cl_uint n = 0;
+ cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
+ }
+
+ vector<cl_device_id> ids(n);
+ err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR);
+ }
+ // Cannot trivially assign because we need to capture intermediates
+ // with safe construction
+ if (devices) {
+ devices->resize(ids.size());
+
+ // Assign to param, constructing with retain behaviour
+ // to correctly capture each underlying CL object
+ for (size_type i = 0; i < ids.size(); i++) {
+ // We do not need to retain because this device is being created
+ // by the runtime
+ (*devices)[i] = Device(ids[i], false);
+ }
+ }
+ return CL_SUCCESS;
+ }
+#endif // defined(CL_HPP_USE_CL_DEVICE_FISSION)
+};
+
+CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Device::default_initialized_;
+CL_HPP_DEFINE_STATIC_MEMBER_ Device Device::default_;
+CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Device::default_error_ = CL_SUCCESS;
+
+/*! \brief Class interface for cl_platform_id.
+ *
+ * \note Copies of these objects are inexpensive, since they don't 'own'
+ * any underlying resources or data structures.
+ *
+ * \see cl_platform_id
+ */
+class Platform : public detail::Wrapper<cl_platform_id>
+{
+private:
+ static std::once_flag default_initialized_;
+ static Platform default_;
+ static cl_int default_error_;
+
+ /*! \brief Create the default context.
+ *
+ * This sets @c default_ and @c default_error_. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefault() {
+ /* Throwing an exception from a call_once invocation does not do
+ * what we wish, so we catch it and save the error.
+ */
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ try
+#endif
+ {
+ // If default wasn't passed ,generate one
+ // Otherwise set it
+ cl_uint n = 0;
+
+ cl_int err = ::clGetPlatformIDs(0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ default_error_ = err;
+ return;
+ }
+ if (n == 0) {
+ default_error_ = CL_INVALID_PLATFORM;
+ return;
+ }
+
+ vector<cl_platform_id> ids(n);
+ err = ::clGetPlatformIDs(n, ids.data(), NULL);
+ if (err != CL_SUCCESS) {
+ default_error_ = err;
+ return;
+ }
+
+ default_ = Platform(ids[0]);
+ }
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ catch (cl::Error &e) {
+ default_error_ = e.err();
+ }
+#endif
+ }
+
+ /*! \brief Create the default platform from a provided platform.
+ *
+ * This sets @c default_. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefaultProvided(const Platform &p) {
+ default_ = p;
+ }
+
+public:
+#ifdef CL_HPP_UNIT_TEST_ENABLE
+ /*! \brief Reset the default.
+ *
+ * This sets @c default_ to an empty value to support cleanup in
+ * the unit test framework.
+ * This function is not thread safe.
+ */
+ static void unitTestClearDefault() {
+ default_ = Platform();
+ }
+#endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
+
+ //! \brief Default constructor - initializes to NULL.
+ Platform() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_platform_id.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * This simply copies the platform ID value, which is an inexpensive operation.
+ */
+ explicit Platform(const cl_platform_id &platform, bool retainObject = false) :
+ detail::Wrapper<cl_type>(platform, retainObject) { }
+
+ /*! \brief Assignment operator from cl_platform_id.
+ *
+ * This simply copies the platform ID value, which is an inexpensive operation.
+ */
+ Platform& operator = (const cl_platform_id& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ static Platform getDefault(
+ cl_int *errResult = NULL)
+ {
+ std::call_once(default_initialized_, makeDefault);
+ detail::errHandler(default_error_);
+ if (errResult != NULL) {
+ *errResult = default_error_;
+ }
+ return default_;
+ }
+
+ /**
+ * Modify the default platform to be used by
+ * subsequent operations.
+ * Will only set the default if no default was previously created.
+ * @return updated default platform.
+ * Should be compared to the passed value to ensure that it was updated.
+ */
+ static Platform setDefault(const Platform &default_platform)
+ {
+ std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_platform));
+ detail::errHandler(default_error_);
+ return default_;
+ }
+
+ //! \brief Wrapper for clGetPlatformInfo().
+ cl_int getInfo(cl_platform_info name, string* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetPlatformInfo, object_, name, param),
+ __GET_PLATFORM_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetPlatformInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_platform_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_platform_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /*! \brief Gets a list of devices for this platform.
+ *
+ * Wraps clGetDeviceIDs().
+ */
+ cl_int getDevices(
+ cl_device_type type,
+ vector<Device>* devices) const
+ {
+ cl_uint n = 0;
+ if( devices == NULL ) {
+ return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
+ }
+ cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ vector<cl_device_id> ids(n);
+ err = ::clGetDeviceIDs(object_, type, n, ids.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ // Cannot trivially assign because we need to capture intermediates
+ // with safe construction
+ // We must retain things we obtain from the API to avoid releasing
+ // API-owned objects.
+ if (devices) {
+ devices->resize(ids.size());
+
+ // Assign to param, constructing with retain behaviour
+ // to correctly capture each underlying CL object
+ for (size_type i = 0; i < ids.size(); i++) {
+ (*devices)[i] = Device(ids[i], true);
+ }
+ }
+ return CL_SUCCESS;
+ }
+
+#if defined(CL_HPP_USE_DX_INTEROP)
+ /*! \brief Get the list of available D3D10 devices.
+ *
+ * \param d3d_device_source.
+ *
+ * \param d3d_object.
+ *
+ * \param d3d_device_set.
+ *
+ * \param devices returns a vector of OpenCL D3D10 devices found. The cl::Device
+ * values returned in devices can be used to identify a specific OpenCL
+ * device. If \a devices argument is NULL, this argument is ignored.
+ *
+ * \return One of the following values:
+ * - CL_SUCCESS if the function is executed successfully.
+ *
+ * The application can query specific capabilities of the OpenCL device(s)
+ * returned by cl::getDevices. This can be used by the application to
+ * determine which device(s) to use.
+ *
+ * \note In the case that exceptions are enabled and a return value
+ * other than CL_SUCCESS is generated, then cl::Error exception is
+ * generated.
+ */
+ cl_int getDevices(
+ cl_d3d10_device_source_khr d3d_device_source,
+ void * d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ vector<Device>* devices) const
+ {
+ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
+ cl_platform_id platform,
+ cl_d3d10_device_source_khr d3d_device_source,
+ void * d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ cl_uint num_entries,
+ cl_device_id * devices,
+ cl_uint* num_devices);
+
+ if( devices == NULL ) {
+ return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
+ }
+
+ static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
+ CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(object_, clGetDeviceIDsFromD3D10KHR);
+
+ cl_uint n = 0;
+ cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
+ object_,
+ d3d_device_source,
+ d3d_object,
+ d3d_device_set,
+ 0,
+ NULL,
+ &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ vector<cl_device_id> ids(n);
+ err = pfn_clGetDeviceIDsFromD3D10KHR(
+ object_,
+ d3d_device_source,
+ d3d_object,
+ d3d_device_set,
+ n,
+ ids.data(),
+ NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ // Cannot trivially assign because we need to capture intermediates
+ // with safe construction
+ // We must retain things we obtain from the API to avoid releasing
+ // API-owned objects.
+ if (devices) {
+ devices->resize(ids.size());
+
+ // Assign to param, constructing with retain behaviour
+ // to correctly capture each underlying CL object
+ for (size_type i = 0; i < ids.size(); i++) {
+ (*devices)[i] = Device(ids[i], true);
+ }
+ }
+ return CL_SUCCESS;
+ }
+#endif
+
+ /*! \brief Gets a list of available platforms.
+ *
+ * Wraps clGetPlatformIDs().
+ */
+ static cl_int get(
+ vector<Platform>* platforms)
+ {
+ cl_uint n = 0;
+
+ if( platforms == NULL ) {
+ return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
+ }
+
+ cl_int err = ::clGetPlatformIDs(0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ vector<cl_platform_id> ids(n);
+ err = ::clGetPlatformIDs(n, ids.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ if (platforms) {
+ platforms->resize(ids.size());
+
+ // Platforms don't reference count
+ for (size_type i = 0; i < ids.size(); i++) {
+ (*platforms)[i] = Platform(ids[i]);
+ }
+ }
+ return CL_SUCCESS;
+ }
+
+ /*! \brief Gets the first available platform.
+ *
+ * Wraps clGetPlatformIDs(), returning the first result.
+ */
+ static cl_int get(
+ Platform * platform)
+ {
+ cl_int err;
+ Platform default_platform = Platform::getDefault(&err);
+ if (platform) {
+ *platform = default_platform;
+ }
+ return err;
+ }
+
+ /*! \brief Gets the first available platform, returning it by value.
+ *
+ * \return Returns a valid platform if one is available.
+ * If no platform is available will return a null platform.
+ * Throws an exception if no platforms are available
+ * or an error condition occurs.
+ * Wraps clGetPlatformIDs(), returning the first result.
+ */
+ static Platform get(
+ cl_int * errResult = NULL)
+ {
+ cl_int err;
+ Platform default_platform = Platform::getDefault(&err);
+ if (errResult) {
+ *errResult = err;
+ }
+ return default_platform;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ //! \brief Wrapper for clUnloadCompiler().
+ cl_int
+ unloadCompiler()
+ {
+ return ::clUnloadPlatformCompiler(object_);
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+}; // class Platform
+
+CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Platform::default_initialized_;
+CL_HPP_DEFINE_STATIC_MEMBER_ Platform Platform::default_;
+CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Platform::default_error_ = CL_SUCCESS;
+
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+/**
+ * Unload the OpenCL compiler.
+ * \note Deprecated for OpenCL 1.2. Use Platform::unloadCompiler instead.
+ */
+inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int
+UnloadCompiler() CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
+inline cl_int
+UnloadCompiler()
+{
+ return ::clUnloadCompiler();
+}
+#endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+
+/*! \brief Class interface for cl_context.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_context as the original. For details, see
+ * clRetainContext() and clReleaseContext().
+ *
+ * \see cl_context
+ */
+class Context
+ : public detail::Wrapper<cl_context>
+{
+private:
+ static std::once_flag default_initialized_;
+ static Context default_;
+ static cl_int default_error_;
+
+ /*! \brief Create the default context from the default device type in the default platform.
+ *
+ * This sets @c default_ and @c default_error_. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefault() {
+ /* Throwing an exception from a call_once invocation does not do
+ * what we wish, so we catch it and save the error.
+ */
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ try
+#endif
+ {
+#if !defined(__APPLE__) && !defined(__MACOS)
+ const Platform &p = Platform::getDefault();
+ cl_platform_id defaultPlatform = p();
+ cl_context_properties properties[3] = {
+ CL_CONTEXT_PLATFORM, (cl_context_properties)defaultPlatform, 0
+ };
+#else // #if !defined(__APPLE__) && !defined(__MACOS)
+ cl_context_properties *properties = nullptr;
+#endif // #if !defined(__APPLE__) && !defined(__MACOS)
+
+ default_ = Context(
+ CL_DEVICE_TYPE_DEFAULT,
+ properties,
+ NULL,
+ NULL,
+ &default_error_);
+ }
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ catch (cl::Error &e) {
+ default_error_ = e.err();
+ }
+#endif
+ }
+
+
+ /*! \brief Create the default context from a provided Context.
+ *
+ * This sets @c default_. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefaultProvided(const Context &c) {
+ default_ = c;
+ }
+
+public:
+#ifdef CL_HPP_UNIT_TEST_ENABLE
+ /*! \brief Reset the default.
+ *
+ * This sets @c default_ to an empty value to support cleanup in
+ * the unit test framework.
+ * This function is not thread safe.
+ */
+ static void unitTestClearDefault() {
+ default_ = Context();
+ }
+#endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
+
+ /*! \brief Constructs a context including a list of specified devices.
+ *
+ * Wraps clCreateContext().
+ */
+ Context(
+ const vector<Device>& devices,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ size_type,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ size_type numDevices = devices.size();
+ vector<cl_device_id> deviceIDs(numDevices);
+
+ for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ object_ = ::clCreateContext(
+ properties, (cl_uint) numDevices,
+ deviceIDs.data(),
+ notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Context(
+ const Device& device,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ size_type,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ cl_device_id deviceID = device();
+
+ object_ = ::clCreateContext(
+ properties, 1,
+ &deviceID,
+ notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Constructs a context including all or a subset of devices of a specified type.
+ *
+ * Wraps clCreateContextFromType().
+ */
+ Context(
+ cl_device_type type,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ size_type,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+#if !defined(__APPLE__) && !defined(__MACOS)
+ cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
+
+ if (properties == NULL) {
+ // Get a valid platform ID as we cannot send in a blank one
+ vector<Platform> platforms;
+ error = Platform::get(&platforms);
+ if (error != CL_SUCCESS) {
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return;
+ }
+
+ // Check the platforms we found for a device of our specified type
+ cl_context_properties platform_id = 0;
+ for (unsigned int i = 0; i < platforms.size(); i++) {
+
+ vector<Device> devices;
+
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ try {
+#endif
+
+ error = platforms[i].getDevices(type, &devices);
+
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ } catch (Error) {}
+ // Catch if exceptions are enabled as we don't want to exit if first platform has no devices of type
+ // We do error checking next anyway, and can throw there if needed
+#endif
+
+ // Only squash CL_SUCCESS and CL_DEVICE_NOT_FOUND
+ if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) {
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ if (devices.size() > 0) {
+ platform_id = (cl_context_properties)platforms[i]();
+ break;
+ }
+ }
+
+ if (platform_id == 0) {
+ detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = CL_DEVICE_NOT_FOUND;
+ }
+ return;
+ }
+
+ prop[1] = platform_id;
+ properties = &prop[0];
+ }
+#endif
+ object_ = ::clCreateContextFromType(
+ properties, type, notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context(const Context& ctx) : detail::Wrapper<cl_type>(ctx) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context& operator = (const Context &ctx)
+ {
+ detail::Wrapper<cl_type>::operator=(ctx);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context(Context&& ctx) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(ctx)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context& operator = (Context &&ctx)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(ctx));
+ return *this;
+ }
+
+
+ /*! \brief Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.
+ *
+ * \note All calls to this function return the same cl_context as the first.
+ */
+ static Context getDefault(cl_int * err = NULL)
+ {
+ std::call_once(default_initialized_, makeDefault);
+ detail::errHandler(default_error_);
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+ }
+
+ /**
+ * Modify the default context to be used by
+ * subsequent operations.
+ * Will only set the default if no default was previously created.
+ * @return updated default context.
+ * Should be compared to the passed value to ensure that it was updated.
+ */
+ static Context setDefault(const Context &default_context)
+ {
+ std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_context));
+ detail::errHandler(default_error_);
+ return default_;
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Context() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_context - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the cl_context
+ * into the new Context object.
+ */
+ explicit Context(const cl_context& context, bool retainObject = false) :
+ detail::Wrapper<cl_type>(context, retainObject) { }
+
+ /*! \brief Assignment operator from cl_context - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseContext() on the value previously held by this instance.
+ */
+ Context& operator = (const cl_context& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetContextInfo().
+ template <typename T>
+ cl_int getInfo(cl_context_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetContextInfo, object_, name, param),
+ __GET_CONTEXT_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetContextInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_context_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_context_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /*! \brief Gets a list of supported image formats.
+ *
+ * Wraps clGetSupportedImageFormats().
+ */
+ cl_int getSupportedImageFormats(
+ cl_mem_flags flags,
+ cl_mem_object_type type,
+ vector<ImageFormat>* formats) const
+ {
+ cl_uint numEntries;
+
+ if (!formats) {
+ return CL_SUCCESS;
+ }
+
+ cl_int err = ::clGetSupportedImageFormats(
+ object_,
+ flags,
+ type,
+ 0,
+ NULL,
+ &numEntries);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
+ }
+
+ if (numEntries > 0) {
+ vector<ImageFormat> value(numEntries);
+ err = ::clGetSupportedImageFormats(
+ object_,
+ flags,
+ type,
+ numEntries,
+ (cl_image_format*)value.data(),
+ NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
+ }
+
+ formats->assign(begin(value), end(value));
+ }
+ else {
+ // If no values are being returned, ensure an empty vector comes back
+ formats->clear();
+ }
+
+ return CL_SUCCESS;
+ }
+};
+
+inline void Device::makeDefault()
+{
+ /* Throwing an exception from a call_once invocation does not do
+ * what we wish, so we catch it and save the error.
+ */
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ try
+#endif
+ {
+ cl_int error = 0;
+
+ Context context = Context::getDefault(&error);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS) {
+ default_error_ = error;
+ }
+ else {
+ default_ = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+ default_error_ = CL_SUCCESS;
+ }
+ }
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ catch (cl::Error &e) {
+ default_error_ = e.err();
+ }
+#endif
+}
+
+CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Context::default_initialized_;
+CL_HPP_DEFINE_STATIC_MEMBER_ Context Context::default_;
+CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Context::default_error_ = CL_SUCCESS;
+
+/*! \brief Class interface for cl_event.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_event as the original. For details, see
+ * clRetainEvent() and clReleaseEvent().
+ *
+ * \see cl_event
+ */
+class Event : public detail::Wrapper<cl_event>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Event() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_event - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * This effectively transfers ownership of a refcount on the cl_event
+ * into the new Event object.
+ */
+ explicit Event(const cl_event& event, bool retainObject = false) :
+ detail::Wrapper<cl_type>(event, retainObject) { }
+
+ /*! \brief Assignment operator from cl_event - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseEvent() on the value previously held by this instance.
+ */
+ Event& operator = (const cl_event& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetEventInfo().
+ template <typename T>
+ cl_int getInfo(cl_event_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetEventInfo, object_, name, param),
+ __GET_EVENT_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetEventInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_event_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_event_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ //! \brief Wrapper for clGetEventProfilingInfo().
+ template <typename T>
+ cl_int getProfilingInfo(cl_profiling_info name, T* param) const
+ {
+ return detail::errHandler(detail::getInfo(
+ &::clGetEventProfilingInfo, object_, name, param),
+ __GET_EVENT_PROFILE_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetEventProfilingInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_profiling_info, name>::param_type
+ getProfilingInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_profiling_info, name>::param_type param;
+ cl_int result = getProfilingInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /*! \brief Blocks the calling thread until this event completes.
+ *
+ * Wraps clWaitForEvents().
+ */
+ cl_int wait() const
+ {
+ return detail::errHandler(
+ ::clWaitForEvents(1, &object_),
+ __WAIT_FOR_EVENTS_ERR);
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+ /*! \brief Registers a user callback function for a specific command execution status.
+ *
+ * Wraps clSetEventCallback().
+ */
+ cl_int setCallback(
+ cl_int type,
+ void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *),
+ void * user_data = NULL)
+ {
+ return detail::errHandler(
+ ::clSetEventCallback(
+ object_,
+ type,
+ pfn_notify,
+ user_data),
+ __SET_EVENT_CALLBACK_ERR);
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+
+ /*! \brief Blocks the calling thread until every event specified is complete.
+ *
+ * Wraps clWaitForEvents().
+ */
+ static cl_int
+ waitForEvents(const vector<Event>& events)
+ {
+ return detail::errHandler(
+ ::clWaitForEvents(
+ (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
+ __WAIT_FOR_EVENTS_ERR);
+ }
+};
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+/*! \brief Class interface for user events (a subset of cl_event's).
+ *
+ * See Event for details about copy semantics, etc.
+ */
+class UserEvent : public Event
+{
+public:
+ /*! \brief Constructs a user event on a given context.
+ *
+ * Wraps clCreateUserEvent().
+ */
+ UserEvent(
+ const Context& context,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateUserEvent(
+ context(),
+ &error);
+
+ detail::errHandler(error, __CREATE_USER_EVENT_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ UserEvent() : Event() { }
+
+ /*! \brief Sets the execution status of a user event object.
+ *
+ * Wraps clSetUserEventStatus().
+ */
+ cl_int setStatus(cl_int status)
+ {
+ return detail::errHandler(
+ ::clSetUserEventStatus(object_,status),
+ __SET_USER_EVENT_STATUS_ERR);
+ }
+};
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+
+/*! \brief Blocks the calling thread until every event specified is complete.
+ *
+ * Wraps clWaitForEvents().
+ */
+inline static cl_int
+WaitForEvents(const vector<Event>& events)
+{
+ return detail::errHandler(
+ ::clWaitForEvents(
+ (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
+ __WAIT_FOR_EVENTS_ERR);
+}
+
+/*! \brief Class interface for cl_mem.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_mem as the original. For details, see
+ * clRetainMemObject() and clReleaseMemObject().
+ *
+ * \see cl_mem
+ */
+class Memory : public detail::Wrapper<cl_mem>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Memory() : detail::Wrapper<cl_type>() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * Optionally transfer ownership of a refcount on the cl_mem
+ * into the new Memory object.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ *
+ * See Memory for further details.
+ */
+ explicit Memory(const cl_mem& memory, bool retainObject) :
+ detail::Wrapper<cl_type>(memory, retainObject) { }
+
+ /*! \brief Assignment operator from cl_mem - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseMemObject() on the value previously held by this instance.
+ */
+ Memory& operator = (const cl_mem& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory(const Memory& mem) : detail::Wrapper<cl_type>(mem) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory& operator = (const Memory &mem)
+ {
+ detail::Wrapper<cl_type>::operator=(mem);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory(Memory&& mem) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(mem)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory& operator = (Memory &&mem)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(mem));
+ return *this;
+ }
+
+
+ //! \brief Wrapper for clGetMemObjectInfo().
+ template <typename T>
+ cl_int getInfo(cl_mem_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
+ __GET_MEM_OBJECT_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetMemObjectInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_mem_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_mem_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+ /*! \brief Registers a callback function to be called when the memory object
+ * is no longer needed.
+ *
+ * Wraps clSetMemObjectDestructorCallback().
+ *
+ * Repeated calls to this function, for a given cl_mem value, will append
+ * to the list of functions called (in reverse order) when memory object's
+ * resources are freed and the memory object is deleted.
+ *
+ * \note
+ * The registered callbacks are associated with the underlying cl_mem
+ * value - not the Memory class instance.
+ */
+ cl_int setDestructorCallback(
+ void (CL_CALLBACK * pfn_notify)(cl_mem, void *),
+ void * user_data = NULL)
+ {
+ return detail::errHandler(
+ ::clSetMemObjectDestructorCallback(
+ object_,
+ pfn_notify,
+ user_data),
+ __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+
+};
+
+// Pre-declare copy functions
+class Buffer;
+template< typename IteratorType >
+cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
+template< typename IteratorType >
+cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
+template< typename IteratorType >
+cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
+template< typename IteratorType >
+cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+namespace detail
+{
+ class SVMTraitNull
+ {
+ public:
+ static cl_svm_mem_flags getSVMMemFlags()
+ {
+ return 0;
+ }
+ };
+} // namespace detail
+
+template<class Trait = detail::SVMTraitNull>
+class SVMTraitReadWrite
+{
+public:
+ static cl_svm_mem_flags getSVMMemFlags()
+ {
+ return CL_MEM_READ_WRITE |
+ Trait::getSVMMemFlags();
+ }
+};
+
+template<class Trait = detail::SVMTraitNull>
+class SVMTraitReadOnly
+{
+public:
+ static cl_svm_mem_flags getSVMMemFlags()
+ {
+ return CL_MEM_READ_ONLY |
+ Trait::getSVMMemFlags();
+ }
+};
+
+template<class Trait = detail::SVMTraitNull>
+class SVMTraitWriteOnly
+{
+public:
+ static cl_svm_mem_flags getSVMMemFlags()
+ {
+ return CL_MEM_WRITE_ONLY |
+ Trait::getSVMMemFlags();
+ }
+};
+
+template<class Trait = SVMTraitReadWrite<>>
+class SVMTraitCoarse
+{
+public:
+ static cl_svm_mem_flags getSVMMemFlags()
+ {
+ return Trait::getSVMMemFlags();
+ }
+};
+
+template<class Trait = SVMTraitReadWrite<>>
+class SVMTraitFine
+{
+public:
+ static cl_svm_mem_flags getSVMMemFlags()
+ {
+ return CL_MEM_SVM_FINE_GRAIN_BUFFER |
+ Trait::getSVMMemFlags();
+ }
+};
+
+template<class Trait = SVMTraitReadWrite<>>
+class SVMTraitAtomic
+{
+public:
+ static cl_svm_mem_flags getSVMMemFlags()
+ {
+ return
+ CL_MEM_SVM_FINE_GRAIN_BUFFER |
+ CL_MEM_SVM_ATOMICS |
+ Trait::getSVMMemFlags();
+ }
+};
+
+// Pre-declare SVM map function
+template<typename T>
+inline cl_int enqueueMapSVM(
+ T* ptr,
+ cl_bool blocking,
+ cl_map_flags flags,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL);
+
+/**
+ * STL-like allocator class for managing SVM objects provided for convenience.
+ *
+ * Note that while this behaves like an allocator for the purposes of constructing vectors and similar objects,
+ * care must be taken when using with smart pointers.
+ * The allocator should not be used to construct a unique_ptr if we are using coarse-grained SVM mode because
+ * the coarse-grained management behaviour would behave incorrectly with respect to reference counting.
+ *
+ * Instead the allocator embeds a Deleter which may be used with unique_ptr and is used
+ * with the allocate_shared and allocate_ptr supplied operations.
+ */
+template<typename T, class SVMTrait>
+class SVMAllocator {
+private:
+ Context context_;
+
+public:
+ typedef T value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ template<typename U>
+ struct rebind
+ {
+ typedef SVMAllocator<U, SVMTrait> other;
+ };
+
+ template<typename U, typename V>
+ friend class SVMAllocator;
+
+ SVMAllocator() :
+ context_(Context::getDefault())
+ {
+ }
+
+ explicit SVMAllocator(cl::Context context) :
+ context_(context)
+ {
+ }
+
+
+ SVMAllocator(const SVMAllocator &other) :
+ context_(other.context_)
+ {
+ }
+
+ template<typename U>
+ SVMAllocator(const SVMAllocator<U, SVMTrait> &other) :
+ context_(other.context_)
+ {
+ }
+
+ ~SVMAllocator()
+ {
+ }
+
+ pointer address(reference r) CL_HPP_NOEXCEPT_
+ {
+ return std::addressof(r);
+ }
+
+ const_pointer address(const_reference r) CL_HPP_NOEXCEPT_
+ {
+ return std::addressof(r);
+ }
+
+ /**
+ * Allocate an SVM pointer.
+ *
+ * If the allocator is coarse-grained, this will take ownership to allow
+ * containers to correctly construct data in place.
+ */
+ pointer allocate(
+ size_type size,
+ typename cl::SVMAllocator<void, SVMTrait>::const_pointer = 0)
+ {
+ // Allocate memory with default alignment matching the size of the type
+ void* voidPointer =
+ clSVMAlloc(
+ context_(),
+ SVMTrait::getSVMMemFlags(),
+ size*sizeof(T),
+ 0);
+ pointer retValue = reinterpret_cast<pointer>(
+ voidPointer);
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ if (!retValue) {
+ std::bad_alloc excep;
+ throw excep;
+ }
+#endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS)
+
+ // If allocation was coarse-grained then map it
+ if (!(SVMTrait::getSVMMemFlags() & CL_MEM_SVM_FINE_GRAIN_BUFFER)) {
+ cl_int err = enqueueMapSVM(retValue, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, size*sizeof(T));
+ if (err != CL_SUCCESS) {
+ std::bad_alloc excep;
+ throw excep;
+ }
+ }
+
+ // If exceptions disabled, return null pointer from allocator
+ return retValue;
+ }
+
+ void deallocate(pointer p, size_type)
+ {
+ clSVMFree(context_(), p);
+ }
+
+ /**
+ * Return the maximum possible allocation size.
+ * This is the minimum of the maximum sizes of all devices in the context.
+ */
+ size_type max_size() const CL_HPP_NOEXCEPT_
+ {
+ size_type maxSize = std::numeric_limits<size_type>::max() / sizeof(T);
+
+ for (Device &d : context_.getInfo<CL_CONTEXT_DEVICES>()) {
+ maxSize = std::min(
+ maxSize,
+ static_cast<size_type>(d.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>()));
+ }
+
+ return maxSize;
+ }
+
+ template< class U, class... Args >
+ void construct(U* p, Args&&... args)
+ {
+ new(p)T(args...);
+ }
+
+ template< class U >
+ void destroy(U* p)
+ {
+ p->~U();
+ }
+
+ /**
+ * Returns true if the contexts match.
+ */
+ inline bool operator==(SVMAllocator const& rhs)
+ {
+ return (context_==rhs.context_);
+ }
+
+ inline bool operator!=(SVMAllocator const& a)
+ {
+ return !operator==(a);
+ }
+}; // class SVMAllocator return cl::pointer<T>(tmp, detail::Deleter<T, Alloc>{alloc, copies});
+
+
+template<class SVMTrait>
+class SVMAllocator<void, SVMTrait> {
+public:
+ typedef void value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+
+ template<typename U>
+ struct rebind
+ {
+ typedef SVMAllocator<U, SVMTrait> other;
+ };
+
+ template<typename U, typename V>
+ friend class SVMAllocator;
+};
+
+#if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
+namespace detail
+{
+ template<class Alloc>
+ class Deleter {
+ private:
+ Alloc alloc_;
+ size_type copies_;
+
+ public:
+ typedef typename std::allocator_traits<Alloc>::pointer pointer;
+
+ Deleter(const Alloc &alloc, size_type copies) : alloc_{ alloc }, copies_{ copies }
+ {
+ }
+
+ void operator()(pointer ptr) const {
+ Alloc tmpAlloc{ alloc_ };
+ std::allocator_traits<Alloc>::destroy(tmpAlloc, std::addressof(*ptr));
+ std::allocator_traits<Alloc>::deallocate(tmpAlloc, ptr, copies_);
+ }
+ };
+} // namespace detail
+
+/**
+ * Allocation operation compatible with std::allocate_ptr.
+ * Creates a unique_ptr<T> by default.
+ * This requirement is to ensure that the control block is not
+ * allocated in memory inaccessible to the host.
+ */
+template <class T, class Alloc, class... Args>
+cl::pointer<T, detail::Deleter<Alloc>> allocate_pointer(const Alloc &alloc_, Args&&... args)
+{
+ Alloc alloc(alloc_);
+ static const size_type copies = 1;
+
+ // Ensure that creation of the management block and the
+ // object are dealt with separately such that we only provide a deleter
+
+ T* tmp = std::allocator_traits<Alloc>::allocate(alloc, copies);
+ if (!tmp) {
+ std::bad_alloc excep;
+ throw excep;
+ }
+ try {
+ std::allocator_traits<Alloc>::construct(
+ alloc,
+ std::addressof(*tmp),
+ std::forward<Args>(args)...);
+
+ return cl::pointer<T, detail::Deleter<Alloc>>(tmp, detail::Deleter<Alloc>{alloc, copies});
+ }
+ catch (std::bad_alloc b)
+ {
+ std::allocator_traits<Alloc>::deallocate(alloc, tmp, copies);
+ throw;
+ }
+}
+
+template< class T, class SVMTrait, class... Args >
+cl::pointer<T, detail::Deleter<SVMAllocator<T, SVMTrait>>> allocate_svm(Args... args)
+{
+ SVMAllocator<T, SVMTrait> alloc;
+ return cl::allocate_pointer<T>(alloc, args...);
+}
+
+template< class T, class SVMTrait, class... Args >
+cl::pointer<T, detail::Deleter<SVMAllocator<T, SVMTrait>>> allocate_svm(const cl::Context &c, Args... args)
+{
+ SVMAllocator<T, SVMTrait> alloc(c);
+ return cl::allocate_pointer<T>(alloc, args...);
+}
+#endif // #if !defined(CL_HPP_NO_STD_UNIQUE_PTR)
+
+/*! \brief Vector alias to simplify contruction of coarse-grained SVM containers.
+ *
+ */
+template < class T >
+using coarse_svm_vector = vector<T, cl::SVMAllocator<int, cl::SVMTraitCoarse<>>>;
+
+/*! \brief Vector alias to simplify contruction of fine-grained SVM containers.
+*
+*/
+template < class T >
+using fine_svm_vector = vector<T, cl::SVMAllocator<int, cl::SVMTraitFine<>>>;
+
+/*! \brief Vector alias to simplify contruction of fine-grained SVM containers that support platform atomics.
+*
+*/
+template < class T >
+using atomic_svm_vector = vector<T, cl::SVMAllocator<int, cl::SVMTraitAtomic<>>>;
+
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+
+/*! \brief Class interface for Buffer Memory Objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Buffer : public Memory
+{
+public:
+
+ /*! \brief Constructs a Buffer in a specified context.
+ *
+ * Wraps clCreateBuffer().
+ *
+ * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was
+ * specified. Note alignment & exclusivity requirements.
+ */
+ Buffer(
+ const Context& context,
+ cl_mem_flags flags,
+ size_type size,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Constructs a Buffer in the default context.
+ *
+ * Wraps clCreateBuffer().
+ *
+ * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was
+ * specified. Note alignment & exclusivity requirements.
+ *
+ * \see Context::getDefault()
+ */
+ Buffer(
+ cl_mem_flags flags,
+ size_type size,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ Context context = Context::getDefault(err);
+
+ object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*!
+ * \brief Construct a Buffer from a host container via iterators.
+ * IteratorType must be random access.
+ * If useHostPtr is specified iterators must represent contiguous data.
+ */
+ template< typename IteratorType >
+ Buffer(
+ IteratorType startIterator,
+ IteratorType endIterator,
+ bool readOnly,
+ bool useHostPtr = false,
+ cl_int* err = NULL)
+ {
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ cl_mem_flags flags = 0;
+ if( readOnly ) {
+ flags |= CL_MEM_READ_ONLY;
+ }
+ else {
+ flags |= CL_MEM_READ_WRITE;
+ }
+ if( useHostPtr ) {
+ flags |= CL_MEM_USE_HOST_PTR;
+ }
+
+ size_type size = sizeof(DataType)*(endIterator - startIterator);
+
+ Context context = Context::getDefault(err);
+
+ if( useHostPtr ) {
+ object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
+ } else {
+ object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
+ }
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ if( !useHostPtr ) {
+ error = cl::copy(startIterator, endIterator, *this);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ }
+
+ /*!
+ * \brief Construct a Buffer from a host container via iterators using a specified context.
+ * IteratorType must be random access.
+ * If useHostPtr is specified iterators must represent contiguous data.
+ */
+ template< typename IteratorType >
+ Buffer(const Context &context, IteratorType startIterator, IteratorType endIterator,
+ bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
+
+ /*!
+ * \brief Construct a Buffer from a host container via iterators using a specified queue.
+ * If useHostPtr is specified iterators must be random access.
+ */
+ template< typename IteratorType >
+ Buffer(const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
+ bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
+
+ //! \brief Default constructor - initializes to NULL.
+ Buffer() : Memory() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with earlier versions.
+ *
+ * See Memory for further details.
+ */
+ explicit Buffer(const cl_mem& buffer, bool retainObject = false) :
+ Memory(buffer, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Buffer& operator = (const cl_mem& rhs)
+ {
+ Memory::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer(const Buffer& buf) : Memory(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer& operator = (const Buffer &buf)
+ {
+ Memory::operator=(buf);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer(Buffer&& buf) CL_HPP_NOEXCEPT_ : Memory(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer& operator = (Buffer &&buf)
+ {
+ Memory::operator=(std::move(buf));
+ return *this;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+ /*! \brief Creates a new buffer object from this.
+ *
+ * Wraps clCreateSubBuffer().
+ */
+ Buffer createSubBuffer(
+ cl_mem_flags flags,
+ cl_buffer_create_type buffer_create_type,
+ const void * buffer_create_info,
+ cl_int * err = NULL)
+ {
+ Buffer result;
+ cl_int error;
+ result.object_ = ::clCreateSubBuffer(
+ object_,
+ flags,
+ buffer_create_type,
+ buffer_create_info,
+ &error);
+
+ detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ return result;
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+};
+
+#if defined (CL_HPP_USE_DX_INTEROP)
+/*! \brief Class interface for creating OpenCL buffers from ID3D10Buffer's.
+ *
+ * This is provided to facilitate interoperability with Direct3D.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class BufferD3D10 : public Buffer
+{
+public:
+
+
+ /*! \brief Constructs a BufferD3D10, in a specified context, from a
+ * given ID3D10Buffer.
+ *
+ * Wraps clCreateFromD3D10BufferKHR().
+ */
+ BufferD3D10(
+ const Context& context,
+ cl_mem_flags flags,
+ ID3D10Buffer* bufobj,
+ cl_int * err = NULL) : pfn_clCreateFromD3D10BufferKHR(nullptr)
+ {
+ typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
+ cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
+ cl_int* errcode_ret);
+ PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
+ cl_platform platform = -1;
+ for( int i = 0; i < props.size(); ++i ) {
+ if( props[i] == CL_CONTEXT_PLATFORM ) {
+ platform = props[i+1];
+ }
+ }
+ CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCreateFromD3D10BufferKHR);
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 110
+ CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateFromD3D10BufferKHR);
+#endif
+
+ cl_int error;
+ object_ = pfn_clCreateFromD3D10BufferKHR(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ BufferD3D10() : Buffer() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit BufferD3D10(const cl_mem& buffer, bool retainObject = false) :
+ Buffer(buffer, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ BufferD3D10& operator = (const cl_mem& rhs)
+ {
+ Buffer::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10(const BufferD3D10& buf) :
+ Buffer(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10& operator = (const BufferD3D10 &buf)
+ {
+ Buffer::operator=(buf);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10& operator = (BufferD3D10 &&buf)
+ {
+ Buffer::operator=(std::move(buf));
+ return *this;
+ }
+};
+#endif
+
+/*! \brief Class interface for GL Buffer Memory Objects.
+ *
+ * This is provided to facilitate interoperability with OpenGL.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class BufferGL : public Buffer
+{
+public:
+ /*! \brief Constructs a BufferGL in a specified context, from a given
+ * GL buffer.
+ *
+ * Wraps clCreateFromGLBuffer().
+ */
+ BufferGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLBuffer(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ BufferGL() : Buffer() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit BufferGL(const cl_mem& buffer, bool retainObject = false) :
+ Buffer(buffer, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ BufferGL& operator = (const cl_mem& rhs)
+ {
+ Buffer::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL(const BufferGL& buf) : Buffer(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL& operator = (const BufferGL &buf)
+ {
+ Buffer::operator=(buf);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL(BufferGL&& buf) CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL& operator = (BufferGL &&buf)
+ {
+ Buffer::operator=(std::move(buf));
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetGLObjectInfo().
+ cl_int getObjectInfo(
+ cl_gl_object_type *type,
+ cl_GLuint * gl_object_name)
+ {
+ return detail::errHandler(
+ ::clGetGLObjectInfo(object_,type,gl_object_name),
+ __GET_GL_OBJECT_INFO_ERR);
+ }
+};
+
+/*! \brief Class interface for GL Render Buffer Memory Objects.
+ *
+ * This is provided to facilitate interoperability with OpenGL.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class BufferRenderGL : public Buffer
+{
+public:
+ /*! \brief Constructs a BufferRenderGL in a specified context, from a given
+ * GL Renderbuffer.
+ *
+ * Wraps clCreateFromGLRenderbuffer().
+ */
+ BufferRenderGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLRenderbuffer(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ BufferRenderGL() : Buffer() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit BufferRenderGL(const cl_mem& buffer, bool retainObject = false) :
+ Buffer(buffer, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ BufferRenderGL& operator = (const cl_mem& rhs)
+ {
+ Buffer::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL(const BufferRenderGL& buf) : Buffer(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL& operator = (const BufferRenderGL &buf)
+ {
+ Buffer::operator=(buf);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL& operator = (BufferRenderGL &&buf)
+ {
+ Buffer::operator=(std::move(buf));
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetGLObjectInfo().
+ cl_int getObjectInfo(
+ cl_gl_object_type *type,
+ cl_GLuint * gl_object_name)
+ {
+ return detail::errHandler(
+ ::clGetGLObjectInfo(object_,type,gl_object_name),
+ __GET_GL_OBJECT_INFO_ERR);
+ }
+};
+
+/*! \brief C++ base class for Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image : public Memory
+{
+protected:
+ //! \brief Default constructor - initializes to NULL.
+ Image() : Memory() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image(const cl_mem& image, bool retainObject = false) :
+ Memory(image, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image& operator = (const cl_mem& rhs)
+ {
+ Memory::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image(const Image& img) : Memory(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image& operator = (const Image &img)
+ {
+ Memory::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image(Image&& img) CL_HPP_NOEXCEPT_ : Memory(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image& operator = (Image &&img)
+ {
+ Memory::operator=(std::move(img));
+ return *this;
+ }
+
+
+public:
+ //! \brief Wrapper for clGetImageInfo().
+ template <typename T>
+ cl_int getImageInfo(cl_image_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetImageInfo, object_, name, param),
+ __GET_IMAGE_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetImageInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_image_info, name>::param_type
+ getImageInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_image_info, name>::param_type param;
+ cl_int result = getImageInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+};
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+/*! \brief Class interface for 1D Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image1D : public Image
+{
+public:
+ /*! \brief Constructs a 1D Image in a specified context.
+ *
+ * Wraps clCreateImage().
+ */
+ Image1D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ size_type width,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE1D,
+ width,
+ 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image1D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image1D(const cl_mem& image1D, bool retainObject = false) :
+ Image(image1D, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image1D& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D(const Image1D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D& operator = (const Image1D &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D(Image1D&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D& operator = (Image1D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+
+};
+
+/*! \class Image1DBuffer
+ * \brief Image interface for 1D buffer images.
+ */
+class Image1DBuffer : public Image
+{
+public:
+ Image1DBuffer(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ size_type width,
+ const Buffer &buffer,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE1D_BUFFER,
+ width,
+ 0, 0, 0, 0, 0, 0, 0,
+ buffer()
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ NULL,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image1DBuffer() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image1DBuffer(const cl_mem& image1D, bool retainObject = false) :
+ Image(image1D, retainObject) { }
+
+ Image1DBuffer& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer(const Image1DBuffer& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer& operator = (const Image1DBuffer &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer(Image1DBuffer&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer& operator = (Image1DBuffer &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+
+};
+
+/*! \class Image1DArray
+ * \brief Image interface for arrays of 1D images.
+ */
+class Image1DArray : public Image
+{
+public:
+ Image1DArray(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ size_type arraySize,
+ size_type width,
+ size_type rowPitch,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE1D_ARRAY,
+ width,
+ 0, 0, // height, depth (unused)
+ arraySize,
+ rowPitch,
+ 0, 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image1DArray() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image1DArray(const cl_mem& imageArray, bool retainObject = false) :
+ Image(imageArray, retainObject) { }
+
+
+ Image1DArray& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray(const Image1DArray& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray& operator = (const Image1DArray &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray(Image1DArray&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray& operator = (Image1DArray &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+
+};
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+
+/*! \brief Class interface for 2D Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image2D : public Image
+{
+public:
+ /*! \brief Constructs a 2D Image in a specified context.
+ *
+ * Wraps clCreateImage().
+ */
+ Image2D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ size_type width,
+ size_type height,
+ size_type row_pitch = 0,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ bool useCreateImage;
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
+ }
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 120
+ useCreateImage = true;
+#else
+ useCreateImage = false;
+#endif
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ if (useCreateImage)
+ {
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE2D,
+ width,
+ height,
+ 0, 0, // depth, array size (unused)
+ row_pitch,
+ 0, 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ if (!useCreateImage)
+ {
+ object_ = ::clCreateImage2D(
+ context(), flags,&format, width, height, row_pitch, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_IMAGE2D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ /*! \brief Constructs a 2D Image from a buffer.
+ * \note This will share storage with the underlying buffer.
+ *
+ * Wraps clCreateImage().
+ */
+ Image2D(
+ const Context& context,
+ ImageFormat format,
+ const Buffer &sourceBuffer,
+ size_type width,
+ size_type height,
+ size_type row_pitch = 0,
+ cl_int* err = nullptr)
+ {
+ cl_int error;
+
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE2D,
+ width,
+ height,
+ 0, 0, // depth, array size (unused)
+ row_pitch,
+ 0, 0, 0,
+ // Use buffer as input to image
+ sourceBuffer()
+ };
+ object_ = ::clCreateImage(
+ context(),
+ 0, // flags inherited from buffer
+ &format,
+ &desc,
+ nullptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != nullptr) {
+ *err = error;
+ }
+ }
+#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ /*! \brief Constructs a 2D Image from an image.
+ * \note This will share storage with the underlying image but may
+ * reinterpret the channel order and type.
+ *
+ * The image will be created matching with a descriptor matching the source.
+ *
+ * \param order is the channel order to reinterpret the image data as.
+ * The channel order may differ as described in the OpenCL
+ * 2.0 API specification.
+ *
+ * Wraps clCreateImage().
+ */
+ Image2D(
+ const Context& context,
+ cl_channel_order order,
+ const Image &sourceImage,
+ cl_int* err = nullptr)
+ {
+ cl_int error;
+
+ // Descriptor fields have to match source image
+ size_type sourceWidth =
+ sourceImage.getImageInfo<CL_IMAGE_WIDTH>();
+ size_type sourceHeight =
+ sourceImage.getImageInfo<CL_IMAGE_HEIGHT>();
+ size_type sourceRowPitch =
+ sourceImage.getImageInfo<CL_IMAGE_ROW_PITCH>();
+ cl_uint sourceNumMIPLevels =
+ sourceImage.getImageInfo<CL_IMAGE_NUM_MIP_LEVELS>();
+ cl_uint sourceNumSamples =
+ sourceImage.getImageInfo<CL_IMAGE_NUM_SAMPLES>();
+ cl_image_format sourceFormat =
+ sourceImage.getImageInfo<CL_IMAGE_FORMAT>();
+
+ // Update only the channel order.
+ // Channel format inherited from source.
+ sourceFormat.image_channel_order = order;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE2D,
+ sourceWidth,
+ sourceHeight,
+ 0, 0, // depth (unused), array size (unused)
+ sourceRowPitch,
+ 0, // slice pitch (unused)
+ sourceNumMIPLevels,
+ sourceNumSamples,
+ // Use buffer as input to image
+ sourceImage()
+ };
+ object_ = ::clCreateImage(
+ context(),
+ 0, // flags should be inherited from mem_object
+ &sourceFormat,
+ &desc,
+ nullptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != nullptr) {
+ *err = error;
+ }
+ }
+#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+ //! \brief Default constructor - initializes to NULL.
+ Image2D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image2D(const cl_mem& image2D, bool retainObject = false) :
+ Image(image2D, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image2D& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D(const Image2D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D& operator = (const Image2D &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D(Image2D&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D& operator = (Image2D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+
+};
+
+
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+/*! \brief Class interface for GL 2D Image Memory objects.
+ *
+ * This is provided to facilitate interoperability with OpenGL.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ * \note Deprecated for OpenCL 1.2. Please use ImageGL instead.
+ */
+class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED Image2DGL : public Image2D
+{
+public:
+ /*! \brief Constructs an Image2DGL in a specified context, from a given
+ * GL Texture.
+ *
+ * Wraps clCreateFromGLTexture2D().
+ */
+ Image2DGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture2D(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image2DGL() : Image2D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image2DGL(const cl_mem& image, bool retainObject = false) :
+ Image2D(image, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *c
+ * See Memory for further details.
+ */
+ Image2DGL& operator = (const cl_mem& rhs)
+ {
+ Image2D::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL(const Image2DGL& img) : Image2D(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL& operator = (const Image2DGL &img)
+ {
+ Image2D::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL(Image2DGL&& img) CL_HPP_NOEXCEPT_ : Image2D(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL& operator = (Image2DGL &&img)
+ {
+ Image2D::operator=(std::move(img));
+ return *this;
+ }
+
+} CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
+#endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+/*! \class Image2DArray
+ * \brief Image interface for arrays of 2D images.
+ */
+class Image2DArray : public Image
+{
+public:
+ Image2DArray(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ size_type arraySize,
+ size_type width,
+ size_type height,
+ size_type rowPitch,
+ size_type slicePitch,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE2D_ARRAY,
+ width,
+ height,
+ 0, // depth (unused)
+ arraySize,
+ rowPitch,
+ slicePitch,
+ 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image2DArray() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image2DArray(const cl_mem& imageArray, bool retainObject = false) : Image(imageArray, retainObject) { }
+
+ Image2DArray& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray(const Image2DArray& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray& operator = (const Image2DArray &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray(Image2DArray&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray& operator = (Image2DArray &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+};
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+/*! \brief Class interface for 3D Image Memory objects.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image3D : public Image
+{
+public:
+ /*! \brief Constructs a 3D Image in a specified context.
+ *
+ * Wraps clCreateImage().
+ */
+ Image3D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ size_type width,
+ size_type height,
+ size_type depth,
+ size_type row_pitch = 0,
+ size_type slice_pitch = 0,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ bool useCreateImage;
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
+ }
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 120
+ useCreateImage = true;
+#else
+ useCreateImage = false;
+#endif
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ if (useCreateImage)
+ {
+ cl_image_desc desc =
+ {
+ CL_MEM_OBJECT_IMAGE3D,
+ width,
+ height,
+ depth,
+ 0, // array size (unused)
+ row_pitch,
+ slice_pitch,
+ 0, 0, 0
+ };
+ object_ = ::clCreateImage(
+ context(),
+ flags,
+ &format,
+ &desc,
+ host_ptr,
+ &error);
+
+ detail::errHandler(error, __CREATE_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ if (!useCreateImage)
+ {
+ object_ = ::clCreateImage3D(
+ context(), flags, &format, width, height, depth, row_pitch,
+ slice_pitch, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_IMAGE3D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image3D() : Image() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image3D(const cl_mem& image3D, bool retainObject = false) :
+ Image(image3D, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image3D& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D(const Image3D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D& operator = (const Image3D &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D(Image3D&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D& operator = (Image3D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+};
+
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+/*! \brief Class interface for GL 3D Image Memory objects.
+ *
+ * This is provided to facilitate interoperability with OpenGL.
+ *
+ * See Memory for details about copy semantics, etc.
+ *
+ * \see Memory
+ */
+class Image3DGL : public Image3D
+{
+public:
+ /*! \brief Constructs an Image3DGL in a specified context, from a given
+ * GL Texture.
+ *
+ * Wraps clCreateFromGLTexture3D().
+ */
+ Image3DGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture3D(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Image3DGL() : Image3D() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit Image3DGL(const cl_mem& image, bool retainObject = false) :
+ Image3D(image, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Image3DGL& operator = (const cl_mem& rhs)
+ {
+ Image3D::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL(const Image3DGL& img) : Image3D(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL& operator = (const Image3DGL &img)
+ {
+ Image3D::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL(Image3DGL&& img) CL_HPP_NOEXCEPT_ : Image3D(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL& operator = (Image3DGL &&img)
+ {
+ Image3D::operator=(std::move(img));
+ return *this;
+ }
+};
+#endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+/*! \class ImageGL
+ * \brief general image interface for GL interop.
+ * We abstract the 2D and 3D GL images into a single instance here
+ * that wraps all GL sourced images on the grounds that setup information
+ * was performed by OpenCL anyway.
+ */
+class ImageGL : public Image
+{
+public:
+ ImageGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_TEXTURE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ ImageGL() : Image() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * See Memory for further details.
+ */
+ explicit ImageGL(const cl_mem& image, bool retainObject = false) :
+ Image(image, retainObject) { }
+
+ ImageGL& operator = (const cl_mem& rhs)
+ {
+ Image::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL(const ImageGL& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL& operator = (const ImageGL &img)
+ {
+ Image::operator=(img);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL(ImageGL&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL& operator = (ImageGL &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+};
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+/*! \brief Class interface for Pipe Memory Objects.
+*
+* See Memory for details about copy semantics, etc.
+*
+* \see Memory
+*/
+class Pipe : public Memory
+{
+public:
+
+ /*! \brief Constructs a Pipe in a specified context.
+ *
+ * Wraps clCreatePipe().
+ * @param context Context in which to create the pipe.
+ * @param flags Bitfield. Only CL_MEM_READ_WRITE and CL_MEM_HOST_NO_ACCESS are valid.
+ * @param packet_size Size in bytes of a single packet of the pipe.
+ * @param max_packets Number of packets that may be stored in the pipe.
+ *
+ */
+ Pipe(
+ const Context& context,
+ cl_uint packet_size,
+ cl_uint max_packets,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS;
+ object_ = ::clCreatePipe(context(), flags, packet_size, max_packets, nullptr, &error);
+
+ detail::errHandler(error, __CREATE_PIPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Constructs a Pipe in a the default context.
+ *
+ * Wraps clCreatePipe().
+ * @param flags Bitfield. Only CL_MEM_READ_WRITE and CL_MEM_HOST_NO_ACCESS are valid.
+ * @param packet_size Size in bytes of a single packet of the pipe.
+ * @param max_packets Number of packets that may be stored in the pipe.
+ *
+ */
+ Pipe(
+ cl_uint packet_size,
+ cl_uint max_packets,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ Context context = Context::getDefault(err);
+
+ cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS;
+ object_ = ::clCreatePipe(context(), flags, packet_size, max_packets, nullptr, &error);
+
+ detail::errHandler(error, __CREATE_PIPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+ Pipe() : Memory() { }
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with earlier versions.
+ *
+ * See Memory for further details.
+ */
+ explicit Pipe(const cl_mem& pipe, bool retainObject = false) :
+ Memory(pipe, retainObject) { }
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ Pipe& operator = (const cl_mem& rhs)
+ {
+ Memory::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Pipe(const Pipe& pipe) : Memory(pipe) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Pipe& operator = (const Pipe &pipe)
+ {
+ Memory::operator=(pipe);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Pipe(Pipe&& pipe) CL_HPP_NOEXCEPT_ : Memory(std::move(pipe)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Pipe& operator = (Pipe &&pipe)
+ {
+ Memory::operator=(std::move(pipe));
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetMemObjectInfo().
+ template <typename T>
+ cl_int getInfo(cl_pipe_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetPipeInfo, object_, name, param),
+ __GET_PIPE_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetMemObjectInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_pipe_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_pipe_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+}; // class Pipe
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+
+/*! \brief Class interface for cl_sampler.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_sampler as the original. For details, see
+ * clRetainSampler() and clReleaseSampler().
+ *
+ * \see cl_sampler
+ */
+class Sampler : public detail::Wrapper<cl_sampler>
+{
+public:
+ //! \brief Default constructor - initializes to NULL.
+ Sampler() { }
+
+ /*! \brief Constructs a Sampler in a specified context.
+ *
+ * Wraps clCreateSampler().
+ */
+ Sampler(
+ const Context& context,
+ cl_bool normalized_coords,
+ cl_addressing_mode addressing_mode,
+ cl_filter_mode filter_mode,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_sampler_properties sampler_properties[] = {
+ CL_SAMPLER_NORMALIZED_COORDS, normalized_coords,
+ CL_SAMPLER_ADDRESSING_MODE, addressing_mode,
+ CL_SAMPLER_FILTER_MODE, filter_mode,
+ 0 };
+ object_ = ::clCreateSamplerWithProperties(
+ context(),
+ sampler_properties,
+ &error);
+
+ detail::errHandler(error, __CREATE_SAMPLER_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#else
+ object_ = ::clCreateSampler(
+ context(),
+ normalized_coords,
+ addressing_mode,
+ filter_mode,
+ &error);
+
+ detail::errHandler(error, __CREATE_SAMPLER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#endif
+ }
+
+ /*! \brief Constructor from cl_sampler - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * This effectively transfers ownership of a refcount on the cl_sampler
+ * into the new Sampler object.
+ */
+ explicit Sampler(const cl_sampler& sampler, bool retainObject = false) :
+ detail::Wrapper<cl_type>(sampler, retainObject) { }
+
+ /*! \brief Assignment operator from cl_sampler - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseSampler() on the value previously held by this instance.
+ */
+ Sampler& operator = (const cl_sampler& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler(const Sampler& sam) : detail::Wrapper<cl_type>(sam) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler& operator = (const Sampler &sam)
+ {
+ detail::Wrapper<cl_type>::operator=(sam);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler(Sampler&& sam) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(sam)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler& operator = (Sampler &&sam)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(sam));
+ return *this;
+ }
+
+ //! \brief Wrapper for clGetSamplerInfo().
+ template <typename T>
+ cl_int getInfo(cl_sampler_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetSamplerInfo, object_, name, param),
+ __GET_SAMPLER_INFO_ERR);
+ }
+
+ //! \brief Wrapper for clGetSamplerInfo() that returns by value.
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_sampler_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_sampler_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+};
+
+class Program;
+class CommandQueue;
+class DeviceCommandQueue;
+class Kernel;
+
+//! \brief Class interface for specifying NDRange values.
+class NDRange
+{
+private:
+ size_type sizes_[3];
+ cl_uint dimensions_;
+
+public:
+ //! \brief Default constructor - resulting range has zero dimensions.
+ NDRange()
+ : dimensions_(0)
+ {
+ sizes_[0] = 0;
+ sizes_[1] = 0;
+ sizes_[2] = 0;
+ }
+
+ //! \brief Constructs one-dimensional range.
+ NDRange(size_type size0)
+ : dimensions_(1)
+ {
+ sizes_[0] = size0;
+ sizes_[1] = 1;
+ sizes_[2] = 1;
+ }
+
+ //! \brief Constructs two-dimensional range.
+ NDRange(size_type size0, size_type size1)
+ : dimensions_(2)
+ {
+ sizes_[0] = size0;
+ sizes_[1] = size1;
+ sizes_[2] = 1;
+ }
+
+ //! \brief Constructs three-dimensional range.
+ NDRange(size_type size0, size_type size1, size_type size2)
+ : dimensions_(3)
+ {
+ sizes_[0] = size0;
+ sizes_[1] = size1;
+ sizes_[2] = size2;
+ }
+
+ /*! \brief Conversion operator to const size_type *.
+ *
+ * \returns a pointer to the size of the first dimension.
+ */
+ operator const size_type*() const {
+ return sizes_;
+ }
+
+ //! \brief Queries the number of dimensions in the range.
+ size_type dimensions() const
+ {
+ return dimensions_;
+ }
+
+ //! \brief Returns the size of the object in bytes based on the
+ // runtime number of dimensions
+ size_type size() const
+ {
+ return dimensions_*sizeof(size_type);
+ }
+
+ size_type* get()
+ {
+ return sizes_;
+ }
+
+ const size_type* get() const
+ {
+ return sizes_;
+ }
+};
+
+//! \brief A zero-dimensional range.
+static const NDRange NullRange;
+
+//! \brief Local address wrapper for use with Kernel::setArg
+struct LocalSpaceArg
+{
+ size_type size_;
+};
+
+namespace detail {
+
+template <typename T, class Enable = void>
+struct KernelArgumentHandler;
+
+// Enable for objects that are not subclasses of memory
+// Pointers, constants etc
+template <typename T>
+struct KernelArgumentHandler<T, typename std::enable_if<!std::is_base_of<cl::Memory, T>::value>::type>
+{
+ static size_type size(const T&) { return sizeof(T); }
+ static const T* ptr(const T& value) { return &value; }
+};
+
+// Enable for subclasses of memory where we want to get a reference to the cl_mem out
+// and pass that in for safety
+template <typename T>
+struct KernelArgumentHandler<T, typename std::enable_if<std::is_base_of<cl::Memory, T>::value>::type>
+{
+ static size_type size(const T&) { return sizeof(cl_mem); }
+ static const cl_mem* ptr(const T& value) { return &(value()); }
+};
+
+// Specialization for DeviceCommandQueue defined later
+
+template <>
+struct KernelArgumentHandler<LocalSpaceArg, void>
+{
+ static size_type size(const LocalSpaceArg& value) { return value.size_; }
+ static const void* ptr(const LocalSpaceArg&) { return NULL; }
+};
+
+}
+//! \endcond
+
+/*! Local
+ * \brief Helper function for generating LocalSpaceArg objects.
+ */
+inline LocalSpaceArg
+Local(size_type size)
+{
+ LocalSpaceArg ret = { size };
+ return ret;
+}
+
+/*! \brief Class interface for cl_kernel.
+ *
+ * \note Copies of these objects are shallow, meaning that the copy will refer
+ * to the same underlying cl_kernel as the original. For details, see
+ * clRetainKernel() and clReleaseKernel().
+ *
+ * \see cl_kernel
+ */
+class Kernel : public detail::Wrapper<cl_kernel>
+{
+public:
+ inline Kernel(const Program& program, const char* name, cl_int* err = NULL);
+
+ //! \brief Default constructor - initializes to NULL.
+ Kernel() { }
+
+ /*! \brief Constructor from cl_kernel - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ * This effectively transfers ownership of a refcount on the cl_kernel
+ * into the new Kernel object.
+ */
+ explicit Kernel(const cl_kernel& kernel, bool retainObject = false) :
+ detail::Wrapper<cl_type>(kernel, retainObject) { }
+
+ /*! \brief Assignment operator from cl_kernel - takes ownership.
+ *
+ * This effectively transfers ownership of a refcount on the rhs and calls
+ * clReleaseKernel() on the value previously held by this instance.
+ */
+ Kernel& operator = (const cl_kernel& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel& operator = (const Kernel &kernel)
+ {
+ detail::Wrapper<cl_type>::operator=(kernel);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel(Kernel&& kernel) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(kernel)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel& operator = (Kernel &&kernel)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(kernel));
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_kernel_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetKernelInfo, object_, name, param),
+ __GET_KERNEL_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ template <typename T>
+ cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetKernelArgInfo, object_, argIndex, name, param),
+ __GET_KERNEL_ARG_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_arg_info, name>::param_type
+ getArgInfo(cl_uint argIndex, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_arg_info, name>::param_type param;
+ cl_int result = getArgInfo(argIndex, name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+ template <typename T>
+ cl_int getWorkGroupInfo(
+ const Device& device, cl_kernel_work_group_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetKernelWorkGroupInfo, object_, device(), name, param),
+ __GET_KERNEL_WORK_GROUP_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
+ getWorkGroupInfo(const Device& device, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_work_group_info, name>::param_type param;
+ cl_int result = getWorkGroupInfo(device, name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)
+ cl_int getSubGroupInfo(const cl::Device &dev, cl_kernel_sub_group_info name, const cl::NDRange &range, size_type* param) const
+ {
+ typedef clGetKernelSubGroupInfoKHR_fn PFN_clGetKernelSubGroupInfoKHR;
+ static PFN_clGetKernelSubGroupInfoKHR pfn_clGetKernelSubGroupInfoKHR = NULL;
+ CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetKernelSubGroupInfoKHR);
+
+ return detail::errHandler(
+ pfn_clGetKernelSubGroupInfoKHR(object_, dev(), name, range.size(), range.get(), sizeof(size_type), param, nullptr),
+ __GET_KERNEL_ARG_INFO_ERR);
+ }
+
+ template <cl_int name>
+ size_type getSubGroupInfo(const cl::Device &dev, const cl::NDRange &range, cl_int* err = NULL) const
+ {
+ size_type param;
+ cl_int result = getSubGroupInfo(dev, name, range, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+#endif // #if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ /*! \brief setArg overload taking a shared_ptr type
+ */
+ template<typename T, class D>
+ cl_int setArg(cl_uint index, const cl::pointer<T, D> &argPtr)
+ {
+ return detail::errHandler(
+ ::clSetKernelArgSVMPointer(object_, index, argPtr.get()),
+ __SET_KERNEL_ARGS_ERR);
+ }
+
+ /*! \brief setArg overload taking a vector type.
+ */
+ template<typename T, class Alloc>
+ cl_int setArg(cl_uint index, const cl::vector<T, Alloc> &argPtr)
+ {
+ return detail::errHandler(
+ ::clSetKernelArgSVMPointer(object_, index, argPtr.data()),
+ __SET_KERNEL_ARGS_ERR);
+ }
+
+ /*! \brief setArg overload taking a pointer type
+ */
+ template<typename T>
+ typename std::enable_if<std::is_pointer<T>::value, cl_int>::type
+ setArg(cl_uint index, const T argPtr)
+ {
+ return detail::errHandler(
+ ::clSetKernelArgSVMPointer(object_, index, argPtr),
+ __SET_KERNEL_ARGS_ERR);
+ }
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+ /*! \brief setArg overload taking a POD type
+ */
+ template <typename T>
+ typename std::enable_if<!std::is_pointer<T>::value, cl_int>::type
+ setArg(cl_uint index, const T &value)
+ {
+ return detail::errHandler(
+ ::clSetKernelArg(
+ object_,
+ index,
+ detail::KernelArgumentHandler<T>::size(value),
+ detail::KernelArgumentHandler<T>::ptr(value)),
+ __SET_KERNEL_ARGS_ERR);
+ }
+
+ cl_int setArg(cl_uint index, size_type size, const void* argPtr)
+ {
+ return detail::errHandler(
+ ::clSetKernelArg(object_, index, size, argPtr),
+ __SET_KERNEL_ARGS_ERR);
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ /*!
+ * Specify a vector of SVM pointers that the kernel may access in
+ * addition to its arguments.
+ */
+ cl_int setSVMPointers(const vector<void*> &pointerList)
+ {
+ return detail::errHandler(
+ ::clSetKernelExecInfo(
+ object_,
+ CL_KERNEL_EXEC_INFO_SVM_PTRS,
+ sizeof(void*)*pointerList.size(),
+ pointerList.data()));
+ }
+
+ /*!
+ * Specify a std::array of SVM pointers that the kernel may access in
+ * addition to its arguments.
+ */
+ template<int ArrayLength>
+ cl_int setSVMPointers(const std::array<void*, ArrayLength> &pointerList)
+ {
+ return detail::errHandler(
+ ::clSetKernelExecInfo(
+ object_,
+ CL_KERNEL_EXEC_INFO_SVM_PTRS,
+ sizeof(void*)*pointerList.size(),
+ pointerList.data()));
+ }
+
+ /*! \brief Enable fine-grained system SVM.
+ *
+ * \note It is only possible to enable fine-grained system SVM if all devices
+ * in the context associated with kernel support it.
+ *
+ * \param svmEnabled True if fine-grained system SVM is requested. False otherwise.
+ * \return CL_SUCCESS if the function was executed succesfully. CL_INVALID_OPERATION
+ * if no devices in the context support fine-grained system SVM.
+ *
+ * \see clSetKernelExecInfo
+ */
+ cl_int enableFineGrainedSystemSVM(bool svmEnabled)
+ {
+ cl_bool svmEnabled_ = svmEnabled ? CL_TRUE : CL_FALSE;
+ return detail::errHandler(
+ ::clSetKernelExecInfo(
+ object_,
+ CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM,
+ sizeof(cl_bool),
+ &svmEnabled_
+ )
+ );
+ }
+
+ template<int index, int ArrayLength, class D, typename T0, typename... Ts>
+ void setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, const pointer<T0, D> &t0, Ts... ts)
+ {
+ pointerList[index] = static_cast<void*>(t0.get());
+ setSVMPointersHelper<index + 1, Ts...>(ts...);
+ }
+
+ template<int index, int ArrayLength, typename T0, typename... Ts>
+ typename std::enable_if<std::is_pointer<T0>::value, void>::type
+ setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, T0 t0, Ts... ts)
+ {
+ pointerList[index] = static_cast<void*>(t0);
+ setSVMPointersHelper<index + 1, Ts...>(ts...);
+ }
+
+ template<int index, int ArrayLength, typename T0, class D>
+ void setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, const pointer<T0, D> &t0)
+ {
+ pointerList[index] = static_cast<void*>(t0.get());
+ }
+
+ template<int index, int ArrayLength, typename T0>
+ typename std::enable_if<std::is_pointer<T0>::value, void>::type
+ setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, T0 t0)
+ {
+ pointerList[index] = static_cast<void*>(t0);
+ }
+
+ template<typename T0, typename... Ts>
+ cl_int setSVMPointers(const T0 &t0, Ts... ts)
+ {
+ std::array<void*, 1 + sizeof...(Ts)> pointerList;
+
+ setSVMPointersHelper<0, 1 + sizeof...(Ts)>(pointerList, t0, ts...);
+ return detail::errHandler(
+ ::clSetKernelExecInfo(
+ object_,
+ CL_KERNEL_EXEC_INFO_SVM_PTRS,
+ sizeof(void*)*(1 + sizeof...(Ts)),
+ pointerList.data()));
+ }
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+};
+
+/*! \class Program
+ * \brief Program interface that implements cl_program.
+ */
+class Program : public detail::Wrapper<cl_program>
+{
+public:
+#if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ typedef vector<vector<unsigned char>> Binaries;
+ typedef vector<string> Sources;
+#else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ typedef vector<std::pair<const void*, size_type> > Binaries;
+ typedef vector<std::pair<const char*, size_type> > Sources;
+#endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+
+ Program(
+ const string& source,
+ bool build = false,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const char * strings = source.c_str();
+ const size_type length = source.size();
+
+ Context context = Context::getDefault(err);
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)1, &strings, &length, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+
+ if (error == CL_SUCCESS && build) {
+
+ error = ::clBuildProgram(
+ object_,
+ 0,
+ NULL,
+#if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
+ "-cl-std=CL2.0",
+#else
+ "",
+#endif // #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
+ NULL,
+ NULL);
+
+ detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
+ }
+
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Program(
+ const Context& context,
+ const string& source,
+ bool build = false,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const char * strings = source.c_str();
+ const size_type length = source.size();
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)1, &strings, &length, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+
+ if (error == CL_SUCCESS && build) {
+ error = ::clBuildProgram(
+ object_,
+ 0,
+ NULL,
+#if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
+ "-cl-std=CL2.0",
+#else
+ "",
+#endif // #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
+ NULL,
+ NULL);
+
+ detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
+ }
+
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /**
+ * Create a program from a vector of source strings and the default context.
+ * Does not compile or link the program.
+ */
+ Program(
+ const Sources& sources,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ Context context = Context::getDefault(err);
+
+ const size_type n = (size_type)sources.size();
+
+ vector<size_type> lengths(n);
+ vector<const char*> strings(n);
+
+ for (size_type i = 0; i < n; ++i) {
+#if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ strings[i] = sources[(int)i].data();
+ lengths[i] = sources[(int)i].length();
+#else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ strings[i] = sources[(int)i].first;
+ lengths[i] = sources[(int)i].second;
+#endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ }
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)n, strings.data(), lengths.data(), &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /**
+ * Create a program from a vector of source strings and a provided context.
+ * Does not compile or link the program.
+ */
+ Program(
+ const Context& context,
+ const Sources& sources,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const size_type n = (size_type)sources.size();
+
+ vector<size_type> lengths(n);
+ vector<const char*> strings(n);
+
+ for (size_type i = 0; i < n; ++i) {
+#if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ strings[i] = sources[(int)i].data();
+ lengths[i] = sources[(int)i].length();
+#else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ strings[i] = sources[(int)i].first;
+ lengths[i] = sources[(int)i].second;
+#endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ }
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)n, strings.data(), lengths.data(), &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /**
+ * Construct a program object from a list of devices and a per-device list of binaries.
+ * \param context A valid OpenCL context in which to construct the program.
+ * \param devices A vector of OpenCL device objects for which the program will be created.
+ * \param binaries A vector of pairs of a pointer to a binary object and its length.
+ * \param binaryStatus An optional vector that on completion will be resized to
+ * match the size of binaries and filled with values to specify if each binary
+ * was successfully loaded.
+ * Set to CL_SUCCESS if the binary was successfully loaded.
+ * Set to CL_INVALID_VALUE if the length is 0 or the binary pointer is NULL.
+ * Set to CL_INVALID_BINARY if the binary provided is not valid for the matching device.
+ * \param err if non-NULL will be set to CL_SUCCESS on successful operation or one of the following errors:
+ * CL_INVALID_CONTEXT if context is not a valid context.
+ * CL_INVALID_VALUE if the length of devices is zero; or if the length of binaries does not match the length of devices;
+ * or if any entry in binaries is NULL or has length 0.
+ * CL_INVALID_DEVICE if OpenCL devices listed in devices are not in the list of devices associated with context.
+ * CL_INVALID_BINARY if an invalid program binary was encountered for any device. binaryStatus will return specific status for each device.
+ * CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
+ */
+ Program(
+ const Context& context,
+ const vector<Device>& devices,
+ const Binaries& binaries,
+ vector<cl_int>* binaryStatus = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const size_type numDevices = devices.size();
+
+ // Catch size mismatch early and return
+ if(binaries.size() != numDevices) {
+ error = CL_INVALID_VALUE;
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return;
+ }
+
+
+ vector<size_type> lengths(numDevices);
+ vector<const unsigned char*> images(numDevices);
+#if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ for (size_type i = 0; i < numDevices; ++i) {
+ images[i] = binaries[i].data();
+ lengths[i] = binaries[(int)i].size();
+ }
+#else // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+ for (size_type i = 0; i < numDevices; ++i) {
+ images[i] = (const unsigned char*)binaries[i].first;
+ lengths[i] = binaries[(int)i].second;
+ }
+#endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
+
+ vector<cl_device_id> deviceIDs(numDevices);
+ for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ if(binaryStatus) {
+ binaryStatus->resize(numDevices);
+ }
+
+ object_ = ::clCreateProgramWithBinary(
+ context(), (cl_uint) devices.size(),
+ deviceIDs.data(),
+ lengths.data(), images.data(), (binaryStatus != NULL && numDevices > 0)
+ ? &binaryStatus->front()
+ : NULL, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ /**
+ * Create program using builtin kernels.
+ * \param kernelNames Semi-colon separated list of builtin kernel names
+ */
+ Program(
+ const Context& context,
+ const vector<Device>& devices,
+ const string& kernelNames,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+
+ size_type numDevices = devices.size();
+ vector<cl_device_id> deviceIDs(numDevices);
+ for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ object_ = ::clCreateProgramWithBuiltInKernels(
+ context(),
+ (cl_uint) devices.size(),
+ deviceIDs.data(),
+ kernelNames.c_str(),
+ &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+ Program() { }
+
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ */
+ explicit Program(const cl_program& program, bool retainObject = false) :
+ detail::Wrapper<cl_type>(program, retainObject) { }
+
+ Program& operator = (const cl_program& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program(const Program& program) : detail::Wrapper<cl_type>(program) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program& operator = (const Program &program)
+ {
+ detail::Wrapper<cl_type>::operator=(program);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program(Program&& program) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(program)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program& operator = (Program &&program)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(program));
+ return *this;
+ }
+
+ cl_int build(
+ const vector<Device>& devices,
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL) const
+ {
+ size_type numDevices = devices.size();
+ vector<cl_device_id> deviceIDs(numDevices);
+
+ for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
+ deviceIDs[deviceIndex] = (devices[deviceIndex])();
+ }
+
+ cl_int buildError = ::clBuildProgram(
+ object_,
+ (cl_uint)
+ devices.size(),
+ deviceIDs.data(),
+ options,
+ notifyFptr,
+ data);
+
+ return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
+ }
+
+ cl_int build(
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL) const
+ {
+ cl_int buildError = ::clBuildProgram(
+ object_,
+ 0,
+ NULL,
+ options,
+ notifyFptr,
+ data);
+
+
+ return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ cl_int compile(
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL) const
+ {
+ cl_int error = ::clCompileProgram(
+ object_,
+ 0,
+ NULL,
+ options,
+ 0,
+ NULL,
+ NULL,
+ notifyFptr,
+ data);
+ return detail::buildErrHandler(error, __COMPILE_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+ template <typename T>
+ cl_int getInfo(cl_program_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetProgramInfo, object_, name, param),
+ __GET_PROGRAM_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_program_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_program_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ template <typename T>
+ cl_int getBuildInfo(
+ const Device& device, cl_program_build_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetProgramBuildInfo, object_, device(), name, param),
+ __GET_PROGRAM_BUILD_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_program_build_info, name>::param_type
+ getBuildInfo(const Device& device, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_program_build_info, name>::param_type param;
+ cl_int result = getBuildInfo(device, name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /**
+ * Build info function that returns a vector of device/info pairs for the specified
+ * info type and for all devices in the program.
+ * On an error reading the info for any device, an empty vector of info will be returned.
+ */
+ template <cl_int name>
+ vector<std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, name>::param_type>>
+ getBuildInfo(cl_int *err = NULL) const
+ {
+ cl_int result = CL_SUCCESS;
+
+ auto devs = getInfo<CL_PROGRAM_DEVICES>(&result);
+ vector<std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, name>::param_type>>
+ devInfo;
+
+ // If there was an initial error from getInfo return the error
+ if (result != CL_SUCCESS) {
+ if (err != NULL) {
+ *err = result;
+ }
+ return devInfo;
+ }
+
+ for (cl::Device d : devs) {
+ typename detail::param_traits<
+ detail::cl_program_build_info, name>::param_type param;
+ result = getBuildInfo(d, name, &param);
+ devInfo.push_back(
+ std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, name>::param_type>
+ (d, param));
+ if (result != CL_SUCCESS) {
+ // On error, leave the loop and return the error code
+ break;
+ }
+ }
+ if (err != NULL) {
+ *err = result;
+ }
+ if (result != CL_SUCCESS) {
+ devInfo.clear();
+ }
+ return devInfo;
+ }
+
+ cl_int createKernels(vector<Kernel>* kernels)
+ {
+ cl_uint numKernels;
+ cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
+ }
+
+ vector<cl_kernel> value(numKernels);
+
+ err = ::clCreateKernelsInProgram(
+ object_, numKernels, value.data(), NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
+ }
+
+ if (kernels) {
+ kernels->resize(value.size());
+
+ // Assign to param, constructing with retain behaviour
+ // to correctly capture each underlying CL object
+ for (size_type i = 0; i < value.size(); i++) {
+ // We do not need to retain because this kernel is being created
+ // by the runtime
+ (*kernels)[i] = Kernel(value[i], false);
+ }
+ }
+ return CL_SUCCESS;
+ }
+};
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+inline Program linkProgram(
+ Program input1,
+ Program input2,
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+{
+ cl_int error_local = CL_SUCCESS;
+
+ cl_program programs[2] = { input1(), input2() };
+
+ Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>(&error_local);
+ if(error_local!=CL_SUCCESS) {
+ detail::errHandler(error_local, __LINK_PROGRAM_ERR);
+ }
+
+ cl_program prog = ::clLinkProgram(
+ ctx(),
+ 0,
+ NULL,
+ options,
+ 2,
+ programs,
+ notifyFptr,
+ data,
+ &error_local);
+
+ detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
+ if (err != NULL) {
+ *err = error_local;
+ }
+
+ return Program(prog);
+}
+
+inline Program linkProgram(
+ vector<Program> inputPrograms,
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+{
+ cl_int error_local = CL_SUCCESS;
+
+ vector<cl_program> programs(inputPrograms.size());
+
+ for (unsigned int i = 0; i < inputPrograms.size(); i++) {
+ programs[i] = inputPrograms[i]();
+ }
+
+ Context ctx;
+ if(inputPrograms.size() > 0) {
+ ctx = inputPrograms[0].getInfo<CL_PROGRAM_CONTEXT>(&error_local);
+ if(error_local!=CL_SUCCESS) {
+ detail::errHandler(error_local, __LINK_PROGRAM_ERR);
+ }
+ }
+ cl_program prog = ::clLinkProgram(
+ ctx(),
+ 0,
+ NULL,
+ options,
+ (cl_uint)inputPrograms.size(),
+ programs.data(),
+ notifyFptr,
+ data,
+ &error_local);
+
+ detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
+ if (err != NULL) {
+ *err = error_local;
+ }
+
+ return Program(prog, false);
+}
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+// Template specialization for CL_PROGRAM_BINARIES
+template <>
+inline cl_int cl::Program::getInfo(cl_program_info name, vector<vector<unsigned char>>* param) const
+{
+ if (name != CL_PROGRAM_BINARIES) {
+ return CL_INVALID_VALUE;
+ }
+ if (param) {
+ // Resize the parameter array appropriately for each allocation
+ // and pass down to the helper
+
+ vector<size_type> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>();
+ size_type numBinaries = sizes.size();
+
+ // Resize the parameter array and constituent arrays
+ param->resize(numBinaries);
+ for (size_type i = 0; i < numBinaries; ++i) {
+ (*param)[i].resize(sizes[i]);
+ }
+
+ return detail::errHandler(
+ detail::getInfo(&::clGetProgramInfo, object_, name, param),
+ __GET_PROGRAM_INFO_ERR);
+ }
+
+ return CL_SUCCESS;
+}
+
+template<>
+inline vector<vector<unsigned char>> cl::Program::getInfo<CL_PROGRAM_BINARIES>(cl_int* err) const
+{
+ vector<vector<unsigned char>> binariesVectors;
+
+ cl_int result = getInfo(CL_PROGRAM_BINARIES, &binariesVectors);
+ if (err != NULL) {
+ *err = result;
+ }
+ return binariesVectors;
+}
+
+inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
+{
+ cl_int error;
+
+ object_ = ::clCreateKernel(program(), name, &error);
+ detail::errHandler(error, __CREATE_KERNEL_ERR);
+
+ if (err != NULL) {
+ *err = error;
+ }
+
+}
+
+enum class QueueProperties : cl_command_queue_properties
+{
+ None = 0,
+ Profiling = CL_QUEUE_PROFILING_ENABLE,
+ OutOfOrder = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
+};
+
+inline QueueProperties operator|(QueueProperties lhs, QueueProperties rhs)
+{
+ return static_cast<QueueProperties>(static_cast<cl_command_queue_properties>(lhs) | static_cast<cl_command_queue_properties>(rhs));
+}
+
+/*! \class CommandQueue
+ * \brief CommandQueue interface for cl_command_queue.
+ */
+class CommandQueue : public detail::Wrapper<cl_command_queue>
+{
+private:
+ static std::once_flag default_initialized_;
+ static CommandQueue default_;
+ static cl_int default_error_;
+
+ /*! \brief Create the default command queue returned by @ref getDefault.
+ *
+ * It sets default_error_ to indicate success or failure. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefault()
+ {
+ /* We don't want to throw an error from this function, so we have to
+ * catch and set the error flag.
+ */
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ try
+#endif
+ {
+ int error;
+ Context context = Context::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ default_error_ = error;
+ }
+ else {
+ Device device = Device::getDefault();
+ default_ = CommandQueue(context, device, 0, &default_error_);
+ }
+ }
+#if defined(CL_HPP_ENABLE_EXCEPTIONS)
+ catch (cl::Error &e) {
+ default_error_ = e.err();
+ }
+#endif
+ }
+
+ /*! \brief Create the default command queue.
+ *
+ * This sets @c default_. It does not throw
+ * @c cl::Error.
+ */
+ static void makeDefaultProvided(const CommandQueue &c) {
+ default_ = c;
+ }
+
+public:
+#ifdef CL_HPP_UNIT_TEST_ENABLE
+ /*! \brief Reset the default.
+ *
+ * This sets @c default_ to an empty value to support cleanup in
+ * the unit test framework.
+ * This function is not thread safe.
+ */
+ static void unitTestClearDefault() {
+ default_ = CommandQueue();
+ }
+#endif // #ifdef CL_HPP_UNIT_TEST_ENABLE
+
+
+ /*!
+ * \brief Constructs a CommandQueue based on passed properties.
+ * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified.
+ */
+ CommandQueue(
+ cl_command_queue_properties properties,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ Context context = Context::getDefault(&error);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS) {
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ else {
+ Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties, 0 };
+ if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+ }
+ else {
+ error = CL_INVALID_QUEUE_PROPERTIES;
+ }
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#else
+ object_ = ::clCreateCommandQueue(
+ context(), device(), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#endif
+ }
+ }
+
+ /*!
+ * \brief Constructs a CommandQueue based on passed properties.
+ * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified.
+ */
+ CommandQueue(
+ QueueProperties properties,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ Context context = Context::getDefault(&error);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS) {
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+ else {
+ Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
+
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#else
+ object_ = ::clCreateCommandQueue(
+ context(), device(), static_cast<cl_command_queue_properties>(properties), &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#endif
+ }
+ }
+
+ /*!
+ * \brief Constructs a CommandQueue for an implementation defined device in the given context
+ * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified.
+ */
+ explicit CommandQueue(
+ const Context& context,
+ cl_command_queue_properties properties = 0,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ vector<cl::Device> devices;
+ error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
+
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS)
+ {
+ if (err != NULL) {
+ *err = error;
+ }
+ return;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties, 0 };
+ if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), devices[0](), queue_properties, &error);
+ }
+ else {
+ error = CL_INVALID_QUEUE_PROPERTIES;
+ }
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#else
+ object_ = ::clCreateCommandQueue(
+ context(), devices[0](), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#endif
+
+ }
+
+ /*!
+ * \brief Constructs a CommandQueue for an implementation defined device in the given context
+ * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified.
+ */
+ explicit CommandQueue(
+ const Context& context,
+ QueueProperties properties,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ vector<cl::Device> devices;
+ error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
+
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
+
+ if (error != CL_SUCCESS)
+ {
+ if (err != NULL) {
+ *err = error;
+ }
+ return;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), devices[0](), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#else
+ object_ = ::clCreateCommandQueue(
+ context(), devices[0](), static_cast<cl_command_queue_properties>(properties), &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#endif
+
+ }
+
+ /*!
+ * \brief Constructs a CommandQueue for a passed device and context
+ * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified.
+ */
+ CommandQueue(
+ const Context& context,
+ const Device& device,
+ cl_command_queue_properties properties = 0,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties, 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#else
+ object_ = ::clCreateCommandQueue(
+ context(), device(), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#endif
+ }
+
+ /*!
+ * \brief Constructs a CommandQueue for a passed device and context
+ * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified.
+ */
+ CommandQueue(
+ const Context& context,
+ const Device& device,
+ QueueProperties properties,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#else
+ object_ = ::clCreateCommandQueue(
+ context(), device(), static_cast<cl_command_queue_properties>(properties), &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+#endif
+ }
+
+ static CommandQueue getDefault(cl_int * err = NULL)
+ {
+ std::call_once(default_initialized_, makeDefault);
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ detail::errHandler(default_error_, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+#else // CL_HPP_TARGET_OPENCL_VERSION >= 200
+ detail::errHandler(default_error_, __CREATE_COMMAND_QUEUE_ERR);
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+ if (err != NULL) {
+ *err = default_error_;
+ }
+ return default_;
+ }
+
+ /**
+ * Modify the default command queue to be used by
+ * subsequent operations.
+ * Will only set the default if no default was previously created.
+ * @return updated default command queue.
+ * Should be compared to the passed value to ensure that it was updated.
+ */
+ static CommandQueue setDefault(const CommandQueue &default_queue)
+ {
+ std::call_once(default_initialized_, makeDefaultProvided, std::cref(default_queue));
+ detail::errHandler(default_error_);
+ return default_;
+ }
+
+ CommandQueue() { }
+
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ */
+ explicit CommandQueue(const cl_command_queue& commandQueue, bool retainObject = false) :
+ detail::Wrapper<cl_type>(commandQueue, retainObject) { }
+
+ CommandQueue& operator = (const cl_command_queue& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue(const CommandQueue& queue) : detail::Wrapper<cl_type>(queue) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue& operator = (const CommandQueue &queue)
+ {
+ detail::Wrapper<cl_type>::operator=(queue);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue(CommandQueue&& queue) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(queue)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue& operator = (CommandQueue &&queue)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(queue));
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_command_queue_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetCommandQueueInfo, object_, name, param),
+ __GET_COMMAND_QUEUE_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_command_queue_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_command_queue_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int enqueueReadBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ size_type offset,
+ size_type size,
+ void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReadBuffer(
+ object_, buffer(), blocking, offset, size,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_READ_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueWriteBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ size_type offset,
+ size_type size,
+ const void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueWriteBuffer(
+ object_, buffer(), blocking, offset, size,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_WRITE_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyBuffer(
+ const Buffer& src,
+ const Buffer& dst,
+ size_type src_offset,
+ size_type dst_offset,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyBuffer(
+ object_, src(), dst(), src_offset, dst_offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQEUE_COPY_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueReadBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const array<size_type, 3>& buffer_offset,
+ const array<size_type, 3>& host_offset,
+ const array<size_type, 3>& region,
+ size_type buffer_row_pitch,
+ size_type buffer_slice_pitch,
+ size_type host_row_pitch,
+ size_type host_slice_pitch,
+ void *ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReadBufferRect(
+ object_,
+ buffer(),
+ blocking,
+ buffer_offset.data(),
+ host_offset.data(),
+ region.data(),
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_READ_BUFFER_RECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueWriteBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const array<size_type, 3>& buffer_offset,
+ const array<size_type, 3>& host_offset,
+ const array<size_type, 3>& region,
+ size_type buffer_row_pitch,
+ size_type buffer_slice_pitch,
+ size_type host_row_pitch,
+ size_type host_slice_pitch,
+ const void *ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueWriteBufferRect(
+ object_,
+ buffer(),
+ blocking,
+ buffer_offset.data(),
+ host_offset.data(),
+ region.data(),
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_WRITE_BUFFER_RECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyBufferRect(
+ const Buffer& src,
+ const Buffer& dst,
+ const array<size_type, 3>& src_origin,
+ const array<size_type, 3>& dst_origin,
+ const array<size_type, 3>& region,
+ size_type src_row_pitch,
+ size_type src_slice_pitch,
+ size_type dst_row_pitch,
+ size_type dst_slice_pitch,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyBufferRect(
+ object_,
+ src(),
+ dst(),
+ src_origin.data(),
+ dst_origin.data(),
+ region.data(),
+ src_row_pitch,
+ src_slice_pitch,
+ dst_row_pitch,
+ dst_slice_pitch,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQEUE_COPY_BUFFER_RECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ /**
+ * Enqueue a command to fill a buffer object with a pattern
+ * of a given size. The pattern is specified as a vector type.
+ * \tparam PatternType The datatype of the pattern field.
+ * The pattern type must be an accepted OpenCL data type.
+ * \tparam offset Is the offset in bytes into the buffer at
+ * which to start filling. This must be a multiple of
+ * the pattern size.
+ * \tparam size Is the size in bytes of the region to fill.
+ * This must be a multiple of the pattern size.
+ */
+ template<typename PatternType>
+ cl_int enqueueFillBuffer(
+ const Buffer& buffer,
+ PatternType pattern,
+ size_type offset,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillBuffer(
+ object_,
+ buffer(),
+ static_cast<void*>(&pattern),
+ sizeof(PatternType),
+ offset,
+ size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+ cl_int enqueueReadImage(
+ const Image& image,
+ cl_bool blocking,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ size_type row_pitch,
+ size_type slice_pitch,
+ void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReadImage(
+ object_,
+ image(),
+ blocking,
+ origin.data(),
+ region.data(),
+ row_pitch,
+ slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_READ_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueWriteImage(
+ const Image& image,
+ cl_bool blocking,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ size_type row_pitch,
+ size_type slice_pitch,
+ const void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueWriteImage(
+ object_,
+ image(),
+ blocking,
+ origin.data(),
+ region.data(),
+ row_pitch,
+ slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_WRITE_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyImage(
+ const Image& src,
+ const Image& dst,
+ const array<size_type, 3>& src_origin,
+ const array<size_type, 3>& dst_origin,
+ const array<size_type, 3>& region,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyImage(
+ object_,
+ src(),
+ dst(),
+ src_origin.data(),
+ dst_origin.data(),
+ region.data(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_COPY_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ /**
+ * Enqueue a command to fill an image object with a specified color.
+ * \param fillColor is the color to use to fill the image.
+ * This is a four component RGBA floating-point color value if
+ * the image channel data type is not an unnormalized signed or
+ * unsigned data type.
+ */
+ cl_int enqueueFillImage(
+ const Image& image,
+ cl_float4 fillColor,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillImage(
+ object_,
+ image(),
+ static_cast<void*>(&fillColor),
+ origin.data(),
+ region.data(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueue a command to fill an image object with a specified color.
+ * \param fillColor is the color to use to fill the image.
+ * This is a four component RGBA signed integer color value if
+ * the image channel data type is an unnormalized signed integer
+ * type.
+ */
+ cl_int enqueueFillImage(
+ const Image& image,
+ cl_int4 fillColor,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillImage(
+ object_,
+ image(),
+ static_cast<void*>(&fillColor),
+ origin.data(),
+ region.data(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueue a command to fill an image object with a specified color.
+ * \param fillColor is the color to use to fill the image.
+ * This is a four component RGBA unsigned integer color value if
+ * the image channel data type is an unnormalized unsigned integer
+ * type.
+ */
+ cl_int enqueueFillImage(
+ const Image& image,
+ cl_uint4 fillColor,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueFillImage(
+ object_,
+ image(),
+ static_cast<void*>(&fillColor),
+ origin.data(),
+ region.data(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_FILL_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+ cl_int enqueueCopyImageToBuffer(
+ const Image& src,
+ const Buffer& dst,
+ const array<size_type, 3>& src_origin,
+ const array<size_type, 3>& region,
+ size_type dst_offset,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyImageToBuffer(
+ object_,
+ src(),
+ dst(),
+ src_origin.data(),
+ region.data(),
+ dst_offset,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueCopyBufferToImage(
+ const Buffer& src,
+ const Image& dst,
+ size_type src_offset,
+ const array<size_type, 3>& dst_origin,
+ const array<size_type, 3>& region,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueCopyBufferToImage(
+ object_,
+ src(),
+ dst(),
+ src_offset,
+ dst_origin.data(),
+ region.data(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ void* enqueueMapBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ size_type offset,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL) const
+ {
+ cl_event tmp;
+ cl_int error;
+ void * result = ::clEnqueueMapBuffer(
+ object_, buffer(), blocking, flags, offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ if (event != NULL && error == CL_SUCCESS)
+ *event = tmp;
+
+ return result;
+ }
+
+ void* enqueueMapImage(
+ const Image& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ size_type * row_pitch,
+ size_type * slice_pitch,
+ const vector<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL) const
+ {
+ cl_event tmp;
+ cl_int error;
+ void * result = ::clEnqueueMapImage(
+ object_, buffer(), blocking, flags,
+ origin.data(),
+ region.data(),
+ row_pitch, slice_pitch,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ if (event != NULL && error == CL_SUCCESS)
+ *event = tmp;
+ return result;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ /**
+ * Enqueues a command that will allow the host to update a region of a coarse-grained SVM buffer.
+ * This variant takes a raw SVM pointer.
+ */
+ template<typename T>
+ cl_int enqueueMapSVM(
+ T* ptr,
+ cl_bool blocking,
+ cl_map_flags flags,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(::clEnqueueSVMMap(
+ object_, blocking, flags, static_cast<void*>(ptr), size,
+ (events != NULL) ? (cl_uint)events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_MAP_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+
+ /**
+ * Enqueues a command that will allow the host to update a region of a coarse-grained SVM buffer.
+ * This variant takes a cl::pointer instance.
+ */
+ template<typename T, class D>
+ cl_int enqueueMapSVM(
+ cl::pointer<T, D> &ptr,
+ cl_bool blocking,
+ cl_map_flags flags,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(::clEnqueueSVMMap(
+ object_, blocking, flags, static_cast<void*>(ptr.get()), size,
+ (events != NULL) ? (cl_uint)events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_MAP_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueues a command that will allow the host to update a region of a coarse-grained SVM buffer.
+ * This variant takes a cl::vector instance.
+ */
+ template<typename T, class Alloc>
+ cl_int enqueueMapSVM(
+ cl::vector<T, Alloc> &container,
+ cl_bool blocking,
+ cl_map_flags flags,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(::clEnqueueSVMMap(
+ object_, blocking, flags, static_cast<void*>(container.data()), container.size(),
+ (events != NULL) ? (cl_uint)events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_MAP_BUFFER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+ cl_int enqueueUnmapMemObject(
+ const Memory& memory,
+ void* mapped_ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueUnmapMemObject(
+ object_, memory(), mapped_ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ /**
+ * Enqueues a command that will release a coarse-grained SVM buffer back to the OpenCL runtime.
+ * This variant takes a raw SVM pointer.
+ */
+ template<typename T>
+ cl_int enqueueUnmapSVM(
+ T* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueSVMUnmap(
+ object_, static_cast<void*>(ptr),
+ (events != NULL) ? (cl_uint)events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueues a command that will release a coarse-grained SVM buffer back to the OpenCL runtime.
+ * This variant takes a cl::pointer instance.
+ */
+ template<typename T, class D>
+ cl_int enqueueUnmapSVM(
+ cl::pointer<T, D> &ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueSVMUnmap(
+ object_, static_cast<void*>(ptr.get()),
+ (events != NULL) ? (cl_uint)events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueues a command that will release a coarse-grained SVM buffer back to the OpenCL runtime.
+ * This variant takes a cl::vector instance.
+ */
+ template<typename T, class Alloc>
+ cl_int enqueueUnmapSVM(
+ cl::vector<T, Alloc> &container,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueSVMUnmap(
+ object_, static_cast<void*>(container.data()),
+ (events != NULL) ? (cl_uint)events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ /**
+ * Enqueues a marker command which waits for either a list of events to complete,
+ * or all previously enqueued commands to complete.
+ *
+ * Enqueues a marker command which waits for either a list of events to complete,
+ * or if the list is empty it waits for all commands previously enqueued in command_queue
+ * to complete before it completes. This command returns an event which can be waited on,
+ * i.e. this event can be waited on to insure that all events either in the event_wait_list
+ * or all previously enqueued commands, queued before this command to command_queue,
+ * have completed.
+ */
+ cl_int enqueueMarkerWithWaitList(
+ const vector<Event> *events = 0,
+ Event *event = 0)
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueMarkerWithWaitList(
+ object_,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_MARKER_WAIT_LIST_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * A synchronization point that enqueues a barrier operation.
+ *
+ * Enqueues a barrier command which waits for either a list of events to complete,
+ * or if the list is empty it waits for all commands previously enqueued in command_queue
+ * to complete before it completes. This command blocks command execution, that is, any
+ * following commands enqueued after it do not execute until it completes. This command
+ * returns an event which can be waited on, i.e. this event can be waited on to insure that
+ * all events either in the event_wait_list or all previously enqueued commands, queued
+ * before this command to command_queue, have completed.
+ */
+ cl_int enqueueBarrierWithWaitList(
+ const vector<Event> *events = 0,
+ Event *event = 0)
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueBarrierWithWaitList(
+ object_,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_BARRIER_WAIT_LIST_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ /**
+ * Enqueues a command to indicate with which device a set of memory objects
+ * should be associated.
+ */
+ cl_int enqueueMigrateMemObjects(
+ const vector<Memory> &memObjects,
+ cl_mem_migration_flags flags,
+ const vector<Event>* events = NULL,
+ Event* event = NULL
+ )
+ {
+ cl_event tmp;
+
+ vector<cl_mem> localMemObjects(memObjects.size());
+
+ for( int i = 0; i < (int)memObjects.size(); ++i ) {
+ localMemObjects[i] = memObjects[i]();
+ }
+
+
+ cl_int err = detail::errHandler(
+ ::clEnqueueMigrateMemObjects(
+ object_,
+ (cl_uint)memObjects.size(),
+ localMemObjects.data(),
+ flags,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+
+ cl_int enqueueNDRangeKernel(
+ const Kernel& kernel,
+ const NDRange& offset,
+ const NDRange& global,
+ const NDRange& local = NullRange,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueNDRangeKernel(
+ object_, kernel(), (cl_uint) global.dimensions(),
+ offset.dimensions() != 0 ? (const size_type*) offset : NULL,
+ (const size_type*) global,
+ local.dimensions() != 0 ? (const size_type*) local : NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_NDRANGE_KERNEL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
+ CL_EXT_PREFIX__VERSION_1_2_DEPRECATED cl_int enqueueTask(
+ const Kernel& kernel,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueTask(
+ object_, kernel(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_TASK_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
+
+ cl_int enqueueNativeKernel(
+ void (CL_CALLBACK *userFptr)(void *),
+ std::pair<void*, size_type> args,
+ const vector<Memory>* mem_objects = NULL,
+ const vector<const void*>* mem_locs = NULL,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ size_type elements = 0;
+ if (mem_objects != NULL) {
+ elements = mem_objects->size();
+ }
+ vector<cl_mem> mems(elements);
+ for (unsigned int i = 0; i < elements; i++) {
+ mems[i] = ((*mem_objects)[i])();
+ }
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueNativeKernel(
+ object_, userFptr, args.first, args.second,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ mems.data(),
+ (mem_locs != NULL && mem_locs->size() > 0) ? (const void **) &mem_locs->front() : NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_NATIVE_KERNEL);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+ cl_int enqueueMarker(Event* event = NULL) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueMarker(
+ object_,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_MARKER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+ cl_int enqueueWaitForEvents(const vector<Event>& events) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+ {
+ return detail::errHandler(
+ ::clEnqueueWaitForEvents(
+ object_,
+ (cl_uint) events.size(),
+ events.size() > 0 ? (const cl_event*) &events.front() : NULL),
+ __ENQUEUE_WAIT_FOR_EVENTS_ERR);
+ }
+#endif // defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+
+ cl_int enqueueAcquireGLObjects(
+ const vector<Memory>* mem_objects = NULL,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueAcquireGLObjects(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_ACQUIRE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueReleaseGLObjects(
+ const vector<Memory>* mem_objects = NULL,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueReleaseGLObjects(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_RELEASE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+#if defined (CL_HPP_USE_DX_INTEROP)
+typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
+ cl_command_queue command_queue, cl_uint num_objects,
+ const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list, cl_event* event);
+typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
+ cl_command_queue command_queue, cl_uint num_objects,
+ const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list, cl_event* event);
+
+ cl_int enqueueAcquireD3D10Objects(
+ const vector<Memory>* mem_objects = NULL,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ cl_context context = getInfo<CL_QUEUE_CONTEXT>();
+ cl::Device device(getInfo<CL_QUEUE_DEVICE>());
+ cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
+ CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueAcquireD3D10ObjectsKHR);
+#endif
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+ CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueAcquireD3D10ObjectsKHR);
+#endif
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ pfn_clEnqueueAcquireD3D10ObjectsKHR(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_ACQUIRE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+
+ cl_int enqueueReleaseD3D10Objects(
+ const vector<Memory>* mem_objects = NULL,
+ const vector<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 120
+ cl_context context = getInfo<CL_QUEUE_CONTEXT>();
+ cl::Device device(getInfo<CL_QUEUE_DEVICE>());
+ cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
+ CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueReleaseD3D10ObjectsKHR);
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+ CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueReleaseD3D10ObjectsKHR);
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ pfn_clEnqueueReleaseD3D10ObjectsKHR(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_RELEASE_GL_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+ }
+#endif
+
+/**
+ * Deprecated APIs for 1.2
+ */
+#if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+ CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
+ cl_int enqueueBarrier() const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+ {
+ return detail::errHandler(
+ ::clEnqueueBarrier(object_),
+ __ENQUEUE_BARRIER_ERR);
+ }
+#endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS
+
+ cl_int flush() const
+ {
+ return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
+ }
+
+ cl_int finish() const
+ {
+ return detail::errHandler(::clFinish(object_), __FINISH_ERR);
+ }
+}; // CommandQueue
+
+CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag CommandQueue::default_initialized_;
+CL_HPP_DEFINE_STATIC_MEMBER_ CommandQueue CommandQueue::default_;
+CL_HPP_DEFINE_STATIC_MEMBER_ cl_int CommandQueue::default_error_ = CL_SUCCESS;
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+enum class DeviceQueueProperties : cl_command_queue_properties
+{
+ None = 0,
+ Profiling = CL_QUEUE_PROFILING_ENABLE,
+};
+
+inline DeviceQueueProperties operator|(DeviceQueueProperties lhs, DeviceQueueProperties rhs)
+{
+ return static_cast<DeviceQueueProperties>(static_cast<cl_command_queue_properties>(lhs) | static_cast<cl_command_queue_properties>(rhs));
+}
+
+/*! \class DeviceCommandQueue
+ * \brief DeviceCommandQueue interface for device cl_command_queues.
+ */
+class DeviceCommandQueue : public detail::Wrapper<cl_command_queue>
+{
+public:
+
+ /*!
+ * Trivial empty constructor to create a null queue.
+ */
+ DeviceCommandQueue() { }
+
+ /*!
+ * Default construct device command queue on default context and device
+ */
+ DeviceCommandQueue(DeviceQueueProperties properties, cl_int* err = NULL)
+ {
+ cl_int error;
+ cl::Context context = cl::Context::getDefault();
+ cl::Device device = cl::Device::getDefault();
+
+ cl_command_queue_properties mergedProperties =
+ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | static_cast<cl_command_queue_properties>(properties);
+
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, mergedProperties, 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*!
+ * Create a device command queue for a specified device in the passed context.
+ */
+ DeviceCommandQueue(
+ const Context& context,
+ const Device& device,
+ DeviceQueueProperties properties = DeviceQueueProperties::None,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ cl_command_queue_properties mergedProperties =
+ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | static_cast<cl_command_queue_properties>(properties);
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, mergedProperties, 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*!
+ * Create a device command queue for a specified device in the passed context.
+ */
+ DeviceCommandQueue(
+ const Context& context,
+ const Device& device,
+ cl_uint queueSize,
+ DeviceQueueProperties properties = DeviceQueueProperties::None,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ cl_command_queue_properties mergedProperties =
+ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | static_cast<cl_command_queue_properties>(properties);
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, mergedProperties,
+ CL_QUEUE_SIZE, queueSize,
+ 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ /*! \brief Constructor from cl_command_queue - takes ownership.
+ *
+ * \param retainObject will cause the constructor to retain its cl object.
+ * Defaults to false to maintain compatibility with
+ * earlier versions.
+ */
+ explicit DeviceCommandQueue(const cl_command_queue& commandQueue, bool retainObject = false) :
+ detail::Wrapper<cl_type>(commandQueue, retainObject) { }
+
+ DeviceCommandQueue& operator = (const cl_command_queue& rhs)
+ {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ DeviceCommandQueue(const DeviceCommandQueue& queue) : detail::Wrapper<cl_type>(queue) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ DeviceCommandQueue& operator = (const DeviceCommandQueue &queue)
+ {
+ detail::Wrapper<cl_type>::operator=(queue);
+ return *this;
+ }
+
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ DeviceCommandQueue(DeviceCommandQueue&& queue) CL_HPP_NOEXCEPT_ : detail::Wrapper<cl_type>(std::move(queue)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ DeviceCommandQueue& operator = (DeviceCommandQueue &&queue)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(queue));
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_command_queue_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetCommandQueueInfo, object_, name, param),
+ __GET_COMMAND_QUEUE_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_command_queue_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_command_queue_info, name>::param_type param;
+ cl_int result = getInfo(name, &param);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ /*!
+ * Create a new default device command queue for the default device,
+ * in the default context and of the default size.
+ * If there is already a default queue for the specified device this
+ * function will return the pre-existing queue.
+ */
+ static DeviceCommandQueue makeDefault(
+ cl_int *err = nullptr)
+ {
+ cl_int error;
+ cl::Context context = cl::Context::getDefault();
+ cl::Device device = cl::Device::getDefault();
+
+ cl_command_queue_properties properties =
+ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties,
+ 0 };
+ DeviceCommandQueue deviceQueue(
+ ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error));
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ return deviceQueue;
+ }
+
+ /*!
+ * Create a new default device command queue for the specified device
+ * and of the default size.
+ * If there is already a default queue for the specified device this
+ * function will return the pre-existing queue.
+ */
+ static DeviceCommandQueue makeDefault(
+ const Context &context, const Device &device, cl_int *err = nullptr)
+ {
+ cl_int error;
+
+ cl_command_queue_properties properties =
+ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties,
+ 0 };
+ DeviceCommandQueue deviceQueue(
+ ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error));
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ return deviceQueue;
+ }
+
+ /*!
+ * Create a new default device command queue for the specified device
+ * and of the requested size in bytes.
+ * If there is already a default queue for the specified device this
+ * function will return the pre-existing queue.
+ */
+ static DeviceCommandQueue makeDefault(
+ const Context &context, const Device &device, cl_uint queueSize, cl_int *err = nullptr)
+ {
+ cl_int error;
+
+ cl_command_queue_properties properties =
+ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties,
+ CL_QUEUE_SIZE, queueSize,
+ 0 };
+ DeviceCommandQueue deviceQueue(
+ ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error));
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ return deviceQueue;
+ }
+}; // DeviceCommandQueue
+
+namespace detail
+{
+ // Specialization for device command queue
+ template <>
+ struct KernelArgumentHandler<cl::DeviceCommandQueue, void>
+ {
+ static size_type size(const cl::DeviceCommandQueue&) { return sizeof(cl_command_queue); }
+ static const cl_command_queue* ptr(const cl::DeviceCommandQueue& value) { return &(value()); }
+ };
+} // namespace detail
+
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+
+template< typename IteratorType >
+Buffer::Buffer(
+ const Context &context,
+ IteratorType startIterator,
+ IteratorType endIterator,
+ bool readOnly,
+ bool useHostPtr,
+ cl_int* err)
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ cl_mem_flags flags = 0;
+ if( readOnly ) {
+ flags |= CL_MEM_READ_ONLY;
+ }
+ else {
+ flags |= CL_MEM_READ_WRITE;
+ }
+ if( useHostPtr ) {
+ flags |= CL_MEM_USE_HOST_PTR;
+ }
+
+ size_type size = sizeof(DataType)*(endIterator - startIterator);
+
+ if( useHostPtr ) {
+ object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
+ } else {
+ object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
+ }
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ if( !useHostPtr ) {
+ CommandQueue queue(context, 0, &error);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ error = cl::copy(queue, startIterator, endIterator, *this);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+}
+
+template< typename IteratorType >
+Buffer::Buffer(
+ const CommandQueue &queue,
+ IteratorType startIterator,
+ IteratorType endIterator,
+ bool readOnly,
+ bool useHostPtr,
+ cl_int* err)
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ cl_mem_flags flags = 0;
+ if (readOnly) {
+ flags |= CL_MEM_READ_ONLY;
+ }
+ else {
+ flags |= CL_MEM_READ_WRITE;
+ }
+ if (useHostPtr) {
+ flags |= CL_MEM_USE_HOST_PTR;
+ }
+
+ size_type size = sizeof(DataType)*(endIterator - startIterator);
+
+ Context context = queue.getInfo<CL_QUEUE_CONTEXT>();
+
+ if (useHostPtr) {
+ object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
+ }
+ else {
+ object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
+ }
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ if (!useHostPtr) {
+ error = cl::copy(queue, startIterator, endIterator, *this);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+}
+
+inline cl_int enqueueReadBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ size_type offset,
+ size_type size,
+ void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueReadBuffer(buffer, blocking, offset, size, ptr, events, event);
+}
+
+inline cl_int enqueueWriteBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ size_type offset,
+ size_type size,
+ const void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueWriteBuffer(buffer, blocking, offset, size, ptr, events, event);
+}
+
+inline void* enqueueMapBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ size_type offset,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ void * result = ::clEnqueueMapBuffer(
+ queue(), buffer(), blocking, flags, offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return result;
+}
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+/**
+ * Enqueues to the default queue a command that will allow the host to
+ * update a region of a coarse-grained SVM buffer.
+ * This variant takes a raw SVM pointer.
+ */
+template<typename T>
+inline cl_int enqueueMapSVM(
+ T* ptr,
+ cl_bool blocking,
+ cl_map_flags flags,
+ size_type size,
+ const vector<Event>* events,
+ Event* event)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS) {
+ return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ }
+
+ return queue.enqueueMapSVM(
+ ptr, blocking, flags, size, events, event);
+}
+
+/**
+ * Enqueues to the default queue a command that will allow the host to
+ * update a region of a coarse-grained SVM buffer.
+ * This variant takes a cl::pointer instance.
+ */
+template<typename T, class D>
+inline cl_int enqueueMapSVM(
+ cl::pointer<T, D> ptr,
+ cl_bool blocking,
+ cl_map_flags flags,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS) {
+ return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ }
+
+ return queue.enqueueMapSVM(
+ ptr, blocking, flags, size, events, event);
+}
+
+/**
+ * Enqueues to the default queue a command that will allow the host to
+ * update a region of a coarse-grained SVM buffer.
+ * This variant takes a cl::vector instance.
+ */
+template<typename T, class Alloc>
+inline cl_int enqueueMapSVM(
+ cl::vector<T, Alloc> container,
+ cl_bool blocking,
+ cl_map_flags flags,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS) {
+ return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ }
+
+ return queue.enqueueMapSVM(
+ container, blocking, flags, events, event);
+}
+
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+inline cl_int enqueueUnmapMemObject(
+ const Memory& memory,
+ void* mapped_ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueUnmapMemObject(
+ queue(), memory(), mapped_ptr,
+ (events != NULL) ? (cl_uint)events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL,
+ (event != NULL) ? &tmp : NULL),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
+}
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+/**
+ * Enqueues to the default queue a command that will release a coarse-grained
+ * SVM buffer back to the OpenCL runtime.
+ * This variant takes a raw SVM pointer.
+ */
+template<typename T>
+inline cl_int enqueueUnmapSVM(
+ T* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS) {
+ return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+ }
+
+ return detail::errHandler(queue.enqueueUnmapSVM(ptr, events, event),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+
+}
+
+/**
+ * Enqueues to the default queue a command that will release a coarse-grained
+ * SVM buffer back to the OpenCL runtime.
+ * This variant takes a cl::pointer instance.
+ */
+template<typename T, class D>
+inline cl_int enqueueUnmapSVM(
+ cl::pointer<T, D> &ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS) {
+ return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+ }
+
+ return detail::errHandler(queue.enqueueUnmapSVM(ptr, events, event),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+}
+
+/**
+ * Enqueues to the default queue a command that will release a coarse-grained
+ * SVM buffer back to the OpenCL runtime.
+ * This variant takes a cl::vector instance.
+ */
+template<typename T, class Alloc>
+inline cl_int enqueueUnmapSVM(
+ cl::vector<T, Alloc> &container,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS) {
+ return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+ }
+
+ return detail::errHandler(queue.enqueueUnmapSVM(container, events, event),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+}
+
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+inline cl_int enqueueCopyBuffer(
+ const Buffer& src,
+ const Buffer& dst,
+ size_type src_offset,
+ size_type dst_offset,
+ size_type size,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyBuffer(src, dst, src_offset, dst_offset, size, events, event);
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Host to Device.
+ * Uses default command queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS)
+ return error;
+
+ return cl::copy(queue, startIterator, endIterator, buffer);
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Device to Host.
+ * Uses default command queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+ if (error != CL_SUCCESS)
+ return error;
+
+ return cl::copy(queue, buffer, startIterator, endIterator);
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Host to Device.
+ * Uses specified queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ size_type length = endIterator-startIterator;
+ size_type byteLength = length*sizeof(DataType);
+
+ DataType *pointer =
+ static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error));
+ // if exceptions enabled, enqueueMapBuffer will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+#if defined(_MSC_VER)
+ std::copy(
+ startIterator,
+ endIterator,
+ stdext::checked_array_iterator<DataType*>(
+ pointer, length));
+#else
+ std::copy(startIterator, endIterator, pointer);
+#endif
+ Event endEvent;
+ error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
+ // if exceptions enabled, enqueueUnmapMemObject will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+ endEvent.wait();
+ return CL_SUCCESS;
+}
+
+/**
+ * Blocking copy operation between iterators and a buffer.
+ * Device to Host.
+ * Uses specified queue.
+ */
+template< typename IteratorType >
+inline cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ size_type length = endIterator-startIterator;
+ size_type byteLength = length*sizeof(DataType);
+
+ DataType *pointer =
+ static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error));
+ // if exceptions enabled, enqueueMapBuffer will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+ std::copy(pointer, pointer + length, startIterator);
+ Event endEvent;
+ error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
+ // if exceptions enabled, enqueueUnmapMemObject will throw
+ if( error != CL_SUCCESS ) {
+ return error;
+ }
+ endEvent.wait();
+ return CL_SUCCESS;
+}
+
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+/**
+ * Blocking SVM map operation - performs a blocking map underneath.
+ */
+template<typename T, class Alloc>
+inline cl_int mapSVM(cl::vector<T, Alloc> &container)
+{
+ return enqueueMapSVM(container, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE);
+}
+
+/**
+* Blocking SVM map operation - performs a blocking map underneath.
+*/
+template<typename T, class Alloc>
+inline cl_int unmapSVM(cl::vector<T, Alloc> &container)
+{
+ return enqueueUnmapSVM(container);
+}
+
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 110
+inline cl_int enqueueReadBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const array<size_type, 3>& buffer_offset,
+ const array<size_type, 3>& host_offset,
+ const array<size_type, 3>& region,
+ size_type buffer_row_pitch,
+ size_type buffer_slice_pitch,
+ size_type host_row_pitch,
+ size_type host_slice_pitch,
+ void *ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueReadBufferRect(
+ buffer,
+ blocking,
+ buffer_offset,
+ host_offset,
+ region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueWriteBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const array<size_type, 3>& buffer_offset,
+ const array<size_type, 3>& host_offset,
+ const array<size_type, 3>& region,
+ size_type buffer_row_pitch,
+ size_type buffer_slice_pitch,
+ size_type host_row_pitch,
+ size_type host_slice_pitch,
+ const void *ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueWriteBufferRect(
+ buffer,
+ blocking,
+ buffer_offset,
+ host_offset,
+ region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyBufferRect(
+ const Buffer& src,
+ const Buffer& dst,
+ const array<size_type, 3>& src_origin,
+ const array<size_type, 3>& dst_origin,
+ const array<size_type, 3>& region,
+ size_type src_row_pitch,
+ size_type src_slice_pitch,
+ size_type dst_row_pitch,
+ size_type dst_slice_pitch,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyBufferRect(
+ src,
+ dst,
+ src_origin,
+ dst_origin,
+ region,
+ src_row_pitch,
+ src_slice_pitch,
+ dst_row_pitch,
+ dst_slice_pitch,
+ events,
+ event);
+}
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110
+
+inline cl_int enqueueReadImage(
+ const Image& image,
+ cl_bool blocking,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ size_type row_pitch,
+ size_type slice_pitch,
+ void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueReadImage(
+ image,
+ blocking,
+ origin,
+ region,
+ row_pitch,
+ slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueWriteImage(
+ const Image& image,
+ cl_bool blocking,
+ const array<size_type, 3>& origin,
+ const array<size_type, 3>& region,
+ size_type row_pitch,
+ size_type slice_pitch,
+ const void* ptr,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueWriteImage(
+ image,
+ blocking,
+ origin,
+ region,
+ row_pitch,
+ slice_pitch,
+ ptr,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyImage(
+ const Image& src,
+ const Image& dst,
+ const array<size_type, 3>& src_origin,
+ const array<size_type, 3>& dst_origin,
+ const array<size_type, 3>& region,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyImage(
+ src,
+ dst,
+ src_origin,
+ dst_origin,
+ region,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyImageToBuffer(
+ const Image& src,
+ const Buffer& dst,
+ const array<size_type, 3>& src_origin,
+ const array<size_type, 3>& region,
+ size_type dst_offset,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyImageToBuffer(
+ src,
+ dst,
+ src_origin,
+ region,
+ dst_offset,
+ events,
+ event);
+}
+
+inline cl_int enqueueCopyBufferToImage(
+ const Buffer& src,
+ const Image& dst,
+ size_type src_offset,
+ const array<size_type, 3>& dst_origin,
+ const array<size_type, 3>& region,
+ const vector<Event>* events = NULL,
+ Event* event = NULL)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.enqueueCopyBufferToImage(
+ src,
+ dst,
+ src_offset,
+ dst_origin,
+ region,
+ events,
+ event);
+}
+
+
+inline cl_int flush(void)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+ return queue.flush();
+}
+
+inline cl_int finish(void)
+{
+ cl_int error;
+ CommandQueue queue = CommandQueue::getDefault(&error);
+
+ if (error != CL_SUCCESS) {
+ return error;
+ }
+
+
+ return queue.finish();
+}
+
+class EnqueueArgs
+{
+private:
+ CommandQueue queue_;
+ const NDRange offset_;
+ const NDRange global_;
+ const NDRange local_;
+ vector<Event> events_;
+
+ template<typename... Ts>
+ friend class KernelFunctor;
+
+public:
+ EnqueueArgs(NDRange global) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+
+ }
+
+ EnqueueArgs(NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(NDRange offset, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(Event e, NDRange global) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(Event e, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(Event e, NDRange offset, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(const vector<Event> &events, NDRange global) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(const vector<Event> &events, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(NullRange),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(const vector<Event> &events, NDRange offset, NDRange global, NDRange local) :
+ queue_(CommandQueue::getDefault()),
+ offset_(offset),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, NDRange global) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, NDRange offset, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, Event e, NDRange global) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(CommandQueue &queue, Event e, NDRange offset, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(offset),
+ global_(global),
+ local_(local)
+ {
+ events_.push_back(e);
+ }
+
+ EnqueueArgs(CommandQueue &queue, const vector<Event> &events, NDRange global) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(NullRange),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, const vector<Event> &events, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(NullRange),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+
+ EnqueueArgs(CommandQueue &queue, const vector<Event> &events, NDRange offset, NDRange global, NDRange local) :
+ queue_(queue),
+ offset_(offset),
+ global_(global),
+ local_(local),
+ events_(events)
+ {
+
+ }
+};
+
+
+//----------------------------------------------------------------------------------------------
+
+
+/**
+ * Type safe kernel functor.
+ *
+ */
+template<typename... Ts>
+class KernelFunctor
+{
+private:
+ Kernel kernel_;
+
+ template<int index, typename T0, typename... T1s>
+ void setArgs(T0&& t0, T1s&&... t1s)
+ {
+ kernel_.setArg(index, t0);
+ setArgs<index + 1, T1s...>(std::forward<T1s>(t1s)...);
+ }
+
+ template<int index, typename T0>
+ void setArgs(T0&& t0)
+ {
+ kernel_.setArg(index, t0);
+ }
+
+ template<int index>
+ void setArgs()
+ {
+ }
+
+
+public:
+ KernelFunctor(Kernel kernel) : kernel_(kernel)
+ {}
+
+ KernelFunctor(
+ const Program& program,
+ const string name,
+ cl_int * err = NULL) :
+ kernel_(program, name.c_str(), err)
+ {}
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ /**
+ * Enqueue kernel.
+ * @param args Launch parameters of the kernel.
+ * @param t0... List of kernel arguments based on the template type of the functor.
+ */
+ Event operator() (
+ const EnqueueArgs& args,
+ Ts... ts)
+ {
+ Event event;
+ setArgs<0>(std::forward<Ts>(ts)...);
+
+ args.queue_.enqueueNDRangeKernel(
+ kernel_,
+ args.offset_,
+ args.global_,
+ args.local_,
+ &args.events_,
+ &event);
+
+ return event;
+ }
+
+ /**
+ * Enqueue kernel with support for error code.
+ * @param args Launch parameters of the kernel.
+ * @param t0... List of kernel arguments based on the template type of the functor.
+ * @param error Out parameter returning the error code from the execution.
+ */
+ Event operator() (
+ const EnqueueArgs& args,
+ Ts... ts,
+ cl_int &error)
+ {
+ Event event;
+ setArgs<0>(std::forward<Ts>(ts)...);
+
+ error = args.queue_.enqueueNDRangeKernel(
+ kernel_,
+ args.offset_,
+ args.global_,
+ args.local_,
+ &args.events_,
+ &event);
+
+ return event;
+ }
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ cl_int setSVMPointers(const vector<void*> &pointerList)
+ {
+ return kernel_.setSVMPointers(pointerList);
+ }
+
+ template<typename T0, typename... T1s>
+ cl_int setSVMPointers(const T0 &t0, T1s... ts)
+ {
+ return kernel_.setSVMPointers(t0, ts...);
+ }
+#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
+
+ Kernel getKernel()
+ {
+ return kernel_;
+ }
+};
+
+namespace compatibility {
+ /**
+ * Backward compatibility class to ensure that cl.hpp code works with cl2.hpp.
+ * Please use KernelFunctor directly.
+ */
+ template<typename... Ts>
+ struct make_kernel
+ {
+ typedef KernelFunctor<Ts...> FunctorType;
+
+ FunctorType functor_;
+
+ make_kernel(
+ const Program& program,
+ const string name,
+ cl_int * err = NULL) :
+ functor_(FunctorType(program, name, err))
+ {}
+
+ make_kernel(
+ const Kernel kernel) :
+ functor_(FunctorType(kernel))
+ {}
+
+ //! \brief Return type of the functor
+ typedef Event result_type;
+
+ //! \brief Function signature of kernel functor with no event dependency.
+ typedef Event type_(
+ const EnqueueArgs&,
+ Ts...);
+
+ Event operator()(
+ const EnqueueArgs& enqueueArgs,
+ Ts... args)
+ {
+ return functor_(
+ enqueueArgs, args...);
+ }
+ };
+} // namespace compatibility
+
+
+//----------------------------------------------------------------------------------------------------------------------
+
+#undef CL_HPP_ERR_STR_
+#if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS)
+#undef __GET_DEVICE_INFO_ERR
+#undef __GET_PLATFORM_INFO_ERR
+#undef __GET_DEVICE_IDS_ERR
+#undef __GET_CONTEXT_INFO_ERR
+#undef __GET_EVENT_INFO_ERR
+#undef __GET_EVENT_PROFILE_INFO_ERR
+#undef __GET_MEM_OBJECT_INFO_ERR
+#undef __GET_IMAGE_INFO_ERR
+#undef __GET_SAMPLER_INFO_ERR
+#undef __GET_KERNEL_INFO_ERR
+#undef __GET_KERNEL_ARG_INFO_ERR
+#undef __GET_KERNEL_WORK_GROUP_INFO_ERR
+#undef __GET_PROGRAM_INFO_ERR
+#undef __GET_PROGRAM_BUILD_INFO_ERR
+#undef __GET_COMMAND_QUEUE_INFO_ERR
+
+#undef __CREATE_CONTEXT_ERR
+#undef __CREATE_CONTEXT_FROM_TYPE_ERR
+#undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
+
+#undef __CREATE_BUFFER_ERR
+#undef __CREATE_SUBBUFFER_ERR
+#undef __CREATE_IMAGE2D_ERR
+#undef __CREATE_IMAGE3D_ERR
+#undef __CREATE_SAMPLER_ERR
+#undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
+
+#undef __CREATE_USER_EVENT_ERR
+#undef __SET_USER_EVENT_STATUS_ERR
+#undef __SET_EVENT_CALLBACK_ERR
+#undef __SET_PRINTF_CALLBACK_ERR
+
+#undef __WAIT_FOR_EVENTS_ERR
+
+#undef __CREATE_KERNEL_ERR
+#undef __SET_KERNEL_ARGS_ERR
+#undef __CREATE_PROGRAM_WITH_SOURCE_ERR
+#undef __CREATE_PROGRAM_WITH_BINARY_ERR
+#undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR
+#undef __BUILD_PROGRAM_ERR
+#undef __CREATE_KERNELS_IN_PROGRAM_ERR
+
+#undef __CREATE_COMMAND_QUEUE_ERR
+#undef __SET_COMMAND_QUEUE_PROPERTY_ERR
+#undef __ENQUEUE_READ_BUFFER_ERR
+#undef __ENQUEUE_WRITE_BUFFER_ERR
+#undef __ENQUEUE_READ_BUFFER_RECT_ERR
+#undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
+#undef __ENQEUE_COPY_BUFFER_ERR
+#undef __ENQEUE_COPY_BUFFER_RECT_ERR
+#undef __ENQUEUE_READ_IMAGE_ERR
+#undef __ENQUEUE_WRITE_IMAGE_ERR
+#undef __ENQUEUE_COPY_IMAGE_ERR
+#undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
+#undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
+#undef __ENQUEUE_MAP_BUFFER_ERR
+#undef __ENQUEUE_MAP_IMAGE_ERR
+#undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
+#undef __ENQUEUE_NDRANGE_KERNEL_ERR
+#undef __ENQUEUE_TASK_ERR
+#undef __ENQUEUE_NATIVE_KERNEL
+
+#undef __UNLOAD_COMPILER_ERR
+#undef __CREATE_SUB_DEVICES_ERR
+
+#undef __CREATE_PIPE_ERR
+#undef __GET_PIPE_INFO_ERR
+
+#endif //CL_HPP_USER_OVERRIDE_ERROR_STRINGS
+
+// Extensions
+#undef CL_HPP_INIT_CL_EXT_FCN_PTR_
+#undef CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_
+
+#if defined(CL_HPP_USE_CL_DEVICE_FISSION)
+#undef CL_HPP_PARAM_NAME_DEVICE_FISSION_
+#endif // CL_HPP_USE_CL_DEVICE_FISSION
+
+#undef CL_HPP_NOEXCEPT_
+#undef CL_HPP_DEFINE_STATIC_MEMBER_
+
+} // namespace cl
+
+#endif // CL_HPP_
diff --git a/source/d/opencl-headers/opencl-headers.SlackBuild b/source/d/opencl-headers/opencl-headers.SlackBuild
new file mode 100755
index 000000000..edb041ec9
--- /dev/null
+++ b/source/d/opencl-headers/opencl-headers.SlackBuild
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+# Slackware build script for opencl-headers
+
+# Copyright 2016 Heinz Wiesinger, Amsterdam, The Netherlands
+# Copyright 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=opencl-headers
+VERSION=${VERSION:-$(echo OpenCL-Headers-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+PKGVER=${PKGVER:-2.1}
+BUILD=${BUILD:-2}
+
+NUMJOBS=${NUMJOBS:--j7}
+
+ARCH=noarch
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$PKGVER-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-opencl-headers
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf OpenCL-Headers-$VERSION
+tar xvf $CWD/OpenCL-Headers-$VERSION.tar.?z* || exit 1
+cd OpenCL-Headers-$VERSION || exit 1
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+mkdir -p $PKG/usr/include/CL
+
+install -p -m 0644 ./* -t $PKG/usr/include/CL/
+
+zcat $CWD/cl.hpp.gz > $PKG/usr/include/CL/cl.hpp
+zcat $CWD/cl2.hpp.gz > $PKG/usr/include/CL/cl2.hpp
+
+# Drop Direct3D related headers
+for i in cl_dx9_media_sharing.h cl_d3d10.h cl_d3d11.h; do
+ rm -f $PKG/usr/include/CL/$i
+done
+
+mkdir -p $PKG/usr/doc/$PKGNAM-$PKGVER
+cp -a $CWD/LICENSE.txt \
+ $PKG/usr/doc/$PKGNAM-$PKGVER
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$PKGVER-$ARCH-$BUILD.txz
diff --git a/source/d/opencl-headers/opencl-headers.url b/source/d/opencl-headers/opencl-headers.url
new file mode 100644
index 000000000..025ce0928
--- /dev/null
+++ b/source/d/opencl-headers/opencl-headers.url
@@ -0,0 +1,3 @@
+https://github.com/KhronosGroup/OpenCL-Headers/archive/abb29588550c77f8340a6c3683531407013bf26b/OpenCL-Headers-abb29588550c77f8340a6c3683531407013bf26b.tar.gz
+https://github.com/KhronosGroup/OpenCL-CLHPP/releases/download/v2.0.10/cl2.hpp
+https://www.khronos.org/registry/cl/api/2.1/cl.hpp
diff --git a/source/d/opencl-headers/slack-desc b/source/d/opencl-headers/slack-desc
new file mode 100644
index 000000000..08e2b88fd
--- /dev/null
+++ b/source/d/opencl-headers/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+opencl-headers: opencl-headers (OpenCL header files)
+opencl-headers:
+opencl-headers: OpenCL (Open Computing Language) header files.
+opencl-headers:
+opencl-headers: Homepage: https://www.khronos.org/registry/cl/
+opencl-headers:
+opencl-headers:
+opencl-headers:
+opencl-headers:
+opencl-headers:
+opencl-headers:
diff --git a/source/d/oprofile/oprofile.SlackBuild b/source/d/oprofile/oprofile.SlackBuild
index 5af568552..28eada9ce 100755
--- a/source/d/oprofile/oprofile.SlackBuild
+++ b/source/d/oprofile/oprofile.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2005-2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2005-2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,9 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
-VERSION=${VERSION:-$(echo oprofile-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+PKGNAM=oprofile
+VERSION=${VERSION:-$(echo oprofile-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-3}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -36,6 +38,14 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
@@ -53,7 +63,6 @@ else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-oprofile
@@ -61,8 +70,8 @@ rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP || exit 1
rm -rf oprofile-$VERSION
-tar xvf $CWD/oprofile-$VERSION.tar.?z* || exit 1
-cd oprofile-$VERSION
+tar xvf $CWD/oprofile-$VERSION.tar.?z || exit 1
+cd oprofile-$VERSION || exit 1
./autogen.sh
@@ -79,10 +88,10 @@ CXXFLAGS="$SLKCFLAGS" \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
- --with-kernel-support
+ --with-kernel-support || exit 1
make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG
+make install DESTDIR=$PKG || exit 1
# Strip binaries:
( cd $PKG
diff --git a/source/d/oprofile/slack-desc b/source/d/oprofile/slack-desc
index 9988ec5db..51e25ea9c 100644
--- a/source/d/oprofile/slack-desc
+++ b/source/d/oprofile/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
oprofile: oprofile (system profiling tool)
oprofile:
-oprofile: OProfile is a profiling system for Linux. Profiling runs
+oprofile: OProfile is a profiling system for Linux. Profiling runs
oprofile: transparently in the background and profile data can be collected
-oprofile: at any time. OProfile makes use of the hardware performance
+oprofile: at any time. OProfile makes use of the hardware performance
oprofile: counters provided on Intel, AMD, and other processors, and uses a
oprofile: timer-interrupt based mechanism on CPUs without counters.
oprofile: OProfile can profile the whole system in high detail.
oprofile:
-oprofile:
+oprofile: Homepage: http://oprofile.sourceforge.net
oprofile:
diff --git a/source/d/p2c/p2c.SlackBuild b/source/d/p2c/p2c.SlackBuild
index 4c2508d32..4f6c255dc 100755
--- a/source/d/p2c/p2c.SlackBuild
+++ b/source/d/p2c/p2c.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,29 +20,39 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
# Sources:
# ftp://ftp.pal.xgw.fi/pub/gnu/alpha/gnu/p2c-1.21alpha2.tar.gz
# ftp://ftp.clara.net/pub/mirrors/gnu/hurd/p2c-1.21alpha2.tar.gz
# ftp://ftp.obspm.fr/pub1/computing/gnu/hurd/p2c-1.21alpha2.tar.gz
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=p2c
VERSION=${VERSION:-1.21alpha2}
-BUILD=${BUILD:-3}
+BUILD=${BUILD:-4}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
@@ -55,7 +65,6 @@ else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-p2c
@@ -80,6 +89,8 @@ find . \
zcat $CWD/p2c_1.21alpha2-2.1.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
zcat $CWD/p2c_time.diff.gz | patch -p0 --verbose --backup --suffix=.orig || exit 1
+zcat $CWD/p2c.getline.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+
find . -name "*.orig" | xargs rm --verbose
# Fix library paths:
sed -i -e "s#/lib #/lib${LIBDIRSUFFIX} #g" \
@@ -89,7 +100,7 @@ sed -i -e "s#/lib #/lib${LIBDIRSUFFIX} #g" \
cd src
make OPT="$SLKCFLAGS" || exit 1
-make p2cc
+make p2cc || exit 1
mv $PKG/usr/lib $PKG/usr/lib${LIBDIRSUFFIX} 2>/dev/null
cat p2c > $PKG/usr/bin/p2c
diff --git a/source/d/p2c/p2c.getline.diff b/source/d/p2c/p2c.getline.diff
new file mode 100644
index 000000000..25df12c15
--- /dev/null
+++ b/source/d/p2c/p2c.getline.diff
@@ -0,0 +1,118 @@
+--- ./src/lex.c.orig 1993-12-07 23:36:49.000000000 -0600
++++ ./src/lex.c 2018-02-01 15:27:54.224877642 -0600
+@@ -1044,7 +1044,7 @@
+
+
+
+-void getline()
++void p2c_getline()
+ {
+ char *cp, *cp2;
+
+@@ -1071,7 +1071,7 @@
+ infname = stralloc(cp);
+ infname[cp2 - cp] = 0;
+ }
+- getline();
++ p2c_getline();
+ return;
+ }
+ if (copysource && *inbuf) {
+@@ -1088,7 +1088,7 @@
+ fprintf(stderr, "\n");
+ if (inputkind == INP_INCFILE) {
+ pop_input();
+- getline();
++ p2c_getline();
+ } else
+ strcpy(inbuf, "\001");
+ }
+@@ -1179,7 +1179,7 @@
+ infname = fname;
+ inf_lnum = 0;
+ } else
+- inf_lnum--; /* adjust for extra getline() */
++ inf_lnum--; /* adjust for extra p2c_getline() */
+ *inbuf = 0;
+ inbufptr = inbuf;
+ gettok();
+@@ -2367,7 +2367,7 @@
+ else
+ commentline(CMT_POST);
+ trailing = 0;
+- getline();
++ p2c_getline();
+ i = 0;
+ for (;;) {
+ if (*inbufptr == ' ') {
+@@ -2419,7 +2419,7 @@
+ if (isspace(*inbufptr)) {
+ inbufptr++;
+ } else if (!*inbufptr) {
+- getline();
++ p2c_getline();
+ } else if (*inbufptr == '{') {
+ inbufptr++;
+ comment(0);
+@@ -2513,7 +2513,7 @@
+ switch (*inbufptr++) {
+
+ case 0:
+- getline();
++ p2c_getline();
+ break;
+
+ case ' ':
+@@ -2765,7 +2765,7 @@
+ case 0:
+ if (commenting_flag)
+ saveinputcomment(inbufptr-1);
+- getline();
++ p2c_getline();
+ cp = curtokbuf;
+ for (;;) {
+ inbufindent = 0;
+@@ -2782,7 +2782,7 @@
+ }
+ if (!*inbufptr && !commenting_flag) { /* blank line */
+ *cp++ = '\001';
+- getline();
++ p2c_getline();
+ } else
+ break;
+ }
+@@ -2797,10 +2797,10 @@
+ *cp++ = '\001';
+ *cp++ = '\014';
+ if (!*inbufptr && !commenting_flag) {
+- getline();
++ p2c_getline();
+ while (!*inbufptr) {
+ *cp++ = '\001';
+- getline();
++ p2c_getline();
+ }
+ }
+ *cp = 0;
+--- ./src/parse.c.orig 2018-02-01 15:25:56.206878896 -0600
++++ ./src/parse.c 2018-02-01 15:28:00.997877570 -0600
+@@ -5073,7 +5073,7 @@
+ out_include(fname, 1);
+ outsection(majorspace);
+ pop_input();
+- getline();
++ p2c_getline();
+ gettok();
+ }
+
+--- ./src/TAGS.orig 1993-12-07 23:36:55.000000000 -0600
++++ ./src/TAGS 2018-02-01 15:27:50.927877677 -0600
+@@ -176,7 +176,7 @@
+ char getchartok(2466,60243
+ Static int getflag(2451,60064
+ char *getinlinepart(2414,59241
+-void getline(1047,22000
++void p2c_getline(1047,22000
+ char *getparenstr(2481,60499
+ void gettok(2728,65611
+ void gettok(2752,66193
diff --git a/source/d/p2c/slack-desc b/source/d/p2c/slack-desc
index 058ac2040..18e6e69f8 100644
--- a/source/d/p2c/slack-desc
+++ b/source/d/p2c/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
p2c: p2c (Pascal to C translator)
p2c:
-p2c: P2c is a tool for translating Pascal programs into C. The input
+p2c: P2c is a tool for translating Pascal programs into C. The input
p2c: consists of a set of source files in any of the following Pascal
-p2c: dialects: HP Pascal, Turbo/UCSD Pascal, DEC VAX Pascal, Oregon
+p2c: dialects: HP Pascal, Turbo/UCSD Pascal, DEC VAX Pascal, Oregon
p2c: Software Pascal/2, Macintosh Programmer's Workshop Pascal,
p2c: Sun/Berkeley Pascal, Texas Instruments Pascal, Apollo Domain Pascal.
-p2c: Modula-2 syntax is also supported. Output is a set of .c and .h
+p2c: Modula-2 syntax is also supported. Output is a set of .c and .h
p2c: files that comprise an equivalent program in any of several dialects
p2c: of C.
p2c:
diff --git a/source/d/parallel/parallel.SlackBuild b/source/d/parallel/parallel.SlackBuild
new file mode 100755
index 000000000..2677ce32b
--- /dev/null
+++ b/source/d/parallel/parallel.SlackBuild
@@ -0,0 +1,147 @@
+#!/bin/sh
+
+# Copyright 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=parallel
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$(uname -m)" in
+ i?86) ARCH=i586 ;;
+ arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$(uname -m) ;;
+ esac
+ export ARCH
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+# This is a noarch package:
+ARCH=noarch
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
+cd $PKGNAM-$VERSION || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Configure, build, and install:
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --docdir=/usr/doc/$PKGNAM-$VERSION \
+ --mandir=/usr/man \
+ --infodir=/usr/info \
+ --build=$ARCH-slackware-linux || exit 1
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
+
+# Fix shebangs:
+sed -i "s|#\!/usr/bin/env perl|#\!/usr/bin/perl|g" $PKG/usr/bin/*
+sed -i "s|#\!/usr/bin/env bash|#\!/bin/bash|g" $PKG/usr/bin/*
+
+# Strip binaries:
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+# Compress manual pages:
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do
+ ln -s $( readlink $i ).gz $i.gz
+ rm $i
+done
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
+cp -a \
+ CITATION COPYING* CREDITS NEWS* README* *.txt \
+ $PKG/usr/doc/${PKGNAM}-$VERSION
+
+# Don't ship duplicate documentation:
+rm -f $PKG/usr/doc/${PKGNAM}-$VERSION/*.{pdf,texi}
+
+# Garbage collection (not production quality):
+rm -f $PKG/usr/bin/env_parallel* $PKG/usr/man/man1/env_parallel.1.gz $PKG/usr/doc/${PKGNAM}-$VERSION}/env_parallel*
+
+# Trim the NEWS file:
+if [ -r NEWS ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat NEWS | head -n 1000 > $DOCSDIR/NEWS
+ touch -r NEWS $DOCSDIR/NEWS
+fi
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/d/parallel/slack-desc b/source/d/parallel/slack-desc
new file mode 100644
index 000000000..45efb3b15
--- /dev/null
+++ b/source/d/parallel/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+parallel: parallel (tool for executing jobs in parallel)
+parallel:
+parallel: GNU Parallel is a shell tool for executing jobs in parallel using one
+parallel: or more computers. A job can be a single command or a small script
+parallel: that has to be run for each of the lines in the input.
+parallel:
+parallel: Homepage: https://www.gnu.org/software/parallel/
+parallel:
+parallel:
+parallel:
+parallel:
diff --git a/source/d/patchelf/patchelf.SlackBuild b/source/d/patchelf/patchelf.SlackBuild
new file mode 100755
index 000000000..7afb9c455
--- /dev/null
+++ b/source/d/patchelf/patchelf.SlackBuild
@@ -0,0 +1,144 @@
+#!/bin/bash
+
+# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=patchelf
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-2}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$(uname -m)" in
+ i?86) ARCH=i586 ;;
+ arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$(uname -m) ;;
+ esac
+ export ARCH
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
+cd $PKGNAM-$VERSION || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Use /usr/include/elf.h from glibc, which is a newer version:
+rm -f src/elf.h
+
+# Configure:
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PKGNAM-$VERSION \
+ --build=$ARCH-slackware-linux || exit 1
+
+# Build and install:
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Strip binaries:
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+)
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
+cp -a \
+ AUTHORS COPYING* NEWS README* THANKS TODO \
+ $PKG/usr/doc/${PKGNAM}-$VERSION
+
+# Compress manual pages:
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do
+ ln -s $( readlink $i ).gz $i.gz
+ rm $i
+done
+
+# Compress and link manpages, if any:
+if [ -d $PKG/usr/man ]; then
+ ( cd $PKG/usr/man
+ for manpagedir in $(find . -type d -name "man*") ; do
+ ( cd $manpagedir
+ for eachpage in $( find . -type l -maxdepth 1 | grep -v '\.gz$') ; do
+ ln -s $( readlink $eachpage ).gz $eachpage.gz
+ rm $eachpage
+ done
+ gzip -9 *.?
+ )
+ done
+ )
+fi
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/d/patchelf/slack-desc b/source/d/patchelf/slack-desc
new file mode 100644
index 000000000..58507aa3b
--- /dev/null
+++ b/source/d/patchelf/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+patchelf: patchelf (tool to modify ELF binaries/libraries)
+patchelf:
+patchelf: PatchELF is a utility for modifying an existing ELF executable or
+patchelf: library. It can change the dynamic loader ("ELF interpreter") of an
+patchelf: executable, modify the RPATH, and add/change/remove declared
+patchelf: dependencies on dynamic libraries.
+patchelf:
+patchelf: PatchELF was written by Eelco Dolstra.
+patchelf:
+patchelf: Homepage: http://nixos.org/patchelf.html
+patchelf:
diff --git a/source/d/perl/DBD-mysql.net_buffer_length.diff b/source/d/perl/DBD-mysql.net_buffer_length.diff
new file mode 100644
index 000000000..cb88a951e
--- /dev/null
+++ b/source/d/perl/DBD-mysql.net_buffer_length.diff
@@ -0,0 +1,35 @@
+From 0f0cebe87fab335873fd3701bc304922da826940 Mon Sep 17 00:00:00 2001
+From: Michiel Beijen <michiel.beijen@gmail.com>
+Date: Fri, 23 Feb 2018 07:52:33 +0000
+Subject: [PATCH] Use net_buffer_length macro if available
+
+---
+ mysql.xs | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/mysql.xs b/mysql.xs
+index 3a9373d..0f97645 100644
+--- a/mysql.xs
++++ b/mysql.xs
+@@ -840,15 +840,14 @@ dbd_mysql_get_info(dbh, sql_info_type)
+ retsv = newSVpvn("`", 1);
+ break;
+ case SQL_MAXIMUM_STATEMENT_LENGTH:
+-#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50709
+- /* MariaDB 10 is not MySQL source level compatible so this
+- only applies to MySQL*/
+- /* mysql_get_option() was added in mysql 5.7.3 */
+- /* MYSQL_OPT_NET_BUFFER_LENGTH was added in mysql 5.7.9 */
++ /* net_buffer_length macro is not defined in MySQL 5.7 and some MariaDB
++ versions - if it is not available, use newer mysql_get_option */
++#if !defined(net_buffer_length)
++ ;
++ unsigned long buffer_len;
+ mysql_get_option(NULL, MYSQL_OPT_NET_BUFFER_LENGTH, &buffer_len);
+ retsv = newSViv(buffer_len);
+ #else
+- /* before mysql 5.7.9 use net_buffer_length macro */
+ retsv = newSViv(net_buffer_length);
+ #endif
+ break;
+
diff --git a/source/d/perl/libnet-3.08-Do-not-create-Net-libnet.cfg.patch b/source/d/perl/libnet-3.08-Do-not-create-Net-libnet.cfg.patch
new file mode 100644
index 000000000..911bc10fa
--- /dev/null
+++ b/source/d/perl/libnet-3.08-Do-not-create-Net-libnet.cfg.patch
@@ -0,0 +1,43 @@
+From a40f2774eede8e65dd6128b45525ec88f469e031 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Fri, 10 Jul 2015 13:02:00 +0200
+Subject: [PATCH 2/2] Do not create Net/libnet.cfg
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+I will remove the Net/libnet.cfg because:
+
+(1) it's content equals to default configuration hard-coded in the
+code
+(2) it's kind of configuration file we do not mark it as a configuration
+file, so it's overwritten on each update
+(3) it's loaded from directory based on Net::Config module location.
+I.e. core module will search it in core path, vendor module in vendor
+path and site module in site path.
+
+perl.spec does not provide it either.
+
+<https://bugzilla.redhat.com/show_bug.cgi?id=1238689>
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ Makefile.PL | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.PL b/Makefile.PL
+index 64d6959..25fc626 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -235,7 +235,7 @@ MAIN: {
+ sub MY::post_initialize {
+ my $self = shift;
+
+- return '' if $self->{PERL_CORE};
++ return '';
+
+ if (not -f $CfgFile) {
+ my @args = qw(Configure);
+--
+2.5.0
+
diff --git a/source/d/perl/perl.SlackBuild b/source/d/perl/perl.SlackBuild
index 1210b6dc9..94518bfe9 100755
--- a/source/d/perl/perl.SlackBuild
+++ b/source/d/perl/perl.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2009, 2010, 2011, 2012, 2013, 2015, 2016 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2009, 2010, 2011, 2012, 2013, 2015, 2016, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,12 +20,14 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
# originally by: David Cantrell <david@slackware.com>
# maintained by: <volkerdi@slackware.com>
-VERSION=5.22.2
-BUILD=${BUILD:-1}
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=perl
+VERSION=5.26.2
+BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -37,20 +39,33 @@ if [ -z "$ARCH" ]; then
esac
fi
-NUMJOBS=${NUMJOBS:--j6}
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+# Set to "yes" to run tests:
+MAKETEST=${MAKETEST:-no}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-perl
# Additional required modules:
-DBDMYSQL=4.033
-DBI=1.636
-URI=1.71
-XMLPARSER=2.44
-XMLSIMPLE=2.22
+DBDMYSQL=4.046
+DBI=1.641
GETTEXT=1.07
-TERMREADKEY=2.33
+TERMREADKEY=2.37
+URI=1.74
+XMLPARSER=2.44
+XMLSIMPLE=2.25
+AUTHENSASL=2.16
+MIMEBASE64=3.15
+LIBNET=3.11
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
@@ -84,7 +99,7 @@ mkdir -p $PKG
# Extract the source code:
cd $TMP
rm -rf perl-$VERSION
-tar xvf $CWD/perl-$VERSION.tar.?z* || exit 1
+tar xvf $CWD/perl-$VERSION.tar.?z || exit 1
# Change into the source directory:
cd perl-$VERSION
@@ -140,30 +155,25 @@ fi
-Ubincompat5005 \
-Uversiononly \
-Dpager='/usr/bin/less -isr' \
- -Darchname=$ARCH-linux
+ -Darchname=$ARCH-linux || exit 1
# -Duseshrplib creates libperl.so
# -Ubincompat5005 helps create DSO -> libperl.so
-# Kludge for gcc-4.2.4's needlessly changed output:
-cat makefile | grep -v '\<command-line\>' > foo
-mv foo makefile
-
# Build perl
make $NUMJOBS || exit 1
-make test
+if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+fi
# Install perl (needed to build modules):
-make install
+make install || exit 1
( cd /usr/bin
ln -sf perl$VERSION perl
- ln -sf c2ph pstruct
)
-#mkdir -p /usr/lib${LIBDIRSUFFIX}/perl5/vendor_perl/${VERSION}/${ARCH}-linux-thread-multi
# Install perl package:
-make install DESTDIR=$PKG
-#mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/perl5/vendor_perl/${VERSION}/${ARCH}-linux-thread-multi
+make install DESTDIR=$PKG || exit 1
# Add additional modules:
( cd ext
@@ -171,58 +181,69 @@ make install DESTDIR=$PKG
cd DBI-${DBI}
chown -R root:root .
perl Makefile.PL INSTALLDIRS=vendor
- make
- make test
- make install
- make install DESTDIR=$PKG
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/doc/perl-$VERSION/DBI-${DBI}
cp -a README* $PKG/usr/doc/perl-$VERSION/DBI-${DBI}
chmod 644 $PKG/usr/doc/perl-$VERSION/DBI-${DBI}/README*
- )
+ ) || exit 1
( tar xzvf $CWD/DBD-mysql-${DBDMYSQL}.tar.gz
cd DBD-mysql-${DBDMYSQL}
+ zcat $CWD/DBD-mysql.net_buffer_length.diff.gz | patch -p1 --verbose || exit 1
chown -R root:root .
perl Makefile.PL INSTALLDIRS=vendor
- make
- make test
- make install
- make install DESTDIR=$PKG
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/doc/perl-$VERSION/DBD-mysql-${DBDMYSQL}
cp -a INSTALL.html README* TODO $PKG/usr/doc/perl-$VERSION/DBD-mysql-${DBDMYSQL}
chmod 644 $PKG/usr/doc/perl-$VERSION/DBD-mysql-${DBDMYSQL}/*
- )
+ ) || exit 1
( tar xzvf $CWD/XML-Parser-${XMLPARSER}.tar.gz
cd XML-Parser-${XMLPARSER}
chown -R root:root .
- perl Makefile.PL INSTALLDIRS=vendor
- make
- make test
- make install
- make install DESTDIR=$PKG
+ perl -I . Makefile.PL INSTALLDIRS=vendor
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/doc/perl-$VERSION/XML-Parser-${XMLPARSER}
cp -a README* $PKG/usr/doc/perl-$VERSION/XML-Parser-${XMLPARSER}
chmod 644 $PKG/usr/doc/perl-$VERSION/XML-Parser-${XMLPARSER}/*
- )
+ ) || exit 1
( tar xzvf $CWD/XML-Simple-${XMLSIMPLE}.tar.gz
cd XML-Simple-${XMLSIMPLE}
chown -R root:root .
perl Makefile.PL INSTALLDIRS=vendor
- make
- make test
- make install
- make install DESTDIR=$PKG
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/doc/perl-$VERSION/XML-Simple${XMLSIMPLE}
cp -a README* $PKG/usr/doc/perl-$VERSION/XML-Simple${XMLSIMPLE}
chmod 644 $PKG/usr/doc/perl-$VERSION/XML-Simple${XMLSIMPLE}/*
- )
+ ) || exit 1
( tar xzvf $CWD/URI-${URI}.tar.gz
cd URI-${URI}
chown -R root:root .
perl Makefile.PL INSTALLDIRS=vendor
- make
- make test
- make install
- make install DESTDIR=$PKG
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/doc/perl-$VERSION/URI-${URI}
cp -a README* $PKG/usr/doc/perl-$VERSION/URI-${URI}
chmod 644 $PKG/usr/doc/perl-$VERSION/URI-${URI}/*
@@ -231,27 +252,76 @@ make install DESTDIR=$PKG
cd Locale-gettext-${GETTEXT}
chown -R root:root .
perl Makefile.PL INSTALLDIRS=vendor
- make
- make test
- make install
- make install DESTDIR=$PKG
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/doc/perl-$VERSION/gettext-${GETTEXT}
cp -a README* $PKG/usr/doc/perl-$VERSION/gettext-${GETTEXT}
chmod 644 $PKG/usr/doc/perl-$VERSION/gettext-${GETTEXT}/*
- )
+ ) || exit 1
( tar xzvf $CWD/TermReadKey-${TERMREADKEY}.tar.gz
cd TermReadKey-${TERMREADKEY}
chown -R root:root .
perl Makefile.PL INSTALLDIRS=vendor
- make
- make test
- make install
- make install DESTDIR=$PKG
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/doc/perl-$VERSION/TermReadKey-${TERMREADKEY}
cp -a README* $PKG/usr/doc/perl-$VERSION/TermReadKey-${TERMREADKEY}
chmod 644 $PKG/usr/doc/perl-$VERSION/TermReadKey-${TERMREADKEY}/*
- )
-)
+ ) || exit 1
+ ( tar xzvf $CWD/Authen-SASL-${AUTHENSASL}.tar.gz
+ cd Authen-SASL-${AUTHENSASL}
+ chown -R root:root .
+ perl -I . Makefile.PL INSTALLDIRS=vendor
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
+ mkdir -p $PKG/usr/doc/perl-$VERSION/Authen-SASL-${AUTHENSASL}
+ cp -a README* META.yml $PKG/usr/doc/perl-$VERSION/Authen-SASL-${AUTHENSASL}
+ chmod 644 $PKG/usr/doc/perl-$VERSION/Authen-SASL-${AUTHENSASL}/*
+ ) || exit 1
+ ( tar xzvf $CWD/MIME-Base64-${MIMEBASE64}.tar.gz
+ cd MIME-Base64-${MIMEBASE64}
+ chown -R root:root .
+ perl Makefile.PL INSTALLDIRS=vendor
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
+ mkdir -p $PKG/usr/doc/perl-$VERSION/MIME-Base64-${MIMEBASE64}
+ cp -a README* $PKG/usr/doc/perl-$VERSION/MIME-Base64-${MIMEBASE64}
+ chmod 644 $PKG/usr/doc/perl-$VERSION/MIME-Base64-${MIMEBASE64}/*
+ ) || exit 1
+ ( tar xzvf $CWD/libnet-${LIBNET}.tar.gz
+ cd libnet-${LIBNET}
+ zcat $CWD/libnet-3.08-Do-not-create-Net-libnet.cfg.patch.gz | patch -p1 --verbose || exit 1
+ chown -R root:root .
+ echo | perl Makefile.PL \
+ PREFIX=/usr \
+ INSTALLDIRS=vendor
+ make || exit 1
+ if [ "$MAKETEST" = "yes" ]; then
+ make test || exit 1
+ fi
+ make install || exit 1
+ make install DESTDIR=$PKG || exit 1
+ mkdir -p $PKG/usr/doc/perl-$VERSION/libnet-${LIBNET}
+ cp -a Artistic Changes Copying INSTALL LICENCE README $PKG/usr/doc/perl-$VERSION/libnet-${LIBNET}
+ chmod 644 $PKG/usr/doc/perl-$VERSION/libnet-${LIBNET}/*
+ ) || exit 1
+) || exit 1
# Strip everything:
( cd $PKG
@@ -263,12 +333,12 @@ make install DESTDIR=$PKG
# I haven't had any requests for them, but would be willing
# to consider adding one or both to the package if anyone
# actually needs them for some reason.
-#make microperl
+#make microperl || exit 1
# Symlinks that replace hard links
( cd $PKG/usr/bin
ln -sf perl$VERSION perl
- ln -sf c2ph pstruct )
+)
# Install documentation
mkdir -p $PKG/usr/doc/perl-$VERSION
@@ -280,7 +350,8 @@ cp -a \
# We follow LSB with symlinks in /usr/share:
( cd $PKG/usr/share
- mv man .. )
+ mv man ..
+)
( cd $PKG/usr/man/man1
mkdir foo
cp *.1 foo
@@ -288,40 +359,24 @@ cp -a \
mv foo/* .
rmdir foo
gzip -9 *
- ln -sf c2ph.1.gz pstruct.1.gz )
+)
( cd $PKG/usr/man/man3
- gzip -9 * )
+ gzip -9 *
+)
chmod 755 $PKG/usr/bin/*
chmod 644 $PKG/usr/man/man?/*
-# This file shouldn't get clobbered:
+# Don't ship a perllocal.pod populated with vendor_perl additions. The file is
+# meant for locally added perl modules:
if [ -r $PKG/usr/lib${LIBDIRSUFFIX}/perl5/perllocal.pod ]; then
- mv $PKG/usr/lib${LIBDIRSUFFIX}/perl5/perllocal.pod $PKG/usr/lib${LIBDIRSUFFIX}/perl5/perllocal.pod.new
+ mv $PKG/usr/lib${LIBDIRSUFFIX}/perl5/perllocal.pod $PKG/usr/lib${LIBDIRSUFFIX}/perl5/vendor_perl.pod
fi
# Insert the slack-desc:
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
-
-cat << EOF | sed -e "s#/lib/#/lib${LIBDIRSUFFIX}/#" | sed -e "s#i486#$ARCH#" \
- > $PKG/install/doinst.sh
-#!/bin/sh
-config() {
- NEW="\$1"
- OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
- # If there's no config file by that name, mv it over:
- if [ ! -r \$OLD ]; then
- mv \$NEW \$OLD
- elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy
- rm \$NEW
- fi
- # Otherwise, we leave the .new copy for the admin to consider...
-}
-config usr/lib/perl5/perllocal.pod.new
-EOF
-
# Build the package:
cd $PKG
/sbin/makepkg -l y -c n $TMP/perl-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/d/perl/slack-desc b/source/d/perl/slack-desc
index e28cf9416..cd05fa753 100644
--- a/source/d/perl/slack-desc
+++ b/source/d/perl/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
perl: perl (Practical Extraction and Report Language)
perl:
-perl: Larry Wall's "Practical Extraction and Report Language". Perl is a
+perl: Larry Wall's "Practical Extraction and Report Language". Perl is a
perl: language optimized for scanning arbitrary text files, extracting
perl: information from those text files, and printing reports based on that
-perl: information. It's also a good language for many system management
-perl: tasks. The language is intended to be practical (easy to use,
+perl: information. It's also a good language for many system management
+perl: tasks. The language is intended to be practical (easy to use,
perl: efficient, complete) rather than beautiful (tiny, elegant, minimal).
perl:
-perl:
+perl: Homepage: http://www.perl.org
perl:
diff --git a/source/d/pkg-config/pkg-config.SlackBuild b/source/d/pkg-config/pkg-config.SlackBuild
index 595e97594..b1b05903a 100755
--- a/source/d/pkg-config/pkg-config.SlackBuild
+++ b/source/d/pkg-config/pkg-config.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010, 2017, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,6 +20,8 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=pkg-config
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-2}
@@ -34,9 +36,16 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-pkg-config
rm -rf $PKG
@@ -79,7 +88,7 @@ CFLAGS="$SLKCFLAGS" \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--docdir=/usr/doc/pkg-config-$VERSION \
- --build=${ARCH}-slackware-linux
+ --build=${ARCH}-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
@@ -99,9 +108,17 @@ gzip -9 $PKG/usr/man/man?/*.?
mkdir -p $PKG/usr/doc/pkg-config-$VERSION
cp -a \
- AUTHORS COPYING NEWS README \
+ AUTHORS* COPYING* NEWS* README* \
$PKG/usr/doc/pkg-config-$VERSION
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
mkdir -p $PKG/install
zcat $CWD/doinst.sh.gz | sed -e "s#/lib/#/lib${LIBDIRSUFFIX}/#g" \
> $PKG/install/doinst.sh
diff --git a/source/d/pkg-config/slack-desc b/source/d/pkg-config/slack-desc
index 52f57e1b9..f13f3fe06 100644
--- a/source/d/pkg-config/slack-desc
+++ b/source/d/pkg-config/slack-desc
@@ -1,16 +1,16 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
pkg-config: pkg-config (system for managing library compile/link flags)
pkg-config:
pkg-config: pkg-config is a system for managing library compile/link flags
-pkg-config: that works with automake and autoconf. It replaces the ubiquitous
-pkg-config: *-config scripts you may have seen with a single tool. See the man
+pkg-config: that works with automake and autoconf. It replaces the ubiquitous
+pkg-config: *-config scripts you may have seen with a single tool. See the man
pkg-config: page that comes with pkg-config for full documentation.
pkg-config:
pkg-config:
diff --git a/source/d/pmake/pmake.SlackBuild b/source/d/pmake/pmake.SlackBuild
index 23cc58d45..5cbd437bb 100755
--- a/source/d/pmake/pmake.SlackBuild
+++ b/source/d/pmake/pmake.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2006-2011 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006-2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,22 +20,30 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=pmake
VERSION=${VERSION:-1.111}
-BUILD=${BUILD:-4}
+BUILD=${BUILD:-5}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
@@ -44,8 +52,7 @@ mkdir -p $TMP $PKG
if [ "$ARCH" = "i386" ]; then
SLKCFLAGS="-O2 -Wall -DMACHINE_ARCH=\\\"${ARCH}\\\" -DHAVE_SETENV -DHAVE_STRERROR -DHAVE_STRDUP -DHAVE_STRFTIME -DHAVE_VSNPRINTF -D_GNU_SOURCE"
-elif [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -Wall -DMACHINE_ARCH=\\\"${ARCH}\\\" -DHAVE_SETENV -DHAVE_STRERROR -DHAVE_STRDUP -DHAVE_STRFTIME -DHAVE_VSNPRINTF -D_GNU_SOURCE"
+elif [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -Wall -DMACHINE_ARCH=\\\"${ARCH}\\\" -DHAVE_SETENV -DHAVE_STRERROR -DHAVE_STRDUP -DHAVE_STRFTIME -DHAVE_VSNPRINTF -D_GNU_SOURCE"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2 -Wall -DMACHINE_ARCH=\\\"${ARCH}\\\" -DHAVE_SETENV -DHAVE_STRERROR -DHAVE_STRDUP -DHAVE_STRFTIME -DHAVE_VSNPRINTF -D_GNU_SOURCE"
@@ -56,9 +63,9 @@ else
fi
cd $TMP
-rm -rf ${PKGNAM}-${VERSION}
-tar xzvf $CWD/${PKGNAM}-$VERSION.tar.gz
-cd ${PKGNAM}
+rm -rf ${PKGNAM}
+tar xvf $CWD/${PKGNAM}-$VERSION.tar.gz || exit 1
+cd ${PKGNAM} || exit 1
zcat $CWD/pmake_1.111-1.diff.gz | patch -p1 || exit 1
# Not sure why the defines in the cflags didn't work here, but
@@ -77,7 +84,7 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
-CFLAGS="$SLKCFLAGS" make -f Makefile.boot
+CFLAGS="$SLKCFLAGS" make -f Makefile.boot || exit 1
mkdir -p $PKG/usr/bin
cp bmake $PKG/usr/bin/pmake
diff --git a/source/d/pmake/slack-desc b/source/d/pmake/slack-desc
index d01c9b44e..d2a4f3a20 100644
--- a/source/d/pmake/slack-desc
+++ b/source/d/pmake/slack-desc
@@ -1,15 +1,15 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
pmake: pmake (BSD parallel make)
pmake:
-pmake: This is PMake -- a parallel Make program originally written for the
-pmake: Sprite operating system, ported from BSD Unix. This may be useful if
+pmake: This is PMake - a parallel Make program originally written for the
+pmake: Sprite operating system, ported from BSD Unix. This may be useful if
pmake: you're going to port software with Makefiles designed for BSD.
pmake:
pmake: PMake was written by Adam de Boor.
diff --git a/source/d/python-pip/pip.url b/source/d/python-pip/pip.url
new file mode 100644
index 000000000..6decc05c5
--- /dev/null
+++ b/source/d/python-pip/pip.url
@@ -0,0 +1 @@
+https://pypi.python.org/pypi/pip
diff --git a/source/d/python-pip/python-pip.SlackBuild b/source/d/python-pip/python-pip.SlackBuild
new file mode 100755
index 000000000..8fb4432e7
--- /dev/null
+++ b/source/d/python-pip/python-pip.SlackBuild
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2017 Heinz Wiesinger, Amsterdam, NL
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=python-pip
+VERSION=${VERSION:-$(echo pip-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+SRCNAM=pip
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf $SRCNAM-$VERSION
+tar xvf $CWD/$SRCNAM-$VERSION.tar.?z || exit 1
+cd $SRCNAM-$VERSION || exit 1
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+python3 setup.py install --root=$PKG || exit 1
+
+# Drop the python3 version of pip so the python 2.7
+# one is installed. We prefer that one to be the default for now.
+rm -rf $PKG/usr/bin/pip
+
+python setup.py install --root=$PKG || exit 1
+
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a *.txt PKG-INFO README.rst \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+find $PKG/usr/doc/$PKGNAM-$VERSION -type f -exec chmod 0644 {} \;
+
+# If there's a CHANGES.txt, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r CHANGES.txt ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat CHANGES.txt | head -n 1000 > $DOCSDIR/CHANGES.txt
+ touch -r CHANGES.txt $DOCSDIR/CHANGES.txt
+fi
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/d/python-pip/slack-desc b/source/d/python-pip/slack-desc
new file mode 100644
index 000000000..8431a1d2c
--- /dev/null
+++ b/source/d/python-pip/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+python-pip: python-pip (tool for installing Python packages)
+python-pip:
+python-pip: The PyPA recommended tool for installing Python packages.
+python-pip:
+python-pip: Homepage: https://pip.pypa.io/
+python-pip:
+python-pip:
+python-pip:
+python-pip:
+python-pip:
+python-pip:
diff --git a/source/d/python-setuptools/python-setuptools.SlackBuild b/source/d/python-setuptools/python-setuptools.SlackBuild
index b867d3669..4f672eeaf 100755
--- a/source/d/python-setuptools/python-setuptools.SlackBuild
+++ b/source/d/python-setuptools/python-setuptools.SlackBuild
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2013-2014 Audrius Kažukauskas <audrius@neutrino.lt>
-# Copyright 2014 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2014, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,9 +21,21 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
+# First, convert the .zip file if needed:
+if ls *.zip 1> /dev/null 2> /dev/null ; then
+ unzip *.zip
+ tar cf $(basename *.zip .zip).tar $(basename *.zip .zip)
+ touch -r *.zip *.tar
+ xz -9 *.tar
+ rm -r $(basename *.zip .zip)
+ rm *.zip
+fi
+
PKGNAM=python-setuptools
VERSION=${VERSION:-$(echo setuptools-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
SRCNAM=setuptools
@@ -35,7 +47,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
@@ -53,7 +72,14 @@ find -L . \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
rm -f setuptools/*.exe
-python setup.py install --root=$PKG
+
+python3 setup.py install --root=$PKG || exit 1
+
+# Drop the python3 version of easy_install so the python 2.7
+# one is installed. We prefer that one to be the default for now.
+rm -rf $PKG/usr/bin/easy_install
+
+python setup.py install --root=$PKG || exit 1
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cp -a CHANGES.rst PKG-INFO README.rst docs/*.txt \
diff --git a/source/d/python-setuptools/python-setuptools.url b/source/d/python-setuptools/python-setuptools.url
new file mode 100644
index 000000000..6e63ed64c
--- /dev/null
+++ b/source/d/python-setuptools/python-setuptools.url
@@ -0,0 +1 @@
+https://pypi.python.org/pypi/setuptools
diff --git a/source/d/python-setuptools/slack-desc b/source/d/python-setuptools/slack-desc
index 6dcce3c61..378849e94 100644
--- a/source/d/python-setuptools/slack-desc
+++ b/source/d/python-setuptools/slack-desc
@@ -2,18 +2,18 @@
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
-# You must make exactly 11 lines for the formatting to be correct. It's also
+# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
python-setuptools: python-setuptools (a collection of enhancements to Python distutils)
python-setuptools:
python-setuptools: This is a full featured library designed to facilitate packaging
-python-setuptools: Python projects. Features include Python package and module
+python-setuptools: Python projects. Features include Python package and module
python-setuptools: definitions, distribution package metadata, test hooks, project
python-setuptools: installation, and platform-specific details.
python-setuptools:
-python-setuptools:
+python-setuptools: Homepage: https://pypi.python.org/pypi/setuptools
python-setuptools:
python-setuptools:
python-setuptools:
diff --git a/source/d/python/python.SlackBuild b/source/d/python/python.SlackBuild
index 09a27a21e..c4948fcd0 100755
--- a/source/d/python/python.SlackBuild
+++ b/source/d/python/python.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright 2008, 2009, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2012, 2013, 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,6 +20,7 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=python
SRCNAM=Python
@@ -39,7 +40,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
rm -rf $PKG
@@ -67,7 +75,7 @@ TOOLSDIR=/usr/lib${LIBDIRSUFFIX}/${PKGNAM}${BRANCH_VERSION}/site-packages
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xf $CWD/$SRCNAM-$VERSION.tar.xz || exit 1
-cd $SRCNAM-$VERSION
+cd $SRCNAM-$VERSION || exit 1
zcat $CWD/python.readline.set_pre_input_hook.diff.gz | patch -p1 --verbose || exit 1
# We don't want a large libpython*.a:
@@ -86,6 +94,9 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# Enable built-in SQLite module to load extensions
+sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
+
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
@@ -94,10 +105,14 @@ find . \
--with-threads \
--enable-ipv6 \
--enable-shared \
- --build=$ARCH-slackware-linux
+ --enable-unicode=ucs4 \
+ --with-system-expat \
+ --with-system-ffi \
+ --without-ensurepip \
+ --build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG
+make install DESTDIR=$PKG || exit 1
# Install some python-demo files:
mkdir -p $PKG/usr/doc/python-$VERSION
@@ -112,6 +127,7 @@ mv $SITEPK/README $PKG/usr/doc/python-$VERSION/README.python-tools
( cd $PKG/usr/doc/python-$VERSION
ln -sf $TOOLSDIR Tools
)
+
# Make a few useful symlinks:
mkdir -p $PKG/usr/bin
( cd $PKG/usr/bin
diff --git a/source/d/python/python.x86_64.diff b/source/d/python/python.x86_64.diff
index e3a2af8ea..55cdf4996 100644
--- a/source/d/python/python.x86_64.diff
+++ b/source/d/python/python.x86_64.diff
@@ -1,61 +1,16 @@
-diff -Nur Python-2.7.9.orig/Lib/distutils/command/install.py Python-2.7.9/Lib/distutils/command/install.py
---- Python-2.7.9.orig/Lib/distutils/command/install.py 2014-12-10 09:59:34.000000000 -0600
-+++ Python-2.7.9/Lib/distutils/command/install.py 2014-12-11 21:14:11.560186033 -0600
-@@ -41,15 +41,15 @@
-
- INSTALL_SCHEMES = {
- 'unix_prefix': {
-- 'purelib': '$base/lib/python$py_version_short/site-packages',
-- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
-+ 'purelib': '$base/lib64/python$py_version_short/site-packages',
-+ 'platlib': '$platbase/lib64/python$py_version_short/site-packages',
- 'headers': '$base/include/python$py_version_short/$dist_name',
- 'scripts': '$base/bin',
- 'data' : '$base',
- },
- 'unix_home': {
-- 'purelib': '$base/lib/python',
-- 'platlib': '$base/lib/python',
-+ 'purelib': '$base/lib64/python',
-+ 'platlib': '$base/lib64/python',
- 'headers': '$base/include/python/$dist_name',
- 'scripts': '$base/bin',
- 'data' : '$base',
-diff -Nur Python-2.7.9.orig/Lib/distutils/sysconfig.py Python-2.7.9/Lib/distutils/sysconfig.py
---- Python-2.7.9.orig/Lib/distutils/sysconfig.py 2014-12-10 09:59:34.000000000 -0600
-+++ Python-2.7.9/Lib/distutils/sysconfig.py 2014-12-11 21:14:45.394770718 -0600
-@@ -120,7 +120,7 @@
+--- ./Makefile.pre.in.orig 2016-12-17 14:05:06.000000000 -0600
++++ ./Makefile.pre.in 2016-12-28 13:17:09.089663880 -0600
+@@ -111,7 +111,7 @@
+ MANDIR= @mandir@
+ INCLUDEDIR= @includedir@
+ CONFINCLUDEDIR= $(exec_prefix)/include
+-SCRIPTDIR= $(prefix)/lib
++SCRIPTDIR= $(prefix)/lib64
- if os.name == "posix":
- libpython = os.path.join(prefix,
-- "lib", "python" + get_python_version())
-+ "lib64", "python" + get_python_version())
- if standard_lib:
- return libpython
- else:
-diff -Nur Python-2.7.9.orig/Lib/site.py Python-2.7.9/Lib/site.py
---- Python-2.7.9.orig/Lib/site.py 2014-12-10 09:59:40.000000000 -0600
-+++ Python-2.7.9/Lib/site.py 2014-12-11 21:15:39.365108237 -0600
-@@ -288,13 +288,13 @@
- if sys.platform in ('os2emx', 'riscos'):
- sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
- elif os.sep == '/':
-- sitepackages.append(os.path.join(prefix, "lib",
-+ sitepackages.append(os.path.join(prefix, "lib64",
- "python" + sys.version[:3],
- "site-packages"))
-- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
-+ sitepackages.append(os.path.join(prefix, "lib64", "site-python"))
- else:
- sitepackages.append(prefix)
-- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
-+ sitepackages.append(os.path.join(prefix, "lib64", "site-packages"))
- if sys.platform == "darwin":
- # for framework builds *only* we add the standard Apple
- # locations.
-diff -Nur Python-2.7.9.orig/Lib/sysconfig.py Python-2.7.9/Lib/sysconfig.py
---- Python-2.7.9.orig/Lib/sysconfig.py 2014-12-10 09:59:40.000000000 -0600
-+++ Python-2.7.9/Lib/sysconfig.py 2014-12-11 21:16:44.487308865 -0600
+ # Detailed destination directories
+ BINLIBDEST= $(LIBDIR)/python$(VERSION)
+--- ./Lib/sysconfig.py.orig 2016-12-17 14:05:06.000000000 -0600
++++ ./Lib/sysconfig.py 2016-12-28 13:17:09.086663880 -0600
@@ -7,20 +7,20 @@
_INSTALL_SCHEMES = {
@@ -100,22 +55,61 @@ diff -Nur Python-2.7.9.orig/Lib/sysconfig.py Python-2.7.9/Lib/sysconfig.py
'include': '{userbase}/include/python{py_version_short}',
'scripts': '{userbase}/bin',
'data' : '{userbase}',
-diff -Nur Python-2.7.9.orig/Makefile.pre.in Python-2.7.9/Makefile.pre.in
---- Python-2.7.9.orig/Makefile.pre.in 2014-12-10 09:59:50.000000000 -0600
-+++ Python-2.7.9/Makefile.pre.in 2014-12-11 21:16:59.515124398 -0600
-@@ -106,7 +106,7 @@
- MANDIR= @mandir@
- INCLUDEDIR= @includedir@
- CONFINCLUDEDIR= $(exec_prefix)/include
--SCRIPTDIR= $(prefix)/lib
-+SCRIPTDIR= $(prefix)/lib64
+--- ./Lib/site.py.orig 2016-12-17 14:05:06.000000000 -0600
++++ ./Lib/site.py 2016-12-28 13:19:06.612662631 -0600
+@@ -288,13 +288,13 @@
+ if sys.platform in ('os2emx', 'riscos'):
+ sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
+ elif os.sep == '/':
+- sitepackages.append(os.path.join(prefix, "lib",
++ sitepackages.append(os.path.join(prefix, "lib64",
+ "python" + sys.version[:3],
+ "site-packages"))
+- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
++ sitepackages.append(os.path.join(prefix, "lib64", "site-python"))
+ else:
+ sitepackages.append(prefix)
+- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
++ sitepackages.append(os.path.join(prefix, "lib64", "site-packages"))
+ return sitepackages
- # Detailed destination directories
- BINLIBDEST= $(LIBDIR)/python$(VERSION)
-diff -Nur Python-2.7.9.orig/Modules/getpath.c Python-2.7.9/Modules/getpath.c
---- Python-2.7.9.orig/Modules/getpath.c 2014-12-10 09:59:55.000000000 -0600
-+++ Python-2.7.9/Modules/getpath.c 2014-12-11 21:18:16.840175232 -0600
-@@ -129,7 +129,7 @@
+ def addsitepackages(known_paths):
+--- ./Lib/distutils/command/install.py.orig 2016-12-17 14:05:05.000000000 -0600
++++ ./Lib/distutils/command/install.py 2016-12-28 13:17:09.079663880 -0600
+@@ -41,15 +41,15 @@
+
+ INSTALL_SCHEMES = {
+ 'unix_prefix': {
+- 'purelib': '$base/lib/python$py_version_short/site-packages',
+- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
++ 'purelib': '$base/lib64/python$py_version_short/site-packages',
++ 'platlib': '$platbase/lib64/python$py_version_short/site-packages',
+ 'headers': '$base/include/python$py_version_short/$dist_name',
+ 'scripts': '$base/bin',
+ 'data' : '$base',
+ },
+ 'unix_home': {
+- 'purelib': '$base/lib/python',
+- 'platlib': '$base/lib/python',
++ 'purelib': '$base/lib64/python',
++ 'platlib': '$base/lib64/python',
+ 'headers': '$base/include/python/$dist_name',
+ 'scripts': '$base/bin',
+ 'data' : '$base',
+--- ./Lib/distutils/sysconfig.py.orig 2016-12-17 14:05:05.000000000 -0600
++++ ./Lib/distutils/sysconfig.py 2016-12-28 13:17:09.081663880 -0600
+@@ -120,7 +120,7 @@
+
+ if os.name == "posix":
+ libpython = os.path.join(prefix,
+- "lib", "python" + get_python_version())
++ "lib64", "python" + get_python_version())
+ if standard_lib:
+ return libpython
+ else:
+--- ./Modules/getpath.c.orig 2016-12-17 14:05:07.000000000 -0600
++++ ./Modules/getpath.c 2016-12-28 13:17:09.093663880 -0600
+@@ -108,7 +108,7 @@
static char exec_prefix[MAXPATHLEN+1];
static char progpath[MAXPATHLEN+1];
static char *module_search_path = NULL;
@@ -124,7 +118,7 @@ diff -Nur Python-2.7.9.orig/Modules/getpath.c Python-2.7.9/Modules/getpath.c
static void
reduce(char *dir)
-@@ -543,7 +543,7 @@
+@@ -520,7 +520,7 @@
}
else
strncpy(zip_path, PREFIX, MAXPATHLEN);
@@ -133,7 +127,7 @@ diff -Nur Python-2.7.9.orig/Modules/getpath.c Python-2.7.9/Modules/getpath.c
bufsz = strlen(zip_path); /* Replace "00" with version */
zip_path[bufsz - 6] = VERSION[0];
zip_path[bufsz - 5] = VERSION[2];
-@@ -553,7 +553,7 @@
+@@ -530,7 +530,7 @@
fprintf(stderr,
"Could not find platform dependent libraries <exec_prefix>\n");
strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
@@ -142,10 +136,9 @@ diff -Nur Python-2.7.9.orig/Modules/getpath.c Python-2.7.9/Modules/getpath.c
}
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
-diff -Nur Python-2.7.9.orig/setup.py Python-2.7.9/setup.py
---- Python-2.7.9.orig/setup.py 2014-12-10 10:00:01.000000000 -0600
-+++ Python-2.7.9/setup.py 2014-12-11 21:19:37.094190107 -0600
-@@ -440,7 +440,7 @@
+--- ./setup.py.orig 2016-12-17 14:05:07.000000000 -0600
++++ ./setup.py 2016-12-28 13:17:09.097663880 -0600
+@@ -456,7 +456,7 @@
def detect_modules(self):
# Ensure that /usr/local is always used
if not cross_compiling:
@@ -154,7 +147,7 @@ diff -Nur Python-2.7.9.orig/setup.py Python-2.7.9/setup.py
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
if cross_compiling:
self.add_gcc_paths()
-@@ -762,11 +762,11 @@
+@@ -782,11 +782,11 @@
elif curses_library:
readline_libs.append(curses_library)
elif self.compiler.find_library_file(lib_dirs +
@@ -168,7 +161,7 @@ diff -Nur Python-2.7.9.orig/setup.py Python-2.7.9/setup.py
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
else:
-@@ -801,8 +801,8 @@
+@@ -821,8 +821,8 @@
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
diff --git a/source/d/python/slack-desc b/source/d/python/slack-desc
index 569c3c5b3..d7db551f0 100644
--- a/source/d/python/slack-desc
+++ b/source/d/python/slack-desc
@@ -1,17 +1,17 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
python: python (object-oriented interpreted programming language)
python:
python: Python is an interpreted, interactive, object-oriented programming
-python: language that combines remarkable power with very clear syntax.
+python: language that combines remarkable power with very clear syntax.
python: Python's basic power can be extended with your own modules written in
-python: C or C++. Python is also adaptable as an extension language for
+python: C or C++. Python is also adaptable as an extension language for
python: existing applications.
python:
python:
diff --git a/source/d/python3/README b/source/d/python3/README
new file mode 100644
index 000000000..8197d5920
--- /dev/null
+++ b/source/d/python3/README
@@ -0,0 +1,18 @@
+Python is an interpreted, interactive, object-oriented programming
+language that combines remarkable power with very clear syntax.
+Python's basic power can be extended with your own modules written in C
+or C++. Python is also adaptable as an extension language for existing
+applications.
+
+Python 3 (a.k.a. "Python 3000" or "Py3k") is a new version of the
+language that is incompatible with the 2.x line of releases. The
+language is mostly the same, but many details, especially how built-in
+objects like dictionaries and strings work, have changed considerably,
+and a lot of deprecated features have finally been removed. Also, the
+standard library has been reorganized in a few prominent places.
+
+It is safe to install alongside Slackware's Python 2.x.
+
+If you'd like to have HTML docs installed, get them from
+<https://docs.python.org/3/download.html> (HTML format, .tar.bz2
+archive).
diff --git a/source/d/python3/python3.SlackBuild b/source/d/python3/python3.SlackBuild
new file mode 100755
index 000000000..aebf3818e
--- /dev/null
+++ b/source/d/python3/python3.SlackBuild
@@ -0,0 +1,166 @@
+#!/bin/bash
+
+# Slackware build script for python3
+
+# Copyright 2012-2017 Audrius Kažukauskas <audrius@neutrino.lt>
+# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=python3
+SRCNAM=Python
+VERSION=$(echo $SRCNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
+BRANCH_VERSION=$(echo $VERSION | cut -f 1,2 -d . )
+BUILD=${BUILD:-3}
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i586 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+# Don't set any SLKCFLAGS here, or OPT="$SLKCFLAGS" before the ./configure.
+# Python gets the compile options right without any help.
+if [ "$ARCH" = "i586" ]; then
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "arm" ]; then
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "armel" ]; then
+ LIBDIRSUFFIX=""
+fi
+
+# Location for Python site-packages:
+SITEPK=$PKG/usr/lib${LIBDIRSUFFIX}/python${BRANCH_VERSION}/site-packages
+# same as above without $PKG
+TOOLSDIR=/usr/lib${LIBDIRSUFFIX}/python${BRANCH_VERSION}/site-packages
+
+cd $TMP
+rm -rf $SRCNAM-$VERSION
+tar xf $CWD/$SRCNAM-$VERSION.tar.xz || exit 1
+cd $SRCNAM-$VERSION || exit 1
+
+zcat $CWD/python3.readline.set_pre_input_hook.diff.gz | patch -p1 --verbose || exit 1
+# We don't want a large libpython*.a.
+zcat $CWD/python3.no-static-library.diff.gz | patch -p1 --verbose || exit 1
+
+if [ "$ARCH" = "x86_64" ]; then
+ # Install to lib64 instead of lib.
+ zcat $CWD/python3.x86_64.diff.gz | patch -p1 --verbose || exit 1
+fi
+
+# Fix python3 path in cgi.py.
+sed -i '1s|^#.*/usr/local/bin/python|#!/usr/bin/python3|' Lib/cgi.py
+
+# If system we're building on already has Python3 with pip in site-packages,
+# ignore it and install pip anyway.
+sed -i 's|\("install",\)|\1 "--ignore-installed",|' Lib/ensurepip/__init__.py
+
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PKGNAM-$VERSION \
+ --with-threads \
+ --enable-ipv6 \
+ --enable-shared \
+ --with-system-expat \
+ --with-system-ffi \
+ --enable-loadable-sqlite-extensions \
+ --without-ensurepip \
+ --build=$ARCH-slackware-linux || exit 1
+
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Remove to avoid overwriting a copy from Python2.
+rm -f $PKG/usr/bin/2to3
+
+# We'll install the python-tools under site-packages.
+mkdir -p $SITEPK
+cp -a Tools/* $SITEPK
+
+# Remove DOS batch/exe files.
+find $PKG \( -name '*.exe' -o -name '*.bat' \) -exec rm -f '{}' \;
+
+# Fix permissions on dynamic libraries.
+find $PKG -type f -perm 555 -exec chmod 755 '{}' \;
+
+# Install docs.
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a README.rst LICENSE Misc $PKG/usr/doc/$PKGNAM-$VERSION
+# Delete stuff that we don't need to package:
+rm -f $PKG/usr/doc/$PKGNAM-$VERSION/Misc/{HISTORY,*.in,*.wpr,python.man,svnmap.txt}
+mv $SITEPK/README $PKG/usr/doc/$PKGNAM-$VERSION/README.python-tools
+( cd $PKG/usr/doc/$PKGNAM-$VERSION ; ln -sf $TOOLSDIR Tools )
+if [ -e "$CWD/python-$VERSION-docs-html.tar.bz2" ]; then
+ tar xf $CWD/python-$VERSION-docs-html.tar.bz2
+ mv python-$VERSION-docs-html $PKG/usr/doc/$PKGNAM-$VERSION/html
+ chown -R root:root $PKG/usr/doc/$PKGNAM-$VERSION/html
+fi
+
+# Fix possible incorrect permissions.
+( cd $PKG
+ find . -type d -exec chmod 755 "{}" \;
+ find . -perm 640 -exec chmod 644 "{}" \;
+ find . -perm 750 -exec chmod 755 "{}" \;
+)
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/python3-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/d/python3/python3.no-static-library.diff b/source/d/python3/python3.no-static-library.diff
new file mode 100644
index 000000000..2821ca79d
--- /dev/null
+++ b/source/d/python3/python3.no-static-library.diff
@@ -0,0 +1,59 @@
+diff -uar Python-3.6.0.orig/Makefile.pre.in Python-3.6.0/Makefile.pre.in
+--- Python-3.6.0.orig/Makefile.pre.in 2016-12-23 04:21:21.000000000 +0200
++++ Python-3.6.0/Makefile.pre.in 2016-12-27 22:50:14.139741226 +0200
+@@ -564,7 +564,7 @@
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py --make
+
+ # Build the interpreter
+-$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
++$(BUILDPYTHON): Programs/python.o $(LDLIBRARY) $(PY3LIBRARY)
+ $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+
+ platform: $(BUILDPYTHON) pybuilddir.txt
+@@ -609,18 +609,6 @@
+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+
+
+-# Build static library
+-# avoid long command lines, same as LIBRARY_OBJS
+-$(LIBRARY): $(LIBRARY_OBJS)
+- -rm -f $@
+- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
+- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
+- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
+- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o
+- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS)
+- $(AR) $(ARFLAGS) $@ $(MODOBJS)
+- $(RANLIB) $@
+-
+ libpython$(LDVERSION).so: $(LIBRARY_OBJS)
+ if test $(INSTSONAME) != $(LDLIBRARY); then \
+ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+@@ -710,7 +698,7 @@
+ echo "-----------------------------------------------"; \
+ fi
+
+-Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
++Programs/_testembed: Programs/_testembed.o $(LDLIBRARY) $(PY3LIBRARY)
+ $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+
+ ############################################################################
+@@ -1388,18 +1376,6 @@
+ else true; \
+ fi; \
+ done
+- @if test -d $(LIBRARY); then :; else \
+- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+- if test "$(SHLIB_SUFFIX)" = .dll; then \
+- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
+- else \
+- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+- fi; \
+- else \
+- echo Skip install of $(LIBRARY) - use make frameworkinstall; \
+- fi; \
+- fi
+ $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
+ $(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
+ $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
diff --git a/source/d/python3/python3.readline.set_pre_input_hook.diff b/source/d/python3/python3.readline.set_pre_input_hook.diff
new file mode 100644
index 000000000..b55820c48
--- /dev/null
+++ b/source/d/python3/python3.readline.set_pre_input_hook.diff
@@ -0,0 +1,12 @@
+--- ./Modules/readline.c.orig 2009-10-26 21:32:51.000000000 +0200
++++ ./Modules/readline.c 2010-05-30 14:07:10.000000000 +0300
+@@ -12,6 +12,9 @@
+ #include <errno.h>
+ #include <sys/time.h>
+
++/* This seems to be needed for set_pre_input_hook to work */
++#define HAVE_RL_PRE_INPUT_HOOK 1
++
+ #if defined(HAVE_SETLOCALE)
+ /* GNU readline() mistakenly sets the LC_CTYPE locale.
+ * This is evil. Only the user or the app's main() should do this!
diff --git a/source/d/python3/python3.x86_64.diff b/source/d/python3/python3.x86_64.diff
new file mode 100644
index 000000000..182fc6293
--- /dev/null
+++ b/source/d/python3/python3.x86_64.diff
@@ -0,0 +1,164 @@
+diff -uar Python-3.6.1.orig/Lib/distutils/command/install.py Python-3.6.1/Lib/distutils/command/install.py
+--- Python-3.6.1.orig/Lib/distutils/command/install.py 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/Lib/distutils/command/install.py 2017-03-22 21:42:23.915962369 +0200
+@@ -29,15 +29,15 @@
+
+ INSTALL_SCHEMES = {
+ 'unix_prefix': {
+- 'purelib': '$base/lib/python$py_version_short/site-packages',
+- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
++ 'purelib': '$base/lib64/python$py_version_short/site-packages',
++ 'platlib': '$platbase/lib64/python$py_version_short/site-packages',
+ 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
+ 'scripts': '$base/bin',
+ 'data' : '$base',
+ },
+ 'unix_home': {
+- 'purelib': '$base/lib/python',
+- 'platlib': '$base/lib/python',
++ 'purelib': '$base/lib64/python',
++ 'platlib': '$base/lib64/python',
+ 'headers': '$base/include/python/$dist_name',
+ 'scripts': '$base/bin',
+ 'data' : '$base',
+diff -uar Python-3.6.1.orig/Lib/distutils/sysconfig.py Python-3.6.1/Lib/distutils/sysconfig.py
+--- Python-3.6.1.orig/Lib/distutils/sysconfig.py 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/Lib/distutils/sysconfig.py 2017-03-22 21:42:23.915962369 +0200
+@@ -133,7 +133,7 @@
+
+ if os.name == "posix":
+ libpython = os.path.join(prefix,
+- "lib", "python" + get_python_version())
++ "lib64", "python" + get_python_version())
+ if standard_lib:
+ return libpython
+ else:
+diff -uar Python-3.6.1.orig/Lib/site.py Python-3.6.1/Lib/site.py
+--- Python-3.6.1.orig/Lib/site.py 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/Lib/site.py 2017-03-22 21:42:23.915962369 +0200
+@@ -304,7 +304,7 @@
+ seen.add(prefix)
+
+ if os.sep == '/':
+- sitepackages.append(os.path.join(prefix, "lib",
++ sitepackages.append(os.path.join(prefix, "lib64",
+ "python%d.%d" % sys.version_info[:2],
+ "site-packages"))
+ else:
+diff -uar Python-3.6.1.orig/Lib/sysconfig.py Python-3.6.1/Lib/sysconfig.py
+--- Python-3.6.1.orig/Lib/sysconfig.py 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/Lib/sysconfig.py 2017-03-22 21:42:23.916962405 +0200
+@@ -20,10 +20,10 @@
+
+ _INSTALL_SCHEMES = {
+ 'posix_prefix': {
+- 'stdlib': '{installed_base}/lib/python{py_version_short}',
+- 'platstdlib': '{platbase}/lib/python{py_version_short}',
+- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
+- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
++ 'stdlib': '{installed_base}/lib64/python{py_version_short}',
++ 'platstdlib': '{platbase}/lib64/python{py_version_short}',
++ 'purelib': '{base}/lib64/python{py_version_short}/site-packages',
++ 'platlib': '{platbase}/lib64/python{py_version_short}/site-packages',
+ 'include':
+ '{installed_base}/include/python{py_version_short}{abiflags}',
+ 'platinclude':
+@@ -32,10 +32,10 @@
+ 'data': '{base}',
+ },
+ 'posix_home': {
+- 'stdlib': '{installed_base}/lib/python',
+- 'platstdlib': '{base}/lib/python',
+- 'purelib': '{base}/lib/python',
+- 'platlib': '{base}/lib/python',
++ 'stdlib': '{installed_base}/lib64/python',
++ 'platstdlib': '{base}/lib64/python',
++ 'purelib': '{base}/lib64/python',
++ 'platlib': '{base}/lib64/python',
+ 'include': '{installed_base}/include/python',
+ 'platinclude': '{installed_base}/include/python',
+ 'scripts': '{base}/bin',
+@@ -61,10 +61,10 @@
+ 'data': '{userbase}',
+ },
+ 'posix_user': {
+- 'stdlib': '{userbase}/lib/python{py_version_short}',
+- 'platstdlib': '{userbase}/lib/python{py_version_short}',
+- 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
+- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
++ 'stdlib': '{userbase}/lib64/python{py_version_short}',
++ 'platstdlib': '{userbase}/lib64/python{py_version_short}',
++ 'purelib': '{userbase}/lib64/python{py_version_short}/site-packages',
++ 'platlib': '{userbase}/lib64/python{py_version_short}/site-packages',
+ 'include': '{userbase}/include/python{py_version_short}',
+ 'scripts': '{userbase}/bin',
+ 'data': '{userbase}',
+diff -uar Python-3.6.1.orig/Makefile.pre.in Python-3.6.1/Makefile.pre.in
+--- Python-3.6.1.orig/Makefile.pre.in 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/Makefile.pre.in 2017-03-22 21:42:23.916962405 +0200
+@@ -131,7 +131,7 @@
+ MANDIR= @mandir@
+ INCLUDEDIR= @includedir@
+ CONFINCLUDEDIR= $(exec_prefix)/include
+-SCRIPTDIR= $(prefix)/lib
++SCRIPTDIR= $(prefix)/lib64
+ ABIFLAGS= @ABIFLAGS@
+
+ # Detailed destination directories
+diff -uar Python-3.6.1.orig/Modules/getpath.c Python-3.6.1/Modules/getpath.c
+--- Python-3.6.1.orig/Modules/getpath.c 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/Modules/getpath.c 2017-03-22 21:42:23.917962441 +0200
+@@ -494,7 +494,7 @@
+ _pythonpath = Py_DecodeLocale(PYTHONPATH, NULL);
+ _prefix = Py_DecodeLocale(PREFIX, NULL);
+ _exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL);
+- lib_python = Py_DecodeLocale("lib/python" VERSION, NULL);
++ lib_python = Py_DecodeLocale("lib64/python" VERSION, NULL);
+
+ if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
+ Py_FatalError(
+@@ -683,7 +683,7 @@
+ }
+ else
+ wcsncpy(zip_path, _prefix, MAXPATHLEN);
+- joinpath(zip_path, L"lib/python00.zip");
++ joinpath(zip_path, L"lib64/python00.zip");
+ bufsz = wcslen(zip_path); /* Replace "00" with version */
+ zip_path[bufsz - 6] = VERSION[0];
+ zip_path[bufsz - 5] = VERSION[2];
+@@ -695,7 +695,7 @@
+ fprintf(stderr,
+ "Could not find platform dependent libraries <exec_prefix>\n");
+ wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
+- joinpath(exec_prefix, L"lib/lib-dynload");
++ joinpath(exec_prefix, L"lib64/lib-dynload");
+ }
+ /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
+
+diff -uar Python-3.6.1.orig/configure Python-3.6.1/configure
+--- Python-3.6.1.orig/configure 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/configure 2017-03-22 21:42:23.920962550 +0200
+@@ -14963,9 +14963,9 @@
+
+
+ if test x$PLATFORM_TRIPLET = x; then
+- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
++ LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}"
+ else
+- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
++ LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+ fi
+
+
+diff -uar Python-3.6.1.orig/setup.py Python-3.6.1/setup.py
+--- Python-3.6.1.orig/setup.py 2017-03-21 08:32:38.000000000 +0200
++++ Python-3.6.1/setup.py 2017-03-22 21:47:59.638077062 +0200
+@@ -491,7 +491,7 @@
+ # directories (i.e. '.' and 'Include') must be first. See issue
+ # 10520.
+ if not cross_compiling:
+- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
++ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ # only change this for cross builds for 3.3, issues on Mageia
+ if cross_compiling:
diff --git a/source/d/python3/slack-desc b/source/d/python3/slack-desc
new file mode 100644
index 000000000..ca18863aa
--- /dev/null
+++ b/source/d/python3/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+python3: python3 (object-oriented interpreted programming language v3)
+python3:
+python3: Python is an interpreted, interactive, object-oriented programming
+python3: language that combines remarkable power with very clear syntax.
+python3: This is a new version of the language that is incompatible with the
+python3: 2.x line of releases. The language is mostly the same, but many
+python3: details, especially how built-in objects like dictionaries and strings
+python3: work, have changed considerably, and a lot of deprecated features have
+python3: finally been removed. Also, the standard library has been reorganized
+python3: in a few prominent places.
+python3:
diff --git a/source/d/rcs/rcs.SlackBuild b/source/d/rcs/rcs.SlackBuild
index 7a23d2fbb..f2348714b 100755
--- a/source/d/rcs/rcs.SlackBuild
+++ b/source/d/rcs/rcs.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2013, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,15 +20,16 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=rcs
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
- i?86) ARCH=i486 ;;
+ i?86) ARCH=i586 ;;
arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$(uname -m) ;;
@@ -36,6 +37,14 @@ if [ -z "$ARCH" ]; then
export ARCH
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i386" ]; then
@@ -64,7 +73,6 @@ else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
@@ -84,14 +92,14 @@ find . \
-exec chmod 644 {} \;
# Configure:
-CFLAGS="$SLKCFLAGS" \
+CFLAGS="$SLKCFLAGS -std=c99" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--infodir=/usr/info \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
# Build and install:
make $NUMJOBS || make || exit 1
diff --git a/source/d/rcs/slack-desc b/source/d/rcs/slack-desc
index b8d62a08c..4baf38d10 100644
--- a/source/d/rcs/slack-desc
+++ b/source/d/rcs/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -10,7 +10,7 @@ rcs: rcs (Revision Control System)
rcs:
rcs: RCS, the Revision Control System, manages multiple revisions of files.
rcs:
-rcs: RCS can store, retrieve, log, identify, and merge revisions. It is
+rcs: RCS can store, retrieve, log, identify, and merge revisions. It is
rcs: useful for files that are revised frequently, e.g. programs,
rcs: documentation, graphics, and papers.
rcs:
diff --git a/source/d/re2c/re2c.SlackBuild b/source/d/re2c/re2c.SlackBuild
new file mode 100755
index 000000000..98f8976f9
--- /dev/null
+++ b/source/d/re2c/re2c.SlackBuild
@@ -0,0 +1,134 @@
+#!/bin/bash
+
+# Copyright 2008-2015 LukenShiro, Italy
+# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=re2c
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-2}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$(uname -m)" in
+ i?86) ARCH=i586 ;;
+ arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$(uname -m) ;;
+ esac
+ export ARCH
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+# .html file needs to be manually installed
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
+cd $PKGNAM-$VERSION || exit 1
+
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# Configure:
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PKGNAM-$VERSION \
+ --build=$ARCH-slackware-linux || exit 1
+
+# Build and install:
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Strip binaries:
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+)
+
+# Compress and link manpages, if any:
+if [ -d $PKG/usr/man ]; then
+ ( cd $PKG/usr/man
+ for manpagedir in $(find . -type d -name "man*") ; do
+ ( cd $manpagedir
+ for eachpage in $( find . -type l -maxdepth 1 | grep -v '\.gz$') ; do
+ ln -s $( readlink $eachpage ).gz $eachpage.gz
+ rm $eachpage
+ done
+ gzip -9 *.?
+ )
+ done
+ )
+fi
+
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a \
+ CHANGELOG NO_WARRANTY README* \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+ps2ascii doc/loplas.ps > $PKG/usr/doc/$PKGNAM-$VERSION/loplas.txt
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/d/re2c/re2c.url b/source/d/re2c/re2c.url
new file mode 100644
index 000000000..b394eb656
--- /dev/null
+++ b/source/d/re2c/re2c.url
@@ -0,0 +1 @@
+https://github.com/skvadrik/re2c/releases/download/1.0.3/re2c-1.0.3.tar.gz
diff --git a/source/d/re2c/slack-desc b/source/d/re2c/slack-desc
new file mode 100644
index 000000000..d8e18cb43
--- /dev/null
+++ b/source/d/re2c/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+re2c: re2c (regular expressions to C/C++ conversion tool)
+re2c:
+re2c: re2c is a tool for writing very fast and very flexible scanners.
+re2c: re2c focuses on generating high efficient code for regular expression
+re2c: matching. As a result this allows a much broader range of use than any
+re2c: traditional lexer offers. And last but not least, re2c generates
+re2c: warning free code that is equal to hand written code in terms of size,
+re2c: speed and quality.
+re2c:
+re2c: Homepage: http://re2c.org
+re2c:
diff --git a/source/d/ruby/ruby.SlackBuild b/source/d/ruby/ruby.SlackBuild
index 51e9edaf6..b3291af1b 100755
--- a/source/d/ruby/ruby.SlackBuild
+++ b/source/d/ruby/ruby.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2015, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,18 +20,19 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=ruby
-if echo $PKGNAM-*.tar.?z* | grep -q p ; then
+if echo $PKGNAM-*.tar.?z | grep -q p ; then
# With patchlevel in tarball name:
- VERSION=$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1,2 -d - | rev)
+ VERSION=$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1,2 -d - | rev)
else
# Without patchlevel in tarball name:
- VERSION=$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
+ VERSION=$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
fi
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -43,9 +44,16 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$(echo $VERSION | tr - _)-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-ruby
@@ -58,7 +66,7 @@ if [ "$ARCH" = "i586" ]; then
OPTFLAGS=-O3
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
- # Unknown if s390 is needs -O3. Check to see if it compiles with -O2.
+ # Unknown if s390 also needs -O3. Check to see if it compiles with -O2.
SLKCFLAGS="-O3 -fno-strict-aliasing"
OPTFLAGS=-O3
LIBDIRSUFFIX=""
@@ -72,7 +80,7 @@ rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf ruby-$VERSION
-tar xvf $CWD/ruby-$VERSION.tar.?z* || exit 1
+tar xvf $CWD/ruby-$VERSION.tar.?z || exit 1
cd ruby-$VERSION || exit 1
chown -R root:root .
@@ -96,7 +104,7 @@ optflags=$OPTFLAGS \
--enable-shared \
--enable-pthread \
--disable-install-capi \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
diff --git a/source/d/ruby/slack-desc b/source/d/ruby/slack-desc
index 13ffd7a3d..60cff1a8c 100644
--- a/source/d/ruby/slack-desc
+++ b/source/d/ruby/slack-desc
@@ -1,16 +1,16 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
ruby: ruby (Interpreted object-oriented scripting language)
ruby:
ruby: Ruby is an interpreted scripting language for quick and easy
-ruby: object-oriented programming. It has many features to process text
-ruby: files and to do system management tasks (as in Perl). It is simple,
+ruby: object-oriented programming. It has many features to process text
+ruby: files and to do system management tasks (as in Perl). It is simple,
ruby: straight-forward, and extensible.
ruby:
ruby: Visit the Ruby project online at http://www.ruby-lang.org/
diff --git a/source/d/rust/link_libffi.diff b/source/d/rust/link_libffi.diff
new file mode 100644
index 000000000..38e0113e9
--- /dev/null
+++ b/source/d/rust/link_libffi.diff
@@ -0,0 +1,12 @@
+diff -Naur rustc-1.21.0-src.bak/src/librustc_llvm/build.rs rustc-1.21.0-src/src/librustc_llvm/build.rs
+--- rustc-1.21.0-src.bak/src/librustc_llvm/build.rs 2017-10-10 09:04:51.000000000 +1300
++++ rustc-1.21.0-src/src/librustc_llvm/build.rs 2017-10-14 15:28:56.761081727 +1300
+@@ -221,6 +221,8 @@
+ println!("cargo:rustc-link-lib={}={}", kind, name);
+ }
+
++ println!("cargo:rustc-link-lib=dylib=ffi");
++
+ // LLVM ldflags
+ //
+ // If we're a cross-compile of LLVM then unfortunately we can't trust these
diff --git a/source/d/rust/rust.SlackBuild b/source/d/rust/rust.SlackBuild
new file mode 100755
index 000000000..1d2f3fb20
--- /dev/null
+++ b/source/d/rust/rust.SlackBuild
@@ -0,0 +1,294 @@
+#!/bin/bash
+
+# Copyright 2017 Andrew Clemons, Wellington, New Zealand
+# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2017 Stuart Winter
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PKGNAM=rust
+SRCNAM="${PKGNAM}c"
+VERSION=${VERSION:-1.26.0}
+BUILD=${BUILD:-1}
+
+# Set this to YES to build with the system LLVM, or NO to use the bundled LLVM.
+# YES is probably better (when it works...)
+SYSTEM_LLVM=${SYSTEM_LLVM:-NO}
+
+# Bootstrap variables (might not be kept updated for latest Rust):
+RSTAGE0_VERSION=${RSTAGE0_VERSION:-1.25.0}
+RSTAGE0_DIR=${RSTAGE0_DIR:-2018-03-29}
+CSTAGE0_VERSION=${CSTAGE0_VERSION:-0.26.0}
+CSTAGE0_DIR=${CSTAGE0_DIR:-$RSTAGE0_DIR}
+
+# Automatically determine the architecture we're building on:
+MARCH=$( uname -m )
+if [ -z "$ARCH" ]; then
+ case "$MARCH" in
+ i?86) export ARCH=i686 ;;
+ armv7hl) export ARCH=$MARCH ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$MARCH ;;
+ esac
+fi
+unset MARCH
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+# if you already have rust and cargo installed, you can bootstrap from the
+# previous version.
+if [ "$LOCAL_BOOTSTRAP" = "" ] && [ -x /usr/bin/cargo ] && [ -x /usr/bin/rustc ] ; then
+ LOCAL_BOOTSTRAP=yes
+fi
+
+# https://forge.rust-lang.org/platform-support.html
+# Bootstrapping ARCH:
+if [ "$ARCH" = "i586" ]; then
+ if [ "$LOCAL_BOOTSTRAP" = "yes" ] ; then
+ if rustc -Vv | grep host | grep i586 > /dev/null ; then
+ BARCH="$ARCH"
+ else
+ BARCH="i686"
+
+ if case "$( uname -m )" in i586) true ;; *) false ;; esac ; then
+ echo "rust must be bootstrapped from an i686 machine"
+ exit 1
+ fi
+ fi
+ else
+ # i586 must be built on a i686 machine, since the bootstrap compiler is i686
+ BARCH="i686"
+
+ if case "$( uname -m )" in i586) true ;; *) false ;; esac ; then
+ echo "rust must be bootstrapped from an i686 machine"
+ exit 1
+ fi
+ fi
+
+ TARCH="$ARCH"
+elif [ "$ARCH" = "armv7hl" ]; then
+ BARCH="armv7"
+ TARCH="$BARCH"
+else
+ BARCH="$ARCH"
+ TARCH="$ARCH"
+fi
+
+# Bootstrapping ABI:
+if [ "$ARCH" = "armv7hl" ]; then
+ BABI="gnueabihf"
+else
+ BABI="gnu"
+fi
+
+TMP=${TMP:-/tmp}
+OUTPUT=${OUTPUT:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+# Not needed, as the build will automatically use as many jobs as there are
+# cores.
+#NUMJOBS=${NUMJOBS:-" -j7 "}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ SLKCFLAGS=""
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SRCNAM-$VERSION-src
+tar xvf $CWD/$SRCNAM-$VERSION-src.tar.?z || exit 1
+cd $SRCNAM-$VERSION-src || exit 1
+
+# Link with -lffi in case of using system LLVM:
+if [ "${SYSTEM_LLVM}" = "YES" ]; then
+ zcat $CWD/link_libffi.diff.gz | patch -p1 --verbose || exit 1
+fi
+
+if [ "$LOCAL_BOOTSTRAP" != "yes" ] ; then
+ # rust requires bootstrapping with the previous rust version.
+ # versions are defined in src/stage0.txt.
+ mkdir -p build/cache/$RSTAGE0_DIR
+ cp $CWD/$PKGNAM-std-$RSTAGE0_VERSION-$BARCH-unknown-linux-gnu.tar.?z \
+ $CWD/$SRCNAM-$RSTAGE0_VERSION-$BARCH-unknown-linux-gnu.tar.?z \
+ build/cache/$RSTAGE0_DIR || exit 1
+ mkdir -p build/cache/$CSTAGE0_DIR
+ cp $CWD/cargo-$CSTAGE0_VERSION-$BARCH-unknown-linux-gnu.tar.?z build/cache/$CSTAGE0_DIR || exit 1
+fi
+
+# Build configuration. We'll go ahead and build with rpath because it may be
+# needed during the build, and then we'll strip the rpaths out of the
+# binaries later.
+cat << EOF > config.toml
+[llvm]
+ccache = "/usr/bin/ccache"
+
+[build]
+build = "$BARCH-unknown-linux-$BABI"
+host = ["$TARCH-unknown-linux-$BABI"]
+target = ["$TARCH-unknown-linux-$BABI"]
+submodules = false
+vendor = true
+extended = true
+
+[install]
+prefix = "/usr"
+docdir = "doc/rust-$VERSION"
+libdir = "lib$LIBDIRSUFFIX"
+mandir = "man"
+
+[rust]
+codegen-units = 0
+channel = "stable"
+rpath = true
+codegen-tests = false
+ignore-git = true
+
+EOF
+
+if [ "${SYSTEM_LLVM}" = "YES" ]; then
+ cat << EOF >> config.toml
+# Add this stuff to build with the system LLVM:
+[target.i586-unknown-linux-gnu]
+llvm-config = "/usr/bin/llvm-config"
+
+[target.i686-unknown-linux-gnu]
+llvm-config = "/usr/bin/llvm-config"
+
+[target.x86_64-unknown-linux-gnu]
+llvm-config = "/usr/bin/llvm-config"
+
+[target.armv7-unknown-linux-gnueabihf]
+llvm-config = "/usr/bin/llvm-config"
+EOF
+fi
+
+if [ "$LOCAL_BOOTSTRAP" = "yes" ] ; then
+ sed -i "s|^\(extended = true\)$|\1\nrustc = \"/usr/bin/rustc\"\ncargo = \"/usr/bin/cargo\"|" config.toml
+fi
+
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+export PKG_CONFIG_ALLOW_CROSS=1
+
+if [ "$BARCH" = "i586" ] ; then
+ # when bootstrapping from i586 (rust already installed), also build a i686
+ # rustlib:
+ sed -i 's/^target =.*$/target = ["i686-unknown-linux-gnu"]/' config.toml
+elif [ "$BARCH" = "i686" ] ; then
+ if [ "$TARCH" = "i586" ] ; then
+ # this will cause some messages like:
+ # warning: redundant linker flag specified for library `m`
+ # but will keep the build from falling over when doing the stage1 compiler
+ # linking for the i586 compiler. seems the correct flags don't get passed
+ # through and we end up failures like:
+ # error: linking with `clang` failed: exit code: 1
+ # /tmp/SBo/rustc-1.20.0-src/build/i686-unknown-linux-gnu/stage1-rustc/i586-unknown-linux-gnu/release/deps/librustc_llvm-4ab259c9aed547db.so: undefined reference to `xxx`
+ export RUSTFLAGS="$RUSTFLAGS -C link-args=-lrt -ldl -lcurses -lpthread -lz -lm"
+ fi
+fi
+
+if [ "$ARCH" = "armv7hl" ] ; then
+ python x.py dist
+else
+ # README.md says gcc 4.7 / clang 3.x or later needed
+ # but building fails for me with GCC 5.3 from slackware 14.2
+ CC=clang \
+ CXX=clang++ \
+ CFLAGS="$SLKCFLAGS" \
+ CXXFLAGS="$SLKCFLAGS" \
+ python x.py dist || exit 1
+fi
+
+DESTDIR=$PKG python x.py install || exit 1
+
+# Eh, none of this is all that big. Might as well leave it around as a
+# reference.
+#rm -f $PKG/usr/lib$LIBDIRSUFFIX/rustlib/components
+#rm -f $PKG/usr/lib$LIBDIRSUFFIX/rustlib/install.log
+#rm -f $PKG/usr/lib$LIBDIRSUFFIX/rustlib/manifest-*
+#rm -f $PKG/usr/lib$LIBDIRSUFFIX/rustlib/rust-installer-version
+#rm -f $PKG/usr/lib$LIBDIRSUFFIX/rustlib/uninstall.sh
+# Make sure the paths are correct, though:
+sed -i "s,/tmp/package-rust/,/,g" $PKG/usr/lib$LIBDIRSUFFIX/rustlib/install.log $PKG/usr/lib$LIBDIRSUFFIX/rustlib/manifest-*
+# And a little compression doesn't hurt either:
+gzip -9 $PKG/usr/lib$LIBDIRSUFFIX/rustlib/manifest-*
+
+# Correct permissions on shared libraries:
+find $PKG/usr/lib$LIBDIRSUFFIX -name "*.so" -exec chmod 755 "{}" \;
+
+# Evidently there are a lot of duplicated libraries in this tree, so let's
+# try to save some space:
+( cd $PKG/usr/lib${LIBDIRSUFFIX}/rustlib/*-linux-gnu/lib && for file in *.so ; do if cmp -s $file ../../../$file ; then ln -sf ../../../$file .; fi; done )
+
+# Strip ELF objects:
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# Remove any compiled-in RPATHs:
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | while read elfobject ; do
+ patchelf --remove-rpath $elfobject || exit 1
+done
+
+# Compress man pages:
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+# Add some documentation:
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a *.md COPYRIGHT* COPYING* LICENSE* $PKG/usr/doc/$PKGNAM-$VERSION
+# Include licenses from third party vendors:
+mkdir $PKG/usr/doc/$PKGNAM-$VERSION/vendor
+( cd src/vendor
+ tar cf - $(find . -maxdepth 2 | grep -e README -e LICENSE -e COPYING -e CHANGELOG -e PERFORMANCE -e UPGRADE ) | ( cd $PKG/usr/doc/$PKGNAM-$VERSION/vendor ; tar xf - )
+)
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/d/rust/rust.url b/source/d/rust/rust.url
new file mode 100644
index 000000000..64e6e863c
--- /dev/null
+++ b/source/d/rust/rust.url
@@ -0,0 +1,23 @@
+# Source code (repacked to .tar.xz):
+lftpget https://static.rust-lang.org/dist/rustc-1.26.0-src.tar.gz
+gzip -d rustc-*tar.gz
+plzip -n 6 -9 -v rustc-*tar
+
+# Please note that the bootstrap binary packages listed below might not be kept
+# updated for later versions. The Rust compiler as shipped with Slackware
+# should be able to compile the next released version of Rust.
+#
+# To find the expected date/versions for bootstrap binaries to be able to
+# update the urls below, look at src/stage0.txt in the Rust sources.
+exit 0
+
+# i686 bootstrap:
+lftpget https://static.rust-lang.org/dist/2018-03-29/cargo-0.26.0-i686-unknown-linux-gnu.tar.gz
+lftpget https://static.rust-lang.org/dist/2018-03-29/rust-std-1.25.0-i686-unknown-linux-gnu.tar.gz
+lftpget https://static.rust-lang.org/dist/2018-03-29/rustc-1.25.0-i686-unknown-linux-gnu.tar.gz
+
+# x86_64 bootstrap:
+lftpget https://static.rust-lang.org/dist/2018-03-29/cargo-0.26.0-x86_64-unknown-linux-gnu.tar.gz
+lftpget https://static.rust-lang.org/dist/2018-03-29/rust-std-1.25.0-x86_64-unknown-linux-gnu.tar.gz
+lftpget https://static.rust-lang.org/dist/2018-03-29/rustc-1.25.0-x86_64-unknown-linux-gnu.tar.gz
+
diff --git a/source/d/rust/slack-desc b/source/d/rust/slack-desc
new file mode 100644
index 000000000..924b1907e
--- /dev/null
+++ b/source/d/rust/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+rust: rust (a safe, concurrent, practical language)
+rust:
+rust: Rust is a curly-brace, block-structured expression language.
+rust: Its design is oriented toward concerns of "programming in the large",
+rust: that is, of creating and maintaining boundaries - both abstract and
+rust: operational - that preserve large-system integrity, availability,
+rust: and concurrency.
+rust:
+rust: Homepage: https://rust-lang.org
+rust:
+rust:
diff --git a/source/d/scons/scons.SlackBuild b/source/d/scons/scons.SlackBuild
index bd46d328c..68787861f 100755
--- a/source/d/scons/scons.SlackBuild
+++ b/source/d/scons/scons.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2015, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# Copyright 2015 Heinz Wiesinger, Amsterdam, The Netherlands
# All rights reserved.
#
@@ -21,10 +21,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=scons
VERSION=${VERSION:-$(echo scons-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -36,6 +37,14 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
if [ "${ARCH}" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
@@ -50,7 +59,6 @@ elif [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
@@ -60,7 +68,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf scons-$VERSION
tar xvf $CWD/scons-$VERSION.tar.*z* || exit 1
-cd scons-$VERSION
+cd scons-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
diff --git a/source/d/scons/slack-desc b/source/d/scons/slack-desc
index baeb5114e..1a758f1bf 100644
--- a/source/d/scons/slack-desc
+++ b/source/d/scons/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
diff --git a/source/d/slacktrack/slacktrack-project/docs/ChangeLog.slacktrack b/source/d/slacktrack/slacktrack-project/docs/ChangeLog.slacktrack
new file mode 100644
index 000000000..1d656d175
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/ChangeLog.slacktrack
@@ -0,0 +1,705 @@
+##############################################################################
+# Document: ChangeLog.slacktrack
+# Purpose : Document the changes that have occurred in 'slacktrack'
+##############################################################################
+
+07-Jun-2017 - v2.18
+ * Added option --run-after-withlog
+ This option is the same as -R, --run-after, with the only difference
+ being that any output from that script is logged to the slacktrack build
+ log.
+
+25-Apr-2015 - v2.17
+ * Cleaned up superfluous white space.
+ * Added operator -o, --no-fs-search
+ Prior to beginning a build, and post build, slacktrack uses the 'find'
+ command to scan the OS' file system, and stores these records. The
+ difference between the two records are used to determine the package's
+ contents.
+
+ This default set is ideal for a default Slackware installation, but some
+ users have data in other directories which should never be included in a
+ package. Scanning these additional directories takes extra time and serves
+ no purpose.
+
+ While the -x,--exclude operator is applied to the final package
+ contents list, -o, --no-fs-search is applied before and can be used to
+ significantly speed up the searches that build the before/after file lists.
+
+ Thanks to Andrew Lyon for the patch.
+
+10-Jan-2014 - v2.16
+ * Added the following paths to the default exclude list:
+ /usr/man/whatis
+ /usr/local/man/whatis
+ /var/lib/pgsql/
+ /var/lib/mysql/
+ Thanks to Eduard Rozenberg.
+ * Updated the 'OVERVIEW' doc to correct a couple of small details.
+ * Updated man pages to conform with stricter pod2man syntax.
+ * Updated FAQ to explain why after using one of the 'touch file system'
+ options, root is notified about having new mail.
+
+23-May-2013 - v2.15
+ * Added the $PWD from which slacktrack was invoked in to the default exclude
+ list. This allows a package's source directory to be in a non-default
+ excluded path and receive updates (such as log files) and avoid slacktrack
+ including them in the newly created package file.
+ Thanks to Eduard Rozenberg.
+
+10-May-2013 - v2.14
+ * Removed '-i, --install' flag from the man page and the slacktrack script,
+ as this has been a no-op since slacktrack stopped using 'installwatch'.
+ Thanks to Michael Stewart.
+ * Added /etc/ntp/drift to the default exclude list.
+ Thanks to Eduard Rozenberg.
+
+05-Apr-2013 - v2.13
+ * Use '-c' operator to 'touch' when touching the file system. This avoids
+ creating empty files that were referenced from a dangling symlink, and
+ avoids creating empty files when using the (not recommended) 'faster'
+ file system touch option.
+ * Moved slacktrack's 'ln' wrapper from /usr/share/slacktrack to
+ /usr/libexec/slacktrack, since /usr/share is for architecture independent
+ files.
+ Thanks to Darren Austin for the suggestion.
+ * Added '/usr/libexec' to the default list of library locations that will
+ have their ELF objects stripped.
+ * Capture the output of touching the file system into the slacktrack log
+ file, as this can be useful for recording any issues resulting from touching
+ files on the file system (such as dangling symlinks in existing installed
+ packages).
+ * Support supplying the full path name using the -p operator. Previously,
+ to store the resulting .t?z package in a location other than the default
+ ('/tmp'), you had to supply -b <dir name> in addition to -p <package name>
+ This was a somewhat wooly distinction between package *name* and package
+ *file name*.
+ The package name can now be supplied using:
+ # slacktrack [options] -p /somedir/foo-1.01-arm-2.tgz
+ The -b operator is still effective, so previous 'trackbuild' scripts will
+ continue to work as before.
+ Thanks to Eduard Rozenberg for the suggestion.
+
+18-Sep-2012 - v2.12
+ * Added /run to the list of default path exclusions.
+
+27-May-2012 - v2.11
+ * Added /var/lib/NetworkManager to the list of default path exclusions.
+ Thanks to Patrick Volkerding for the suggestion.
+
+05-Nov-2011 - v2.10
+ * Added --allow-overlapping option to permit the package to contain files
+ that overlap with existing packages installed on the system.
+ The default is to permit this behaviour, but if you're using the -Q option
+ as I do to build my packages, you'll find that there's no way to switch
+ the behaviour off whilst building an otherwise Slackware standards
+ compliant package.
+ To use this option you will need to supply it on the command line
+ after '-Q'.
+ * Fixed bug where --delete-overlapping was expecting an input.
+ * To the default path exclusion list, the following paths have been added:
+ /var/spool/cron/cron
+ /dev/bus/
+ /dev/char/
+ /dev/rfkill
+
+25-Sep-2011 - v2.09
+ * Fixed formatting issues with the man pages exposed by a newer version
+ of "pod2man". Thanks to Branko Grubic for the report and the patches.
+ * The /var/log/{packages,scripts}/$PACKAGE entries of the unprocessed
+ package contents (just after slacktrack completes execution of the
+ supplied package build script) were incorrect due to slacktrack not
+ handling symlinks when creating these entries - any symlinks were treated
+ treated as files which caused "removepkg" to emit messages such as
+ ".. no longer exists"
+ slacktrack now uses "makepkg" and "installpkg" to correctly create and
+ handle the /var/log/{packages,scripts} entries.
+ Thanks to Roberto for the report and a good detailed explaination.
+ * Removed /usr/bin/altertrack symlink to /usr/bin/slacktrack. It's
+ been years since altertrack was a separate tool. If you have any
+ scripts still calling "altertrack" -- change them :-)
+ * When deleting perllocal.pod files, look in /usr/lib & /usr/lib64
+ * Warn if any files in the newly built package overlap with other packages
+ that are already installed on the system.
+ * Added -X, --delete-overlapping option.
+ This option deletes any of the overlapping files from the new package.
+ The -Q option now includes the erasing of any overlapping files.
+ * Do not emit the name of the newly built package when displaying the
+ list of package dependencies.
+
+08-Nov-2010 - v2.08
+ * Exclude /var/lib/dhcpcd from being included in the package contents.
+
+18-Dec-2009 - v2.07
+ * Rewrote package_name() function to cater for "old style" package names.
+ Thanks to Jim Hawkins for the bit of sed script.
+ * Prevent /etc/dhcpc, /var/run and /etc/resolv.conf from appearing in
+ the package contents. This is especially useful when your build
+ machine is using dhcpcd to manage its network address.
+
+16-July-2009 - v2.06
+ * Added /lib/udev/devices to the default path exclusion list.
+ Files in here are generated and maintained by udev and should not
+ be included in packages.
+
+02-June-2009 - v2.05
+ * If after removing orphaned *.pyc files, their previous & parent
+ directories become empty, delete the directories.
+
+29-May-2009 - v2.04
+ * Added -Y, --delete-orphaned-pyc option.
+ Within the package contents, if slacktrack finds *.pyc files without a
+ matching *.py file, the *.pyc files will be removed from the package
+ contents.
+ Thanks to Patrick Volkerding for the suggestion.
+ Updated slacktrack(8).
+
+15-May-2009 - v2.03
+ slackdtxt:
+ * Updated to handle .tgz, .tbz, .tlz, .txz file extensions
+ Thanks to Patrick Volkerding.
+ * Renamed --nodeletetgz option in to --nodelete.
+ * Updated slackdtxt(8)
+ slacktrack:
+ * Added /usr/lib64 and /lib64 to the list of known library directories.
+ Thanks to Eric Hameleers for reminding me.
+
+12-May-2009 - v2.02
+
+ This is an interim release to allow slacktrack to work with the
+ additional package compression formats introduced in Slackware v13.
+ The documentation & the 'slackdtxt' utility will be updated at a
+ later date.
+
+ * Renamed --md5sumtgz option to --md5sum because starting at
+ Slackware v13, the package format has been expanded to several
+ other compression types; updated slacktrack(8).
+ * No longer suffix ".tgz" to a package name if the ".tgz" extension
+ wasn't specified. This allows you to specify one of the new alternate
+ package file extensions: .tgz, .tbz, .tlz and .txz
+ * Added /usr/share/slacktrack/ln which is an ln wrapper.
+ This calls /bin/ln with the -f (force) option which allows the
+ time stamp to get updated on symlinks.
+ Thanks to Jim Hawkins for writing this wrapper.
+
+19-Nov-2008 - v2.01
+ * Added /var/cache/ to the default exclude list.
+ This excludes SAMBA's 'browse.dat'.
+ Thanks to Eduard Rozenberg for the suggestion.
+ * Updated 'dvd_libs' example build scripts to use libdvdcss-1.2.10
+ and verified the source URLs for the other components.
+ (You must still download the source yourself).
+
+17-Sep-2008 - v2.00
+ * The 'slacktrack' tool is now what used to be shipped as 'altertrack'.
+ This tool tracks installations directly within a live root file system
+ rather than a pseudo root file system.
+
+ ** Important: This means that you *MUST* now run slacktrack on a
+ devbox only **
+
+ Please read /usr/doc/slacktrack*/RELEASE_NOTES for
+ important details about migrating from the previous version of
+ slacktrack.
+
+
+ * Changed to BSD licence for 'slacktrack' and 'slackdtxt' tools.
+ The only reason it was previously GPL was because this was the licence
+ installwatch used.
+ * Updated documentation & man pages.
+ * A GPG signing key must be specified when using the -G,--gpg-sign option;
+ it will not fall back on the default. This is because the code
+ to parse the command line operators doesn't work. I checked
+ the supplied examples for getopt and even they don't work!
+ (Perhaps it used to work with older versions of bash?)
+ * Added -P, --delete-perllocalpod option.
+ This deletes any 'perllocal.pod' found within the package's /usr/lib.
+ perllocal.pod files should only be included with the Slackware 'perl'
+ package.
+ * The -Q (set options to build a Slackware compliant package) option now
+ sets the -P, --delete-perllocalpod options.
+ * Removed --froot operator. This used to run the 'fakeroot' daemon
+ and LD_PRELOAD the fakeroot library to make your user environment
+ appear as if were root, with the intention of allowing package utilities
+ to set ownerships of files/dirs -- an ability allowed only for root.
+ However, since slacktrack needs to be run as root to make a useful
+ package (it's unlikely you'd use slacktrack to track files in a
+ non-root location, eg /mypackages/), then this option is defunct.
+ * Removed --with-scratchbox. This deleted the /dev and /home
+ directories that used to find their way into early ARMedslack packages.
+ ARMedslack has not used scratchbox in years, and I can't imagine
+ anybody else ever used this option!
+ * Build script examples are now bundled with the package rather than
+ being on a separate web site (since there's no cholestrol
+ from installwatch)
+ * Added "/dev/input$|/dev/input/|/dev/.udev/|/dev/.udev$" to the default
+ exclude list because udev is now keeping some live data in there.
+
+08-Feb-2008 - v1.33 - build 1 [ Not released ]
+ * Replaced installwatch with 'libsentry' - a fork of installwatch
+ by Gilbert Ashley.
+
+29-Jun-2007 - v1.32 - build 1, Slackware 12.0 special version.
+ * Fixed a bug where if --stripallexec was used, it wasn't stripping
+ all ELFs (.so, bins & .a files).
+ * Replaced slacktrack script with a dummy for the release of
+ Slackware 12.0. The new *at-style functions that coreutils 6.7+
+ are not tracked by installwatch, so chown, chmod et al do not work.
+ The real slacktrack script (if you wanted to use it) is named
+ /usr/bin/slacktrack-real
+
+05-May-2007 - v1.31 - build 2
+ * Fixed a bug in altertrack's --touch-filesystem-first code.
+ See docs/ChangeLog.altertrack.
+ * Updated slacktrack(8): -Q option now states that files in binary
+ directories are chown root:root not root:bin.
+ Thanks to Eduard Rozenberg for noticing that.
+
+31-Mar-2007 - v1.31 - build 1
+ * When gzipping man & info pages, force compression (gzip -f)
+ * Applied Fred Emmott's portable patch to installwatch to make it
+ work on 64bit machines.
+
+19-Feb-2007 - v1.30 - build 1
+ * Move installwatch library from /usr/lib/installwatch.so
+ /usr/lib/installwatch-slacktrack.so
+ This prevents an installation conflict with checkinstall.
+ Thanks to Henrik Carlqvist for the suggestion.
+
+04-Apr-2006 - v1.29 - build 1
+ * Added new option, -m|--chown-bins-root-root
+ This sets ownerships of files and directories in the standard Slackware
+ binary directories to 'root:root'.
+ This change is for Slackware v11 - binary directories are no longer
+ chown root:bin.
+ * The -Q option now sets -m rather than chowning root:bin.
+ If you want root:bin, specify the -f and -e options. The command would
+ look something like this:
+
+ # slacktrack -Q -fe -p moose-1.0-i486-1.tgz ./moose.build
+
+ * Added /media,/srv and /selinux to the 'watch' patch exclusion list
+ (any changes to these paths will be excluded from the package).
+ Updated slacktrack(1) with the new paths.
+
+14-Nov-2005 - v1.28 - build 1
+ * Fixed a bug where any man page symlinks broken by gzipping were not
+ being repaired.
+ Thanks to Andrei Levin for the bug report.
+
+22-Sep-2005 - v1.27 build 1
+ * Rewrote the slack-desc file to explain what slacktrack actually does
+ in simple words :-)
+ * Added /var/lib/rpm to list of excluded paths. This allows you to
+ do some seriously kludgey stuff like build from a source RPM and
+ install the binary RPM as part of the build script.
+ Very useful sometimes - docbook is an example :-)
+ * Fixed bug where if a temporary directory was manually specified with -T,
+ its contents were tracked by installwatch. Manually set temporary
+ directories are now in installwatch's exclude list.
+ Thanks to Gufo for reporting this.
+ * slacktrack will now return error code 6 and abort if it finds the
+ temporary directory (either chosen automatically or selected via the
+ -T|--tempdir option) already exists. This is to prevent slacktrack
+ from wiping user data without any warning.
+ slacktrack does not create a sub directory within the specified area;
+ it was never designed to do so, so this is the best option.
+ * Modified man page to reflect the above change, and added error code 6
+ to the error code section.
+ Thanks to Gufo for suggesting this change.
+
+22-Jul-2005 - v1.26 build 1
+ * Added /opt/kde/man to the list of man page directories.
+
+08-May-2005 - v1.25 build 1
+ * Renamed internal string 'VERSION' to 'SLACKTRACKVERSION' as it's
+ too much of a generic name and can cause confusion as it's exported
+ to the build script/environment.
+
+21-Mar-2004 - v1.24 build 1
+ * Added /sys to the list of excluded paths
+ * Fixed bug with chowning files that was introduced in v1.19.
+ Files with brackets in the name would get interpreted by bash. Now
+ these names are enclosed within '' to prevent this.
+ * Trimmed down --help text a little - it's too wordy.
+ * Added a patch to installwatch which was posted by Alexander Kern on the
+ checkinstall mailing list:
+ It adds simply "utimes" and "setxattr" to the list of
+ intercepted functions.
+ - Please note, however, that I am aware that there seems to be a problem
+ with installwatch on Slackware-10.1, although it does not show up when
+ building all software. I am looking to replace installwatch with
+ something specifically for slacktrack.
+
+09-Dec-2004 - v1.23 build 1
+ * Upgraded to installwatch-0.7.0beta4 from checkinstall-1.6.0beta4
+ * Fixed bug where you were informed that there were "orphaned" libraries
+ and dependencies upon installed packages, but the list was blank.
+ This was because the file contained spaces and therefore passed the
+ if [ -s ] check.
+
+16-Nov-2004 - v1.22 build 1
+ * Fixed a bug where if --notidy was specified and slacktrack/altertrack
+ failed to track any changes, the temporary workspace would be deleted.
+ This became a bug when I introduced $SLACKTRACKSCRATCHDIR; if a build
+ fails then the developer will be interested in looking at the source
+ tree which should always be preserved by --notidy.
+ * /usr/local/bin, /usr/local/sbin and /usr/X11R? directories & files
+ contained within will now:
+ - be chown root:bin
+ - be stripped (with the same strip option as the major bin directories)
+ * man pages in /usr/X11R?/man will now be compressed.
+ * Updated slacktrack(8) to reflect the above two changes.
+ * Fixed a typo in --help and added a suggested usage line.
+ * If an incorrect parameter is specified then --help is directed to STDERR.
+ * If no parameters are specified (or there has been no package name
+ specified) then the usage message is directed to STDERR.
+ * Updated the TODO list.
+ * Updated the OVERVIEW document (last update was 09-Dec-2003)
+ - Added a couple of new architectures (official & unofficial ports)
+ and made a note about i586 binary packages
+ - A couple of other minor edits.
+
+26-Aug-2004 - v1.21 build 2
+ * Tidied up slacktrack.SlackBuild
+ * Updates to altertrack
+
+19-Jun-2004 - v1.21 build 1
+ * Only strip debugging symbols (strip -g) from object files in .a archives
+ because --strip-unneeded tends to render many object files unusable.
+ If you're sure you know what you're doing and want to use strip
+ options other than -g, then I suggest doing this inside your build
+ script or (if using altertrack) in your post build script.
+ Updated slacktrack(8) to reflect this.
+ * Use strip -p to preserve dates/time stamps.
+ * Fixed a typo in the package info display prior to building the package.
+
+31-May-2004 - v1.20 build 1
+ * Changed chown uid.gid to uid:gid
+
+25-Mar-2004 - v1.19 build 1
+ * With the recent version of the coreutils package in Slackware-current
+ (coreutils-5.2.1), chmod no longer preserves setuid bits. This means
+ that if you elect to chown root.bin the binaries, you lose setuid.
+ I have implemented a work-around which works with both the new and old
+ coreutils chown.
+
+03-Mar-2004 - v1.18 build 1
+ * Strip archive files (.a) with --strip-unneeded, as using strip without
+ this option causes the contents of some archive files to be unusable.
+ Thanks to longname@sezampro for reporting it.
+
+12-Feb-2004 - v1.17 build 1
+ * Added --froot option to start the fakeroot server prior to setting
+ ownerships and so on. This may be helpful if you are not root on
+ the machine where the packages are being prepared. However, if the
+ build script or 'make install' sets its own ownerships, these will
+ be lost because the fakeroot server is not started until *after* the
+ build script finishes. The reason for this is that fakeroot can make
+ some configure scripts fail. If you know that the configure script
+ you are using does *not* fail under fakeroot, I suggest that you still
+ use fakeroot ./trackbuild.xxx
+ -- Please note that due to the path to the fakeroot libraries, slacktrack
+ only works with fakeroot-0.8.3 and up
+ You can download the latest version of a fakeroot Slackware package
+ builder from http://www.slackware.com/~mozes --
+ * Upgraded to installwatch-0.7.0beta3 from CheckInstall 1.6.0beta3
+
+12-Dec-2003 - v1.16 build 1
+ * Updated docs/OVERVIEW
+ * Updated docs/TODO
+ * Bumped up version number for release.
+
+10-Dec-2003 - v1.15 build 5
+ * Tidied up slacktrack.SlackBuild
+ Most of the recent changes have been in altertrack (bug fixes) which
+ is why the version of slacktrack itself hasn't been updated.
+ The usr/doc/slacktrack-version directory is now
+ usr/doc/slacktrack-version_build
+ because (at present) the build number is important to this project
+ because it changes more than the major slacktrack version number.
+ * Mentioned installwatch segfaulting in the FAQ.
+
+01-Nov-2003 - v1.15(release)
+ * altertrack is now included within the binary .tgz package because
+ I'm satisfied that it is just as safe as protopkg, and it enables you
+ to build packages from .build scripts that do not work with
+ slacktrack/installwatch.
+
+29-Oct-2003 - v1.15rc1
+ * If running under fakeroot then remove fakeroot from the list of
+ dependencies (it's included because it's LD_PRELOADed)
+ (suggested by Emanuele Vicentini).
+ Patch from Emanuele Vicentini:
+ * Redirect file descriptor 2 to 1 so that the slacktrack log file
+ contains anything sent to STDOUT.
+
+22-Oct-2003 - v1.15
+ * Added --showdeps option to log to screen and a log file what
+ _installed_ Slackware packages your new package relies upon.
+ The purpose of this for interest only but I find it useful to ensure
+ I haven't just built a package on a box that Xfree86 installed
+ and I intend to install and use the package on a box that does not,
+ when the package has linked against X's libraries.
+ Using this option will also flag up 'orphaned' libraries (ones that
+ do not belong to an installed package, which is especially handy
+ if you're going to be distributing a package).
+ * Added another question to FAQ.
+ * Bomb out if /var/log/packages or /var/log/scripts is missing.
+
+20-Oct-2003 - v1.14 [beta only]
+ * When stripping shared objects (.so files), look for 'shared' rather
+ than 'shared objects' (in the output from 'file') as this was causing
+ some files not to be stripped (PHP is an example).
+ * Added --mpopts option to allow the inclusion of additional options
+ (e.g. --prepend) to Slackware's 'makepkg' program.
+ * Fixed bug where by the .txt description file wouldn't be created if
+ you had specified a seperate build store directory that didn't end
+ with a /
+ * No longer create the /install directory because if your build script
+ fails to create any files then you don't see the warning slacktrack
+ gives you. I could code around this but I think it's cleaner this way.
+ * Added /root to the list of directories that will not be included within
+ the package. This should help with using ccache when compiling as root.
+ You should still see docs/FAQ for help with non-root users.
+ It also helps with building CPAN modules.
+ * Updated the FAQ with information about using perl -MCPAN -eshell
+ (turn off logging and the CPAN interface console will work)
+ * Fixed bug where by gzipping info pages wouldn't gunzip .bz files first
+ * Forked slacktrack into another script named 'altertrack'. This works
+ in a similar fashion to Pat's 'bp' and David Cantrell's 'protopkg' in
+ that it compares the differences between the file system before and
+ after 'make install', rather than using installwatch.
+ This script is available only in the source distribution and is
+ totally unsupported (but it works for me). There is an example
+ build script contained within the source in the 'examples-altertrack'
+ directory.
+ * Moved fakeroot's build script (and source) out of slacktrack's source
+ and on to http://www.slackware.com/~mozes because it's
+ more useful there.
+
+01-Oct-2003 - v1.13
+ * Warn if /install/slack-desc not found or 0 bytes
+ * The package's /install directory is now created by slacktrack
+ _before_ it executes your .build script. This saves you a line
+ in your .build script, plus it's required in order
+ to meet Slackware package standards (because 'slack-desc' lives
+ within /install). However, if you do not wish to have a /install
+ directory within your final package, you may delete it within
+ your .build script ( rm -rf ${SLACKTRACKFAKEROOT}/install )
+ * Updated dependency checking code so that it can handle packages
+ that begin with the same name (e.g. 'glib' 'glib2').
+ * Updated the fakeroot build scripts for version 0.7.8
+ Patches from Emanuele Vicentini:
+ * Added -Q, --standard options that specifies all command line switches
+ required to create a .tgz file that complies with the Slackware standard.
+ * Added -G, --gpg-sign option that will sign the resulting .tgz
+ package file with the default user's GnuPG key and placed the
+ detached, armored signature (.asc file) in the package store
+ directory.
+ * Fixed the value of GZINFO (which should be "No" according to the
+ man page but was "Yes")
+ * Updated man pages, typos fixed and so on.
+
+ The easiest way to build a package is now:
+ # slacktrack -Qp foo-1.13-i486-1.tgz ./foo.build
+
+11-Jul-2003 - v1.12
+ * Added -D, --md5sumtgz option that will create an MD5sum of
+ the resulting .tgz package file.
+ * Fixed problem with checking the exit code from getopt
+ (reported by Emanuele Vicentini).
+ * Added a preemptive FAQ
+ * Merged Patrick's changes of slacktrack.SlackBuild into mine
+ slacktrack.SlackBuild now also creates its own slacktrack-*.txt file
+
+22-Jun-2003 - v1.11r2
+ * I'd missed single quotes from a few find commands - fixed.
+
+02-Jun-2003 - v1.11
+ * -S, --stripallexec will now strip .a (archive) files.
+ * -A, --striparchives option added. This option strips .a archives.
+ Suggested by Patrick Volkerding.
+ * slacktrack.SlackBuild no longer includes the large collection of
+ example scripts into the resulting package .tgz; they're now
+ maintained in a separate archive (slacktrack-examples-v??.tar.gz)
+ available from http://www.slackware.com/~mozes
+
+28-May-2003 - v1.10r2
+ * If deleting 'usr/info/dir' then append this info to the log.
+
+22-May-2003 - v1.10
+ * Before gzipping man or info pages we now find any bzip2 (.bz2) files
+ and unpack them. I have found that BitchX installs BitchX(1) as
+ a bzip2 file. There is no slacktrack option to turn this feature off
+ because if we gzip the bzip2'd man page, the man program won't
+ work with the file.
+ * Added -K, --delete-usrinfodir option. If this option is specified
+ then slacktrack will delete the file 'usr/info/dir' if it is
+ found in the package.
+ This file is a special file used by the 'info' program. To quote
+ texinfo's 'dir' file:
+ "This (the Directory node) gives a menu of major topics."
+ Many programs create their own 'info' file. However, using slacktrack
+ (or even a clean SlackBuild script), any such attempts to create
+ an up to date 'info' file result in the file only containing
+ information about the particular program (or set of programs)
+ you have just compiled.
+ Therefore you will usually want to delete this file from your
+ package so as to avoid overwriting the system version when you
+ install your new package.
+ The default is not to delete usr/info/dir.
+ * As an example, I typically invoke slacktrack as:
+ # slacktrack -gfenzKSUIp package-1.00-i386-1.tgz ./package.build
+
+
+16-May-2003 - v1.09
+ * Added exported variable: SLACKTRACKSCRATCHDIR
+ This variable points to a 'scratch' dir inside slacktrack's temporary
+ path. Should they wish to do so, the authors of the build scripts
+ can use this directory to save them 'managing' their own temporary
+ directories where they unpack the source archives and so on.
+ This directory is subject to the same conditions as the rest of the
+ slacktrack temporary path -- it will remain if --notidy is specified.
+ * Added paragraph in slacktrack(8) that talks about the exported environment
+ variables.
+ * Now use date +%s to create more randomly named temp directory for installwatch
+ This reduces the possibility of conflicting with another user who is
+ running slacktrack on the same system.
+ * Modified afio.build to demonstrate using ${SLACKTRACKSCRATCHDIR}
+ * Modified tf.build to use ${SLACKTRACKSCRATCHDIR} & to prevent it from
+ confirming the compile-time settings with the user.
+ * Tidy up of the build scripts in the docs dir.
+ * slacktrack(8) & slackdtxt(8) release dates now always in sync with
+ their respective scripts.
+
+07-May-2003 - v1.08r3
+ * Updated a few docs
+ * Fixed a comment typo in the slacktrack script
+ * Tidy up of 'SlackBuild' script
+ * Other misc tidying.
+
+03-May-2003 - v1.08r2
+ * If the command line/script provided exits with an error code we now
+ display the error code as well as a warning message.
+ * Moved slacktrack and slackdtxt to /usr/bin rather than being in
+ /usr/sbin. This is because we can use slacktrack with 'fakeroot'
+ from the Debian distribution. fakeroot fakes root privileges, thereby
+ allowing slacktrack to chown correctly. Therefore we can sensibly
+ use slacktrack as user other than root.
+
+ To use slacktrack with fakeroot you could do this
+ # fakeroot ./trackbuild.fetchmail
+
+ less through the resulting package .tgz to verify that the permissions
+ are what they ought to be. Obviously there will be some issues with
+ using fakeroot but it should be pretty useful for users without root
+ access.
+ I have packaged up fakeroot and you may download it at
+ http://www.slackware.com/~mozes
+ I have included by fakeroot build script within slacktrack's source
+ ball - slacktrack/misc/fakeroot/
+
+28-Apr-2003 - v1.08
+ * Added -N, --strip-prog to allow the user to specify the location
+ of the strip binary. This allows me to start cross compiling
+ stuff with slacktrack stripping the binaries.
+ * Renamed my wrapper scripts from 'SlackBuild' to 'trackbuild' to
+ avoid any confusion & updated docs to match.
+ * If specifying an alternate package store dir, now suffix the path
+ with a /
+ * Now reports size of .tgz if a .tgz is built
+ * No options are 'Advanced' - they are now just options
+ * Added -R, --run-after facility to make slacktrack execute a given
+ command prior to running makepkg. The purpose of this is to allow
+ the user to specify a program such as mc (Midnight Commander) to
+ inspect the package directory contents and possibly make changes
+ before slacktrack creates the .tgz
+ [] Note: The CWD is changed to the package's root directory before
+ the external command is executed. This allows you to specify
+ -Rmc and have Midnight Commander load and automatically
+ display the root dir of the package.
+ * -T wasn't accepting the specified path. Fixed.
+ * -g,--chmod644docs also now does chown -R root.root /usr/doc. I am finding
+ I need to do this in build scripts a lot so I figured since I'm already
+ chmod 644ing I may as well just chown them to root since they always
+ are in Slackware packages anyway !
+
+16-Apr-2003 - v1.07
+ * Added the facility to gzip info pages & updated slacktrack(8) to match.
+ -I, --gzinfo
+ -W, --extra-infodir <path>
+ -F, --gzinfo-no-symfix
+ * Switched @uksolutions email addresses in example build scripts with
+ @polplex.co.uk
+ * Added two build scripts for GNU VCD Imager into the docs/examples/non-slackware
+ directory. There are two scripts:
+ vcdimager.build -- this is for use with slacktrack
+ vcdimager.SlackBuild -- this is a 'clean' SlackBuild script
+ that installs the package into a clean
+ dir by doing make DESTDIR
+ The purpose of having these two scripts is for anybody who is
+ interested in building their own packages; it enables you to
+ compare and contrast the differences... or something :)
+
+01-Apr-2003 - v1.06
+ * --extra-libdir, --extra-bindir, --extra-mandir added to allow
+ the user to specify additional directories that slacktrack should
+ consider when stripping binaries and gzipping man pages.
+ Note that any binary directories specified by --extra-bindir
+ will NOT be chown root.bin
+ Suggested by Darren Austin
+ * No longer chown root.bin in /usr/local/{sbin,bin}/
+ as it's not the Slackware standard to chown root.bin in any dirs other
+ than /sbin, /bin, /usr/bin & /usr/sbin
+
+26-Mar-2003 - v1.05
+ * Now considers usr/local for man page, binary and .so files after
+ Darren Austin gave a convincing argument as to why one may wish to
+ use /usr/local
+
+22-Mar-2003 - v1.04-build-2
+ * Moved Change Log details into separate file - 'ChangeLog.slacktrack'
+ to save cluttering the slacktrack script.
+ * Added zlib build script to the list of Slackware example build scripts
+ This script downloaded the Slackware bits and also patches in the
+ security patch from OpenPKG.
+ * Added NVIDIA_GLX-1.0-4191 and tinyfuge example slacktrack build scripts
+ * Fixed a few typos and grammar problems in the docs
+ * Tidied up a few comments & code in the slacktrack script
+ - No new features added.
+
+10-Mar-2003 - v1.04
+ * Added --stripallexec option to strip any unstripped ELF executable files
+ in the entire package directory. This means that slacktrack will find all
+ files in non-standard Slackware directories such as /opt.
+ * Added 'short' command flags for the advanced options.
+
+02-Mar-2003 - v1.03
+ * Make sure we have specified a package name before proceeding
+ * Bomb out & tidy up if no files or dirs are found in /var/tmp/slacktrack/TRANSL/
+ this saves makepkg building a package of the current directory & it also
+ indicates that installwatch failed to track any activity, thus has no files
+ to package.
+ * Fixed problem with the location of installwatch's log file.
+ * Lots of error checks
+ * Exit codes now have meaning; read slacktrack(8) man page.
+ * If build store dir doesn't exist then change it to /tmp rather than
+ creating it without warning.
+
+01-Mar-2003 - v1.02
+ * Added --chmod644docs option
+ * Renamed SLACKTRACKPSEUDODIR to SLACKTRACKFAKEROOT because it makes more
+ sense.
+
+28-Feb-2003 - v1.01
+ * Stopped dumping all output to /dev/null when gzipping man pages
+ as this doesn't always work
+ * Added code to fix broken symlinks caused by gzipping man pages
+ Added --gzman-no-symfix command line option to prevent this behaviour
+ * Added --chown-bdirs-root-bin & chown-bfiles-root-bin (-e,-f) options
+ to chown root.bin the system binaries installed into /usr/bin and so on
+ This behaviour is specified in Pat's 'slack-tools' README file.
+
+22-Jan-2002 - v1.00
+ * Created
diff --git a/source/d/slacktrack/slacktrack-project/docs/FAQ b/source/d/slacktrack/slacktrack-project/docs/FAQ
new file mode 100644
index 000000000..98ea7d7cd
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/FAQ
@@ -0,0 +1,234 @@
+################################################################
+# Document: FAQ
+# Purpose : Frequently asked questions
+# Author..: Stuart Winter <mozes@slackware.com>
+################################################################
+# It's small at the moment but if I get any repeated
+# or potentially repeated questions then they'll be added
+# here.
+################################################################
+
+
+Questions
+---------
+
+1. My build script places files into /home, but these are not
+ included in the package created by slacktrack. Why?
+
+2. Do I really have to remove the existing package before
+ building a new version with slacktrack ?
+
+3. I want to build a package of DVD libraries and players
+ but the players depend on the libraries being installed
+ first. How can I build such a package with slacktrack?
+
+4. I find that when building packages with slacktrack, a number of
+ files are appearing in the package that do not belong there. Why?
+
+5. What does slacktrack's --touch-filesystem-first option do?
+ why would I need it?
+
+6. I can't compile Perl CPAN modules via perl -MCPAN -eshell
+ Why ?
+
+7. I'm using Slackware v13 (or greater) and I want to create
+ package files using one of the other compression methods.
+ How can I do that?
+
+8. After completing a build using slacktrack, I see
+ "You have mail in /var/mail/root"
+ but I have no new email.
+
+Answers
+-------
+
+Q1. My build script places files into /home, but these are not
+ included in the package created by slacktrack. Why?
+
+A1. slacktrack (by design and thus default) excludes /home
+ from being included within the package. The reason for this
+ that typically no package shipped should ever contain
+ data within /home.
+
+Q2. Do I really have to remove the existing package before
+ building a new version with slacktrack ?
+
+A. No (see my zlib example), but in the majority of cases,
+ I'd advise that you do.
+
+ The reason that my example trackbuild scripts remove the
+ existing package first (or bomb out) is because some
+ package installations (makefiles) will not install a
+ new file onto the filesystem if it's identical to the
+ one in the source archive. This means that slacktrack
+ will not notice any change in the before and after picture
+ of the filesystem; thus your resulting package may
+ be missing some files.
+
+ The way to work around this is:
+ 1. removepkg the package prior to building;
+ 2. Use the --touch-filesystem-first option;
+ But this option is not recommended since it destroys the
+ time stamp information on your system.
+ This option should only be used by experts using a disposable
+ OS installation.
+ Please see FAQ question 5.
+
+ It's worth noting that Slackware's 'removepkg' program
+ won't always remove all files (especially config files
+ which are packaged as /etc/file.new and are renamed to
+ /etc/file by install/doinst.sh).
+
+ It shouldn't be too much of an issue though. If it's a
+ brand new piece of software that you are building from
+ scratch then installwatch will pick up all new files.
+ If you're rebuilding a Slackware package using a
+ .build script from the source tree then it's worth
+ browsing the package's contents ( # cat /var/log/packages/lftp-*
+ for example ), then running 'removepkg' and looking at its
+ output. If there are any remaining config files then either
+ move them to a safe place or delete them before
+ building your package with slacktrack.
+
+ In general though you shouldn't have any problems.
+
+
+Q3. I want to build a package of DVD libraries and players
+ but the players depend on the libraries being installed
+ first. How can I build such a package with slacktrack?
+
+A. There are two ways.
+ 1. You either write build scripts for each individual
+ library and create packages for each. Once the packages
+ have been built, you install them prior to building
+ the player.
+ You then unarchive all packages into a temporary
+ directory and run makepkg over it.
+ 2. Use slacktrack and build them all one after another as
+ you no doubt have originally attempted.
+
+ I have included example build scripts for a DVD library
+ package within slacktrack's source archive.
+
+
+Q4. I find that when building packages with slacktrack, a number of
+ files are appearing in the package that do not belong there. Why?
+
+A. The way that slacktrack works is that it:
+ [a] takes a snapshot of the files and directories on the file system;
+ [b] runs the build script
+ [c] makes another snapshot of the files & dirs on the file system;
+ [d] compares the two snapshots and determines the differences
+ [e] the differences between the two snapshots constitute the package
+ contents
+
+ The problem with this approach is that other running programs can
+ make modifications to files & dirs on the file system during the
+ build/compilation process. slacktrack will consider these modifications
+ to be part of the package -- slacktrack does not directly track what the
+ build process does: it *only* compares the differences between the
+ file system snapshots.
+
+ Major culprits for this are:
+ cups
+ crond (running cron jobs)
+ Window Managers and X
+
+ When using slacktrack you are advised to reduce the number of
+ processes to the minimum, and try to ensure that there are no processes
+ running which will modify the file system during the build process.
+
+ If you cannot do this then you there are a number of work arounds:
+ [a] Using the -x (--exclude) operator.
+ With this operator you can specify a list of
+ paths to exclude from the file system snapshots, thus excluding them
+ from the resulting package.
+ [b] Use the -R (--run-after) operator.
+ With this operator you can specify a command that will be run after
+ slacktrack has compiled the package contents.
+ You may wish to run 'mc' (Midnight Commander) or perhaps just a 'bash'
+ shell; this will enable you to inspect and modify the contents of the
+ package prior to it being turned into a package file.
+
+Q5. What does slacktrack's --touch-filesystem-first option do?
+ why would I need it?
+
+ This option touches all files this pre-set location on the host's
+ filesystem:
+ /opt /bin /boot /dev /etc /install /lib /sbin /usr /var
+
+ It *excludes* by default '/lib/udev/devices' since this contains
+ live device data that doesn't take kindly to being touched.
+ You may see errors from 'touch' about certain binaries, including
+ /sbin/vol_id because this is a symlink into /lib/udev/devices.
+
+ This will touch every file within those directories, destoying all the
+ timestamp information.
+ This is intended to be used on a throwaway development installation
+ that's reinstalled daily or more often. Builds will often leave
+ residue strewn about, so don't use this on your "good" machine and
+ think you're managing it properly. :-)
+
+ The reason behind this is that if you run slacktrack and your build
+ partially fails, then it will leave some data on the filesystem.
+ You then fix the problem and re-try: this time the build may succeed.
+ However, if the original data on the filesystem from the first
+ part-failed build has *not* changed (ie if it was some static data that
+ was copied with cp -a (preserved time stamp & ownership)) between
+ the first part-failed build and second successful build, slacktrack
+ will miss this data from the final package.
+
+ This option updates the file stamps contained within standard package
+ directories, therefore allowing slacktrack to detect changes
+ (even if the data contains an *old* time stamp from 1982, it will still
+ detect the difference).
+
+***** This is an expert option: Please don't use this option unless you do
+ not care about your operating system installation *****
+
+
+Q6. I can't compile Perl CPAN modules via perl -MCPAN -eshell
+ Why ?
+
+A. If you get this message:
+ Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work.
+ The COLUMNS and LINES environment variables didn't work.
+ The resize program didn't work.
+
+ the answer is to tell slacktrack to turn off logging.
+ eg:
+ # slacktrack -Qnp foo-1.0-i486-2.tgz ./foo.build
+
+Q7. I'm using Slackware v13 (or greater) and I want to create
+ package files using one of the other compression methods.
+ How can I do that?
+
+A. It is 'makepkg' from the 'pkgtools' package which handles
+ the compression, based upon the extension of the package
+ file name supplied to it.
+
+ The compression methods & file names are:
+
+ .tgz - Gzip
+ .tbz - Bzip2
+ .tlz - LZMA
+ .txz - XZ
+
+
+ Examples:
+
+ # slacktrack -Qp foo-1.0-i486-1.tgz ./foo.build
+ # slacktrack -Qp foo-1.0-i486-1.tbz ./foo.build
+ # slacktrack -Qp foo-1.0-i486-1.tlz ./foo.build
+ # slacktrack -Qp foo-1.0-i486-1.txz ./foo.build
+
+
+Q8. After completing a build using slacktrack, I see
+ "You have mail in /var/mail/root"
+ but I have no new email.
+
+A. This is because you used the '--touch-filesystem-first' or
+ '--touch-filesystem-faster' option at build time.
+ This option has touched all of the files on the file system, which
+ refreshes their date stamp. The mail notification system works only on
+ the date stamp of the mail spools, hence it triggers the message.
diff --git a/source/d/slacktrack/slacktrack-project/docs/INSTALL b/source/d/slacktrack/slacktrack-project/docs/INSTALL
new file mode 100644
index 000000000..8b74c9f18
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/INSTALL
@@ -0,0 +1,9 @@
+
+In order to build slacktrack:
+
+ # ./slacktrack.SlackBuild -i
+
+This will create a Slackware package of slacktrack
+and install it.
+
+The resulting package will reside in /tmp.
diff --git a/source/d/slacktrack/slacktrack-project/docs/OVERVIEW b/source/d/slacktrack/slacktrack-project/docs/OVERVIEW
new file mode 100644
index 000000000..fb99b247d
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/OVERVIEW
@@ -0,0 +1,595 @@
+##############################################################################
+# Document: OVERVIEW
+# Purpose : Provide an overview of the Slackware package system incorporating
+# the use of 'slacktrack'
+# Please note that this is *not* a guide to the use of slacktrack;
+# the man page and SlackBuild scripts in the 'examples' directory
+# aim to fulfill that requirement.
+# Date....: 15-May-2009
+# Author..: Stuart Winter <mozes@slackware.com>
+# Homepage: http://www.slackware.com/~mozes
+##############################################################################
+
+
+CONTENTS:
+---------
+1.0 Preamble
+2.0 Slackware packages
+ 2.0.1 Format of official Slackware packages
+ 2.0.1.1 Package names
+ 2.0.1.2 Version numbers
+ 2.0.1.3 Architectures
+ 2.0.1.4 Build numbers
+ 2.1 An overview of the creation of official Slackware packages
+ 2.1.1 'Clean' and 'dirty' builds
+ 2.1.1.1 Clean builds
+ 2.1.1.2 Dirty builds
+ 2.1.1 SlackBuild and .build scripts
+ 2.1.1.2 SlackBuild scripts
+ 2.1.1.3 .build scripts
+ 2.2 slacktrack in the scheme of things
+ 2.2.1 Using slacktrack with official .build scripts
+ 2.2.2 Writing your own .build scripts for slacktrack
+ 2.2.2.1 Making use of slacktrack's environment variables
+3.0 slacktrack in operation
+ 3.1 How slacktrack finds which files have been installed
+4.0 Example scripts
+ 4.0.1 non-slackware example build scripts
+ 4.0.2 slackware example wrapper build scripts
+5.0 Known problems/features of slacktrack
+6.0 New features
+7.0 Licence
+
+
+
+1.0 Preamble
+ ---------
+
+I used to work for a company that provided web hosting and shell accounts.
+When I started there were a number of shell servers all running various
+releases of RedHat Linux, in various states of repair. I managed to convince
+the management to let me try Slackware on there instead because I have a much
+stronger understanding of how to maintain and build server using the
+Slackware distribution. This trial went well and within a few months all
+servers were converted to Slackware version 8.1.
+
+In order to ease the speed of installation (and to prevent against
+forgetting to install or configure something critical), I wrote a
+set of post installation scripts that upgraded Slackware packages,
+configured numerous config files and copied pre-compiled software
+(such as courier IMAP) onto the new system.
+For other software that I could not simply copy, I'd compile it on the
+new server.
+
+However, it soon became clear that due to security updates and so on,
+it became incredibly time consuming (not to mention seriously boring)
+to compile PHP, Apache and so on on every server.
+
+At this point, I began to investigate how to create packages for Slackware.
+
+
+2.0 Slackware packages
+ ------------------
+
+ The Slackware Linux distribution consists of a variety of 'packages'
+ that make up the distribution.
+
+ Traditionally, all packages are in '.tgz' format (a gzipped tar archive).
+ Starting with Slackware v13, new compression formats are supported which
+ are represented by three additional file extensions:
+
+ .tgz - Gzip
+ .tbz - Bzip2
+ .tlz - LZMA
+ .txz - XZ
+
+ In this document, we use the file extension '.t?z' to represent
+ one of the above file formats.
+
+ Once you have initially installed Slackware from the installer screen,
+ you have the facilities to install, remove or upgrade new or existing
+ packages using the package management tools:
+
+ installpkg <package.t?z> - install 'package.t?z'
+
+ upgradepkg <package.t?z> - upgrade existing 'package' with the
+ new version specified at the command line.
+
+ removepkg <package> - remove specified package
+
+
+ Whilst the Slackware package system is not especially feature rich,
+ Slackware's user base (including me) like it because it is simple.
+ If we want to write our own package utilities then we can easily do so
+ by examining the existing package tools and querying and amending the
+ package database (text files).
+
+ 2.0.1 Format of official Slackware packages
+ -------------------------------------
+
+ In Slackware 8.1 and up, each package file is named as follows:
+
+ packagename-version-architecture-buildnumber.t?z
+
+ 2.0.1.1 Package names
+ -------------
+
+ The package name is either the name of the single program
+ or the name of a collection of utilities that fall under
+ a single umbrella.
+ For example:
+ autoconf-2.54-noarch-1.tgz
+
+ That is the name of the autoconf package I have on my
+ Slackware 8.1 box.
+ 'autoconf' is the name of the the entire collection of
+ binaries and associated documents that are extracted from
+ the autoconf source distribution archive.
+
+ However, if we consider another example:
+ tcpip-0.17-i386-15.tgz
+
+ There is no single piece of software called 'tcpip'.
+ This package contains a number of associated utilities
+ written by different authors but bundled into one single
+ 'package'.
+
+ 2.0.1.2 Version numbers
+ ---------------
+
+ If the package is the name of a particular piece of software
+ such as 'autoconf' from the example above, then the version
+ number represents the version number that its authors distribute.
+
+ If the package is a 'bundle' such as 'tcpip' then the version
+ number increases as and when you add a new piece of software to
+ the package, or upgrade a particular piece of major software
+ contained within the package.
+ For example, with 'tcpip' above, the 0.17 refers to the version of
+ Linux Netkit. However, there are other programs included within
+ the Slackware tcpip package that are not part of 'Linux netkit'.
+
+ 2.0.1.3 Architectures
+ -------------
+
+ The architecture is just that -- it tells you which architecture
+ the package is for.
+
+ The current values in use are:
+
+ ----- [ Official Slackware architecures ]
+
+ noarch - Architecture independent files such as config files
+ i386 - packages for the x86 (Slackware v8.1 & 9)
+ i486 - packages for the x86 (Slackware 9.1+)
+ i586 - packages for the x86
+ i686 - packages for the x86
+ s390 - packages for the IBM s/390 mainframe
+ arm - packages for the ARM architecture
+
+ Note: Whilst Slackware v10 is primarily built for i486, you may
+ find that there are some packages whose architecture versions
+ are higher than i486. This is for two reasons:
+
+ [a] There is no source for the package - it is a repackaged
+ binary distribution (SUN's j2sdk is an example).
+
+ [b] The package is not required or otherwise not suitable for
+ earlier revisions of the architecture (this is especially
+ the true with ARM and SPARC).
+
+ ----- [ Unofficial ports of Slackware ]
+
+ sparc - packages for the SUN Sparc architecture
+ powerpc - packages for the PowerPC architecture
+
+ 2.0.1.4 Build numbers
+ -------------
+
+ A build number suplements the version number and is changed
+ when the *package maintainer* makes a change to the package but
+ the original source code and version number remains the same.
+
+ For example, I build a package of 'foo' version 0.14 for the
+ sparc. I have never built this package before, thus it becomes
+ foo-0.14-sparc-1.tgz
+ However, I realise that I haven't configured
+ the 'bar' parameter correctly in /etc/foo.conf. I fix it
+ and re-build the package. The package is now named
+ foo-0.14-sparc-2.tgz
+
+
+ 2.1 An overview of the creation of official Slackware packages
+ -----------------------------------------------------------
+
+ This section gives a brief introduction of the two methods of
+ used when building the official Slackware packages.
+
+
+ 2.1.1 'Clean' and 'dirty' builds
+ --------------------------
+
+ I am assuming the reader has some experience with Makefiles
+ and has compiled and installed a number of software packages.
+
+ 2.1.1.1 Clean builds
+ ------------
+
+ I term a 'clean' package one where you can specify a variable
+ to the 'make install' which contains the directory you wish to install
+ the package in, rather than installing it properly over the root file system.
+ For example:
+ # ./configure --prefix=/usr --sysconfdir=/etc
+ # make
+ # make install DESTDIR=/tmp/package-foo
+
+ With a 'Makefile' that honours the DESTDIR variable, this will
+ install the whole package into /tmp/package-foo. This directory
+ effectively is the 'root' directory '/' as far as the Makefile
+ is concerned.
+
+ From here you can use the Slackware 'makepkg' program and build
+ a package.
+
+ This is by far the safest and most preferred method by all
+ users that make packages.
+
+ You will find that DESTDIR is called prefix, TOPDIR and other names;
+ you need to examine the Makefile scripts in order to determine whether
+ it contains this functionality and if it does, then discover what
+ the variable name is.
+
+ 2.1.1.2 Dirty builds
+ ------------
+
+ A 'dirty' build is the name I give to source distribution archives
+ whose Makefile scripts do not have any provisioning to install
+ in an alternate directory other than root.
+
+ For these type of builds, you will typically do:
+ # ./configure --prefix=/usr --sysconfdir=/etc
+ # make
+ # make install
+
+ The package will then be installed on the root filesystem.
+
+ So how do you know what files were installed where and
+ even if you did, how do you pull all these files together in order
+ to run makepkg over them ?
+ That's the purpose of slacktrack! :-)
+
+
+ 2.1.1 SlackBuild and .build scripts
+ -----------------------------
+
+ Slackware has a number of packages by a great number of authors.
+ Some of the packages's source Makefiles honour a DESTDIR type
+ variable but others do not.
+
+ 2.1.1.2 SlackBuild scripts
+ ------------------
+
+ SlackBuild scripts can be 'interesting'. They are
+ scripts that install into a 'clean' environment (usually /tmp).
+
+ Some of the scripts follow the make install DESTDIR=
+ style, if the Makefile permits.
+
+ Others have a 'framework' or 'controller tarball' which is
+ a _packagename.t?z (note the prefixing underscore).
+
+ The SlackBuild script uses the Slackware 'explodepkg' script
+ to untar the contents of the _.t?z into the /tmp-package<name>
+ directory.
+ Slackbuild then runs 'make' to compile the binaries
+ and libraries, but then uses the 'cat' program such as:
+ # cat foobar > /tmp/package-foobar/usr/bin/foobar
+
+ By using 'cat', the *new* version of 'foobar' retains
+ the original permissions and ownerships that are in the
+ controller tar ball.
+
+ However, you may be wondering how, if the package does not
+ have a facility to install into somewhere other than root,
+ do we get the file names and permissions for the
+ controller _.t?z in the first place.
+ The answer is simple:
+ [a] find all files on the file system and dump to a file.
+ [b] compile and install the software
+ [c] find all files on the file system and compare the file
+ produced by the first 'find'. After a little pruning, you
+ have the list of files for the controller tar ball.
+
+
+ 2.1.1.3 .build scripts
+ ---------------
+
+ For those software distributions whose Makefile does not hounour
+ the DESTDIR type system, there are Slackware's .build scripts.
+
+ These scripts literally ./configure ; make ; make install
+ and copy docs and other goodies into the root file system.
+
+ One of the problems with these scripts is that they are
+ often incomplete -- they build and install the package but
+ do not gzip the man pages or strip the binaries and libraries;
+ this is done manually afterwards.
+
+ *These* are the scripts that slacktrack and altertrack were
+ written for.
+
+ * Note: Whilst some software's Makefiles may appear to honour
+ the DESTDIR variable, the Makefile *may* be broken which can
+ result in files missing or corrupt within your new package.
+ For example: I built Apache v2.0.48 and built a package using
+ make install DESTDIR. However, a problem exists in that some of
+ the Perl scripts it installs have *temporary build paths*
+ hard coded into the resulting scripts.
+ This is why you *may* find a .build instead of a SlackBuild
+ script within Slackware's source tree.
+
+ However, the primary reason is because the build script just
+ hasn't been updated to make use of DESTDIR. *
+
+
+ 2.2 slacktrack in the scheme of things
+ ----------------------------------
+
+ I follow Slackware-current quite closly. Often I want to
+ 'back port' a -current package to an earlier release of Slackware .
+ I can't simply upgrade with -current's package because it was
+ compiled for a newer GLIBC than Slackware 8.1's, for example.
+ For packages that use a 'clean' 'SlackBuild' script, this is
+ an easy job -- I simply run 'SlackBuild' on an 8.1 box.
+
+ However, for .build scripts, I needed a way of building packages
+ using Slackware's .build scripts.
+
+ I found a great program called 'CheckInstall' which fulfilled most of my
+ requirements. However, as time went on and I started building
+ more of Slackware's packages and writing my own build scripts, I found
+ that checkinstall was lacking some features that I required.
+ At this time I was also considering porting Slackware to run on
+ the ARM architecture and helping with the Splack (Slackware on SPARC project),
+ and therefore wanted a robust program that can deal with every .build script
+ I threw at it, and if it can't handle it, I needed to be able to make modifications.
+ The easiest way of doing this was to write my own script; thus
+ 'slacktrack' was born.
+
+ slacktrack is based on the *idea* behind 'CheckInstall', but uses
+ only my own code (and contributions from other users), and only contains
+ Slackware-specific facilities -- it can not build Debian or RedHat packages
+ and never will.
+
+ slacktrack does not have all of the facilities of CheckInstall either,
+ but then these are not required for building Slackware packages
+ from .build scripts.
+
+ Also, slacktrack only works with 'official' Slackware directory locations
+ and /usr/local.
+ For example, if your make install installs binaries in /opt/packagename/bin
+ and the man pages in anywhere other than /usr/man or /usr/local/man, then
+ slacktrack's relevant options (eg stripping libs, bins, gzman) will
+ not detect them.
+
+
+ 2.2.1 Using slacktrack with official .build scripts
+ ---------------------------------------------
+
+ Building a replicar Slackware package from a .build script is
+ typically fairly trivial with slacktrack.
+
+ If we wanted to build slackware-9.1's elvis, we could do
+ # cd slackware/slackware-9.1/source/a/elvis
+ # chmod 755 elvis.build
+ # slacktrack -jefkzp "elvis-2.1-i386-2.tgz" ./elvis.build
+
+ The resulting package (by default) be stored in
+ /tmp/built-slackwarepackages/
+
+ As already mentioned, some of the Slackware .build scripts
+ are incomplete with regard to gzipping man pages, stripping binaries
+ and so on -- fetchmail.build is one of them.
+ Therefore you can specify various options to slacktrack that
+ will take care of this for you.
+ The options in the example above :
+ j - compress libraries
+ e - chown root:bin /bin,/sbin,/usr/bin,/usr/sbin directories
+ f - chown root:bin files in the binary dirs listed above
+ k - strip binaries found in the binary dirs listed above
+ z - gzip man pages
+ p - the resulting Slackware package .t?z name
+
+ The way I re-create the packages is to build a 'trackbuild' script that
+ launches slacktrack with the required options and the name
+ of the Slackware .build script. You can find examples of such
+ scripts within the docs directory after installing slacktrack:
+
+ /usr/doc/slacktrack*/buildscript-examples/
+
+ You will also find that in Slackware versions 12.0 and upwards,
+ the .build scripts are accompanied by 'trackbuild' scripts because
+ slacktrack is used by the Slackware team to produce the packages.
+
+ 2.2.2 Writing your own .build scripts for slacktrack
+ ----------------------------------------------
+
+ There isn't any specific that you have to do to write a build
+ script for use with slacktrack -- the script name specified to
+ slacktrack doesn't even have to be a script - it can be a binary -
+ as long as it is executable, it is acceptable.
+
+ You can see some of my own build scripts that I have written
+ for use with slacktrack by looking in the documents directory
+ after installing slacktrack:
+
+ /usr/doc/slacktrack*/buildscript-examples/
+
+ 2.2.2.1 Making use of slacktrack's environment variables
+ -------------------------------------------------
+
+ slacktrack exports two environment variables:
+ SLACKTRACKFAKEROOT and SLACKTRACKSCRATCHDIR
+
+ SLACKTRACKFAKEROOT:
+ ````````````````````
+
+ The purpose of this to allow your .build script to access the
+ 'root' directory of the resulting package.
+ There are two scenarios where you may want to use this
+ variable:
+
+ 1. During the build:
+
+ The reason you may wish to do this is to pre-populate
+ the package with files that you may not wish to place directly
+ onto the root filesystem.
+ The package contents will only appear inside this directory
+ once your build script has finished, and slacktrack has determined
+ what to put into this directory.
+
+ In previous slacktrack versions which used a pseudo-root filesystem
+ (where the package contents were populated *during* the build), this
+ made sense, but in slacktrack v2.00, it is unlikely that you'd want
+ to use this vairable from the build script.
+
+ 2. Post-build -- cleanups after the build:
+
+ The most likely use of this script is to perform package cleanup
+ tasks after the build. This is mainly to perform tasks that slacktrack
+ does not handle itself - such as deleting known files/directories that
+ creep into packages (due to a system daemon such as CUPS), or setting
+ some file and directory permissions.
+
+ An example post build script is below.
+ A post build script can be specified by slacktrack's -R option:
+
+ # Incase you had CUPS running:
+ rm -rf etc/cups etc/printcap
+ # crond:
+ rm -rf var/spool/cron
+ rmdir var/spool
+
+ # perllocal.pod files don't belong in packages.
+ # SGMLSPL creates this:
+ find . -name perllocal.pod -print0 | xargs -0 rm -f
+
+ # Some doc dirs have attracted setuid.
+ # We don't need setuid for anything in this package:
+ chmod -R a-s .
+
+
+ SLACKTRACKSCRATCHDIR:
+ `````````````````````
+
+ The purpose of this variable is to provide some temporary
+ space to untar your source archives and so on. slacktrack
+ will manage the creation and deletion of this directory.
+
+ For example:
+ # cd ${SLACKTRACKSCRATCHDIR}
+ # tar zxvvf ${ORIGPATH}/source/foobar.tar.gz
+
+ You can see in some of the example 'non-slackware' scripts
+ how I have used these variables
+
+
+3.0 slacktrack in operation
+ -----------------------
+
+ The basic event flow is as follows:
+
+ [1] Parse command line arguments
+ -> Check they are OK, if not bomb out
+ [2] Launch the supplied build script
+ [3] Run any specified functions (eg gzman, strip bins, chowns) over the
+ package 'root' directory and contents
+ [4] Run Slackware's 'makepkg' program over the package contents
+ [5] Move the .t?z to the specified build store path
+ [6] Scan for any hard links that may be in the package
+ -> If any found, alert the user on screen and also
+ log to a packagename.hardlinks.log file in the build store path
+
+ The slacktrack shell script is fairly simple and well commented; it should be
+ relatively easy for anybody who understands bash to quickly comprehend what
+ is happening and why.
+
+ 3.1 How slacktrack finds which files have been installed
+ ----------------------------------------------------
+
+ In order to track the files and directories that have been installed
+ or changed, slacktrack follows this ordered process:
+
+ [1] Scans a pre-set list of directories on the filesystem and
+ logs the contents.
+ [2] Launches build script which installs the package onto the
+ filesystem
+ [3] Scans the filesystem once again
+ [4] Compares the differences in the before and after snapshots
+ [5] Copies the differences into a 'package root directory' and
+ runs makepkg over them.
+
+ In slacktrack version 1, we used 'installwatch' which overloaded
+ some of glibc's filesystem calls, creating new files and directories
+ into a pseudo-root filesystem, avoiding the need to install onto
+ the host's filesystem (and also allowing to build as a non-root user).
+ However, this library is ill maintained and even in the early days
+ when it worked well, it still had problems and workarounds were required.
+
+4.0 Example scripts
+ ---------------
+
+ Included with the slacktrack binary distribution are a number of example
+ scripts that hopefully should provide you with a basis of how to use slacktrack
+ to build from 'dirty' source distributions.
+
+ The examples are bundled in the documentation directory available
+ after installing slacktrack:
+
+ /usr/doc/slacktrack*/buildscript-examples/
+
+
+5.0 Known problems/features of slacktrack
+ -------------------------------------
+
+ Current problems:
+
+ [1] slacktrack doesn't have sufficient error checking.
+
+ I'm in two minds about *where* to put error checking, you see.
+ Do I go no further if the supplied build script exits with a non-zero
+ value?
+ No, that's a bad idea because what if you didn't write the build script?
+ it might be one of these qmail type binary installer programs that
+ you can't (easily without hacking the source) fix. The author may
+ have their own systems, and the program exits with a value that their
+ own controller script recognises as non-failure.
+
+ What should I do if makepkg has failed? You see it on screen
+ and in the logs anyway, plus makepkg is one of the last things
+ that slacktrack calls -- how can you recover?
+
+ That said, version 1.03 now has some error handling. There's still
+ not enough though, imo.
+
+ [2] No support for a default config file
+
+ I don't see the point. Each .build script is different
+ and although I typically use the same options to slacktrack
+ for most of my build scripts, I don't see why I'd need a
+ config file just to save 4 bytes or so in a trackbuild wrapper :-)
+
+
+6.0 New features
+ -------------
+
+ See the TODO file in the docs directory.
+
+ If you have any specific features you would like to see
+ included, or have found any bugs, please
+ email me <mozes@slackware.com>
+
+7.0 Licence
+ -------
+
+ slacktrack is distributed under BSD Licence.
diff --git a/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_CHECKLIST b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_CHECKLIST
new file mode 100644
index 000000000..12817bebc
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_CHECKLIST
@@ -0,0 +1,244 @@
+##########################################################################
+# Document: PACKAGE_BUILDING_CHECKLIST
+# Purpose : Check list for creation of Slackware packages
+# via .build scripts
+# Author..: Stuart Winter <mozes@slackware.com>
+# Date....: 04-Apr-2006
+# Version : 1.01
+##########################################################################
+# This document belongs to my 'slacktrack' program
+# http://www.slackware.com/~mozes
+##########################################################################
+# Changelog
+###########
+# v1.01 - 04-Apr-2006
+# * Added note about Slackware version 11 using root:root ownerships
+# for binary directories.
+# v1.00 - 01-Mar-2003
+# * Created
+###########################################################################
+Building the package via slacktrack
+-----------------------------------
+
+Let's assuming you're rebuilding the 'fetchmail' utilities package
+from Slackware-current.
+
+ # cd slackware/slackware-current/source/n
+ # slacktrack -jefkzcnp "fetchmail-6.2.0-sparc-2.tgz" "/bin/sh fetchmail.build"
+
+
+If you wanted to make slacktrack save the package into a different directory
+you would use the -b option, eg
+ # slacktrack -b "/data/sparc-packages/n/" \
+ -Qnp "fetchmail-6.2.0-sparc-2.tgz" "/bin/sh fetchmail.build"
+
+slacktrack now moves the package and its .txt description file into my
+Sparc port's 'n' series package directory.
+
+Your package compiles successfully and is now stored in
+/tmp/built-slackwarepackages/
+as fetchmail-6.2.0-sparc-2.tgz
+
+Testing the package
+-------------------
+
+We must now manually check the integrity of the resulting package.
+
+The easiest way of examining the package is to run it through less.
+ # less fetchmail-6.2.0-sparc-2.tgz
+
+[a] The 'install/slack-desc' file
+ -----------------------------
+
+ This is a text file in the standard 'slack-desc' format.
+ It gives a brief description of the package and any relevant
+ information.
+
+ For examples you should look in the source directory
+ of any slackware package.
+
+[b] The 'install/doinst.sh' file
+ ----------------------------
+
+ Unless you know what you are doing, your installation scripts should
+ only refer to relative path names.
+ For example:
+
+ if [ ! -f etc/foo.conf ]; then
+ mv -f etc/foo.conf.new etc/foo.conf
+ fi
+
+ This is because the user can specify a different root directory
+ when installing the package. If your script uses absolute path names
+ (path names begin with a /) then this script will not work as expected because
+ installpkg only changes into the specified root directory and runs the script;
+ it does not perform a chroot or anything similar.
+
+[c] Check permissions
+ -----------------
+
+ Ensure that there are no globally writeable files and directories
+ that should not be there.
+ PHP 4.3.0 is an all time classic example of why you should check
+ your packages; it had globally writeable files in /usr/lib/php !
+
+ You can feed slacktrack the --chmod-og-w option to help you
+ deal with globally writeable files. However, it's best if you
+ do it yourself from your script, and using this option is no
+ excuse to not check !
+
+[d] Check file & directory ownerships
+ -----------------------------------
+
+ Unless specifically required, the files and directories should
+ be owned by 'root' in the group 'root'.
+ You may find that some source distributions install their files
+ with different UIDs because they've simply copied them from the
+ source ball -- so the files end up being owned by 'bob.users'
+ or similar.
+
+ However, also see the next check regarding binaries.
+
+[e] Check binary file & binary directory ownerships
+ -----------------------------------------------
+
+ Prior to Slackware version 11, the standard was to have binaries
+ installed in
+ /bin,/sbin,/usr/bin,/usr/sbin
+ as owned by root:bin
+
+ The directories (above) themselves should also have these ownerships.
+
+ You can feed slacktrack the following options to help here:
+ -e, --chown-bdirs-root-bin
+ This runs chown root.bin over the binary directories listed above
+ -f, -chown-bfiles-root-bin
+ This runs chown root.bin over the FILES inside the binary directories
+ listed above.
+
+ Again, you should check the package incase there has been a problem.
+
+ The -e and -f options are provided because *Slackware*'s .build scripts
+ do not do chown them for you -- it is done manually by Pat.
+
+ With Slackware version 11, those binary directories are owned by root:root.
+ For slacktrack you can use the -m operator to have this set for you.
+
+[f] Ensure man pages are gzipped & any broken symlinks are fixed
+ ------------------------------------------------------------
+
+ Slackware's packages all (or at least should) have gzipped man pages.
+ The man pages reside in numbered directories ('sections') within
+ /usr/man
+ eg man pages in section 1 reside in /usr/man/man1
+
+ man pages that are *not* gzipped will not have a .gz extension.
+ For example, the mkdir man page that is not gzipped would be:
+ /usr/man/man1/mkdir.1
+ The gzipped version is
+ /usr/man/man1/mkdir.1.gz
+
+ Some binaries behave differently when called with different names, or
+ have different names for historical purposes.
+ Such an example are packages from the 'floppy' Slackware package.
+ /usr/bin/xdfformat is a symlink to /usr/bin/xdfcopy
+ The man page is no different:
+ xdfformat.1 -> xdfcopy.1
+ By default, the Slackware 'floppy.build' script does not gzip man pages.
+ It's easy to gzip man pages - slacktrack does this
+ find usr/man -type f -print0 | xargs -0 gzip -9
+ However, if you do an ls -l on the man1 directory, you will see
+ that we have broken the xdffformat.1 symlink to xdfcopy.1
+ because xdfcopy.1 is now named xdfcopy.1.gz
+ The way to fix this would be to
+ # rm -f xdffformat.1 ; ln -s xdfcopy.1 xdfformat.1
+
+ The easiest way to ensure your man pages are gzipped and all symlinks
+ are restored is to feed slacktrack the -z or --gzman option
+ slacktrack will take care of your symlinks for you.
+
+ Again, there is no excuse not to check manually !
+
+[g] strip binaries and shared objects
+ ---------------------------------
+
+ In order to reduce the size of the binary once installed and package,
+ Slackware strips the libraries and binaries.
+
+ For example, if we wanted to strip the grep program we would do
+ # strip --strip-unneeded /bin/grep
+
+ Stripping binaries from .build scripts called via slacktrack
+ is fairly easy. There are two ways of doing it:
+ [1] Let slacktrack take care of it
+ -j or --striplib will cause slacktrack to strip
+ any executable .so files it finds in /lib and /usr/lib
+
+ -k or --stripbin will cause slacktrack to strip
+ any executable binaries it finds in /bin,/sbin,/usr/bin,/usr/sbin
+
+ [2] Do it yourself in the your build script - this is the preferred way.
+ slacktrack exports an environment variable named
+ SLACKTRACKFAKEROOT
+ This enables you to do something like this
+ # find ${SLACKTRACKFAKEROOT}/usr/lib -type f -name *.so -print0 | xargs -0 strip
+ Using the environement variable prevents you from having to know
+ all of the library & binary file names, as you will only find
+ files that your build script has created in the fake root directory.
+
+ * Note: You may find that some binaries or libraries break when they
+ are stripped. This is because they require symbols that strip
+ removes. This is why it's best to do your own binary and
+ library stripping and individually strip the required files rather
+ than letting slacktrack do it for you *
+
+[h] Check zero length files
+ -----------------------
+
+ slacktrack uses Slackware's makepkg program which should identify any
+ zero length files for you. However, it's worth checking *why* any files
+ are of zero length -- you will find that some of them are meant to be;
+ the etc-*-noarch-*.tgz package's /etc/mtab file is an example of this.
+
+ There should be no occasion for a binary or .so to be of zero bytes.
+
+ If you're unsure of any zero length files, check out the next point.
+
+[i] Compare your package with the official package
+ -----------------------------------------------
+
+ If you are rebuilding/porting a Slackware package from -8.1 or -current
+ (or any other version for that matter), then one of the easiest ways
+ to give you some confidence that your package is official-looking is to
+ simply examine the official package.
+
+ This will allow you to see whether the file & dir permissions are the
+ same as your own package, verify any zero length files and so on.
+
+ Please note that if you DO find any zero length files or anything
+ that you can easily PROVE is broken then *DO* submit a report
+ to Slackware so that it can be fixed.
+
+ If you're porting Slackware packages to a different architecture then
+ obviously don't be overly concerned about file size differences -- although
+ it's worth making sure you've stripped your binaries. You may actually
+ find that some of the Slackware official packages aren't stripped.
+
+[j] Ensure your package root directory is chmod 755
+ -----------------------------------------------
+
+ prisere [packages] # tar ztvvf foo.tgz
+ drwx------ root/root 0 2003-03-01 18:46:17 ./
+
+ If you see this, your package IS BROKEN.
+
+ Installing this package will render your system seriously
+ broken because it will chmod 700 the root directory !
+
+ By default slacktrack will chmod 755 the root directory, but
+ as with everything else, you should check !
+
+
+
+That's about it. If you can think of any other checks then please
+email <mozes@slackware.com>
diff --git a/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_URLS b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_URLS
new file mode 100644
index 000000000..801b8aa0a
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/PACKAGE_BUILDING_URLS
@@ -0,0 +1,38 @@
+These are a few URLs that provide information about
+how to build packages for Slackware Linux:
+
+ Slackware Linux Essentials book
+ -------------------------------
+
+ http://www.slackware.com/book/index.php?source=x4132.html
+
+
+ Linux packages
+ --------------
+
+ This web site has a great number of pre-built packages for
+ Slackware.
+
+ It also has a HOWTO about building packages:
+
+ http://www.linuxpackages.net/howto/howto.php?page=package
+
+
+ Slackbuilds.org
+ ------------------
+
+ This site has a huge repository of build scripts for Slackware.
+ They are all 'SlackBuild' type -- eg the 'clean' builds
+ (the preferred method -- i.e. these do not need slacktrack)
+
+ http://www.slackbuilds.org
+
+
+ Slackware's official build scripts
+ ----------------------------------
+
+ I also recommend that you look at the official Slackware build
+ scripts that can be found on the FTP site in the 'source'
+ directory of the distribution
+ (e.g. slackware/slackware-9.1/source)
+
diff --git a/source/d/slacktrack/slacktrack-project/docs/RELEASE_NOTES b/source/d/slacktrack/slacktrack-project/docs/RELEASE_NOTES
new file mode 100644
index 000000000..02876d898
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/RELEASE_NOTES
@@ -0,0 +1,137 @@
+slacktrack version 2.00
+Release notes: 17th September 2008
+===================================
+
+Highlights:
+-----------
+
+slacktrack no longer uses 'installwatch' to track the installation
+process -- what was previously called 'altertrack' has been turned
+into 'slacktrack'.
+
+slacktrack's method of tracking package installations is to
+have the package installed directly onto the host's filesystem.
+
+This is for a number of reasons:
+
+ 1. installwatch is ill maintained and was failing to work correctly
+ with new versions of glibc and GNU 'coreutils'.
+
+ 2. installwatch could not track statically compiled binaries,
+ meaning that if a statically compiled binary was used to
+ manipulate the filesystem in any way, these manipulations would
+ not be reflected in your package contents.
+
+ 3. With virtualisation -- QEMU, VMWare, SUN's VirtualBox -- being so
+ readily available, and allowing filesystem 'snapshots', it's
+ easier and easier to spin up a development operating system and
+ build and install directly onto the root filesystem, thus getting
+ a complete package.
+
+Upgrading your build scripts from slacktrack version 1.x
+--------------------------------------------------------
+
+1. slacktrack internal variables
+ -----------------------------
+
+ $SLACKTRACKFAKEROOT
+
+ This variable points to the location of the package's
+ root filesystem (usually /var/tmp/<someplace>).
+ Using slacktrack 1.x, you could perform operations on the
+ package contents from your build script *during* the build
+ process.
+
+ In slacktrack 2.x, the package root directory is only populated
+ after the build script has finished.
+
+ However, the variable can still be used from a post-build
+ script.
+ You can use slacktrack's '-R' operator to specify a post-build
+ script. In the example below, the post build script is
+ called 'postbuildfixes.sh' and resides in the same directory
+ as the 'trackbuild' script.
+
+ ** Note: Ensure that your post-build script is chmod 755. **
+
+# Launch the build script:
+altertrack \
+ --notidy \
+ --showdeps \
+ -T $TMP \
+ -l $CWD/build.$ARCH.log \
+ -R $CWD/postbuildfixes.sh \
+ -b $PKGSTORE \
+ -zIKASmg \
+ -Ocp $PKGNAM-$PKGVERSION-$ARCH-$BUILD.tgz ./linuxdoc-tools.build
+
+ The contents of this post build script can be something such as:
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+#!/bin/bash
+
+# Once altertrack has determined what the contents of the package
+# should be, it copies them into $SLACKTRACKFAKEROOT
+# From here we can make modifications to the package's contents
+# immediately prior to the invocation of makepkg: altertrack will
+# do nothing else with the contents of the package after the execution
+# of this script.
+
+# If you modify anything here, be careful *not* to include the full
+# path name - only use relative paths (ie rm usr/bin/foo *not* rm /usr/bin/foo).
+
+# Enter the package's contents:
+cd $SLACKTRACKFAKEROOT
+
+# OpenSP creates this symlink; we delete it.
+if [ -L usr/share/doc ]; then
+ rm -f usr/share/doc
+fi
+
+# Incase you had CUPS running:
+rm -rf etc/cups etc/printcap
+# crond:
+rm -rf var/spool/cron
+rmdir var/spool
+
+# perllocal.pod files don't belong in packages.
+# SGMLSPL creates this:
+find . -name perllocal.pod -print0 | xargs -0 rm -f
+
+# Some doc dirs have attracted setuid.
+# We don't need setuid for anything in this package:
+chmod -R a-s .
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+
+2. Build script changes
+ --------------------
+
+ If your build scripts were more sophisticated and took advantage of
+ the way installwatch used a pseudo root filesystem, please be acutely
+ aware that your build script now runs on the host's live operating system;
+ so you need to be more careful. However, as suggested -- run only on development
+ installations.
+
+3. Additional files creeping into the packages
+ -------------------------------------------
+
+ Due to some daemons making changes to their config files whilst your build
+ is in flight, you may find some additional files have crept into your package
+ which you were not expecting.
+
+ You may wish to turn off the following daemons before starting a build:
+ CUPS
+ crond
+ sendmail
+ ypbind (NIS)
+ ypserv (NIS)
+
+ If you look at the example post build script above, you can see that it
+ removes some CUPS and crond residue.
+ Whilst it would be possible to remove these paths from slacktrack's scan
+ locations, some users may wish their package to place data in those directories;
+ so you need to make your own adjustments and checks for this.
+
+
+END.
diff --git a/source/d/slacktrack/slacktrack-project/docs/SLACKDTXT.examples b/source/d/slacktrack/slacktrack-project/docs/SLACKDTXT.examples
new file mode 100644
index 000000000..9a57620a7
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/SLACKDTXT.examples
@@ -0,0 +1,103 @@
+##########################################################################
+# Document: SLACKDTXT.examples
+# Purpose : Provide examples of how one may use slackdtxt
+# Author..: Stuart Winter <mozes@slackware.com>
+# Version : 1.00
+# Date....: 02-Mar-2003
+###########################################################################
+
+1.0 Building ProFTPD from Slackware's source directory
+ --------------------------------------------------
+
+In this example, I have my slackware-current source tree
+stored in the directory ' /data2 '
+
+I want to compile ProFTPD using Slackware's SlackBuild script, but I want
+to move the package from /tmp (where SlackBuild stores it)
+into my Slackware binary directory
+ /data2/slackware-current/slackware/n/
+and I also want to create a .txt description file in the same binary directory.
+
+ 1. Enter the slackware-current source directory
+ --------------------------------------------
+
+ meths [proftpd] # pwd
+ /data2/slackware-current/source/n/proftpd
+ meths [proftpd] # ls
+ _proftpd.tar.gz etc proftpd-1.2.7.tar.bz2 proftpd-1.2.7.tar.bz2.asc proftpd.SlackBuild slack-desc
+
+
+ 2. Compile ProFTPd using the supplied SlackBuild script.
+ -----------------------------------------------------
+
+ meths [proftpd] # ./proftpd.SlackBuild
+
+ [ .. snip lots of text as the package is compiled and built .. ]
+
+ Our proftpd package is built in /tmp as this is where SlackBuild stores it.
+
+ meths [proftpd] # ls -l /tmp/proftpd-1.2.7-i386-1.tgz
+ -rw-r--r-- 1 root root 503169 Mar 3 00:43 /tmp/proftpd-1.2.7-i386-1.tgz
+ meths [proftpd] #
+
+
+ 3. Create the .txt file and move the package into the binary distribution directory
+ ---------------------------------------------------------------------------------
+ meths [proftpd] # slackdtxt -d /data2/slackware-current/slackware/n/ /tmp/proftpd-1.2.7-i386-1.tgz
+ slackdtxt: Copying package to destination directory ....done
+ slackdtxt: Verifying the version of the package in the destination directory ....done
+ slackdtxt: Attempting to extract install/slack-desc from the package ....done
+ slackdtxt: proftpd-1.2.7-i386-1.txt created
+ slackdtxt: Deleting the original package ....done
+ meths [proftpd] #
+
+ In this instance I have extracted the slack-desc file from the /tmp/proftpd-1.2.7-i386-1.tgz
+ package. Because I was in the source directory, I could have used the local slack-desc
+ file and saved the overhead of having to untar. In order to do this I could have done:
+
+ # slackdtxt -d /data2/slackware-current/slackware/n/ -s slack-desc /tmp/proftpd-1.2.7-i386-1.tgz
+
+
+Example 2: Creating .txt files from a bunch of packages
+ --------------------------------------------
+
+In this example, I have built a number of packages already. They are
+stored in my binary distribution directory (/data2/slackware-current/slackware)
+but the packages do not have corresponding .txt files.
+
+I will use slackdtxt to create .txt files in the same directory as the package files.
+
+
+ 1. Enter the slackware-current binary distribution directory
+ ==========================================================
+
+ meths [n] # pwd
+ /data2/slackware-current/slackware/n
+
+ These are the packages I have built previously.
+
+ meths [n] # ls
+ htdig-3.1.6-i386-2.tgz mod_ssl-2.8.12_1.3.27-i386-1.tgz mutt-1.4i-i386-1.tgz wget-1.8.2-i386-2.tgz
+ meths [n] #
+
+ 2. Create .txt files for all corresponding package files
+ =====================================================
+
+ meths [n] # slackdtxt *.tgz
+ slackdtxt: Attempting to extract install/slack-desc from the package ....done
+ slackdtxt: htdig-3.1.6-i386-2.txt created
+ slackdtxt: Attempting to extract install/slack-desc from the package ....done
+ slackdtxt: mod_ssl-2.8.12_1.3.27-i386-1.txt created
+ slackdtxt: Attempting to extract install/slack-desc from the package ....done
+ slackdtxt: mutt-1.4i-i386-1.txt created
+ slackdtxt: Attempting to extract install/slack-desc from the package ....done
+ slackdtxt: wget-1.8.2-i386-2.txt created
+
+ meths [n] # ls
+ htdig-3.1.6-i386-2.tgz mod_ssl-2.8.12_1.3.27-i386-1.tgz mutt-1.4i-i386-1.tgz wget-1.8.2-i386-2.tgz
+ htdig-3.1.6-i386-2.txt mod_ssl-2.8.12_1.3.27-i386-1.txt mutt-1.4i-i386-1.txt wget-1.8.2-i386-2.txt
+ meths [n] #
+
+ All .txt files are now created.
+
+
diff --git a/source/d/slacktrack/slacktrack-project/docs/SLACKTRACK.examples b/source/d/slacktrack/slacktrack-project/docs/SLACKTRACK.examples
new file mode 100644
index 000000000..924f932f7
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/SLACKTRACK.examples
@@ -0,0 +1,34 @@
+
+If you are looking for example scripts to help you use
+slacktrack please look in the documentation directory:
+
+ /usr/doc/slacktrack*/buildscript-examples/
+
+Quick example:
+--------------
+
+I will build the elvis editor that you can find in Slackware's
+'a' series. This is looking at an older version of the Slackware
+source tree (v 9.1) -- the build script has since been replaced
+by a 'SlackBuild', but this example still serves as a good example
+reference:
+
+bourbon [root] # cd slackware-9.1/source/a
+bourbon [elvis] # slacktrack -gfenzKSUIp elvis-2.41-i486-1.tgz ./elvis.build
+bourbon [elvis] # tar ztvvf /tmp/elvis-2.41-i486-1.tgz | head -n9
+drwxr-xr-x root/root 0 2003-07-11 09:26:05 ./
+drwxr-xr-x root/root 0 2003-07-11 09:26:04 usr/
+drwxr-xr-x root/bin 0 2003-07-11 09:26:05 usr/bin/
+-rwxr-xr-x root/bin 301280 2003-07-11 09:26:05 usr/bin/elvis
+-rwxr-xr-x root/bin 19956 2003-07-11 09:26:05 usr/bin/ref
+-rwxr-xr-x root/bin 15160 2003-07-11 09:26:05 usr/bin/elvtags
+-rwxr-xr-x root/bin 936180 2002-06-08 00:15:29 usr/bin/vim
+drwxr-xr-x root/root 0 2003-07-11 09:26:01 usr/share/
+drwxr-xr-x root/root 0 2003-07-11 09:26:04 usr/share/elvis-2.1_4/
+bourbon [elvis] #
+
+As you can see, we now have an elvis package with the
+correct ownerships set on the binary files and so on and
+so forth.
+
+Stuart.
diff --git a/source/d/slacktrack/slacktrack-project/docs/TODO b/source/d/slacktrack/slacktrack-project/docs/TODO
new file mode 100644
index 000000000..28c22b04a
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/TODO
@@ -0,0 +1,65 @@
+To do list
+----------
+
+Likely to be done:
+==================
+
+This list represents changes that I am likely to implement myself:
+
+Thinking about it:
+==================
+
+1. Modify slacktrack to do a couple of scans of the filesystem prior to
+ launching the build script.
+ It'd compare the scans and add any differences to an exclude list -- since
+ any such differences were not generated by the build script, thus should not
+ be in the package.
+ The purpose of this is to reduce the possibility of non package material making
+ its way into the final .tgz.
+ *However*, there's nothing to say that some arbitary cron job won't launch and
+ modify the filesystem anyway -- so this sort of feature would only lead to
+ confusion in the long run.
+
+2. Allow addition of exclude/additional scan dirs without having to replace
+ the existing list.
+ Suggested by: Eduard Rozenberg
+
+3. Compare contents of new package and warn about any overlapping files.
+ This is harder to do that it sounds because the user may not be removing
+ the previous package (although it's suggested that you do) because it's
+ an integral system library or binary and they simply want to upgrade
+ it and produce a package. This would always talk about overlap.
+ We could get the 'base package name' of the supplied package
+ and then remove it from any found ovelap results, but it seems
+ a bit slow.
+
+Unlikely to be done:
+====================
+
+This list represents future additions that (for one reason or another) I am
+unlikely to implement. However, feel free to submit a patch (but ask me first -
+I don't like receiving unsolicited attachments!).
+
+2. Add an option to rename/move .conf files to conf.new
+ Suggested by Geoffrey Sanders, based on an option protopkg supports.
+
+ [..]
+ > altertrack to (during it's file scan of new files for the package) to
+ > move any newly created .conf (or any other type of config files) to a
+ > *.new extension. Don't know how much work this would be...but thought
+ > that it might be nice to add for those of us who may forget to 'backup'
+ > any config's that may get stepped on.
+ [..]
+
+ I must admit that I'm not overly keen on this idea - it sounds too much
+ like checkinstall -- add a feature that mainly works but breaks when you
+ least expect it.
+
+ Just moving the .conf to .conf.new is okay in theory but it may:
+ a) catch people out who rely on the feature but where the config
+ file isn't called '*.conf'
+
+ b) if it updates the doinst.sh script, the shell script which changes
+ the file name may need to be before or after the symlink creation
+ code (if there is any).
+
diff --git a/source/d/slacktrack/slacktrack-project/docs/USAGE b/source/d/slacktrack/slacktrack-project/docs/USAGE
new file mode 100644
index 000000000..46ec1f1cc
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/USAGE
@@ -0,0 +1,8 @@
+
+slacktrack and slackdtxt have full section 8 man pages. Please do
+
+ # man slacktrack
+ # man slackdtxt
+
+
+Stuart Winter <mozes@slackware.com>
diff --git a/source/d/slacktrack/slacktrack-project/docs/WARNINGS b/source/d/slacktrack/slacktrack-project/docs/WARNINGS
new file mode 100644
index 000000000..0ba7e31cb
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/WARNINGS
@@ -0,0 +1,38 @@
+1. Do not Use on production servers
+ ---------------------------------
+
+ Do NOT run slacktrack on production servers.
+
+ It should only be run on a development box.
+
+ This is because slacktrack version 2.0 and upwards install onto
+ the filesystem of the server, rather than into a pseudo root.
+
+2. Slackware versions
+ ------------------
+
+ slacktrack has been tested on:
+ - Slackware 12.0, 12.1, 12.2, 13.0
+ - ARMedslack, all versions.
+
+ It may works on previous releases of Slackware, it may not.
+
+3. slacktrack default working space
+ --------------------------------
+
+ By default, slacktrack puts its work space in
+ /var/tmp/<randomnumber>slacktrack
+
+ It is essential that you have enough disk space on the
+ partition on which /var/tmp resides - particularly if you use
+ ${SLACKTRACKSCRATCHDIR}
+
+ If you do not have enough space in /var/tmp then you can
+ pass --tempdir to slacktrack to change the base temporary directory.
+
+ eg you may do
+ # slacktrack --tempdir /tmp/slacktrack -Qp "foobar-4.1-sparc-2.tgz" "/bin/sh foobar.build"
+
+
+Stuart Winter <mozes@slackware.com>
+
diff --git a/source/d/slacktrack/slacktrack-project/docs/buildscript-examples/README b/source/d/slacktrack/slacktrack-project/docs/buildscript-examples/README
new file mode 100644
index 000000000..5182cc992
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/docs/buildscript-examples/README
@@ -0,0 +1,19 @@
+This directory contains example scripts on which you may
+base your own build scripts.
+
+Note that the packages and versions are not current, but their
+purpose is to serve as examples.
+
+Slackware's packaging standard is that documents in /usr/doc are
+chmod 644, so these examples are archived to retain the execute
+permissions on the build scripts.
+
+Please extract the archive to /tmp to begin:
+Example:
+
+mkdir -pm /tmp/slacktrack
+tar xf examples.tar.bz2 -C /tmp/slacktrack
+
+--
+Stuart Winter <mozes@slackware.com>
+17th Sept 2008
diff --git a/source/d/slacktrack/slacktrack-project/ln-wrapper.c b/source/d/slacktrack/slacktrack-project/ln-wrapper.c
new file mode 100644
index 000000000..225c75767
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/ln-wrapper.c
@@ -0,0 +1,19 @@
+// ln-wrapper.c by Jim Hawkins <jawkins@armedslack.org>
+// Call /bin/ln with the -f operator.
+// This file lives in /usr/libexec/slacktrack & is called by having this
+// directory as the first dir in your $PATH
+//
+
+#include <string.h>
+#include <unistd.h>
+
+#define LN_PATH "/bin/ln"
+
+int main(int argc, char *argv[])
+{
+ char *argv2[argc + 2];
+ memcpy(&argv2[2], &argv[1], sizeof(*argv) * argc);
+ argv2[0] = LN_PATH;
+ argv2[1] = "-f";
+ return execv(LN_PATH, argv2);
+}
diff --git a/source/d/slacktrack/slacktrack-project/man/man.build b/source/d/slacktrack/slacktrack-project/man/man.build
new file mode 100755
index 000000000..12fb2fe2c
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/man/man.build
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+###########################################################################
+# Program: man.build
+# Purpose: Create an nroff format file from slacktrack's Perl POD
+# format manpage
+# Author : Stuart Winter <mozes@slackware.com>
+###########################################################################
+# Information about man pages:
+# http://www.fnal.gov/docs/products/ups/ReferenceManual/html/manpages.html
+# which describes creating man pages in nroff format.
+# However, it's easier (IMO) to create them in POD format.
+###########################################################################
+
+# Get version from the scripts
+SLACKTRACKVERSION="$( grep VERSION= ../scripts/slacktrack | tr -d =,\",[:alpha:] | awk '{print $2}' )"
+SLACKDTXTVERSION="$( grep VERSION= ../scripts/slackdtxt | tr -d =,\",[:alpha:] | awk '{print $2}' )"
+
+# Turn /usr/doc/slacktrack-@VERSION@ into usr/doc/slacktrack-1.02
+# You can't pipe sed into pod2man because pod2man then creates
+# the man page's name as 'STANDARD INPUT(8)' rather than 'SLACKTRACK(8)'
+sed s/@VERSION@/${SLACKTRACKVERSION}/g slacktrack.pod > SLACKTRACK.pod
+sed s/@VERSION@/${SLACKTRACKVERSION}/g slackdtxt.pod > SLACKDTXT.pod
+
+# Use pod2man to create an nroff compatible man page
+pod2man \
+ --section=8 \
+ --release="$(grep "^# Date" ../scripts/slacktrack | rev | awk '{print $1}' | rev)" \
+ --center=' ' \
+ --date="slacktrack Version ${SLACKTRACKVERSION}" \
+ SLACKTRACK.pod 2>&1 > slacktrack.8
+
+pod2man \
+ --section=8 \
+ --release="$(grep "^# Date" ../scripts/slackdtxt | rev | awk '{print $1}' | rev)" \
+ --center=' ' \
+ --date="slackdtxt Version ${SLACKDTXTVERSION}" \
+ SLACKDTXT.pod > slackdtxt.8
+
+# If we specified -t at the command line then display the man page & exit
+if [ "${1}" = "-t" ]; then
+ man ./slacktrack.8
+ man ./slackdtxt.8
+ rm -f slacktrack.8 slackdtxt.8
+fi
+
+# Delete the butchered .pod files
+rm -f SLACKTRACK.pod SLACKDTXT.pod
+
+# EOF
+
diff --git a/source/d/slacktrack/slacktrack-project/man/slackdtxt.pod b/source/d/slacktrack/slacktrack-project/man/slackdtxt.pod
new file mode 100644
index 000000000..a8b4f6210
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/man/slackdtxt.pod
@@ -0,0 +1,205 @@
+=pod
+
+=head1 NAME
+
+slackdtxt - Create package description files for Slackware packages
+
+=head1 SYNOPSIS
+
+B<slackdtxt> B<[>optionsB<]> B<E<lt>tgz file or list of filesE<gt>>
+
+
+=head1 DESCRIPTION
+
+B<slackdtxt> is tool for creating the package description (packagename.txt)
+files that can be see in the Slackware package series directories. It can
+also optionally sign the Slackware package with your GnuPG secret key.
+
+All Slackware packages have an 'install/slack-desc' file contained within the
+package file. This file gives a brief description of the package and is displayed
+by the B<installpkg> program when the package is installed, or by B<upgradepkg>
+when the package is upgraded.
+
+Within the Slackware binary distribution package 'series' directories
+are the '.t?z' files and an accompanying .txt file. However, the slack-desc files
+contained within the .t?z often have comments and 'the handy ruler' which
+should B<not> appear the .txt version. B<slackdtxt> removes this and generates
+a 'standard' .txt version from the slack-desc file.
+
+B<slackdtxt> can either take an existing B<slack-desc> file and convert it, or
+extract the slack-desc from the specified .t?z package file.
+
+The basic purpose of B<slackdtxt> is to build .txt files after you have run
+Slackware's official B<SlackBuild> scripts. Slackware's SlackBuild scripts
+leave the packages in /tmp, and it is presumed that you would like to move
+them into a safe place and create a .txt file at the same time. Therefore slackdtxt
+enables you to specify a B<destination directory> in which to copy or move the .t?z
+and to create the .txt file.
+
+slackdtxt was written with porting Slackware to other architectures in mind.
+
+=head1 Slackware Package file extensions
+
+Starting with Slackware version 13, four types of package compression formats
+are suported.
+
+=over 4
+
+=item B<.tgz> - Gzip
+
+=item B<.tbz> - Bzip2
+
+=item B<.tlz> - LZMA
+
+=item B<.txz> - XZ
+
+=back
+
+Where this document mentions '.t?z', it refers to one of the above formats.
+
+
+
+=head1 OPTIONS - GENERAL
+
+=over 4
+
+=item B<-h>, B<--help>
+
+Show the available options and exit
+
+=item B<-v>, B<--version>
+
+Show the version information and exit
+
+=back
+
+=head1 OPTIONS - MAIN
+
+=over 4
+
+=item B<-s>, B<--slackdescfile> <path to slack-desc file>
+
+Specify the name of/path to the 'slack-desc' file.
+
+You would typically want to use this option if you are in the package
+build directory that contains the B<slack-desc> file.
+
+B<Note:> You cannot use this option when specifying more than
+one .t?z package file; all slack-desc files will be extracted
+from the .t?z file.
+
+This option is not mandatory.
+
+=item B<-d>, B<--destdir> <directory>
+
+If this option is specified, slackdtxt will move (or copy, see
+B<--nodelete>) the .t?z file into this directory. The .txt and .asc
+files will also be created in this directory.
+
+See the examples document for the purpose of this option.
+
+This option is not mandatory.
+
+B<Note:> Omitting this flag implies B<--nodelete>
+
+=item B<-n>, B<--nodelete>
+
+This option is used in conjunction with B<--destdir>
+
+With this option, when slackdtxt has created the .txt file and copied the .t?z file
+into the destination directory, it will not delete the original version.
+
+For example, if your file is F</tmp/foobar-2.0-i386-4.tgz>
+and you feed slackdtxt B<--destdir> F</data/slackware/> then
+the F</tmp/foobar-2.0-i386-4.tgz> will remain.
+
+By default, the original will be deleted B<unless> there is no
+destination directory specified by B<--destdir>
+
+=item B<-G>, B<--gpg-sign> <id>
+
+Sign the original .t?z package file with specified GnuPG key. The
+GnuPG signature file will have the same name as the .t?z file but with an
+extra B<.asc> suffixed (e.g. foobar-1.0-i486-5.tgz.asc).
+
+=back
+
+
+=head1 EXAMPLES
+
+=over 4
+
+=item # B<slackdtxt> foo-1.00-i486-1.tgz
+
+This will create a single file named foo-1.00-i486-1.txt
+within the current working directory. To specify a different
+directory, see options B<-d>, B<--destdir>
+
+=item # B<slackdtxt> *.t?z
+
+This will make slackdtxt create '.txt' files for every
+'.t?z' package file within the current working directory.
+
+=back
+
+=head1 RETURN VALUES
+
+These are the exit codes that slackdtxt will produce when it encounters
+certain problems. You may wish to use these return codes to indicate
+success or failure when slackdtxt is called from unattended auto builder
+scripts.
+
+=over 4
+
+=item B<0>
+Clean exit
+
+slackdtxt exited without encountering any errors.
+This is the default exit code.
+
+=item B<1>
+Reserved
+
+This error code is not currently used.
+
+=item B<6>
+Missing destination directory
+
+The destination directory specified by the B<--destdir> switch does not exist.
+
+=item B<7>
+Missing user specified file
+
+A file specified by the user does not exist. Typically this will
+be the .t?z package file.
+
+=item B<8>
+Error moving data or moved data is corrupt
+
+slackdtxt failed to copy or move a data file correctly, or the file
+was moved correctly (B<mv> or B<cp> did not exit with a non-zero value)
+but a further verify failed.
+
+=back
+
+
+=head1 FILES
+
+F</usr/bin/slackdtxt> the slackdtxt script
+
+F</usr/doc/slacktrack-@VERSION@/SLACKDTXT.examples> slackdtxt usage examples
+
+=head1 AUTHOR
+
+Stuart Winter <mozes@slackware.com>
+
+=head1 SEE ALSO
+
+=over 4
+
+B<slacktrack>(8), B<makepkg>(8), B<installpkg>(8), B<explodepkg>(8), B<removepkg>(8), B<pkgtool>(8), B<upgradepkg>(8)
+
+=cut
+=back
+
+
diff --git a/source/d/slacktrack/slacktrack-project/man/slacktrack.pod b/source/d/slacktrack/slacktrack-project/man/slacktrack.pod
new file mode 100644
index 000000000..07eac6a4d
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/man/slacktrack.pod
@@ -0,0 +1,949 @@
+=pod
+
+=head1 NAME
+
+slacktrack - build Slackware packages from B<.build> scripts
+
+=head1 SYNOPSIS
+
+B<slacktrack> B<[>optionsB<]> -p B<">packagefilenameB<"> B<">buildscriptB<">
+
+
+=head1 DESCRIPTION
+
+B<slacktrack> is a packaging tool to build Slackware packages
+from simple B<.build> scripts, some of which can be found in the distribution
+source tree. B<slacktrack> has many features available to eliminate the
+majority of the manual element involved with producing packages from
+these scripts. B<slacktrack> uses the standard Slackware B<makepkg> program
+to produce the resulting packages.
+
+
+=head1 OPTIONS - GENERAL
+
+=over 4
+
+=item B<-h>, B<--help>
+
+Show the available options and exit
+
+=item B<-v>, B<--version>
+
+Show the version information and exit
+
+=back
+
+=head1 OPTIONS - SLACKWARE 'makepkg' PACKAGE MAKER
+
+The values from these options are passed to the Slackware
+B<makepkg> tool.
+
+=over 4
+
+=item B<-p>, B<--package> <package_name>
+
+Resulting tar file name of the package. This will be in the format
+of B<name>-B<version>-B<arch>-B<build>.tgz
+
+For example: B<slacktrack>-B<@VERSION@>-B<i386>-B<1>.B<tgz>
+
+=item B<-s>, B<--nosymlinks>
+
+Tell B<makepkg> not to search for symlinks in the package directory
+
+=item B<-r>, B<--setrootowner>
+
+Tell B<makepkg> to set permissions on directories to 755 and owners to root.root
+
+See also B<--chown-bdirs-root-bin>
+
+=item B<--mpopts>
+
+Supply additional options to B<makepkg>.
+
+Example: # B<slacktrack> --mpopts "--prepend" -Qnp foo-1.0-i486-1.tgz ./foo.build
+
+B<Note:> You B<must> include the additional options in either
+quotes (as shown in the example above) or single quotes otherwise slacktrack will take them
+as options to itself.
+
+=back
+
+=head1 OPTIONS - SPECIFIC SLACKTRACK OPTIONS
+
+=over 4
+
+=item B<-t>, B<--notidy>
+
+Do not delete temporary package directory when slacktrack has finished.
+slacktrack uses a temporary work space directory in /var/tmp (by default).
+This directory contains the package.tgz contents. This option can be
+useful when you are having difficulties with building the package, or
+for debugging slacktrack.
+slacktrack will inform you of the (randomly named) temporary directory
+when it has finished.
+
+=item B<-b>, B<--buildstore> <directory>
+
+Specify the location in which to store the built .tgz packages.
+By default this is B</tmp/built-slackwarepackages>, but you may wish
+to change it to another location. If this directory does not exist
+then slacktrack will default to using B</tmp>
+
+This directory also will contain any logs and the package description
+file (if specified).
+
+
+=item B<-l>, B<--logfile> <filename>
+
+slacktrack logs every element of the compilation and build process
+that the B<build script> outputs along with slacktrack's own on-screen
+output. The log file is especially useful for debugging a failed build.
+The default log path is B<E<lt>buildstore_pathE<gt>/E<lt>package_nameE<gt>.log>
+
+This option permits the user to specify a different directory for the
+logs rather than storing the .log in the same directory as the .tgz.
+
+=item B<-n>, B<--nologging>
+
+Do not save the log file when slacktrack has finished.
+See B<--logfile> above for a description of the contents of the log file.
+
+The default is to log.
+
+=item B<-D>, B<--md5sum>
+
+Create an MD5sum of the resulting package file in the package
+store directory (where the resulting package will be built; usually
+this is F</tmp>). The MD5sum file will be the same name as the resulting
+package file but with B<.md5> suffixed (e.g. foobar-1.0-i486-5.tgz.md5).
+
+This option does nothing if the B<--nocreatetgz> option has been
+specified.
+
+=item B<-G>, B<--gpg-sign> <key id>
+
+Sign the resulting package file with specified GnuPG key and
+placed the detached, armored signature in the package store directory (where
+the resulting package will be stored; usually this is F</tmp>). The GnuPG
+signature file will have the same name as the resulting package file but with
+an extra B<.asc> suffixed (e.g. foobar-1.0-i486-5.tgz.asc).
+
+This option does nothing if the B<--nocreatetgz> option has been specified.
+
+
+=item B<-z>, B<--gzman>
+
+Slackware's standard is that all man pages should be gzipped.
+This option makes slacktrack gzip any man pages that exist within the
+directories F</usr/man>, F</usr/local/man> and F</usr/X11R?/man>.
+
+The default is not to gzip man pages.
+
+Also see the B<--gzman-no-symfix>, B<--gzinfo> and B<--gzinfo-no-symfix> options.
+
+=item B<-I>, B<--gzinfo>
+
+Slackware's standard is that all GNU info pages should be gzipped.
+This option makes slacktrack gzip any info pages that exist within the
+directories F</usr/info> and F</usr/local/info>
+
+The default is not to gzip info pages.
+
+Also see the B<--gzinfo-no-symfix>, B<--gzman> and B<--gzman-no-symfix> options.
+
+=item B<-P>, B<--delete-perllocalpod>
+
+Delete any B<perllocal.pod> files found in the package's /usr/lib directory.
+
+These files contain information about a system's Perl packages installed
+in addition to the vendor's Perl distribution. Typically these files are
+created by the installation script of the additional Perl add-on package.
+
+However, they are snapshots of the particular system on which the Slackware
+package is made - and most likely will not reflect the target system's
+environment (the target is unlikely to have an identical set of additional
+Perl modules installed); thus these files should not be present in Slackware packages.
+
+The default is not to delete these files.
+
+=item B<-K>, B<--delete-usrinfodir>
+
+Delete the package's /usr/info/dir file if it exists. This file is
+a special file used by the GNU 'info' program to provide the user
+with a list of the info pages present on the system.
+Some software's Makefile will create a new 'dir' page that only contains
+information pertaining to the newly compiled software itself, rather than
+appending to the existing list of software.
+
+In the main you will want to use this option to avoid replacing the original
+/usr/info/dir file.
+
+However, the default is not to delete this file.
+
+
+=item B<-x>, B<--exclude> B<pattern for egrep>
+
+slacktrack traverses the filesystem using the UNIX 'find' utility and generates
+a 'snapshot' of the contents. grep -E (or B<'egrep'>) is then used to remove
+a number of paths and specific files from this snapshot; this is because
+these paths/directories either are locations that should never be installation
+destinations for software, or are system files that are subject to change
+moment to moment.
+
+This option allows you to replace the entire default pattern.
+
+By default, slacktrack excludes the following:
+
+EXCLUDE_LIST="${PWD}$|${PWD}|/etc/ntp/drift|/var/run/|/var/run$|/var/lib/dhcpcd|/var/lib/dhcpcd$|/etc/dhcpc/|/etc/dhcpc$|/var/cache/|/var/cache$|/run$|/run/|/media$|/media/|/srv$|/srv/|/selinux$|/selinux/|/var/lib/rpm|/var/lib/rpm$|/var/yp$|/var/yp/|/sys$|/sys/|/initrd$|/initrd/|/dev/bus$|/dev/bus/|/dev/char$|/dev/char/|/dev/rfkill|/dev/input$|/dev/input/|/dev/.udev/|/dev/.udev$|/dev/vc$|/dev/vc/|/dev/console|/dev/pts$|/dev/pts/|/dev/ptmx|/dev/tty|/var/log|/etc/mtab|/etc/resolv.conf|/etc/ld.so.cache|/tmp|/root|/proc|/var/tmp|/var/run/utmp|/var/spool/cron/cron|/var/lib/NetworkManager|/var/lib/NetworkManager$|/usr/man/whatis|/usr/local/man/whatis|/var/lib/pgsql$|/var/lib/pgsql|/var/lib/mysql$|/var/lib/mysql"
+
+This is a pattern for grep -E. Please familiarise yourself with the grep man page
+if you wish to make changes.
+
+It is recommended that these defaults are unchanged.
+
+In addition, slacktrack excludes the PWD (present working directory) from which slacktrack
+was invoked. This allows a package's source directory to be in a non-default excluded
+path and receive updates (such as log files) and avoid slacktrack including them in the
+newly created package file.
+
+=item B<-o>, B<--no-fs-search> B<pattern for find -regex (pre and post file system scans)>
+
+Prior to beginning a build, and post build, slacktrack uses the 'find' command to scan
+the OS' file system, and stores these records. The difference between the two records are used to
+determine the package's contents.
+
+There are some directory paths that should never be included within packages. By default
+this list is:
+
+SEARCH_EXCLUDE_LIST='mnt\|sys\|proc\|tmp\|home\|lib/udev/devices'
+
+B<Note:> The list uses escaped pipes and does not have a leading forward slash. The regex is
+applied to the --rootdir argument, so the excluded paths should be relative to that.
+
+This is a good set for a default Slackware installation, but some users have data
+in other directories which should never be included in a package. Scanning these additional
+directories takes extra time and serves no purpose.
+
+While the B<-x,--exclude> operator is applied to the final package contents list, B<-o, --no-fs-search> is applied
+before and can be used to significantly speed up the searches that build the before/after file lists.
+
+=item B<-d>, B<--depend> B<'>package1,package2B<'>
+
+Ensure the given Slackware packages are installed before executing
+the build script.
+
+This is a primative method of build-time dependency checking.
+It simply prevents the build from failing, or a certain feature from
+being compiled out because (at build time) you had not got a certain
+library installed.
+
+The packages are wildcarded by slacktrack, thus you do not have to specify
+version information. To depend on 'oggutils' being installed, you would
+specify B<-d "oggutils"> and slacktrack would find any installed version of the
+Slackware oggutils package.
+
+No depdendencies are checked by default.
+
+=item B<-j>, B<--striplib>
+
+The Slackware standard is to run B<strip --strip-unneeded> over any
+shared objects. This option causes slacktrack to strip any .so objects in
+/usr/lib, /usr/lib64, /lib64, /lib, /usr/local/lib and /usr/libexec
+
+Also see option -S, --stripallexec
+
+The default is not to strip.
+
+
+=item B<-A>, B<--striparchives>
+
+This option causes slacktrack to run the B<strip> program against any
+.a (archive) files that it finds in the package's directory.
+
+Only debugging symbols are stripped (B<strip -g>).
+
+For information about such files you should read ar(1) and ranlib(1).
+
+B<Note:> This option strips any .a files it finds within the package's directory
+rather than limiting itself to a pre-set list of directories (as with
+the other strip options that slacktrack provides).
+
+Also see option -S, --stripallexec
+
+The default is not to strip.
+
+
+=item B<-k>, B<--stripbin>
+
+The Slackware standard is to run B<strip --strip-unneeded> over any
+binary files. This option causes slacktrack to strip any binaries found
+in /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin and
+/usr/X11R?/bin.
+
+Also see option -S, --stripallexec
+
+The default is not to strip.
+
+
+=item B<-S>, B<--stripallexec>
+
+This option performs B<--striplib>, B<--stripbin> and B<--striparchives> but rather than
+limiting itself to a pre-set list of directories, it strips any files (with execute permissions)
+that the B<file> program reports as being unstripped ELF binaries. This includes
+B<.a archives>.
+
+The purpose of this command is to strip binaires and shared object files
+that are B<not> in the normal locations. An example of a known deviations is B</opt>
+
+Using this option is slower (especially when used with packages containing many
+files in deep directory structures) than using B<--striplib>, B<--stripbin> or B<--striparchives>
+options individually.
+
+If this option is also specified with B<--striplib>, B<--stripbin> or B<--striparchives> then
+those options are dropped in favour of the B<--stripallexec> mode of operation.
+
+The default is not to strip objects of any type.
+
+=item B<-c>, B<--createdescription>
+
+From Slackware 8.1 and upwards, the package series directories contain
+a B<name>-B<version>-B<arch>-B<build.txt> along with the package.
+
+Using this option causes slacktrack to create such a file in the
+build store directory (see the B<--buildstore> option)
+
+The default is not to create a description file.
+
+=item B<-e>, B<--chown-bdirs-root-bin>
+
+Prior to Slackware v11, the standard was to have the /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/sbin, /usr/local/bin and /usr/X11R?/bin directories owned by root:bin.
+
+Slackware v11 changed binary directory ownerships to 'root:root'.
+B<If you are building packages for a version of Slackware prior to version 11,
+you should use this operator>.
+
+B<Note:> If you use the B<--setrootowner> option then B<makepkg> will
+reset the directory permissions to root.root
+
+The default is not to set these ownerships.
+
+=item B<-f>, B<--chown-bfiles-root-bin>
+
+Prior to Slackware v11, the standard was to have binaries contained within
+the /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/sbin, /usr/local/bin
+and /usr/X11R?/bin directories owned by root:bin.
+
+B<If you are building packages for a version of Slackware prior to version 11,
+you should use this operator>.
+
+The default is not to set these ownerships.
+
+=item B<-m>, B<--chown-bins-root-root>
+
+The Slackware standard is to have the /bin, /sbin, /usr/bin, /usr/sbin,
+/usr/local/sbin, /usr/local/bin and /usr/X11R?/bin directories owned by root:root.
+
+If you are intending on building Slackware compliant packages, please use this
+operator.
+
+B<If you are building packages for Slackware versions prior to 11,
+please see the two operators listed above>.
+
+The default is not to set these ownerships.
+
+=item B<-g>, B<--chmod644docs>
+
+Often when installing documents, the permissions vary wildly.
+It is preferable if documents are chmod 644 and owned by
+the user 'root' and group 'root'.
+
+Using this option causes slacktrack to set all files contained
+within F</usr/doc> to chmod 644 and runs chmod -R root.root on the package's
+F</usr/doc> directory.
+
+The default is not to set these permissions.
+
+=item B<-U>, B<--nousrtmp>
+
+When compiling some programs (such as Apache), slacktrack sometimes picks up
+the /usr/tmp symlink. This symlink is part of another Slackware package
+and therefore should not be present in other packages.
+
+Using this option causes slacktrack to prevent this symlink from appearing
+in the resulting package.
+
+This behaviour is not the default.
+
+=item B<-Q>, B<--standard>
+
+This option is the combination of the following slacktrack's options:
+B<--gzman> (B<-z>), B<--gzinfo> (B<-I>), B<--delete-usrinfodir> (B<-K>),
+B<--stripallexec> (B<-S>), B<--createdescription> (B<-c>),
+B<--chown-bdirs-root-bin> (B<-m>), B<--chown-bins-root-root> (B<-f>),
+B<--chmod644docs> (B<-g>), B<--delete-perllocalpod> (B<-P>) and B<--nousrtmp> (B<-U>).
+
+It can be considered the quick way to build a package which follows
+the Slackware standard without specifying each
+individual command line switch.
+
+You would use this option as follows:
+
+# B<slacktrack> -Qp foo-2.0-i486-1.tgz ./foo.build
+
+
+=item B<-T>, B<--tempdir> B<'><path>B<'>
+
+slacktrack uses a temporary work space to store the package contents.
+By default, slacktrack will choose one in /var/tmp. However, you may wish
+to change it to another location should there not be enough space in
+/var/tmp to hold the temporary files.
+
+Please note that if the temporary directory (either automatically chosen by
+slacktrack or specified using this operator) already exists, slacktrack
+will exit with error code B<6>; the directory should be deleted prior
+to invoking slacktrack.
+
+=item B<-C>, B<--nocreatetgz>
+
+Do not execute the Slackware B<makepkg> program when the build script
+finishes. You may wish to use this option if you want to run makepkg
+by hand.
+
+Using this option implies B<--notidy>
+
+The default is to execute B<makepkg>
+
+=item B<-L>, B<--nologhardlinks>
+
+Some software distribution archive build scripts will use ln (hard link)
+instead of ln -s (soft link). Hard links which should not be
+allowed to make their way into a package that is to be distributed.
+
+By default, hard links are logged to screen and an additional
+.hardlinks.log file will be created in the build store directory.
+
+=item B<-O>, B<--chmod-og-w>
+
+Run 'chmod -R og-w' over the package directory.
+
+Some packages (such as PHP 4.3.0) install globally writeable files
+when it should not. This option runs chmod -R og-w over the entire
+package directory.
+
+This behaviour is not the default.
+
+=item B<-Z>, B<--gzman-no-symfix>
+
+Do not repair broken man page symlinks caused by the B<--gzman> option
+
+Some man pages are symlinks to other man pages. When the
+original file is gzipped, its name changes to name.x.gz
+and thus the symlink is broken.
+
+This option repairs such broken symlinks by renaming the
+symlink to name.x.gz and pointing it to the new .gz man page file.
+The symlink also has to be named .gz otherwise the B<man> program
+fails because it doesn't know that it is expecting a gzipped file.
+
+The default behaviour is to repair any broken symlinks.
+
+=item B<-F>, B<--gzinfo-no-symfix>
+
+Do not repair broken info page symlinks caused by the B<--gzinfo> option
+
+Some info pages are symlinks to other info pages. When the
+original file is gzipped, its name changes to name.gz
+and thus the symlink is broken.
+
+This option repairs such broken symlinks by renaming the
+symlink to name.gz and pointing it to the new .gz info page file.
+
+The GNU B<info> program is capable of working with broken symlinks
+but it is desirable to have the symlink corrected.
+
+The default behaviour is to repair any broken symlinks.
+
+
+=item B<-M>, B<--extra-mandir> <path>
+
+Append additional man page directories to the default list (F</usr/man>, F</usr/local/man>, F</usr/X11R?/man>).
+
+You would want to use this option if you are storing man pages in non-system
+locations such as /opt/kde/man and wish to gzip them using slacktrack's B<--gzman> option.
+
+Extra paths can be comma separated as shown below:
+ B<# slacktrack --extra-mandir /opt/kde/man,/opt/prog/man>
+
+B<Warning:> Do B<not> specify paths other than directories that will
+contain man pages, otherwise normal files will become gzipped !
+
+
+=item B<-W>, B<--extra-infodir> <path>
+
+Append additional info page directories to the default list (F</usr/info>, F</usr/local/info>).
+
+You would want to use this option if you are storing info pages in non-system
+locations such as /opt/kde/info and wish to gzip them using slacktrack's B<--gzinfo> option.
+
+Extra paths can be comma separated as shown below:
+ B<# slacktrack --extra-infodir /opt/kde/info,/opt/prog/info>
+
+B<Warning:> Do B<not> specify paths other than directories that will
+contain info pages, otherwise normal files will become gzipped !
+
+
+=item B<-E>, B<--extra-libdir> <path>
+
+Append additional shared object (library) directories to the default list (/lib, /usr/lib, /usr/local/lib).
+
+You would want to use this option if you are storing shared objects in non-standard locations
+and wish slacktrack to strip them using the B<--striplib> option.
+
+Multiple paths may be supplied by comma separating them.
+
+=item B<-B>, B<--extra-bindir> <path>
+
+Append additional binary directories to the default list
+(/bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, /usr/X11R?/bin).
+
+You would want to use this option if you are storing binaries in non-standard locations
+and wish slacktrack to strip them using the B<--stripbin> option.
+
+Multiple paths may be supplied by comma separating them.
+
+=item B<-N>, B<--strip-prog> <path>
+
+Specify a different binary name for the B<strip> program. You may need
+to use this option if you are cross compiling and wanting to strip
+the resulting binaries.
+
+Example:
+# B<slacktrack> --strip-prog /usr/local/arm/2.95.3/bin/arm-linux-strip -mnzSIP foo-2.0-arm-1.tgz
+
+By default slacktrack will use the version of strip that it finds
+in the $PATH.
+
+
+=item B<-R>, B<--run-after> <command>
+
+Run the specified command/script after the specified build script has finished
+and prior to creating the package.
+
+The purpose of this is to allow the user to inspect and if required, modify
+the contents of the package before the package file is created.
+
+B<Note:> The CWD (working directory) is changed to the package's root
+directory before the specified command is executed. This allows you to
+specify (for example) /usr/bin/mc (Midnight Commander) and have
+it automatically display the contents of the package.
+
+Example:
+
+The following slacktrack command would run the Midnight Commander program
+F<mc> prior to creating the package B<foo-2.0-arm-1.tgz>.
+
+# B<slacktrack> -Rmc -mnzSIP foo-2.0-arm-1.tgz
+
+By default slacktrack does not execute any commands prior to creating
+the package.
+
+=item B<--run-after-withlog> <command>
+
+This option is the same as B<-R>, B<--run-after>, with the only difference being that
+any output from that script is logged to the slacktrack build log.
+
+If any of your post build scripts perform any checks that should be inspected
+manually after the package build completes, you'd be best choosing this option; but
+note that logging may not work properly for any scripts that require keyboard
+input or use curses based applications (such as 'dialog').
+
+=item B<--showdeps>
+
+This option lists the B<installed> Slackware packages (those that appear in
+F</var/log/packages>) that contain shared libraries upon which your new
+package depends.
+
+The purpose of this option for interest only but you may
+find it useful to ensure that you haven't built a package on a box that
+Xfree86 (for example) installed but intend to install and use the package
+on a box that does not, when the package has become linked against X's
+libraries.
+
+Using this option will also flag up 'orphaned' libraries (ones that
+do not belong to an installed package, which is especially handy
+if you're going to be distributing a package).
+
+The package dependencies (and orphans, if any) will be logged (regardless
+of whether logging is turned off) in text files that will be stored
+in the package build store (usually /tmp) under the following names:
+
+packagename.orphaned_ld_deps.log
+
+packagename.ld_deps.log
+
+B<Note:> Slackware does not have any form of dependency checking and
+as such any file you produce will not be considered by
+pkgtools. However, third parties have developed a standard that uses
+a single file to assist with the handling of automated dependency checking
+(when the package is installed via 3rd party package managers such as
+swaret, slapt-get et al). This file resides within the package as
+F</install/slack-required>. You may like to use this feature of
+slacktrack to help you generate such a file.
+
+The default behaviour is not to display dependencies.
+
+=item B<-X>, B<--delete-overlapping>
+
+After the filesystem comparison has been completed, slacktrack determines whether there
+are any files that overlap between the new package and those already installed on the
+running system. Normally there should be no overlapping files; however, some packages
+that provide additional Python or Perl libraries often re-process or re-compile some parts
+of the vendor-supplied package contents, causing slacktrack to correctly identify that
+the files have changed after the package build process has finished.
+
+It is undesirable for packages to have overlapping files because it is not
+possible to identify which is the master package. One of the side effects may be that
+the end user has problems with the installation order of the packages.
+
+slacktrack will identify any overlapping files and match them with the package(s) to which the file also belongs.
+Using this operator, slacktrack will erase any overlapping files from the content of the newly
+created package.
+
+The best practice is to review the package build log and investigate any overlapping files.
+It is the responsibility of the package builder (you) to determine why the file is overlapping
+and decide what to do with them.
+
+=item B<--allow-overlapping>
+
+Allow the package to contain files that overlap with packages that are already installed
+on the system. This is the default behaviour, if if you like to use slacktrack's -Q option to build
+an otherwise Slackware standards compliant package, you will need to supply this option afterwards
+to permit files to overlap.
+
+=item B<--touch-filesystem-first>
+
+Use the UNIX touch(1) tool to touch (set the objects' time stamps to the current system time)
+a pre-defined list of directories and their contents prior to generating the
+snapshot of the filesystem.
+
+The pre-defined paths are:
+ /opt /bin /boot /dev /etc /install /lib /sbin /usr /var
+
+It B<excludes> by default '/lib/udev/devices' since this contains
+live device data that doesn't take kindly to being touched.
+You may see errors from 'touch' about certain binaries, including
+/sbin/vol_id because this is a symlink into /lib/udev/devices.
+
+This is intended to be used on a throwaway development installation
+that's reinstalled daily or more often.
+
+The reason behind this is that if you run slacktrack and your build
+partially fails, then it will leave some data on the filesystem.
+You then fix the problem and re-try: this time the build may succeed.
+However, if the original data on the filesystem from the first
+part-failed build has *not* changed (for example, if it was some static data that
+was copied with cp -a (preserved time stamp & ownership)) between
+the first part-failed build and second successful build, slacktrack
+will miss this data from the final package file.
+
+This option updates the file stamps contained within standard package
+directories, therefore allowing slacktrack to detect changes
+(even if the data contains an *old* time stamp from 1982, it will still
+detect the difference).
+
+B<Note:> This is an expert option and is not recommended for use unless
+you are working on a throw-away development installation.
+
+=item B<--touch-filesystem-faster>
+
+This operator performs the same function as B<--touch-filesystem-first> except
+that it uses a faster method; except that potentially speed comes at a price.
+
+If this method finds files or directories with spaces in the name, it
+may create empty files in your package's source build directory.
+
+For example:
+
+B</usr/doc/prog-2.0/FILE WITH A SPACE IN IT>
+
+You may find that you have six new files, "FILE", "WITH", "A", "SPACE," "IN", and "IT" existing
+in your package's build source directory.
+
+However, if you know that there are no files or directories with spaces in their names,
+feel free to use this option in preference to B<--touch-filesystem-first>.
+
+B<Note:> This is an expert option and is not recommended for use unless
+you are working on a throw-away development installation.
+
+
+=item B<-Y>, B<--delete-orphaned-pyc>
+
+After the build has completed, this option scans the contents of the new package,
+and if it finds any '*.pyc' files without a matching '*.py' file, the *.pyc file
+will be removed from the package contents (but not from the filesystem).
+
+This scan only checks the content of the B<package> not the filesystem. There may be
+a corresponding '*.py' file on the filesystem, but it wasn't created or modified
+during the build process of this particular package.
+
+When building Slackware's 'ap/linuxdoc-tools' package, we found that 'gnome doc-tools'
+was causing some Python '*.py' system files from the Python package to be recompiled
+(generating '*.pyc' files) but was not modifying the original '*.py' files.
+This meant that slacktrack was correctly detecting the changed '*.pyc' files and including
+them in the 'linuxdoc-tools' package; but this meant that we had file overlap
+with the 'd/python' package. Since the original '*.py' files were not modified,
+and the '*.pyc' files already existed in the Slackware Python package, they didn't
+need to be included in the 'linuxdoc-tools' package - and the overlapping files
+would have caused problems with package upgrades.
+
+This option is not on by default because it's quite conceivable that the user
+may wish to include '*.pyc' files without '*.py' files.
+
+If the directories and parent directories containing the *.pyc files become
+empty after this operation, then these directories are removed from the package.
+
+=back
+
+=head1 SPECIAL SLACKTRACK ENVIRONMENT VARIABLES
+
+slacktrack makes a small number of environment variables available to the
+build script(s). The variables allow build scripts to gain access to
+various inner-workings of slacktrack.
+
+=over 4
+
+=item B<SLACKTRACKFAKEROOT>
+
+This directory is the 'root' directory of the package. You may wish
+to access this directory during build or post-build time so that you can perform
+special operations that slacktrack itself cannot perfom.
+
+However, the to-be-packaged contents won't exist in this directory until
+B<after> the build script finishes and the package has installed itself
+to the filesystem; but you can still pre-populate it with content if you wish,
+although typically you'd perform these actions directly onto the filesystem
+and let slacktrack take care of packaging it.
+
+For example, whilst slacktrack is able to strip all ELF objects, it may
+be that a small number of the objects will not function when stripped, yet
+the rest will. Therefore you cannot use slacktrack's stripping options
+to accomplish this task; instead you can access the package's directory
+directly.
+
+You could do this using the following script, called from slacktrack
+using the B<-R, --run-after> operator:
+
+=item # B<slacktrack> -R $CWD/postbuildfixes.sh -Qp foo-1.0-i486-2.tgz ./foo.build
+
+
+B<Example post build script 1:>
+
+
+Where the 'postbuildfixes.sh' script contains:
+
+B<( cd ${SLACKTRACKFAKEROOT}
+ strip usr/bin/foo
+ strip bin/bar ) >
+
+
+B<Example post build script 2:>
+
+Another example would be to remove known files that were detected by slacktrack
+as being changed/added/updated during the build process, but that we do not want
+to be packaged. This is an easier method than using the B<-x,--exclude> operator.
+
+B<# Incase you had CUPS running:
+ rm -rf etc/cups etc/printcap
+ # crond:
+ rm -rf var/spool/cron
+ rmdir var/spool
+ # perllocal.pod files don't belong in packages.
+ # SGMLSPL creates this:
+ find . -name perllocal.pod -print0 | xargs -0 rm -f
+ # Some doc dirs have attracted setuid.
+ # We don't need setuid for anything in this package:
+ chmod -R a-s .
+>
+
+B<Note:> You may use any shell commands once inside the package's root directory
+but be careful never to specify any paths within the B<real> root directory (for example
+F</usr> rather than F<usr>) in any of your commands.
+
+=back
+
+
+=over 4
+
+
+=item B<SLACKTRACKSCRATCHDIR>
+
+This directory provides a temporary 'scratch' directory for use by the
+build scripts. Its purpose is to allow the author to simplify the build scripts
+by removing the need to create and manage temporary directories where
+the source archives will be unpacked.
+
+Example usage:
+
+B< cd ${SLACKTRACKSCRATCHDIR}
+ tar jxf /path/to/source/ball.bz2
+ cd ball-2.3
+ ./configure && make install >
+
+This directory is subject to the same command line options as the
+rest of the slacktrack temporary build tree; if --notidy is specified
+then this directory will remain, otherwise it is deleted.
+
+=back
+
+
+=head1 EXAMPLES
+
+=over 4
+
+=item # B<slacktrack> -p foo-0.10-i386-1.tgz '/bin/sh -x foo.build'
+
+This is the minimum selection of options you must pass to slacktrack.
+You are simply telling slacktrack the name of the resulting package file
+and specifying that slacktrack should launch "foo.build" via "/bin/sh"
+
+=item # B<slacktrack> -jmkznp bar-3.20-sparc-5.tgz ./bar.build
+
+We are telling slacktrack to strip libraries, chown root:root /bin
+/sbin, /usr/bin, /usr/sbin, /usr/local/sbin, /usr/local/bin and /usr/X11R?/bin directories,
+chown root:root files in the binary dirs, strip binaries found in the binary dirs listed above
+and gzip man pages.
+
+The resulting Slackware package name is 'bar-3.20-sparc-5.tgz'
+
+Note that I have compounded the various options; the above option list could
+also be specified as B<-j -m -k -z -n -p bar-3.20-sparc-5.tgz>
+
+=back
+
+There are various example scripts in F</usr/doc/slacktrack-@VERSION@/examples>
+
+=head1 WARNINGS
+
+=over 4
+
+
+=item B<Do not use slacktrack on production machines>
+
+Please do not run slacktrack on a production machine. Infact, it is advisable
+not build B<any> packages (either B<SlackBuild> or B<.build>) on production machines.
+
+Always use a development box.
+
+
+=item B<Slackware versions>
+
+slacktrack has only been tested on Slackware 8.1 & Slackware-9 and Splack (Slackware on SPARC,
+using Slackware 9's pkgtools & tar-1.13).
+
+It may works on previous releases of Slackware, it may not.
+
+=item B<slacktrack default working space>
+
+By default, slacktrack puts its work space in B</var/tmp/>
+
+It is essential that you have enough disk space on the
+partition on which /var/tmp resides. If you do not then you
+can pass B<--tempdir> to slacktrack to change the base temporary directory:
+
+# B<slacktrack> --tempdir /tmp/slacktrack -jefknzp "foobar-4.1-sparc-2.tgz" "/bin/sh foobar.build">
+
+=back
+
+=head1 RETURN VALUES
+
+These are the exit codes that slacktrack will produce when it encounters
+certain problems. You may wish to use these return codes to indicate
+success or failure when slacktrack is called from unattended auto builder
+scripts.
+
+=over 4
+
+=item B<0>
+Clean exit
+
+slacktrack exited without encountering any errors.
+This is the default exit code.
+
+=item B<1>
+Reserved
+
+This error code is not currently used.
+
+=item B<2>
+Missing command line parameters
+
+slacktrack was called with insufficient parameters or a parameter
+that requires a value was specified but no value was given.
+
+=item B<3>
+Slackware package dependencies failed
+
+slacktrack was asked to check that certain Slackware packages were installed.
+It didn't find at least one of the specified packages.
+
+=item B<4>
+Missing external helper
+
+slacktrack failed to find a required external helper. Currently the external helpers
+is the Slackware 'makepkg' utility.
+
+=item B<5>
+Zero files found in slacktrack's package-content-tracking working directory
+
+slacktrack failed to find any files installed as part of the build process.
+
+This error may be due to any of the following reasons:
+
+B<1.> The build script or command line specified did not exist or could not be executed.
+
+B<2.> The build script/command line exists but failed to be executed or executed and died with an error
+
+B<3.> The build script/command worked as expected but slacktrack failed to detect any activity.
+
+It is suggested that you run B<slacktrack> with the --notidy option and inspect
+the working space directory in /var/tmp/ to discover what the problem is.
+
+=item B<6>
+Possibly unsafe to continue operation.
+
+slacktrack determined that it was possibly unsafe to continue. This may be
+because it found the temporary directory to already exist (slacktrack needs
+to wipe the temporary directory), or it may get to a point where it needs to
+overwrite an existing file which would require manual intervention.
+
+Since slacktrack is designed to be scriptable, it will never prompt for human
+interaction - just fail with pre-set error codes which can be collected by
+caller scripts.
+
+=back
+
+=head1 FILES
+
+F</usr/bin/slacktrack> the slacktrack script
+
+F</usr/doc/slacktrack-@VERSION@/LICENCE> a copy of the GPLv2 licence
+
+F</usr/doc/slacktrack-@VERSION@/OVERVIEW> an overview of the Slackware package system & build scripts
+
+F</usr/doc/slacktrack-@VERSION@/PACKAGE_BUILDING_CHECKLIST> a checklist for package builders
+
+=head1 AUTHOR
+
+Stuart Winter <mozes@slackware.com>
+
+=head1 SEE ALSO
+
+=over 4
+
+B<makepkg>(8), B<installpkg>(8), B<explodepkg>(8), B<removepkg>(8), B<pkgtool>(8), B<upgradepkg>(8), B<slackdtxt>(8)
+
+=back
+=cut
+
+
diff --git a/source/d/slacktrack/slacktrack-project/old_stuff/findy b/source/d/slacktrack/slacktrack-project/old_stuff/findy
new file mode 100755
index 000000000..382eea481
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/old_stuff/findy
@@ -0,0 +1,17 @@
+#!/bin/bash -x
+function package_name () {
+ local PACKAGENAME="$( echo $1 | rev | cut -d- -f4- | rev )"
+ echo ${PACKAGENAME}
+}
+
+
+PACKAGE=linuxdoc-tools-2.0-arm-1.txz
+
+# need to get the find op right.
+find . -path './install' -prune -o -type f -printf "%P\n" | egrep -v "^$" > /tmp/log # | \
+( cd /var/log/packages
+ cat /tmp/log | while read file ; do
+ grep -H "${file}" *
+ done ) | sort | uniq | egrep -v "^$( package_name ${PACKAGE}).*:" > /tmp/log2 2>&1
+
+cat /tmp/log2
diff --git a/source/d/slacktrack/slacktrack-project/scripts/slackdtxt b/source/d/slacktrack/slacktrack-project/scripts/slackdtxt
new file mode 100755
index 000000000..a32bf690f
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/scripts/slackdtxt
@@ -0,0 +1,312 @@
+#!/bin/bash
+#
+# Copyright 2002, 2009 Stuart Winter, Surrey, England, United Kingdom.
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+##################################################################################
+# Program: slackdtxt
+# Purpose: Create package-ver-arch-build.txt files from slack-desc files.
+# For use after running a SlackBuild script - you do not need to
+# use this program for a package produced by slacktrack -- use its
+# -c switch instead.
+# Author : Stuart Winter <mozes@slackware.com>
+# Date...: 24-Sep-2011
+# Version: 1.05
+#################################################################################
+# History
+##########
+# 24-Sep-2011 - v1.05
+# * Look for 'install/slack-desc' and './install/slack-desc'
+# in the packages. This provides support for malformed packages
+# that have not been created with the Slackware 'makepkg' command.
+# Thanks to Helmut Hullen for the suggestion.
+# 15-May-2009 - v1.04
+# * Adjust to handle .tgz, .tbz, .tlz, .txz file extensions/
+# compression formats.
+# 04-Sep-2008 - v1.03
+# * Display the filename of the .tgz being processed.
+# * .txt files now use the time stamp of the corresponding .tgz
+# * New default: only create a .txt or sign a package if there
+# isn't an existing .txt or .asc *or* the .txt's time stamp
+# isn't the same as the .tgz's.
+# * Fixed bug where the gpg signing key wasn't being picked up
+# at the command line.
+# * Always wipe temp file when exiting
+# * A GPG signing key must be specified -- it will not fall back
+# on the default. This is because the code to check check the
+# command line operators doesn't work. I checked the supplied
+# examples for getopt and even they don't work!
+# 28-Sep-2003 - v1.02
+# * Added option -G, --gpg-sign to sign the .tgz package
+# (Patch from Emanuele Vicentini)
+# * Removed -t option. You may now do specify the file after
+# as before (but without -t) or specify more than one package
+# at once: eg slackdtxt *.tgz
+# 11-Jul-2003 - v1.01
+# * Fixed problem with checking the exit code from getopt.
+# (reported by Emanuele Vicentini).
+# 02-Mar-2003 - v1.00
+# * Created
+##################################################################################
+
+# Program name
+PROGNAME=slackdtxt
+
+# Version
+VERSION="${PROGNAME} v1.03 by Stuart Winter <mozes@slackware.com>"
+
+# Temporary store for the slack-desc file
+DESCTMPFILE="/var/tmp/$$.slackdtxt.desc.$$"
+
+trap "rm -f $DESCTMPFILE" EXIT
+
+############################## Functions###################################
+function display_usage () {
+printf "Usage: ${PROGNAME} [options] <package file/list of package files>\n"
+if [ ! -z "$1" ]; then
+ echo "Use $( basename $0 ) --help for a list of options"
+fi
+}
+
+function display_help () {
+printf "${VERSION}\n\n$(display_usage)
+
+Startup:
+ -h, --help Display this help
+ -v, --version Display version information
+
+Main options:
+ -s, --slackdescfile <file> 'slack-desc' file (cannot be used when
+ specifying more than one package file)
+ -d, --destdir <directory> The directory in which to store the package
+ file & create the .txt description file within
+ Omitting this flag implies --nodelete
+ -n, --nodelete Do not delete the original package file.
+ once moved into destination directory
+ -G, --gpg-sign <key id> Sign the package with GnuPG
+ -f, --force Force creation of a .txt and GPG signing.
+ By default, .txt files are only created and
+ packages signed if there is no existing .txt
+ or .asc file, or the .txt time stamps aren't
+ the same as the package's.
+"
+}
+
+###############################################################################
+
+############################## Configuration variables #########################
+# These can be changed via the command line switches
+#
+DELETEPKG="Yes"
+# By default, don't force signing nor creation of .txt files
+FORCE=No
+################################################################################
+
+PARAMS="$( getopt -qn "$( basename $0 )" -o s:d:fnhvG: -l slackdescfile:,destdir:,nodelete,force,help,version,gpg-sign: -- "$@" )"
+# If params are incorrect then
+if [ $? -gt 0 ]; then display_help ; exit 2 ; fi
+eval set -- "${PARAMS}"
+for param in $*; do
+ case "$param" in
+ -s|--slackdescfile) SLACKDESCFILE="$2"
+ shift 2;;
+
+ -d|--destdir) DESTDIR="$2"
+ shift 2;;
+
+ -n|--nodelete) DELETEPKG="No"
+ shift 1;;
+
+ -f|--force) FORCE="Yes"
+ shift 1;;
+
+ -G|--gpg-sign) SIGNPACKAGE="Yes"
+ SIGNINGKEY="$2"
+ shift 2 ;;
+
+ -h|--help) display_help ; exit ;;
+
+ -v|--version) printf "${VERSION}\n" ; exit;;
+
+ --) shift; break;;
+ esac
+done
+
+# Do we have the relevant information to proceed?
+if [ -z "${1}" ]; then
+ display_usage help
+ exit 2
+fi
+
+# Do we have too *much* information to proceed?
+if [ $# -gt 1 -a ! -z "${SLACKDESCFILE}" ]; then
+ echo "Error: You cannot specify a slack-desc file when"
+ echo " specifying more than one package file"
+ display_usage help
+ exit 2
+fi
+
+# Let's check if user really has gpg.
+if [ "${SIGNPACKAGE}" = "Yes" ]; then
+ which gpg >/dev/null 2>&1 || { echo "${PROGNAME}: Warning: Cannot find gpg; disabling signature creation"; unset SIGNPACKAGE; }
+fi
+
+# Main loop, handle any number (well, not really but you know..)
+# of package files specified at the command line.
+for PKGFILE in $*; do
+
+# If we were given a destination dir then check whether it exists
+# Now giving a dest dir allows us to do
+# # for i in *.t?z ; do slackdtxt -t $i ; done
+# and create .txt files for all the package files in a dir.
+if [ ! -z "${DESTDIR}" ]; then
+ DESTDIR="${DESTDIR}/" # otherwise when we tar without specifying a dest dir, it becomes /package-blah.tgz
+ if [ ! -d "${DESTDIR}" ]; then
+ echo "${PROGNAME}: ERROR: The destination directory does not exist"
+ exit 6
+ fi
+ else
+ DELETEPKG="No" # otherwise we'd delete our only copy
+fi
+
+# Does the specified package exist?
+if [ ! -s "${PKGFILE}" ]; then
+ echo "${PROGNAME}: ERROR: The specified package "${PKGFILE}" does not exist"
+ exit 7
+fi
+
+# Does the specified slack-desc file exist ?
+if [ ! -z "${SLACKDESCFILE}" ]; then
+ if [ ! -s "${SLACKDESCFILE}" ]; then
+ echo "${PROGNAME}: Warning: The specified slack-desc file ${SLACKDESCFILE} does not exist;"
+ echo " will try and extract from the package."
+ unset SLACKDESCFILE
+ else
+ # .. the file is fine.
+ # copy the slack-desc file to the temp location so I don't have
+ # to code around having the user specify one and having to take one
+ # from the package then delete it.
+ cp -f "${SLACKDESCFILE}" "${DESCTMPFILE}"
+ # .. but if copying it fails then we'll take it from the package anyway.
+ if [ $? -gt 0 ]; then
+ unset SLACKDESCFILE
+ else
+ SLACKDESCFILE="${DESCTMPFILE}" # we'll use the /var/tmp version now
+ fi
+ fi
+fi
+############################## Main program###################################
+
+# Move the pakage file to the dest dir if we were given one
+if [ ! -z "${DESTDIR}" ]; then
+ echo -n "${PROGNAME}: Copying package to destination directory"
+ cp -fa "${PKGFILE}" "${DESTDIR}"
+ if [ $? -gt 0 ]; then
+ printf "\n${PROGNAME}: ERROR: Failed to copy the package\n"
+ exit 8
+ else
+ echo " ... done"
+ fi
+fi
+
+# Test the copied package -- it probably isn't corrupt (eg no disk space on $DESTDIR)
+# as the cp would have errored, but I'd like to check anyway
+if [ ! -z "${DESTDIR}" ]; then
+ echo -n "${PROGNAME}: Verifying the version of the package in the destination directory"
+ tar ftz "${DESTDIR}$( basename ${PKGFILE} )" >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ printf "\n${PROGNAME}: ERROR: The package in ${DESTDIR} is corrupt\n"
+ exit 8
+ else
+ echo " ... done"
+ fi
+fi
+
+# If we weren't given a slack-desc file then try and pull one from the
+# package
+if [ -z "${SLACKDESCFILE}" ]; then
+ SLACKDESCFILE="${DESCTMPFILE}"
+ echo "${PROGNAME}: Processing $( basename ${PKGFILE} ) ..."
+ echo -n "${PROGNAME}: Attempting to extract install/slack-desc from the package"
+ # In case somebody's not used 'makepkg' (which uses tar-1.13) to create the package,
+ # and tar has created the archive index with absolute path names.
+ # (it's a malformed package in this case, but we may as well support it)
+ tar fOx "${PKGFILE}" install/slack-desc ./install/slack-desc > "${SLACKDESCFILE}" 2>/dev/null
+ if [ ! -s "${SLACKDESCFILE}" ]; then
+ printf "\n${PROGNAME}: ERROR: Failed to extract the slack-desc file from the package\n"
+ rm -f "${SLACKDESCFILE}" # it may be zero bytes/empty
+ exit 8
+ else
+ echo " ... done"
+ fi
+fi
+
+# Turn the slack-desc file into a .txt file;
+# only if there isn't an existing .txt or the .txt is older than the package
+# unless -f,--force is specified.
+SLACKTXTFILE="${DESTDIR}$( echo $( basename $PKGFILE ) | rev | cut -d. -f2- | rev ).txt"
+if [ $SLACKTXTFILE -ot $PKGFILE -o $SLACKTXTFILE -nt $PKGFILE -o "$FORCE" = "Yes" ]; then
+ egrep -v '^($|#| *\|)' "${SLACKDESCFILE}" > $SLACKTXTFILE
+ rm -f "${SLACKDESCFILE}"
+ # Set the time stamp to that of the package:
+ touch -r $PKGFILE $SLACKTXTFILE
+ echo "${PROGNAME}: $SLACKTXTFILE created"
+ else
+ echo "${PROGNAME}: Not created .txt - is same age as package (use -f to override)"
+fi
+
+# Let's sign the original package with user's gpg key
+if [ ! -z "${SIGNPACKAGE}" ]; then
+# If the .asc is the same time stamp as the package, don't sign unless
+# forced.
+ if [ ${DESTDIR}${PKGFILE}.asc -ot $PKGFILE -o ${DESTDIR}${PKGFILE}.asc -nt $PKGFILE -o "$FORCE" = "Yes" ]; then
+ echo -n "${PROGNAME}: signing ${PKGFILE} with ${SIGNINGKEY:-your default} key"
+ GPG_OPTIONS="--detach-sign --armor --yes"
+ if [ "${SIGNINGKEY}" ]; then
+ GPG_OPTIONS="${GPG_OPTIONS} --local-user $SIGNINGKEY"
+ fi
+ gpg ${GPG_OPTIONS} --output ${DESTDIR}${PKGFILE}.asc ${PKGFILE}
+ if [ $? -ne 0 ]; then
+ echo "${PROGNAME}: ERROR: Signature has not been correctly generated"
+ else
+ echo " ... done"
+ # Set time stamp to that of the package:
+ touch -r $PKGFILE ${DESTDIR}${PKGFILE}.asc
+ fi
+ else
+ echo "${PROGNAME}: Not signed package - is same age as package (use -f to override)"
+ fi
+fi
+
+# Delete the package ?
+if [ "${DELETEPKG}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Deleting the original package"
+ rm -f "${PKGFILE}"
+ if [ $? -gt 0 ]; then
+ printf "\n${PROGNAME}: Warning: unable to delete package\n"
+ else
+ echo " ... done"
+ fi
+fi
+
+unset SLACKDESCFILE
+
+# Exit from main loop
+done
diff --git a/source/d/slacktrack/slacktrack-project/scripts/slacktrack b/source/d/slacktrack/slacktrack-project/scripts/slacktrack
new file mode 100755
index 000000000..27ab2be81
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/scripts/slacktrack
@@ -0,0 +1,1305 @@
+#!/bin/bash
+#
+# Copyright 2002-2017 Stuart Winter, Surrey, England, United Kingdom.
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+######################################################################################
+# Program: slacktrack
+# Purpose: Tracking & building packages for Slackware v9.1+
+# Inspired by Patrick Volkerding's 'bp' script
+#
+# This DOES NOT USE libsentry nor installwatch!
+# This WILL INSTALL THE PACKAGE ON THE SYSTEM (and updates the
+# /var/log/packages database so that you may remove the newly built package).
+#
+# * DO NOT USE THIS ON ANYTHING BUT A PACKAGE BUILDING DEVELOPMENT MACHINE *
+#
+# You MUST consult the FAQ before using this script so that you avoid
+# including unrelated files in your packages.
+#
+# Author : Stuart Winter <mozes@slackware.com>
+# Date...: 07-Jun-2017
+# Version: 2.18
+######################################################################################
+
+# Program name
+PROGNAME="slacktrack"
+
+# Version
+SLACKTRACKVERSION="${PROGNAME} v2.18 by Stuart Winter <mozes@slackware.com>"
+
+# Path to Slackware's makepkg
+MAKEPKG=/sbin/makepkg
+
+# Set defaults. These may be modified via the command line switches
+unset SLACKWAREPACKAGE PACKAGEDEPEND
+CREATESYMLINKS=Yes
+SETROOTOWNER=No
+CHOWNBINDIRSROOTBIN=No
+CHOWNBINFILESROOTBIN=No
+CHOWNBINSROOTROOT=No
+TIDYONFINISH=Yes
+GZMAN=No
+GZINFO=No
+GZMANFIXSYMLINKS=Yes
+GZINFOFIXSYMLINKS=Yes
+DELETEUSRINFODIR=No
+DELETEPERLLOCALPOD=No
+DELETEORPHANEDPYC=No
+STRIPPROG="$( which strip )"
+STRIPLIB=No
+STRIPBIN=No
+STRIPALLEXEC=No
+STRIPARCHIVES=No
+CREATEDESCRIPTION=No
+CHMODNOGLOBALWRITE=No
+CHMOD644DOCS=No
+BUILDSTORE=/tmp/built-slackwarepackages/ # if that dir doesn't exist it'll use /tmp
+LOGGING=Yes
+CREATEMD5SUM=No
+SIGNPACKAGE=No
+SIGNINGKEY=
+NOUSRTMP=No
+ALLOWOVERLAPPINGFILES=Yes
+LOGHARDLINKS=Yes
+SLACKTRACKLOGFILE="/var/tmp/$$.$(date +%s).${RANDOM}.slacktrack.log"
+MANDIR_LIST="/usr/man /usr/local/man /usr/X11R?/man /opt/kde/man"
+INFODIR_LIST="/usr/info /usr/local/info"
+LIBDIR_LIST="/usr/lib /usr/lib64 /lib64 /lib /usr/local/lib /usr/libexec"
+BINDIR_LIST="/bin /sbin /usr/sbin /usr/bin /usr/local/bin /usr/local/sbin /usr/X11R?/bin"
+ROOTDIR=/
+RUNCMDAFTER=
+RUNCMDAFTER_WITHLOG=No
+MAKEPKGOPTS=
+SHOWDEPS=No
+# Below is the list of files and directories that should be excluded from the list
+# of files that have changed since before and after the build.
+# It's in egrep's pattern format. Note that when this string is used in altertrack
+# (as it used to be called), we prefix everything with ^ meaning to only remove the
+# listed value if it is at the start of a line. Eg, /var/log/monkey.log would be removed
+# from the list (because /var/log is listed below), but /usr/monkey/var/log/monkey.log
+# would not.
+EXCLUDE_LIST="${PWD}$|${PWD}|/etc/ntp/drift|/var/run/|/var/run$|/var/lib/dhcpcd|/var/lib/dhcpcd$|/etc/dhcpc/|/etc/dhcpc$|/var/cache/|/var/cache$|/run$|/run/|/media$|/media/|/srv$|/srv/|/selinux$|/selinux/|/var/lib/rpm|/var/lib/rpm$|/var/yp$|/var/yp/|/sys$|/sys/|/initrd$|/initrd/|/dev/bus$|/dev/bus/|/dev/char$|/dev/char/|/dev/rfkill|/dev/input$|/dev/input/|/dev/.udev/|/dev/.udev$|/dev/vc$|/dev/vc/|/dev/console|/dev/pts$|/dev/pts/|/dev/ptmx|/dev/tty|/var/log|/etc/mtab|/etc/resolv.conf|/etc/ld.so.cache|/tmp|/root|/proc|/var/tmp|/var/run/utmp|/var/spool/cron/cron|/var/lib/NetworkManager|/var/lib/NetworkManager$|/usr/man/whatis|/usr/local/man/whatis|/var/lib/pgsql$|/var/lib/pgsql|/var/lib/mysql$|/var/lib/mysql"
+
+# The list of files/directories to exclude from the pre and post-file system scan.
+# Note that this is applied to the search itself, unlike EXCLUDE_LIST, which
+# means a) if you know what to exclude can make the install a lot faster and
+# b) it uses find's -regex syntax.
+# Paths are relative to ROOTDIR - if you amend these using the --no-fs-search operator
+# you will need to omit the '/' prefix as you can see below:
+SEARCH_EXCLUDE_LIST='mnt\|sys\|proc\|tmp\|home\|lib/udev/devices'
+
+# Default touch list:
+# (ideally there shouldn't be any directories called /install as these are part of the
+# package that are used during installation, and wiped afterwards; but occasionally
+# there is some residue due to a problematic package or a failed build):
+FSTOUCHLIST="/opt /bin /boot /etc /install /lib /usr/lib64 /lib64 /sbin /usr /var"
+
+# Basic sanity checks
+if [ ! -f "${MAKEPKG}" ]; then
+ echo "ERROR: Unable to locate the Slackware 'makepkg' program"
+ echo " Your system is broken. makepkg is part of the pkgtools"
+ echo " package; you must install it to continue."
+ exit 4
+fi
+if [ ! -d /var/log/packages -o ! -d /var/log/scripts ]; then
+ echo "ERROR: Unable to find at least one of the package"
+ echo " information repositories. Your system is broken!"
+ exit 4
+fi
+
+
+############################################### Functions###################################
+function display_usage () {
+printf "Usage: ${PROGNAME} [options] -p <package_file_name> <command_line>\n"
+if [ ! -z "$1" ]; then
+ echo "Use $( basename $0 ) --help for a list of options"
+fi
+}
+
+function display_help () {
+printf "${SLACKTRACKVERSION}\n\n$(display_usage)
+
+Startup:
+ -h, --help Display this help
+ -v, --version Display version information
+
+Options to Slackware's 'makepkg':
+ -p, --package <package_name> Resulting tar file name of the package
+ -s, --nosymlinks Do not create symlinks via install/doinst.sh script
+ -r, --setrootowner Set permissions on directories to 755 and owners to root.root
+ --mpopts \"<options>\" Specify additional options to 'makepkg'
+
+Specific slacktrack options:
+ -t, --notidy Do not delete temporary package directory
+ -b, --buildstore <directory> Location to store built packages
+ [ default: ${BUILDSTORE} ]
+ -l, --logfile <filename> Path of slacktrack's logfile
+ [ default: (buildstore_path)/<package_name>.log ]
+ -n, --nologging Delete log file upon slacktrack completing successfully
+ -D, --md5sum Create an MD5sum file of the resulting package
+ -G, --gpg-sign <key id> Sign the resulting package with GnuPG
+ -z, --gzman gzip any man pages found in known locations
+ -I, --gzinfo gzip any info pages found in known locations
+ -Z, --gzman-no-symfix Do not repair broken symlinks caused by the --gzman option
+ [ default is to fix broken symlinks ]
+ -F, --gzinfo-no-symfix Do not repair broken symlinks caused by the --gzinfo option
+ [ default is to fix broken symlinks ]
+ -K, --delete-usrinfodir Delete package's /usr/info/dir file [default is no]
+ -P, --delete-perllocalpod Delete perllocal.pod files found in /usr/lib & /usr/lib64 [default is no]
+ -d, --depend \"package1,pack2\" Ensure Slackware packages are installed before continuing
+ -j, --striplib Strip executable ELF .so objects in the library directories
+ -A, --striparchives Strip .a (archive) files found anywhere within the package
+ -k, --stripbin Strip executable ELF files in the binary directories
+ -S, --stripallexec Strip all executable ELF objects found within the package
+ -c, --createdescription Create a slack-desc file named <package-name>.txt in
+ the build store path
+ -e, --chown-bdirs-root-bin Set ownerships of the standard Slackware binary directories to
+ 'root:bin'. If you use the --setrootowner option then it will
+ reset the directory permissions to root:root
+ -f, --chown-bfiles-root-bin Set ownerships of files contained within the standard Slackware
+ binary directories to 'root:bin'
+ -m, --chown-bins-root-root Set ownerships of files and directories in the standard Slackware
+ binary directories to 'root:root'
+ -g, --chmod644docs Run chmod 644 & chown root:root on files in package's /usr/doc/
+ -U, --nousrtmp If /usr/tmp is a symlink, delete it and its contents
+ -T, --tempdir <path> Specify a temporary path for the package building
+ By default, slacktrack will choose one in /var/tmp
+ -L, --nologhardlinks Do not log the existence of hard links
+ -O, --chmod-og-w Run 'chmod -R og-w' over the package directory
+ -x, --exclude '/foo|/bar' Supply replacement egrep pattern for dir/file exclusion
+ -o, --no-fs-search 'foo\|bar' Supply replacement find regex pattern for pre and post-build file
+ system scans. If you know where the package will install, this can
+ significantly reduce the processing time. Paths are relative to --rootdir
+ [default: mnt\|sys\|proc\|tmp\|home\|lib/udev/devices]
+ -M, --extra-mandir <path> Append path to the man directory list
+ -W, --extra-infodir <path> Append path to the info directory list
+ -E, --extra-libdir <path> Append path to the lib directory list
+ -B, --extra-bindir <path> Append path to the bin directory list
+ -N, --strip-prog <path> Specify the location of the 'strip' binary
+ -R, --run-after <cmd> Run command/script after build script finishes, without appending
+ its output to the slacktrack log file.
+ Use this for any post build processing scripts that require manual
+ intervention or use a curses interface (for example a 'dialog' script).
+ --run-after-withlog <cmd> Run command/script after build script finishes, appending any output
+ to the slacktrack log file.
+ -X, --delete-overlapping Remove any files from the resulting package's contents that overlap
+ with any of the system's existing installed packages
+ --allow-overlapping Permit the package to contain any files that overlap with existing
+ installed packages [this is the default]
+ -Q, --standard Select options required to build a compliant Slackware package
+ --showdeps List the installed packages on which this new package depend
+ --rootdir Change the directory that slacktrack considers to be the root
+ [default: /]
+ --touch-filesystem-first Touch files on the filesystem before scanning filesystem
+ contents
+ --touch-filesystem-faster Touch files on the filesystem before scanning filesystem
+ contents, using a faster but less safe method
+ than --touch-filesystem-first
+ This option is _not_ recommended.
+ -Y, --delete-orphaned-pyc Delete orphaned Python compiled *.pyc files from the package.
+
+Suggested usage: ${PROGNAME} -Qp foo-1.0-i486-1.txz ./foo.build
+"
+}
+
+# basename + strip extensions .tbz, .tgz, .tlz and .txz
+pkgbase() {
+ echo "$1" | sed 's?.*/??;s/\.t[bglx]z$//'
+}
+# Function to retrieve the package name.
+# glibc-solibs-2.2-i386-1.tgz = glibc-solibs
+package_name() {
+ # Strip version, architecture and build from the end of the name
+ pkgbase $1 | sed 's?-[^-]*-[^-]*-[^-]*$??'
+}
+
+# Function to determine whether a supplied package name is already installed
+# Returns 0 if not installed, 1 if installed.
+# This function allows us to specify 'autoconf' for example, without having
+# to worry about the version number installed (unless you specifically want to,
+# in which case specify the version number as well - e.g. autoconf-2.54)
+function is_package_installed () {
+ local PACKAGENAME="$1"
+ local installed_package
+
+ # We have to go through each package like this (rather than just do if -f foobar-*
+ # because otherwise packges such as glibc, glibc-solibs and so on get wildcarded
+ # and things get confused.
+ for installed_package in $( find /var/log/packages/${PACKAGENAME}-* -type f -printf "%f\n" 2>/dev/null ) ; do
+ installed_package="$( package_name ${installed_package} )"
+ if [ "${installed_package}" = "${PACKAGENAME}" ]; then
+ return 1 # the package 'short' name is installed
+ break
+ fi
+ done
+return 0
+}
+
+# Check if we have any package dependencies. This is a lame way of doing it and
+# possibly proves nothing, but it saves me writing it in a few build scripts that
+# would otherwise fail when they haven't got package X installed.
+function check_package_dep () {
+local error pack
+# Change comma separated input into spaces and consider them one by one
+for pack in $( echo ${1} | sed s/,/\ /g ); do
+ is_package_installed "${pack}"
+ if [ $? -eq 0 ]; then
+ echo "${PROGNAME}: dependency Slackware package '${pack}' not installed"
+ error=y
+ else
+ echo "${PROGNAME}: dependency Slackware package '${pack}' is installed. OK!"
+ fi
+done
+
+if [ ! -z "${error}" ]; then
+ echo "Error: Package dependencies failed"
+ return 1
+fi
+}
+
+
+# Function to move the temporary log file into the correct place & with the correct name.
+function move_log () {
+if [ "${LOGGING}" = "Yes" ]; then
+ if [ -z "${USER_SLACKTRACKLOGFILE}" ]; then
+ # Move /var/tmp/slacklog to /tmp/built-slackwarepackages/packagename.log
+ mv -f ${SLACKTRACKLOGFILE} "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).log" > /dev/null 2>&1
+ else
+ # The user specified their own log path; rename our /var/tmp/slacklog to their's
+ mv -f ${SLACKTRACKLOGFILE} ${USER_SLACKTRACKLOGFILE} > /dev/null 2>&1
+ fi
+ else
+ # We don't want a log, so we'll just delete the /var/tmp version
+ rm -f ${SLACKTRACKLOGFILE}
+fi
+}
+
+# Tidy up the temporary directory (source extraction dir and pseudo root):
+function tidy_workspace () {
+( if [ "${TIDYONFINISH}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Deleting temporary directory"
+ rm -rf /install/* /install > /dev/null 2>&1 # otherwise this may cause trouble for other builds
+ rm -rf "${SLACKTRACKTMPPATH}"
+ if [ $? -gt 0 ]; then
+ echo " ... error removing"
+ else
+ echo " ... done"
+ fi
+ else
+ rm -rf /install/* /install > /dev/null 2>&1
+ echo "${PROGNAME}: Temporary workspace '${SLACKTRACKTMPPATH}' will remain"
+fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+}
+
+#############################################################################################
+PARAMS="$( getopt -qn "$( basename $0 )" -o p:b:l:d:M:N:W:E:x:o:B:R:T:DG:mnefgcsrthvzPAISjkKULOZQXY -l exclude:,no-fs-search:,mpopts:,tempdir:,package:,buildstore:,logfile:,depend:,delete-overlapping,allow-overlapping,extra-mandir:,extra-infodir:,run-after:,run-after-withlog:,extra-libdir:,extra-bindir:,strip-prog:,nologging,createdescription,gzman,gzinfo,gzman-no-symfix,gzinfo-no-symfix,striplib,striparchives,stripbin,stripallexec,nosymlinks,nousrtmp,chmod644docs,setrootowner,chown-bdirs-root-bin,chown-bfiles-root-bin,notidy,help,version,delete-usrinfodir,nologhardlinks,md5sum,gpg-sign:,chmod-og-w,standard,showdeps,rootdir:,chown-bins-root-root,touch-filesystem-first,touch-filesystem-faster,delete-perllocalpod,delete-orphaned-pyc -- "$@" )"
+
+# If params are incorrect then
+if [ $? -gt 0 ]; then display_help >&2 ; exit 2 ; fi
+eval set -- "${PARAMS}"
+for param in $* ; do
+ case "$param" in
+
+ -p|--package) SLACKWAREPACKAGE="$2"
+ shift 2;;
+
+ -b|--buildstore) BUILDSTORE="$2/"
+ shift 2;;
+
+ -l|--logfile) USER_SLACKTRACKLOGFILE="$2"
+ shift 2;;
+
+ -n|--nologging) LOGGING=No
+ shift 1;;
+
+ -D|--md5sum) CREATEMD5SUM="Yes"
+ shift 1;;
+
+ -G|--gpg-sign) SIGNPACKAGE="Yes"
+ SIGNINGKEY="$2"
+ shift 2;;
+
+ -s|--nosymlinks) CREATESYMLINKS="No"
+ shift 1;;
+
+ -U|--nousrtmp) NOUSRTMP="Yes"
+ shift 1;;
+
+ -L|--nologhardlinks) LOGHARDLINKS="No"
+ shift 1;;
+
+ -O|--chmod-og-w) CHMODNOGLOBALWRITE="Yes"
+ shift 1;;
+
+ -T|--tempdir) SLACKTRACKTMPPATH="$2"
+ shift 2;;
+
+ -r|--setrootowner) SETROOTOWNER="Yes"
+ shift 1;;
+
+ --mpopts) MAKEPKGOPTS="$2"
+ shift 2;;
+
+ -e|--chown-bdirs-root-bin) CHOWNBINDIRSROOTBIN="Yes"
+ CHOWNBINSROOTROOT="No"
+ shift 1;;
+
+ -f|--chown-bfiles-root-bin) CHOWNBINFILESROOTBIN="Yes"
+ CHOWNBINSROOTROOT="No"
+ shift 1;;
+
+ -m|--chown-bins-root-root) CHOWNBINSROOTROOT="Yes"
+ shift 1;;
+
+ -g|--chmod644docs) CHMOD644DOCS="Yes"
+ shift 1;;
+
+ -t|--notidy) TIDYONFINISH="No"
+ shift 1;;
+
+ -c|--createdescription) CREATEDESCRIPTION="Yes"
+ shift 1;;
+
+ -j|--striplib) STRIPLIB="Yes"
+ shift 1;;
+
+ -k|--stripbin) STRIPBIN="Yes"
+ shift 1;;
+
+ -S|--stripallexec) STRIPALLEXEC="Yes"
+ shift 1;;
+
+ -A|--striparchives) STRIPARCHIVES="Yes"
+ shift 1;;
+
+ -N|--strip-prog) STRIPPROG="$2"
+ shift 2;;
+
+ -z|--gzman) GZMAN="Yes"
+ shift 1;;
+
+ -I|--gzinfo) GZINFO="Yes"
+ shift 1;;
+
+ -Z|--gzman-no-symfix) GZMANFIXSYMLINKS="No"
+ shift 1;;
+
+ -F|--gzinfo-no-symfix) GZINFOFIXSYMLINKS="No"
+ shift 1;;
+
+ -K|--delete-usrinfodir) DELETEUSRINFODIR="Yes"
+ shift 1;;
+
+ -P|--delete-perllocalpod) DELETEPERLLOCALPOD="Yes"
+ shift 1;;
+
+ -d|--depend) PACKAGEDEPEND="$2"
+ shift 2;;
+
+ -Y|--delete-orphaned-pyc) DELETEORPHANEDPYC="Yes"
+ shift 1;;
+
+ -x|--exclude) EXCLUDE_LIST="$2"
+ shift 2;;
+
+ -o|--no-fs-search) SEARCH_EXCLUDE_LIST="$2"
+ shift 2;;
+
+ -M|--extra-mandir) MANDIR_LIST="${MANDIR_LIST} $( echo ${2} | sed s/,/\ / )" # replace commas with spaces for 'for' loops
+ shift 2;;
+
+ -W|--extra-infodir) INFODIR_LIST="${INFODIR_LIST} $( echo ${2} | sed s/,/\ / )"
+ shift 2;;
+
+ -E|--extra-libdir) LIBDIR_LIST="${LIBDIR_LIST} $( echo ${2} | sed s/,/\ / )"
+ shift 2;;
+
+ -B|--extra-bindir) BINDIR_LIST="${BINDIR_LIST} $( echo ${2} | sed s/,/\ / )"
+ shift 2;;
+
+ -R|--run-after) RUNCMDAFTER="$2"
+ shift 2;;
+
+ --run-after-withlog) RUNCMDAFTER="$2"
+ RUNCMDAFTER_WITHLOG="Yes"
+ shift 2;;
+
+ -v|--version) printf "${SLACKTRACKVERSION}\n" ; exit 0 ;;
+
+ -h|--help) display_help ; exit 0 ;;
+
+ -X|--delete-overlapping) ALLOWOVERLAPPINGFILES="No"
+ shift ;;
+
+ --allow-overlapping) ALLOWOVERLAPPINGFILES="Yes"
+ shift ;;
+
+ -Q|--standard) GZMAN="Yes"
+ GZINFO="Yes"
+ DELETEUSRINFODIR="Yes"
+ STRIPALLEXEC="Yes"
+ CREATEDESCRIPTION="Yes"
+ CHMOD644DOCS="Yes"
+ CHOWNBINSROOTROOT="Yes"
+ NOUSRTMP="Yes"
+ DELETEPERLLOCALPOD="Yes"
+ ALLOWOVERLAPPINGFILES="No"
+ shift ;;
+
+ --showdeps) SHOWDEPS="Yes"
+ shift ;;
+
+ --rootdir) ROOTDIR="$2"
+ shift 2;;
+
+ --touch-filesystem-first) TOUCHFILESYSTEMFIRST=Yes
+ shift ;;
+ --touch-filesystem-faster) TOUCHFILESYSTEMFIRST=Yes
+ TOUCHFILESYSTEMFASTER=Yes
+ shift ;;
+
+
+ --) shift; break;;
+esac done
+
+# The package name is the final argument in the list
+COMMANDLINESCRIPT="$@"
+
+#
+# Sanity checks:
+#
+# Support the user supplying the full path of the package name - e.g. slacktrack -p /tmp/foo-1.0-arm-1.tgz
+# rather than specifying slacktrack -b /tmp -p foo-1.0-arm-1.tgz
+if [ "$( dirname "$SLACKWAREPACKAGE" )" != "." ]; then
+ BUILDSTORE="$( dirname "$SLACKWAREPACKAGE" )"
+ SLACKWAREPACKAGE="$( basename "$SLACKWAREPACKAGE" )"
+fi
+
+# Do we have a package name & a build script ? If not, bomb out.
+if [ -z "${SLACKWAREPACKAGE}" -o -z "${COMMANDLINESCRIPT}" ]; then
+ display_usage help >&2
+ exit 2
+fi
+
+# Why don't we check to see if the build script exists?
+# Well, if I do "/bin/sh foo.build" -- how can I check whether it exists?
+# Just don't pass slacktrack duff stuff ;)
+
+# Check package dependencies
+if [ ! -z "${PACKAGEDEPEND}" ]; then
+ check_package_dep "${PACKAGEDEPEND}" || exit 3
+fi
+
+# If we didn't specify a temporary directory then we need make a random one
+if [ -z "${SLACKTRACKTMPPATH}" ]; then
+ SLACKTRACKTMPPATH="/var/tmp/$$.$(date +%s).${RANDOM}.slacktrack.FAKEROOT" # Temporary path for file translation
+ else
+ # Remove duplicate / otherwise it breaks further down when we egrep it out of the 'changed files'
+ # list.
+ SLACKTRACKTMPPATH="$( echo $SLACKTRACKTMPPATH | tr -s '/' )"
+fi
+
+# If we elected to strip everything in the entire package directory then
+# set the other two strip options to something sensible to display to the
+# user/log file.
+if [ "${STRIPALLEXEC}" = "Yes" ]; then
+ STRIPLIB="Yes"
+ STRIPBIN="Yes"
+ STRIPARCHIVES="Yes"
+fi
+
+# Let's check if user really has gpg.
+if [ "${SIGNPACKAGE}" = "Yes" ]; then
+ which gpg >/dev/null 2>&1 || { echo "${PROGNAME}: Warning: Cannot find gpg; disabling signature creation"; SIGNPACKAGE="No"; }
+fi
+
+# Display some info about the new package we're going to build
+(
+printf "
+Package information
+--------------------------------------------------
+Slackware package name...........................: ${SLACKWAREPACKAGE}
+Build script/command line........................: ${COMMANDLINESCRIPT}
+Build package store..............................: ${BUILDSTORE}
+slacktrack log file..............................: ${SLACKTRACKLOGFILE}
+slacktrack temporary dir.........................: ${SLACKTRACKTMPPATH}
+Logging..........................................: ${LOGGING}
+Create an MD5sum of the resulting package........: ${CREATEMD5SUM}
+Sign the resulting package with GnuPG............: $( if [ "${SIGNPACKAGE}" = "Yes" ]; then echo "with ${SIGNINGKEY:-your default} key" ; else echo "No" ; fi )
+Create description file..........................: ${CREATEDESCRIPTION}
+Log hard links...................................: ${LOGHARDLINKS}
+chmod -R og-w....................................: ${CHMODNOGLOBALWRITE}
+chown root:bin binary directories................: ${CHOWNBINDIRSROOTBIN}
+chown root:bin binaries in bin dirs..............: ${CHOWNBINFILESROOTBIN}
+chown root:root binary dirs & files..............: ${CHOWNBINSROOTROOT}
+chmod 644 & chown root:root /usr/doc/*...........: ${CHMOD644DOCS}
+Additional options to 'makepkg'..................: $( if [ -z "${MAKEPKGOPTS}" ]; then echo "[ None ]" ; else echo "${MAKEPKGOPTS}" ; fi )
+Tell 'makepkg' to create symlinks................: ${CREATESYMLINKS}
+Call 'makepkg' with --setrootowner...............: ${SETROOTOWNER}
+Tidy on finish...................................: ${TIDYONFINISH}
+gzip man pages...................................: ${GZMAN}
+gzip info pages..................................: ${GZINFO}
+Fix broken gz man page symlinks..................: ${GZMANFIXSYMLINKS}
+Fix broken gz info page symlinks.................: ${GZINFOFIXSYMLINKS}
+Delete package's /usr/info/dir page..............: ${DELETEUSRINFODIR}
+Delete perllocal.pod files in /usr/lib{,64}......: ${DELETEPERLLOCALPOD}
+Strip executable ELF binaries....................: ${STRIPBIN}
+Strip executable ELF shared objects..............: ${STRIPLIB}
+Strip .a (archive) files.........................: ${STRIPARCHIVES}
+Strip all executable ELF files...................: ${STRIPALLEXEC}
+Path to strip utility............................: ${STRIPPROG}
+Shared objects (libraries) dirs..................: ${LIBDIR_LIST}
+Binary objects dirs..............................: ${BINDIR_LIST}
+Man page dirs....................................: ${MANDIR_LIST}
+Info page dirs...................................: ${INFODIR_LIST}
+Delete /usr/tmp symlink..........................: ${NOUSRTMP}
+Show dependencies to other packages..............: ${SHOWDEPS}
+egrep pattern for dir/file/path exclusion........: ${EXCLUDE_LIST}
+File system pre & post scan path exclusion regex : ${SEARCH_EXCLUDE_LIST}
+Command/script to run after build script.........: $( if [ -z "${RUNCMDAFTER}" ]; then echo "None" ; else echo ${RUNCMDAFTER} ; fi )
+Directory slacktrack considers is root...........: ${ROOTDIR}
+Allow files to overlap with other packages.......: ${ALLOWOVERLAPPINGFILES}
+Delete orphaned Python *.pyc files...............: ${DELETEORPHANEDPYC}
+Touch filesystem contents first..................: $( if [ -z "${TOUCHFILESYSTEMFIRST}" ]; then echo "No" ; else echo "in $FSTOUCHLIST" ; fi )
+--------------------------------------------------\n"
+) 2>&1 | tee ${SLACKTRACKLOGFILE}
+
+# Ensure that the temporary directory (either one chosen by slacktrack or set manually
+# with --tempdir) does not exist.
+# A user may expect slacktrack to choose its own directory within a sub directory
+# which it deliberately does not do.
+# It's safest to abort if the directory exists to avoid destroying user data.
+if [ -d "${SLACKTRACKTMPPATH}" ]; then
+ echo "${PROGNAME}: ERROR: Temporary directory ${SLACKTRACKTMPPATH} already exists"
+ echo " Please delete this directory before trying again."
+ exit 6 # error code=unsafe to continue
+ else
+ # We're safe to create the directory:
+ mkdir -pm700 "${SLACKTRACKTMPPATH}"
+fi
+
+# Create a temporary 'scratch' directory inside the slacktrack
+# temporary dir. This is to save build scripts managing their own
+# temporary directories should the author be too lazy ;)
+export SLACKTRACKSCRATCHDIR="${SLACKTRACKTMPPATH}/SCRATCHDIR"
+mkdir -pm700 "${SLACKTRACKSCRATCHDIR}"
+
+export SLACKTRACKFAKEROOT="${SLACKTRACKTMPPATH}/TRANSL"
+mkdir -pm755 "${SLACKTRACKFAKEROOT}"
+
+# Touch the contents of the filesystem.
+( if [ "${TOUCHFILESYSTEMFIRST}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Touching contents of"
+ for touching in $FSTOUCHLIST ; do
+ if [ -d "$touching" ]; then
+ echo -n " $touching"
+ # Also, exclude /lib/udev/devices:
+ if [ "${TOUCHFILESYSTEMFASTER}" = "Yes" ]; then
+ find $touching -path '/lib/udev/devices' -prune -o -print | xargs touch -c
+ else
+ # Do it the slower but safer, preferred way:
+ # This method handles files/dirs with spaces in the names - the above, faster method
+ # may fail to touch some files that have spaces in their file names - therefore you cannot
+ # be certain that a full 'state of the system' has been captured, which may lead to
+ # some new/modified files being excluded from the resulting .t?z package upon build completion.
+ find $touching -path '/lib/udev/devices' -prune -o -print | xargs -I '{}' touch -c '{}'
+ fi
+ # Update symlink time stamps on the symlink targets:
+ # There's not really any point in doing this actually since the build script
+ # or makefile would have to use ln -fs as well, in which case slacktrack
+ # would find the change with just the regular touching.
+ # To do this reliably, you could patch 'ln' to always force overwriting of the
+ # target.
+ # But if we wanted to, here's how we'd do it:
+ # find $touching -path '/lib/udev/devices' -prune -o -type l -printf "ln -nfs "%l" "%p"\n" | bash
+ fi
+ done
+ echo
+fi ) 2>&1 | tee ${SLACKTRACKLOGFILE}
+
+# Generate list of files on the system prior to executing the build script
+#
+# I remove /mnt, /proc, /tmp and /home here to make the find
+# execute more quickly. I have a box NFS mounted on /mnt
+# so it's highly undesirable to scan another OS installation
+# in addition to our own ;-)
+BEFOREFILESLIST="${SLACKTRACKTMPPATH}/before_files.list"
+AFTERFILESLIST="${SLACKTRACKTMPPATH}/after_files.list"
+NEWFILESLIST="${SLACKTRACKTMPPATH}/new_files.list"
+DIRLIST="${SLACKTRACKTMPPATH}/dir.list"
+
+echo -n "${PROGNAME}: Finding files on the system, please wait"
+( cd ${ROOTDIR}
+ find . \( -regex "./\(${SEARCH_EXCLUDE_LIST}\)" -prune \) -o -not -name . -printf "%p %T@ %s\n" | cut -d. -f2- > ${BEFOREFILESLIST} ) >/dev/null 2>&1
+echo " ... done"
+
+# Launch build script with logging
+if [ "${LOGGING}" = "Yes" ]; then
+ [ -x /usr/libexec/slacktrack/ln ] && export PATH=/usr/libexec/slacktrack:$PATH
+ ( printf "\n\n\n[$( date "+%D %r" )] ${PROGNAME}: Executing command line '${COMMANDLINESCRIPT}'\n\n"
+ ${COMMANDLINESCRIPT}
+ EXIT_CODE=$?
+ if [ ${EXIT_CODE} -gt 0 ]; then
+ printf "\n\n[$( date "+%D %r" )] ${PROGNAME}: * WARNING: ${COMMANDLINESCRIPT} returned exit code ${EXIT_CODE} *\n\n"
+ fi
+ printf "[$( date "+%D %r" )] ${PROGNAME}: Command line '${COMMANDLINESCRIPT}' finished\n\n"
+ ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+ else
+ # Launch build script without logging (allows perl's CPAN interface to work)
+ ( printf "\n\n\n[$( date "+%D %r" )] ${PROGNAME}: Executing command line '${COMMANDLINESCRIPT}'\n\n"
+ [ -x /usr/libexec/slacktrack/ln ] && export PATH=/usr/libexec/slacktrack:$PATH
+ ${COMMANDLINESCRIPT}
+ EXIT_CODE=$?
+ if [ ${EXIT_CODE} -gt 0 ]; then
+ printf "\n\n[$( date "+%D %r" )] ${PROGNAME}: * WARNING: ${COMMANDLINESCRIPT} returned exit code ${EXIT_CODE} *\n\n"
+ fi
+ printf "[$( date "+%D %r" )] ${PROGNAME}: Command line '${COMMANDLINESCRIPT}' finished\n\n"
+ )
+fi
+
+
+# Generate list of files post installation
+# Again we miss out /mnt et al to speed up the process.
+echo -n "${PROGNAME}: Finding files on the system, please wait"
+( cd ${ROOTDIR}
+ find . \( -regex "./\(${SEARCH_EXCLUDE_LIST}\)" -prune \) -o -not -name . -printf "%p %T@ %s\n" | cut -d. -f2- > ${AFTERFILESLIST} ) >/dev/null 2>&1
+echo " ... done"
+
+# Generate new list of files on the system (compare before and after file list)
+# and delete the list of files/dirs that match the egrep pattern exclude list.
+echo -n "${PROGNAME}: Comparing file lists"
+diff -Bbu ${BEFOREFILESLIST} ${AFTERFILESLIST} | grep "^+" | awk '{print $1}' | cut -d+ -f2- | \
+egrep -v "^(/$|\+\+$|${EXCLUDE_LIST}|${SLACKTRACKTMPPATH}$|${SLACKTRACKTMPPATH}/)" > ${NEWFILESLIST}
+echo " ... done"
+
+# Remove all non-empty directories from our package contents list
+# If we don't and we have any non-empty directories that have
+# changed (or been accessed) then the tar (below) ends up
+# including the directory & contents in its entirety into our new package!
+cd ${SLACKTRACKFAKEROOT}
+echo -n "${PROGNAME}: Removing non-empty directories from package contents list"
+( cd ${ROOTDIR}
+ cat ${NEWFILESLIST} | while read fileline ; do
+ if [ -d "./${fileline}" ]; then
+ # We only retain the *empty* directories otherwise any directories
+ # created by our build scripts (such as place holders) will be
+ # removed. Everything contained within the non-empty directories will
+ # be picked up by tar.
+ if [ "$( find "./${fileline}" | wc -l )" -ne 1 ]; then
+ echo "${fileline}" >> "${DIRLIST}"
+ fi
+ fi
+ done ) > /dev/null 2>&1
+( cat ${NEWFILESLIST} ${DIRLIST} | sort | uniq -u > ${NEWFILESLIST}.new ) > /dev/null 2>&1
+mv -f ${NEWFILESLIST}.new ${NEWFILESLIST}
+echo " ... done"
+
+# Copy the changed files into our temporary package directory
+echo -n "${PROGNAME}: Copying the new/changed files into temporary directory"
+( cd ${ROOTDIR} ; cut -d/ -f2- ${NEWFILESLIST} | tar pvvcf - -T- | tar -C${SLACKTRACKFAKEROOT} -pxf - ) >/dev/null 2>&1
+echo " ... done"
+
+# Do we have any files in the temporary directory ?
+if [ "$( find ${SLACKTRACKTMPPATH}/TRANSL -print | wc -l )" -le 1 ]; then
+ ( printf "slacktrack: failed to track any activity\n"
+ printf " Perhaps the build script doesn't exist or is broken\n\n"
+ printf " ERROR: Cannot build a package\n\n"
+ ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+ move_log # we will want to log this error incase we're using slacktrack through an unattended auto builder
+ tidy_workspace # clean up workspace
+ exit 5
+fi
+
+# Get back inside the package's root directory
+# (we shouldn't have left it because all cding is done inside subshells
+# but it doesn't hurt)
+cd ${SLACKTRACKFAKEROOT}
+
+# Determine whether there are any files that overlap with other packages on the filesystem.
+# These should be avoided since they may cause problems when upgrading packages (how would we know
+# which package 'really' owns the file?)
+# Output a list of all files *not* owned by the name of the package you're building
+# (this caters for situations when the package you're building cannot be removed from the
+# filesystem of a running system ("zlib" is an example)).
+shopt -s extglob # needed to find package names
+cd /var/log/packages # we need to enter a directory that doesn't contain the archive (*.t?z) filename of the package
+find . -type f -not -name $( package_name ${SLACKWAREPACKAGE} )-+([^-])-+([^-])-+([^-]) | xargs sed -s -e '1,/FILE LIST:/d' | egrep -v '\/\.\/|^install/' > ${SLACKTRACKTMPPATH}/packaged_and_owned_files.list
+shopt -u extglob # return to previous behaviour
+cd ${SLACKTRACKFAKEROOT}
+
+# Find the unique entries in the packaged/owned files (there are lots of duplicate entries for /bin and so on)
+# then merge it in with the list of new files we've found when creating this package, and finally
+# identify the overlapping (duplicated) entries:
+# Remove the absolute path name from the list of new files detected, so that we can compare them with the
+# list in /var/log/packages:
+sed 's?^/??g' ${SLACKTRACKTMPPATH}/new_files.list > ${SLACKTRACKTMPPATH}/new_files_noabsolutepath.list
+sort -u ${SLACKTRACKTMPPATH}/packaged_and_owned_files.list | sort -m ${SLACKTRACKTMPPATH}/new_files_noabsolutepath.list - | uniq -d > ${SLACKTRACKTMPPATH}/overlapping_files.list
+# Match an overlapping file to its package name and print out the list:
+# This flapping between subshells and the parent is due to 'shopt' not working properly inside subshells
+# and the need to direct the output of slacktrack to the log file.
+# It's messy and horribly inefficient -- if you know of a better way, let me know!
+if [ -s ${SLACKTRACKTMPPATH}/overlapping_files.list ]; then
+ ( echo "${PROGNAME}: Warning - found file overlap with existing packages:" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+ pushd /var/log/packages > /dev/null
+ shopt -s extglob # needed to find package names
+ cat ${SLACKTRACKTMPPATH}/overlapping_files.list | while read ofile ; do
+ # Identify the package(s!) that contains the overlapping file, but exclude the package name
+ # that we're currently building (it could be the case that an older version of the package
+ # we're currently building is already installed that also contains overlapping files. I assume
+ # that you're going to replace this older package, so it's not worth identifying the overlapping
+ # file as belonging to this other version).
+ # The following only works with 'new' (Slackware 8.1+) style package names: "foo-1.0-arm-1.t?z"
+ foundpkg="$( grep "$( echo "$ofile" )" * | awk -F: '{print $1}' | egrep -v "^$( package_name ${SLACKWAREPACKAGE} )-[^-]*-[^-]*-[^-]*$" | sed '2,$s/^/\t\ \ \ \ /' )"
+ if [ ! -z "$foundpkg" ]; then
+ ( # We found it in a package:
+ echo "File: $ofile"
+ echo "Package(s): $foundpkg" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+ fi
+ done
+ popd > /dev/null
+ shopt -u extglob # return to previous behaviour
+ if [ "${ALLOWOVERLAPPINGFILES}" = "No" ]; then
+ ( echo -n "${PROGNAME}: Deleting overlapping files from the package contents"
+ cat ${SLACKTRACKTMPPATH}/overlapping_files.list | while read ovlpfile ; do
+ rm -f "${SLACKTRACKFAKEROOT}/${ovlpfile}"
+ done
+ echo " ... done" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+ fi
+ fi
+
+# Restore original directory permissions from root filesytem.
+# Why? Because we only store (in our file list), EMPTY directories. Example:
+# I chmod 700 /etc/rc.d (which contains many startup scripts)
+# My new file rc script is called 'rc.foo' and this is the only thing that's changed
+# within /etc/rc.d. Therefore slacktrack only preserves the file name
+# '/etc/rc.d/rc.foo', so tar has to create etc/rc.d for itself -- it has no
+# information about its permissions/ownerships.
+# Why don't I just tar up the directory? read the comments above the code that does the tar.
+( if [ -s ${DIRLIST} ]; then
+ echo -n "${PROGNAME}: Restoring directory permissions & ownerships"
+ cat ${DIRLIST} | while read line ; do
+ find "${ROOTDIR}/${line}" -mindepth 0 -maxdepth 0 -printf "%U:%G" | xargs -0i chown {} "./${line}"
+ find "${ROOTDIR}/${line}" -mindepth 0 -maxdepth 0 -printf "%m" | xargs -0i chmod {} "./${line}"
+ done
+ echo " ... done"
+fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+# Get back inside the package's root directory
+# (we shouldn't have left it because all cding is done inside subshells
+# but it doesn't hurt)
+cd ${SLACKTRACKFAKEROOT}
+
+# Create a temporary package using "makepkg" to contain everything that
+# we have detected should be in the new package.
+# This will be used to populate the /var/log/packages/$package entry - the only thing we're doing
+# in this block of code is to generate the package entry for the build box, so that the build "mess" can be
+# removed cleanly. The reason we do this here rather than use the contents of the $package (the final .t?z) is
+# because post-build, we modify some files (such as gzipping man pages), and as such when we removepkg $package,
+# removepkg won't delete /usr/man/man1/bash.1 because the entry would contain /usr/man/man1/bash1.gz
+# First copy the contents to another temporary location so that makepkg can slice and dice it.
+( echo -n "${PROGNAME}: Creating entries for $( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ) in /var/log/{packages,scripts}"
+ cp -fa ${SLACKTRACKFAKEROOT} ${SLACKTRACKTMPPATH}/makepkg.tmppkg
+ cd ${SLACKTRACKTMPPATH}/makepkg.tmppkg
+ # Create a slack-desc that identifies this as a slacktrack special.
+ mkdir -pm755 install
+ NOEXTPKGNAM=$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev )
+cat << EOF > install/slack-desc
+ |-----handy-ruler------------------------------------------------------|
+${NOEXTPKGNAM}: $NOEXTPKGNAM
+${NOEXTPKGNAM}:
+${NOEXTPKGNAM}: This package entry represents the filesystem as it was when slacktrack
+${NOEXTPKGNAM}: finished executing your build script.
+${NOEXTPKGNAM}:
+${NOEXTPKGNAM}: There has been no post processing on the contents of the package
+${NOEXTPKGNAM}: (for example, no compression of man pages).
+${NOEXTPKGNAM}:
+${NOEXTPKGNAM}: The primary purpose of this entry is to allow easy removal of the
+${NOEXTPKGNAM}: package contents with the Slackware removepkg tool.
+${NOEXTPKGNAM}:
+EOF
+
+ ${MAKEPKG} -l y -c n ${SLACKTRACKTMPPATH}/${SLACKWAREPACKAGE} >/dev/null 2>&1
+ # We don't need to install it on to the root filesystem since we already have the contents,
+ # all that we need is the /var/log/{packages,scripts} entries to allow manipulation by pkgtools.
+ mkdir -pm755 ${SLACKTRACKTMPPATH}/fakeinstalldir
+ installpkg --root ${SLACKTRACKTMPPATH}/fakeinstalldir ${SLACKTRACKTMPPATH}/${SLACKWAREPACKAGE} >/dev/null 2>&1
+ cp -fa ${SLACKTRACKTMPPATH}/fakeinstalldir/var/log/scripts/$NOEXTPKGNAM /var/log/scripts/ >/dev/null 2>&1
+ cp -fa ${SLACKTRACKTMPPATH}/fakeinstalldir/var/log/packages/$NOEXTPKGNAM /var/log/packages/ >/dev/null 2>&1
+echo " ... done" ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+# gzip man pages ?
+# Note that we prefix the dir name with ./ - this is so that if users specify
+# additional directories with --extra-xxxdir and include / , then it doesn't actually
+# *look* in the root dir.
+( if [ "${GZMAN}" = "Yes" ]; then
+ echo -n "${PROGNAME}: gzipping man pages"
+ for man_dir in ${MANDIR_LIST}; do
+ if [ -d "./${man_dir}" ]; then
+ ( find ./${man_dir} -type f -name '*.bz2' -print0 | xargs -0 bzip2 -df ) >/dev/null 2>&1
+ ( find ./${man_dir} -type f -print0 | xargs -0 gzip -9f ) >/dev/null 2>&1
+ ( find ./${man_dir} -type f -print0 | xargs -0 chmod 644 ) >/dev/null 2>&1
+ fi
+ done
+ echo " ... done"
+
+ if [ "${GZMANFIXSYMLINKS}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Fixing any broken symlinks in man page directories"
+ # Fix up symlinks unless instructed not to
+ for man_dir in ${MANDIR_LIST}; do
+ if [ -d "./${man_dir}" ]; then
+ ( cd ./${man_dir}
+ # Enter each man page directory (man1,man2..) and whittle them down one by one
+ for i in $( find . -type d -maxdepth 1 -printf "%P\n" | grep -v "^$" ); do
+ # We cd into the man dir then use find to construct some shell commands & pipe into
+ # bash for execution. Neat huh? ;)
+ cd ${i} && ( find . -type l -printf "rm -f %P ; ln -s %l.gz %p.gz\n" ) | /bin/bash && cd ..
+ done
+ )
+ fi
+ done
+ echo " ... done"
+ fi
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+# Delete any perllocal.pod files found in /usr/lib:
+( if [ "${DELETEPERLLOCALPOD}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Deleting perllocal.pod files in /usr/lib and /usr/lib64"
+ ( find usr/lib{,64} -name perllocal.pod -print0 | xargs -0 rm -f ) >/dev/null 2>&1
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+# Delete package's /usr/info/dir ?
+# You're more than likely going to want to do this.
+( if [ "${DELETEUSRINFODIR}" = "Yes" -a -f usr/info/dir ]; then
+ echo -n "${PROGNAME}: Deleting /usr/info/dir"
+ rm -f usr/info/dir
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+# gzip info pages ?
+( if [ "${GZINFO}" = "Yes" ]; then
+ echo -n "${PROGNAME}: gzipping info pages"
+ for info_dir in ${INFODIR_LIST}; do
+ if [ -d "./${info_dir}" ]; then
+ ( find ./${info_dir} -type f -name '*.bz2' -print0 | xargs -0 bzip2 -df ) >/dev/null 2>&1
+ ( find ./${info_dir} -type f -print0 | xargs -0 gzip -9f ) >/dev/null 2>&1
+ ( find ./${info_dir} -type f -print0 | xargs -0 chmod 644 ) >/dev/null 2>&1
+ fi
+ done
+ echo " ... done"
+
+ if [ "${GZINFOFIXSYMLINKS}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Fixing any broken symlinks in info page directories"
+ # Fix up symlinks unless instructed not to
+ for info_dir in ${INFODIR_LIST}; do
+ if [ -d "./${info_dir}" ]; then
+ ( cd ./${info_dir} && ( find . -type l -printf "rm -f %P ; ln -s %l.gz %p.gz\n" ) | /bin/bash )
+ fi
+ done
+ echo " ... done"
+ fi
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Strip shared objects ?
+( if [ "${STRIPLIB}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Stripping unstripped ELF shared objects"
+ for i in ${LIBDIR_LIST}; do
+ ( cd ./${i} && find . -name '*.so*' -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*shared.*not stripped)' | awk -F: '{print $1}' | xargs ${STRIPPROG} -p --strip-unneeded ) > /dev/null 2>&1
+ done
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Strip .a (archive) files ?
+( if [ "${STRIPARCHIVES}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Stripping .a (archive) files"
+ ( find . -name '*.a' -type f -print0 | xargs -0 ${STRIPPROG} -p -g ) > /dev/null 2>&1
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Strip binaries?
+( if [ "${STRIPBIN}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Stripping unstripped ELF binaries"
+ for i in ${BINDIR_LIST}; do
+ ( cd ./${i} && find . -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*not stripped)' | awk -F: '{print $1}' | xargs ${STRIPPROG} -p --strip-unneeded ) >/dev/null 2>&1
+ done
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Strip everything? This does the same as the above but instead it does it across
+# the entire package directory -- therefore it finds stuff in /opt and anywhere else
+# that files have been created. You may prefer to use this option if you already use -jkA
+# but it's worth noting that it will take longer (especially on a package with many files
+# in a deep directory structure)
+( if [ "${STRIPALLEXEC}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Stripping all unstripped executable ELF files"
+ ( find . -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*not stripped)' | awk -F: '{print $1}' | xargs ${STRIPPROG} -p --strip-unneeded ) >/dev/null 2>&1
+ # Strip the .a archives
+ ( find . -name '*.a' -type f -print0 | xargs -0 ${STRIPPROG} -p -g ) > /dev/null 2>&1
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# If we find <package_builddir>/usr/tmp is a symlink then delete it.
+# Some programs such as Apache seem to put stuff in here. /usr/tmp is a symlink and is
+# created by Slackware's 'aaa_base' package.
+( if [ "${NOUSRTMP}" = "Yes" -a -h "usr/tmp" ]; then
+ echo "${PROGNAME}: Deleting /usr/tmp symlink from package build directory"
+ rm -rf "${SLACKTRACKTMPPATH}/TRANSL/usr/tmp"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Run chmod -R og-w over the package directory ?
+# In general you won't want to do this because you should take care of your
+# own permissions on a per-build-script basis. However, some software such
+# as PHP leaves files globally writeable (even a recent Slackware PHP package
+# had files og+w).
+( if [ "${CHMODNOGLOBALWRITE}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Running chmod -R og-w on package contents"
+ chmod -R og-w .
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Fix up ownerships in the package. According to the 'README' that comes with
+# Pat's 'slack-tools' scripts say:
+# "non-setuid binaries in /bin, /sbin, /usr/bin, and /usr/sbin are
+# all chown root:bin (and the directories are, too)"
+# However, I spot traceroute as being setuid and owned by root.bin
+# So we'll just set everything in & including those dirs to be root.bin
+# You WON'T want to always use this facility -- some build scripts such as
+# 'floppy' set their own permissions correctly. Again, you need to check over
+# the package afterwards and make changes to your build script accordingly.
+( if [ "${CHOWNBINDIRSROOTBIN}" = "Yes" ]; then
+ echo -n "${PROGNAME}: chowning root:bin the directories ${BINDIR_LIST}"
+ for i in ${BINDIR_LIST}; do
+ # Yes, we're assuming we may have dirs inside our bins. I've yet to see
+ # one but there may be in the future.
+ ( cd ./$i && find . -type d -print0 | xargs -0 chown root:bin ) >/dev/null 2>&1
+ done
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# chown root:bin files
+# Please note that any additional paths specified using --extra-bindir
+# will NOT be considered here. The Slackware standard is to only chown root:bin on
+# /usr dirs -- if you look at /opt/kde/bin you'll see the files are owned by root.root
+( if [ "${CHOWNBINFILESROOTBIN}" = "Yes" ]; then
+ echo -n "${PROGNAME}: chowning root:bin the files inside ${BINDIR_LIST}"
+ for i in ${BINDIR_LIST}; do
+ ( cd ./$i && find . -type f -printf "chown root:bin '%p' && chmod %m '%p'\n" | /bin/bash ) > /dev/null 2>&1
+ done
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# chown root:root files.
+# This was introduced in Slackware v11.
+# Please note that any additional paths specified using --extra-bindir
+# will NOT be considered here. The Slackware standard is to only chown root:root on
+# /usr dirs -- if you look at /opt/kde/bin you'll see the files are owned by root:root
+( if [ "${CHOWNBINSROOTROOT}" = "Yes" ]; then
+ echo -n "${PROGNAME}: chowning root:root on files inside ${BINDIR_LIST}"
+ for i in ${BINDIR_LIST}; do
+ ( cd ./$i && find . -type f -printf "chown root:root '%p' && chmod %m '%p'\n" | /bin/bash ) > /dev/null 2>&1
+ done
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# chmod 644 & chown root:root docs in usr/doc ?
+# This is my own 'thing'. I don't like having any executable files in
+# my docs directory.
+( if [ "${CHMOD644DOCS}" = "Yes" -a -d "usr/doc" ]; then
+ echo -n "${PROGNAME}: Running chmod 644 over documents in usr/doc/"
+ ( find usr/doc/ -type f -print0 | xargs -0 chmod 644 ) >/dev/null 2>&1
+ ( chown -R root:root usr/doc/ ) >/dev/null 2>&1
+ echo " ... done"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# If the user has specified both --setrootowner and --chown-bdirs-root-bin then warn
+# them that their dirs permissions will be changed
+# These options aren't mutually exclusive because --chown-bdirs-root-bin
+# ONLY chowns /bin,/sbin,/usr/bin & /usr/sbin
+( if [ "${CHOWNBINDIRSROOTBIN}" = "Yes" -a "${SETROOTOWNER}" = "Yes" ]; then
+ echo "${PROGNAME}: * WARNING *"
+ echo " You have specified both --setrootowner AND --chown-bdirs-root-bin"
+ echo " options, but Slackware's makepkg script will change the"
+ echo " directory permissions to 'root.root'."
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Ensure the 'root' directory of the tarchive is globally readable
+# else it breaks your root dir thus your system when you install the package ;)
+chmod 755 ${SLACKTRACKTMPPATH}/TRANSL
+chown root:root ${SLACKTRACKTMPPATH}/TRANSL
+
+# Delete any orpahaned *.pyc files - these do not have a matching *.py file
+# that was detected by slacktrack. It doesn't mean that there isn't a file
+# on the *filesystem*, just that if there was, it was not modified during the
+# build, and so probably doesn't belong in the package, and infact may be
+# conflicting with an existing file in another package.
+( if [ "${DELETEORPHANEDPYC}" = "Yes" ]; then
+ echo "${PROGNAME}: Deleting any orphaned *.pyc files within the package"
+ find . -name '*.pyc' -type f | sed 's/\(.*\)\..*/\1/' | while read pycfile ; do
+ # We searched for .pyc files and chopped off the file extension; if
+ # we dont find a matching .py file for the .pyc, then we wipe it:
+ if [ ! -f "${pycfile}.py" ]; then
+ # Wipe the *.pyc file, and if that was successful then try and rmdir the directory
+ # and its parents. This will fail if there were more than just *.pyc files.
+ # We redirect to a temporary log file because rmdir displays its progress
+ # as it goes, rather than doing its business then reporting -- so
+ # we'd see "Removing directory /usr/foo", next line "Failed removing /usr/foo"
+ # This way we only display the log file if rmdir successfully removed the dir.
+ # Note however, that if it's a directory such as /usr/lib, then rmdir will try
+ # and remove that on every invocation, which will fail - so we'll never see
+ # the output; this isn't what I'd like but I don't see a way around it
+ # and it's not a big deal.
+ { rm -fv "${pycfile}.pyc" ; } && { rmdir -vp "$( dirname ${pycfile}.pyc )" > ${SLACKTRACKTMPPATH}/rmdir.out 2>&1 && cat ${SLACKTRACKTMPPATH}/rmdir.out ; }
+ fi
+ done
+ # Remove that temp file
+ rm -f ${SLACKTRACKTMPPATH}/rmdir.out
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+# If the buildstore doesn't exist then we'll use /tmp instead
+# We don't check this earlier because *my* scripts mkdir /tmp/built-slackwarepackages
+# and Slackware's SlackBuild scripts leave the package in /tmp -- and /tmp must always exist
+# We won't try and create the dir because if you made a typo in the dir name, you
+# make find your package (that may contain sensitive files) ends up in a globally readable
+# area.
+if [ ! -d "${BUILDSTORE}" ]; then
+ printf "${PROGNAME}: WARNING: The build store directory ${BUILDSTORE}\n"
+ printf " does not exist; using /tmp instead\n\n"
+ BUILDSTORE="/tmp/"
+fi
+
+
+# Show dependencies to the INSTALLED packages ?
+( if [ "${SHOWDEPS}" = "Yes" ]; then
+ LDDEPSFILE="${SLACKTRACKTMPPATH}/ld_list"
+ LDDEPSUNRESOLVED="${SLACKTRACKTMPPATH}/ld_unresolved"
+ LDDEPSFOUNDPACKAGES="${SLACKTRACKTMPPATH}/ld_found_packages"
+
+ echo -n "${PROGNAME}: Generating list of shared library dependencies"
+ # I grep out 'not found' from the list because if this package CONTAINS the
+ # 'not found' library then we're not going to find it in /var/log/packages
+ # This isn't the same as having what I call an 'orphaned' library.
+ ( find . -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print0 | xargs -0 file | egrep '(ELF.*shared)' | \
+ awk -F: '{print $1}' | xargs ldd 2>/dev/null | grep '=>' | grep -vi 'not found' | \
+ awk '{print $3}' | grep -v "^$" > "${LDDEPSFILE}" ) > /dev/null 2>&1
+
+ if [ ! -s "${LDDEPSFILE}" ]; then
+ printf "\n Failed to find any shared object dependencies\n"
+ else
+
+ # Remove dupes from the list
+ sort "${LDDEPSFILE}" | uniq > "${LDDEPSFILE}.sorted"
+ mv -f "${LDDEPSFILE}.sorted" "${LDDEPSFILE}"
+
+ # Look in /var/log/packages and /var/log/scripts (because our library
+ # may be linked against a symlink) and find our packages.
+ # Now, a problem that we have is that some of
+ # Slackware's packages have an 'incoming' directory (eg glibc)
+ # to avoid trampling over the running system without doing
+ # some pokery first.
+ # This is why I am *only* keeping the .so name rather than the
+ # full path leading to it.
+ cat "${LDDEPSFILE}" | rev | cut -d/ -f1 | rev | while read library_name ; do
+ ( ( cd /var/log/packages && grep -l ${library_name} * ) || ( cd /var/log/scripts && grep -l ${library_name} * ) ) >> "${LDDEPSFOUNDPACKAGES}"
+ # If we couldn't find it in a package (most likely because
+ # it's linked against something that was compiled 'locally' rather than
+ # being brewed into a package, or because you've broken your packages list)
+ if [ $? -gt 0 ]; then
+ # This way it shows the full path to the library rather than just its file name.
+ egrep "${library_name}$" "${LDDEPSFILE}" >/dev/null 2>&1 && \
+ echo "$( egrep "${library_name}$" "${LDDEPSFILE}" )" >> "${LDDEPSUNRESOLVED}"
+ fi
+ done
+
+ # Before you think "Hold on a second old cheese, but some libraries
+ # exist in more than one package (glibc/glibc-solibs is an example)
+ # so what you going to do about that?"
+ # Absolutely nothing! :-) That'd mean having some sort of database
+ # to know that you'd only need one of the packages listed.
+ # *Also*, if you think about it, then who's to tell you whether you
+ # should have glibc OR glibc-solibs? *I* only install 'glibc' because
+ # I compile stuff (you don't need -solibs if you have the
+ # developer/full package) .. then if I compiled this package on a box
+ # that only had 'openssl' (rather than openssl-solibs *AND* openssl)
+ # then... oh it's too complicated. It's like a paradox or something.
+
+ # Remove any dupes from the package list
+ sort "${LDDEPSFOUNDPACKAGES}" | uniq > "${LDDEPSFOUNDPACKAGES}.sorted"
+ mv -f "${LDDEPSFOUNDPACKAGES}.sorted" "${LDDEPSFOUNDPACKAGES}"
+
+ # From 'generating list of dependencies' above.
+ echo " ... done"
+
+ # Dump the list of package dependencies to screen
+ if [ -s "${LDDEPSFOUNDPACKAGES}" ]; then
+ echo "${PROGNAME}: This package depends on libraries within the following installed packages:"
+ egrep -v "$( package_name ${SLACKWAREPACKAGE} )" "${LDDEPSFOUNDPACKAGES}" | while read line ; do
+ printf "\t ${line}\n"
+ done
+ fi
+
+ # Now dump the list of dependencies into a log file.
+ # We could store it somewhere in the package I suppose, any suggestions?
+ install -m644 "${LDDEPSFOUNDPACKAGES}" "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).ld_deps.log"
+
+ # And if we found any libraries that aren't part of installed packages, dump
+ # those too.
+ if [ -s "${LDDEPSUNRESOLVED}" ]; then
+ echo "${PROGNAME}: The following libraries were not found in any installed package:"
+ cat "${LDDEPSUNRESOLVED}" | while read line ; do
+ printf "\t ${line}\n"
+ done
+ # Not much point in listing libraries in the package if we can't
+ # tell the user how to get a package containing that library, so
+ # we'll just log it and let the developer fix it afterwards.
+ install -m644 "${LDDEPSUNRESOLVED}" "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).orphaned_ld_deps.log"
+ fi
+ fi
+
+fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Launch an external command/script before running makepkg ?
+# This may be useful to inspect the package contents with a file manager such as
+# Midnight Commander or xtc.
+# This is extremly useful for slacktrack as you can fix up symlinks and stuff
+# that you couldn't do inside the root file system.
+if [ ! -z "${RUNCMDAFTER}" ]; then
+ echo "${PROGNAME}: Launching external command '${RUNCMDAFTER}'" >> ${SLACKTRACKLOGFILE}
+ # Enter the package's root directory and run the command, appending any output to
+ # slacktrack's log:
+ if [ "${RUNCMDAFTER_WITHLOG}" = "Yes" ]; then
+ ( cd ${SLACKTRACKTMPPATH}/TRANSL ; ${RUNCMDAFTER} ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+ else
+ # No logging - best for manual intervention or a curses type program, since this would
+ # potentially cause an unclean log file:
+ ( cd ${SLACKTRACKTMPPATH}/TRANSL ; ${RUNCMDAFTER} )
+ fi
+ echo "${PROGNAME}: External command finished" >> ${SLACKTRACKLOGFILE}
+fi
+
+
+# Execute the Slackware package making utility & append its output to the package logfile
+( ${MAKEPKG} ${MAKEPKGOPTS} \
+ --linkadd $( echo ${CREATESYMLINKS} | cut -b1 | tr A-Z a-z ) \
+ --chown $( echo ${SETROOTOWNER} | cut -b1 | tr A-Z a-z ) \
+ ${BUILDSTORE}/${SLACKWAREPACKAGE}
+
+ # Warn if no slack-desc file found. You don't need a doinst.sh script
+ # though, so we won't bother with that one.
+ # Why do this *after* running makepkg? makepkg makes lots of noise
+ # and unless you specifically scroll up or look at logs, you'll miss this warning.
+ if [ ! -s "install/slack-desc" ]; then
+ echo "${PROGNAME}: WARNING - /install/slack-desc not found or is 0 bytes"
+ fi
+
+ # Display the size of the package:
+ if [ -f "${BUILDSTORE}/${SLACKWAREPACKAGE}" ]; then
+ printf "${PROGNAME}: ${SLACKWAREPACKAGE}'s size is $( ls -lah ${BUILDSTORE}/${SLACKWAREPACKAGE} | awk '{print $5}' )\n"
+ fi
+
+ # Create an MD5sum of the package if requested
+ if [ "${CREATEMD5SUM}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Creating an MD5 sum of ${SLACKWAREPACKAGE}"
+ ( cd "${BUILDSTORE}"
+ md5sum "${SLACKWAREPACKAGE}" > "${SLACKWAREPACKAGE}.md5" )
+ echo " ... done"
+ fi
+
+ # Sign the package if requested to do so.
+ if [ "${SIGNPACKAGE}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Signing ${SLACKWAREPACKAGE} with ${SIGNINGKEY:-your default} key"
+ ( cd "${BUILDSTORE}"
+ GPG_OPTIONS="--detach-sign --yes --armor"
+ if [ "${SIGNINGKEY}" ]; then
+ GPG_OPTIONS="${GPG_OPTIONS} --local-user $SIGNINGKEY"
+ fi
+
+ gpg ${GPG_OPTIONS} --output ${SLACKWAREPACKAGE}.asc ${SLACKWAREPACKAGE}
+ if [ $? -ne 0 ]; then
+ printf "\n${PROGNAME}: ERROR: Signature has not been correctly generated\n"
+ else
+ echo " ... done"
+ fi )
+
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Copy the slack-desc file into the build store path ?
+( if [ "${CREATEDESCRIPTION}" = "Yes" -a -f "${SLACKTRACKTMPPATH}/TRANSL/install/slack-desc" ]; then
+ echo "${PROGNAME}: Installing package description file into build store"
+ # Cut the handy ruler, comments and empty lines out of the file.
+ egrep -v '^($|#| *\|)' ${SLACKTRACKTMPPATH}/TRANSL/install/slack-desc > "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).txt"
+ chmod 644 "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).txt"
+ fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+
+# Log hard links
+# Some packages (such as Python) use ln to create hard links rather than soft links.
+# It is impossible to determine the original file name of a hard link, and thus
+# must be weeded out manually.
+( if [ "${LOGHARDLINKS}" = "Yes" ]; then
+ echo -n "${PROGNAME}: Scanning for hard links"
+ printf "$( find ${SLACKTRACKTMPPATH}/TRANSL -type f -links +1 -printf "Hard link: %P\n" )\n" > ${SLACKTRACKLOGFILE}.hardlinks
+ if [ ! -z "$( grep "Hard link:" ${SLACKTRACKLOGFILE}.hardlinks )" ]; then
+ printf "\nWARNING: The following hard links were detected\n"
+ cat ${SLACKTRACKLOGFILE}.hardlinks
+ echo
+ # We will ALWAYS create a log file for hardlinks regardless of whether logging is disabled.
+ # The packager HAS to know about them !
+ mv ${SLACKTRACKLOGFILE}.hardlinks "${BUILDSTORE}/$( echo $SLACKWAREPACKAGE | rev | cut -d. -f2- | rev ).hardlinks.log"
+ else
+ echo " ... none found"
+ rm -f "${SLACKTRACKLOGFILE}.hardlinks"
+ fi
+fi ) 2>&1 | tee -a ${SLACKTRACKLOGFILE}
+
+# Tidy up workspace:
+tidy_workspace
+
+# Report that slacktrack has finished, but to the log only.
+printf "\n\n[$( date "+%D %r" )] ${PROGNAME} finished.\n" >> ${SLACKTRACKLOGFILE}
+
+
+# Unless the user has specified their own logfile, we'll use packagename-ver-arch-build.log
+# If they've disabled logging with --nologging then simply delete the log file.
+# You could say this was sloppy, that we're logging in the first place if we're told not to
+# but given that most make scripts scroll tens of pages off the screen, I think a log file
+# is *Always* handy to have, even if you don't retain it.
+move_log
+
+
+# Report that slacktrack has finished (to screen only).
+printf "\n\n[$( date "+%D %r" )] ${PROGNAME} finished.\n"
+
+exit 0
+#EOF
diff --git a/source/d/slacktrack/slacktrack-project/slack-desc b/source/d/slacktrack/slacktrack-project/slack-desc
new file mode 100644
index 000000000..167f8e099
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/slack-desc
@@ -0,0 +1,21 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+#
+# I've broken the 11 line rule here but installpkg can handle up to 13.
+#
+ |-----handy-ruler------------------------------------------------------|
+slacktrack: slacktrack (Slackware package building utilities)
+slacktrack:
+slacktrack: slacktrack tracks the installation of a 'make install' (or similar)
+slacktrack: and produces a Slackware compliant package from the results.
+slacktrack:
+slacktrack: slacktrack can be used to build packages from Slackware's '.build'
+slacktrack: scripts or your own.
+slacktrack:
+slacktrack: slacktrack tracks installations directly on the host's filesystem.
+slacktrack:
+slacktrack:
diff --git a/source/d/slacktrack/slacktrack-project/slacktrack.SlackBuild b/source/d/slacktrack/slacktrack-project/slacktrack.SlackBuild
new file mode 100755
index 000000000..244d92ede
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/slacktrack.SlackBuild
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+#################################################################
+# Program: slacktrack.SlackBuild
+# Purpose: Build a Slackware Package of slacktrack
+# Author : Stuart Winter <mozes@slackware.com>
+# Version: 1.06
+# Date...: 05-Apr-2013
+#################################################################
+
+PKGNAM=slacktrack
+VERSION=${VERSION:-2.18}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+case "$( uname -m )" in
+ i?86) export ARCH=i586
+ PKGEXT=txz ;;
+ arm*) export ARCH=arm
+ PKGEXT=txz ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m )
+ PKGEXT=txz ;;
+esac
+
+SLACKPACKAGE=$PKGNAM-$VERSION-$ARCH-$BUILD.$PKGEXT
+
+# Resting place for the package .t?z:
+PKGSTORE=${PKGSTORE:=/tmp}
+
+# Temporary unarchive, compile & package-root directory:
+TMP=/tmp/build-slacktrack
+PKG=/tmp/package-slacktrack
+
+# Work out where we are now so we can untar our source ball from it:
+CWD=$PWD
+
+# Delete previous build dirs
+rm -rf $PKG $TMP
+mkdir -pm755 $PKG $TMP
+
+# Create package framework:
+mkdir -pm755 $PKG/{install,usr/{libexec/slacktrack,bin,doc/$PKGNAM-${VERSION},man/man8}}
+
+# slacktrack's docs:
+cp -fav $CWD/docs/* $PKG/usr/doc/$PKGNAM-${VERSION}
+rm -fv $PKG/usr/doc/$PKGNAM-${VERSION}/INSTALL
+
+# Fix any wonky permissions the docs may have attracted:
+find $PKG/usr/doc -type f -print0 | xargs -0 chmod 644
+find $PKG/usr/doc -type f -print0 | xargs -0 chown root:root
+
+# Install man pages:
+( cd $CWD/man
+ ./man.build
+ gzip -9c slacktrack.8 > $PKG/usr/man/man8/slacktrack.8.gz
+ gzip -9c slackdtxt.8 > $PKG/usr/man/man8/slackdtxt.8.gz
+ rm -f *.8 )
+
+# Install slacktrack & friends:
+install -oroot -groot -vpm755 $CWD/scripts/{slacktrack,slackdtxt} \
+ $PKG/usr/bin
+
+# Build the ln wrapper:
+gcc -O3 $CWD/ln-wrapper.c -o $PKG/usr/libexec/slacktrack/ln || exit 1
+strip --strip-unneeded $PKG/usr/libexec/slacktrack/ln
+
+# Install package description:
+install -vpm644 $CWD/slack-desc $PKG/install
+
+# Build package:
+cd $PKG
+chown -R root:root .
+chmod -R og-w .
+makepkg -l y -c n $PKGSTORE/$SLACKPACKAGE
+
+# Create the corresponding .txt description file:
+( cd $PKGSTORE && $CWD/scripts/slackdtxt $SLACKPACKAGE )
+
+# Package maintainer stuff:
+PARAMS="$( getopt -qn "$( basename $0 )" -o iz -- "$@" )"
+if [ $? -eq 0 ]; then
+ eval set -- "$PARAMS"
+ for option in $* ; do
+ case "${option}" in
+ -i)
+ removepkg slacktrack
+ installpkg $PKGSTORE/$SLACKPACKAGE
+ shift ;;
+
+ -z)
+ echo -n "Making a distributable source archive"
+ ( cd $CWD/..
+ # Don't worry, you're not missing much!
+ chown -R root:root .
+ tar --exclude slacktrack/2bourbon \
+ --exclude slacktrack/old_stuff \
+ -Ixz -cf $CWD/../slackware-package-dir/slacktrack/$PKGNAM-${VERSION}-source.tar.xz slacktrack-project )
+ echo " ... done"
+ shift ;;
+ esac done
+fi
+
+# Delete temporary build dir and package-root.
+# I don't like doing this anymore - I prefer to be able to refer back to
+# the compiled source tree after the build.
+#rm -rf $TMP $PKG
diff --git a/source/d/slacktrack/slacktrack-project/tests/test-exclusion b/source/d/slacktrack/slacktrack-project/tests/test-exclusion
new file mode 100755
index 000000000..cbb2d32c2
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/tests/test-exclusion
@@ -0,0 +1,12 @@
+#!/bin/bash
+eval $( grep ^EXCLUDE_LIST ../scripts/slacktrack )
+
+cat << EOF | egrep "$EXCLUDE_LIST"
+/var/lib/NetworkManager/dir
+/usr/bin/wn
+/usr/man/whatis.gz
+/usr/local/man/whatis.gz
+/var/lib/pgsql/foop
+/var/lib/mysql
+EOF
+
diff --git a/source/d/slacktrack/slacktrack.SlackBuild b/source/d/slacktrack/slacktrack.SlackBuild
index ffd6d7d39..6e5ff906d 100755
--- a/source/d/slacktrack/slacktrack.SlackBuild
+++ b/source/d/slacktrack/slacktrack.SlackBuild
@@ -1,11 +1,32 @@
-#!/bin/sh
+#!/bin/bash
# Set initial variables:
-CWD=`pwd`
+cd $(dirname $0) ; CWD=$(pwd)
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
-export VERSION=2.17
+PKGNAM=slacktrack
+export VERSION=2.18
+# Automatically determine the architecture we're building on:
+case "$( uname -m )" in
+ i?86) export ARCH=i586
+ PKGEXT=txz ;;
+ arm*) export ARCH=arm
+ PKGEXT=txz ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m )
+ PKGEXT=txz ;;
+esac
+BUILD=${BUILD:-2}
+export BUILD
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
if [ ! -d $TMP ]; then
mkdir -p $TMP # location to build the source
diff --git a/source/d/strace/slack-desc b/source/d/strace/slack-desc
index 9f6d01c88..9f3c69c6f 100644
--- a/source/d/strace/slack-desc
+++ b/source/d/strace/slack-desc
@@ -1,19 +1,19 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
strace: strace (trace system calls and signals)
strace:
-strace: Strace allows you to trace the execution of a command. It runs the
+strace: Strace allows you to trace the execution of a command. It runs the
strace: specified command until it exits, intercepting signals and system
-strace: calls and dumping the information to the standard error. System
+strace: calls and dumping the information to the standard error. System
strace: administrators, diagnosticians and trouble-shooters will find it
strace: invaluable for solving problems with programs for which the source
strace: is not readily available since they do not need to be recompiled in
-strace: order to trace them.
+strace: order to trace them.
strace:
strace:
diff --git a/source/d/strace/strace.SlackBuild b/source/d/strace/strace.SlackBuild
index f4cb29727..86066a6a3 100755
--- a/source/d/strace/strace.SlackBuild
+++ b/source/d/strace/strace.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2013, 2016 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2013, 2016, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,9 +20,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=strace
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -34,6 +36,14 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i586" ]; then
@@ -46,7 +56,6 @@ else
SLKCFLAGS="-O2"
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-strace
@@ -68,7 +77,7 @@ CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--mandir=/usr/man \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
diff --git a/source/d/strace/strace.url b/source/d/strace/strace.url
new file mode 100644
index 000000000..ae9f55678
--- /dev/null
+++ b/source/d/strace/strace.url
@@ -0,0 +1,2 @@
+https://github.com/strace/strace/releases/download/v4.22/strace-4.22.tar.xz
+https://github.com/strace/strace/releases/download/v4.22/strace-4.22.tar.xz.asc
diff --git a/source/d/subversion/slack-desc b/source/d/subversion/slack-desc
index af2ef0b61..6ffc63e73 100644
--- a/source/d/subversion/slack-desc
+++ b/source/d/subversion/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,9 +11,9 @@ subversion:
subversion: Subversion is a version control system which allows you to keep old
subversion: versions of files and directories (usually source code), and keep a
subversion: log of who, when, and why changes occurred, similar to other such
-subversion: systems like CVS, RCS or SCCS. Subversion keeps all the information
+subversion: systems like CVS, RCS or SCCS. Subversion keeps all the information
subversion: to permit extracting previous versions of those files at any time.
subversion:
subversion: For more information about the Subversion project, visit:
-subversion: http://subversion.apache.org
+subversion: http://subversion.apache.org
subversion:
diff --git a/source/d/subversion/subversion.SlackBuild b/source/d/subversion/subversion.SlackBuild
index 1df803128..64eeca48b 100755
--- a/source/d/subversion/subversion.SlackBuild
+++ b/source/d/subversion/subversion.SlackBuild
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2008, 2009, 2010, 2011, 2012, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010, 2011, 2012, 2015, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,7 +20,9 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+PKGNAM=subversion
VERSION=${VERSION:-$(echo subversion-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
@@ -34,6 +36,14 @@ if [ -z "$ARCH" ]; then
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i586" ]; then
@@ -50,7 +60,6 @@ else
LIBDIRSUFFIX=""
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-subversion
@@ -81,10 +90,11 @@ CFLAGS="$SLKCFLAGS" \
--with-apr=/usr \
--with-apr-util=/usr \
--with-apxs=/usr/bin/apxs \
+ --with-lz4=internal \
--with-zlib=/usr \
--with-pic \
--with-kwallet \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
@@ -92,8 +102,8 @@ make install-tools DESTDIR=$PKG || exit 1
make install-docs DESTDIR=$PKG || exit 1
# Install python bindings
-make swig-py
-make install-swig-py DESTDIR=$PKG
+make swig-py || exit 1
+make install-swig-py DESTDIR=$PKG || exit 1
PYTHON_VER=$(python -c 'import sys; print "%d.%d" % sys.version_info[:2]')
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/python${PYTHON_VER}/site-packages
mv $PKG/usr/lib${LIBDIRSUFFIX}/svn-python/* \
@@ -101,22 +111,32 @@ mv $PKG/usr/lib${LIBDIRSUFFIX}/svn-python/* \
rmdir $PKG/usr/lib${LIBDIRSUFFIX}/svn-python
# Perl bindings
-make swig-pl-lib
-make install-swig-pl-lib DESTDIR=$PKG
+make swig-pl-lib || exit 1
+make install-swig-pl-lib DESTDIR=$PKG || exit 1
( cd subversion/bindings/swig/perl/native
perl Makefile.PL
- make install_vendor DESTDIR=$PKG
-)
+ make install_vendor DESTDIR=$PKG || exit 1
+) || exit 1
eval $(perl '-V:archlib')
mv $PKG/$archlib/perllocal.pod $PKG/$archlib/subversion.pod
# Ruby bindings
-make swig-rb
-make install-swig-rb DESTDIR=$PKG
+make swig-rb || exit 1
+make install-swig-rb DESTDIR=$PKG || exit 1
+
+# Don't ship .la files:
+rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+# Remove rpaths:
+for file in $(find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : 2> /dev/null) ; do
+ if [ ! "$(patchelf --print-rpath $file 2> /dev/null)" = "" ]; then
+ patchelf --remove-rpath $file
+ fi
+done
+
rm -rf $PKG/usr/info
# Something doesn't honor --mandir
mv $PKG/usr/share/man/man3 $PKG/usr/man
diff --git a/source/d/swig/slack-desc b/source/d/swig/slack-desc
index 189d275a2..5b41c974a 100644
--- a/source/d/swig/slack-desc
+++ b/source/d/swig/slack-desc
@@ -1,18 +1,18 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler--------------------------------------------------------|
swig: swig (Simplified Wrapper and Interface Generator)
swig:
swig: SWIG is an interface compiler that connects programs written in C and
-swig: C++ with scripting languages such as Perl, Python, Ruby, and Tcl. It
+swig: C++ with scripting languages such as Perl, Python, Ruby, and Tcl. It
swig: works by taking the declarations found in C/C++ header files and using
swig: them to generate the wrapper code that scripting languages need to
-swig: access the underlying C/C++ code. In addition, SWIG provides a variety
+swig: access the underlying C/C++ code. In addition, SWIG provides a variety
swig: of customization features that let you tailor the wrapping process to
swig: suit your application.
swig:
diff --git a/source/d/swig/swig.SlackBuild b/source/d/swig/swig.SlackBuild
index 72d3bbd29..99f78f0c3 100755
--- a/source/d/swig/swig.SlackBuild
+++ b/source/d/swig/swig.SlackBuild
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2009 Robby Workman, Northport, Alabama, USA
-# Copyright 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2009, 2010, 2011, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,9 +21,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cd $(dirname $0) ; CWD=$(pwd)
+
PKGNAM=swig
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -35,7 +37,14 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
TMP=${TMP:-/tmp}
PKG=${PKG:-$TMP/package-swig}
diff --git a/source/d/yasm/slack-desc b/source/d/yasm/slack-desc
index fc28253f2..8907db50e 100644
--- a/source/d/yasm/slack-desc
+++ b/source/d/yasm/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in. You must
-# make exactly 11 lines for the formatting to be correct. It's also
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -10,7 +10,7 @@ yasm: yasm (complete rewrite of the NASM assembler)
yasm:
yasm: Yasm is a complete rewrite of the NASM assembler under the "new" BSD
yasm: License (some portions are under other licenses, see COPYING for
-yasm: details). Yasm currently supports the x86 and AMD64 instruction sets,
+yasm: details). Yasm currently supports the x86 and AMD64 instruction sets,
yasm: accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64,
yasm: 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats,
yasm: and generates source debugging information in STABS, DWARF 2, and
diff --git a/source/d/yasm/yasm.SlackBuild b/source/d/yasm/yasm.SlackBuild
index 20c7fccd3..ae976f889 100755
--- a/source/d/yasm/yasm.SlackBuild
+++ b/source/d/yasm/yasm.SlackBuild
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
# $Id: yasm.SlackBuild,v 1.7 2009/05/12 20:24:31 root Exp root $
# Copyright (c) 2008 Eric Hameleers <alien@slackware.com>
-# Copyright 2010 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2010, 2018 Patrick Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
@@ -48,29 +48,37 @@
#
# -----------------------------------------------------------------------------
+# Where do we look for sources?
+cd $(dirname $0) ; SRCDIR=$(pwd)
+
PKGNAM=yasm
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
DOCS="ABOUT-NLS AUTHORS ChangeLog COPYING GNU_* NEWS README *.txt"
# If you want to disable python bindings, set ENABLE_PYTHON to "NO".
# Building python support requires Cython, which is not shipped with Slackware.
ENABLE_PYTHON=${ENABLE_PYTHON:-"'NO"}
-# Where do we look for sources?
-SRCDIR=$(cd $(dirname $0); pwd)
-
# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
TMP=${TMP:-/tmp/build}
PKG=$TMP/package-$PKGNAM
@@ -84,7 +92,7 @@ set -u
P1=${1:-1}
case "$ARCH" in
- i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ i586) SLKCFLAGS="-O2 -march=i586 -mtune=i686"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
s390) SLKCFLAGS="-O2"