[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#676504: pocl package now builds



After importing version 0.9 and making the attached changes to /debian, pocl builds, and appears to be functional (tested with pyopencl).

Remaining known issues:
Out-of-date symbols files (how do you get the (c++) in there?)
dpkg-shlibdeps warnings:
dh_shlibdeps -a -- --warnings=7
dpkg-shlibdeps: warning: debian/libpocl1/usr/lib/x86_64-linux-gnu/pocl/llvmopencl.so.3.0.0 contains an unresolvable reference to symbol _ZNK4llvm15ScalarEvolution10isSCEVableEPNS_4TypeE: it's probably a plugin dpkg-shlibdeps: warning: 264 other similar warnings have been skipped (use -v to see them all) dpkg-shlibdeps: warning: debian/libpocl1/usr/lib/x86_64-linux-gnu/pocl/llvmopencl.so.3.0.0 should not be linked against libgcc_s.so.1 (it uses none of the library's symbols) dpkg-shlibdeps: warning: debian/libpocl1/usr/lib/x86_64-linux-gnu/libpocl.so.1.2.0 should not be linked against libffi.so.6 (it uses none of the library's symbols) dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/libpocl1/usr/lib/x86_64-linux-gnu/pocl/llvmopencl.so.3.0.0 was not linked against libgcc_s.so.1 (it uses none of the library's symbols) dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/libpocl1/usr/lib/x86_64-linux-gnu/libpocl.so.1.2.0 was not linked against libffi.so.6 (it uses none of the library's symbols)

commit 993bed5ef33521ab7680bc110047b3d7c3888e4c
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Sat Apr 19 16:23:33 2014 +0100

    Link statically to llvm
    
    Upstream reports that not doing this can crash when used together
    with mesa llvmpipe, https://github.com/pocl/pocl/issues/46

diff --git a/debian/rules b/debian/rules
index cc775c6..6ecb62e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -32,6 +32,7 @@ export LLC_HOST_CPU=(unknown)
 override_dh_auto_configure:
 	autoreconf -vif -Wall -Wno-obsolete
 	dh_auto_configure -- --enable-icd --disable-static \
+		--enable-static-llvm \
 		LLVM_CONFIG=/usr/lib/llvm-3.4/bin/llvm-config \
 		--host=`dpkg-architecture -qDEB_HOST_GNU_TYPE` \
 		--target=`dpkg-architecture -qDEB_HOST_GNU_TYPE`

commit d5b54ec750a1be49f6065221038b5e031a00afaf
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Sat Apr 19 15:36:03 2014 +0100

    Rename libpoclu0->1 to match soname

diff --git a/debian/control b/debian/control
index 6b09772..7261e6a 100644
--- a/debian/control
+++ b/debian/control
@@ -44,7 +44,7 @@ Description: Portable OpenCL library
  .
  This package provides the core of POCL.
 
-Package: libpoclu0
+Package: libpoclu1
 Architecture: any
 Section: libs
 Multi-Arch: same
@@ -89,4 +89,4 @@ Description: debugging symbols for POCL
  target-dependent manual optimizations. A "native" target is included, which
  allows running OpenCL kernels on the host (CPU). 
  .
- This package contains the debugging symbols for libpocl1 and libpoclu0.
+ This package contains the debugging symbols for libpocl1 and libpoclu1.
diff --git a/debian/libpoclu0.install b/debian/libpoclu0.install
deleted file mode 100644
index 0f2032a..0000000
--- a/debian/libpoclu0.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/*/libpoclu.*so.*
diff --git a/debian/libpoclu0.symbols b/debian/libpoclu0.symbols
deleted file mode 100644
index 23ed5c6..0000000
--- a/debian/libpoclu0.symbols
+++ /dev/null
@@ -1,6 +0,0 @@
-libpoclu.so.0 libpoclu0 #MINVER#
- poclu_bswap_cl_float2_array@Base 0.7~rc2
- poclu_bswap_cl_float@Base 0.7~rc2
- poclu_bswap_cl_float_array@Base 0.7~rc2
- poclu_bswap_cl_int@Base 0.7~rc2
- poclu_bswap_cl_int_array@Base 0.7~rc2
diff --git a/debian/libpoclu1.install b/debian/libpoclu1.install
new file mode 100644
index 0000000..0f2032a
--- /dev/null
+++ b/debian/libpoclu1.install
@@ -0,0 +1 @@
+usr/lib/*/libpoclu.*so.*
diff --git a/debian/libpoclu1.symbols b/debian/libpoclu1.symbols
new file mode 100644
index 0000000..2fed492
--- /dev/null
+++ b/debian/libpoclu1.symbols
@@ -0,0 +1,6 @@
+libpoclu.so.1 libpoclu1 #MINVER#
+ poclu_bswap_cl_float2_array@Base 0.7~rc2
+ poclu_bswap_cl_float@Base 0.7~rc2
+ poclu_bswap_cl_float_array@Base 0.7~rc2
+ poclu_bswap_cl_int@Base 0.7~rc2
+ poclu_bswap_cl_int_array@Base 0.7~rc2

commit 940f4808e4ea874c61fc4f784cbafba4692d21d6
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Sat Apr 19 15:30:58 2014 +0100

    Update fix_linkage.patch, add -Wl,--as-needed
    
    (Not yet enough to remove all the unnecessary linkage)

diff --git a/debian/patches/fix_linkage.patch b/debian/patches/fix_linkage.patch
index 51b9299..36c13cf 100644
--- a/debian/patches/fix_linkage.patch
+++ b/debian/patches/fix_linkage.patch
@@ -1,37 +1,28 @@
 Description: remove most of superflous linkage
  Several binaries and libraries are linked with uneeded libraries. This patch
  remove most of them.
-Author: Vincent Danjean <vdanjean@debian.org>
+Author: Vincent Danjean <vdanjean@debian.org>, Rebecca Palmer
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/lib/llvmopencl/Makefile.am
 +++ b/lib/llvmopencl/Makefile.am
-@@ -25,7 +25,7 @@
- pkglib_LTLIBRARIES = llvmopencl.la
+@@ -37,7 +37,7 @@
+ AM_CXXFLAGS += -DNDEBUG
+ endif
  
- AM_CXXFLAGS = -I@top_srcdir@/fix-include -I@top_srcdir@/include `@LLVM_CONFIG@ --cxxflags`
 -AM_LDFLAGS = -module -export-dynamic -version-info ${KERNEL_COMPILER_LIB_VERSION} `@LLVM_CONFIG@ --ldflags`
 +AM_LDFLAGS = -module -export-dynamic -version-info ${KERNEL_COMPILER_LIB_VERSION} -L${LLVM_LIBDIR}
- llvmopencl_la_LIBADD = -lLLVM-${LLVM_VERSION}
- 
- llvmopencl_la_SOURCES = Barrier.h						\
---- a/tools/llvm-ld/Makefile.am
-+++ b/tools/llvm-ld/Makefile.am
-@@ -1,6 +1,6 @@
- bin_PROGRAMS = pocl-llvm-ld
- pocl_llvm_ld_SOURCES = llvm-ld.cpp Optimize.cpp
--pocl_llvm_ld_LDFLAGS = `@LLVM_CONFIG@ --ldflags`
-+pocl_llvm_ld_LDFLAGS = -L${LLVM_LIBDIR}
- pocl_llvm_ld_LDADD = -lLLVM-${LLVM_VERSION}
- pocl_llvm_ld_CXXFLAGS = `@LLVM_CONFIG@ --cxxflags`
- 
+
+ # When building in API mode, LLVM gets linked into libpocl. Linking
+ # it in here too gives "symbol redefined" errors with the standalone build.
 --- a/configure.ac
 +++ b/configure.ac
-@@ -79,6 +79,7 @@
- LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
+@@ -90,6 +90,7 @@
+ NEW_PRINTF_WORKS=true
  
  AC_SUBST([LLVM_VERSION], [$LLVM_VERSION])
 +AC_SUBST([LLVM_LIBDIR], [$LLVM_LIBDIR])
  
- AM_CONDITIONAL([LLVM_3_1], test "$LLVM_VERSION" == "3.1")
- 
+ case "$LLVM_VERSION" in
+      3.2*)
+
diff --git a/debian/rules b/debian/rules
index 0903cf2..cc775c6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,6 +16,9 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
+# Avoid unnecessary linking
+export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
+
 # Turn off subarchitecture autodetection, so the library will work on
 # machines less capable than the buildds (see README.packaging)
 # It may well be possible to have multiple subarchitectures via hwcaps, but

commit f7f4d0427f993e0a945226340c8ab76c36786c78
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Sat Apr 19 15:28:51 2014 +0100

    Make ICD depend on an ICD loader

diff --git a/debian/control b/debian/control
index 525048d..6b09772 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,7 @@ Architecture: any
 Provides: opencl-icd
 Section: libs
 Multi-Arch: same
-Depends: ${misc:Depends}, libpocl1
+Depends: ${misc:Depends}, libpocl1, ocl-icd-libopencl1 | libopencl1
 Description: pocl ICD
  Portable OpenCL is an open source implementation of the OpenCL standard which
  can be easily adapted for new targets. One of the goals of the project is

commit f6dd53a32b50ea421d84889bd7cc937b6e86dd25
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Sat Apr 19 13:19:55 2014 +0100

    Disable CPU autodetection

diff --git a/debian/rules b/debian/rules
index e3c713a..0903cf2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,11 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
-
+# Turn off subarchitecture autodetection, so the library will work on
+# machines less capable than the buildds (see README.packaging)
+# It may well be possible to have multiple subarchitectures via hwcaps, but
+# timing the test suite suggests a speed difference of only ~20% (on amd64)
+export LLC_HOST_CPU=(unknown)
 %:
 	dh $@  --with autotools-dev --parallel
 
@@ -25,7 +29,9 @@ export DH_OPTIONS
 override_dh_auto_configure:
 	autoreconf -vif -Wall -Wno-obsolete
 	dh_auto_configure -- --enable-icd --disable-static \
-		LLVM_CONFIG=/usr/lib/llvm-3.4/bin/llvm-config
+		LLVM_CONFIG=/usr/lib/llvm-3.4/bin/llvm-config \
+		--host=`dpkg-architecture -qDEB_HOST_GNU_TYPE` \
+		--target=`dpkg-architecture -qDEB_HOST_GNU_TYPE`
 
 override_dh_shlibdeps:
 	dh_shlibdeps -a -- --warnings=7

commit 8d7b49b62d5ab2dbc9130553a915ee9ee3c1c8ec
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Fri Apr 18 19:16:36 2014 +0100

    add missing dependencies
    
    needs /usr/bin/clang, /usr/lib/llvm-3.4/bin/llc to avoid
    python3: common.c:101: llvm_codegen: Assertion `error == 0' failed.

diff --git a/debian/control b/debian/control
index c112378..525048d 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,7 @@ Architecture: any
 Provides: opencl-icd
 Section: libs
 Multi-Arch: same
-Depends: ${misc:Depends}
+Depends: ${misc:Depends}, libpocl1
 Description: pocl ICD
  Portable OpenCL is an open source implementation of the OpenCL standard which
  can be easily adapted for new targets. One of the goals of the project is
@@ -34,7 +34,7 @@ Architecture: any
 Section: libs
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, clang-3.4, llvm-3.4-dev
 Description: Portable OpenCL library
  Portable OpenCL is an open source implementation of the OpenCL standard which
  can be easily adapted for new targets. One of the goals of the project is

commit 3558b9ca079009d1244b8ad27eb9e27ce96f27a9
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Fri Apr 18 18:28:32 2014 +0100

    Don't try to install files that no longer exist

diff --git a/debian/libpocl-dev.install b/debian/libpocl-dev.install
index 1fca753..c065c18 100644
--- a/debian/libpocl-dev.install
+++ b/debian/libpocl-dev.install
@@ -1,5 +1,3 @@
 usr/include/poclu.h
-usr/include/pocl/pocl_device.h
-usr/include/pocl/pocl.h
 usr/lib/*/*.so
 usr/lib/*/pkgconfig
diff --git a/debian/libpocl1.install b/debian/libpocl1.install
index 1c37223..2b2fc8e 100644
--- a/debian/libpocl1.install
+++ b/debian/libpocl1.install
@@ -2,5 +2,3 @@ usr/lib/*/pocl
 usr/lib/*/libpocl.*so.*
 usr/share/pocl
 usr/bin
-usr/include/pocl/_kernel.h
-usr/include/pocl/*/types.h

commit f6928c32a3be1554762f89dbf9c3e185f67fafa5
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Fri Apr 18 18:26:48 2014 +0100

    Add libclang, switch to 3.4 (matching mesa)

diff --git a/debian/control b/debian/control
index fb06595..c112378 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders: Vincent Danjean <vdanjean@debian.org>,
 Build-Depends: debhelper (>= 9~), autotools-dev, autoconf, dh-autoreconf,
  pkg-config, libhwloc-dev, libltdl-dev, mesa-common-dev,
  ocl-icd-dev (>=1.3-3), ocl-icd-libopencl1 (>=1.3-3), ocl-icd-opencl-dev,
- clang, llvm-3.2-dev
+ clang-3.4, libclang-3.4-dev, llvm-3.4-dev
 Standards-Version: 3.9.3
 Homepage: https://launchpad.net/pocl
 Vcs-Git: git://git.debian.org/collab-maint/pocl.git
diff --git a/debian/rules b/debian/rules
index 6ab01c6..e3c713a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,7 +25,7 @@ export DH_OPTIONS
 override_dh_auto_configure:
 	autoreconf -vif -Wall -Wno-obsolete
 	dh_auto_configure -- --enable-icd --disable-static \
-		LLVM_CONFIG=/usr/bin/llvm-config-3.2
+		LLVM_CONFIG=/usr/lib/llvm-3.4/bin/llvm-config
 
 override_dh_shlibdeps:
 	dh_shlibdeps -a -- --warnings=7

commit d798b6cd31ac1d5400a4421debde26bb1d995694
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Fri Apr 18 14:12:15 2014 +0100

    Drop patches now included upstream.
    
    fix_script_path = 15e7bb0df555acd89706ef3f492fb824a76ef893
    backport-install-fix = f7f9526833e18d8f01451aac1614e3eb7c773da1

diff --git a/debian/patches/backport-install-fix.patch b/debian/patches/backport-install-fix.patch
deleted file mode 100644
index ed779ed..0000000
--- a/debian/patches/backport-install-fix.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Backporting some install fix from upstream
---- a/include/Makefile.am
-+++ b/include/Makefile.am
-@@ -22,8 +22,8 @@
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- # THE SOFTWARE.
- 
--pkginclude_HEADERS = pocl.h _kernel.h pocl_device.h utlist.h \
--	poclu.h
-+pkginclude_HEADERS = pocl.h _kernel.h pocl_device.h
-+
- # The sort command (also) removes duplicate entries which might appear 
- # due to @TARGET@ and/or @HOST@ being one of the manually defined 
- # targets. 
-@@ -36,6 +36,9 @@
- 
- include_HEADERS = poclu.h
- 
--EXTRA_DIST = types.host.in types.target.in
-+# utlist.h is a header only utility lib for linked list
-+# handling. Needs to be included in the source package but
-+# should not be installed.
-+EXTRA_DIST = utlist.h types.host.in types.target.in
- 
- SUBDIRS = CL OpenCL
diff --git a/debian/patches/fix_script_path.patch b/debian/patches/fix_script_path.patch
deleted file mode 100644
index 6c7d9e8..0000000
--- a/debian/patches/fix_script_path.patch
+++ /dev/null
@@ -1,577 +0,0 @@
-Fix to the script search logic and move internal tools out of bindir.
-
-Search from the BUILDDIR only if env POCL_BUILDING is
-defined. Otherwise search from PKGDATADIR first, then
-from the PATH.
---- a/scripts/pocl-build.in
-+++ b/scripts/pocl-build.in
-@@ -62,11 +62,13 @@
- 
- preprocessed_file=${output_file}.i
- 
--if [ -f @abs_top_srcdir@/include/_kernel.h ]
--then 
--    @CLANG@ ${EXTRA_CPPFLAGS} ${USER_OPTIONS} ${CLANG_FLAGS} @CLFLAGS@ -E -I@abs_top_builddir@ -include @abs_top_builddir@/include/${target_dir}/types.h -include @abs_top_srcdir@/include/_kernel.h -o ${preprocessed_file} -x cl $1
--else
--    @CLANG@ ${EXTRA_CPPFLAGS} ${USER_OPTIONS} ${CLANG_FLAGS} @CLFLAGS@ -E -include @pkgincludedir@/${target_dir}/types.h -include @pkgincludedir@/_kernel.h -o ${preprocessed_file} -x cl $1
-+# BEGIN REMOVE ONCE INSTALLED
-+@CLANG@ ${EXTRA_CPPFLAGS} ${USER_OPTIONS} ${CLANG_FLAGS} @CLFLAGS@ -E -I@abs_top_builddir@ -include @abs_top_builddir@/include/${target_dir}/types.h -include @abs_top_srcdir@/include/_kernel.h -o ${preprocessed_file} -x cl $1
-+if false ; then
-+# END REMOVE ONCE INSTALLED
-+@CLANG@ ${EXTRA_CPPFLAGS} ${USER_OPTIONS} ${CLANG_FLAGS} @CLFLAGS@ -E -include @pkgincludedir@/${target_dir}/types.h -include @pkgincludedir@/_kernel.h -o ${preprocessed_file} -x cl $1
-+# BEGIN REMOVE ONCE INSTALLED
- fi
-+# END REMOVE ONCE INSTALLED
- 
- @CLANG@ ${CLANG_FLAGS} @CLFLAGS@ -c -emit-llvm -o ${output_file} -x cl ${preprocessed_file}
---- a/scripts/pocl-kernel.in
-+++ b/scripts/pocl-kernel.in
-@@ -52,12 +52,14 @@
- 
- rm -f ${header}
- 
--if [ -f @abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so ]
--then
--    @OPT@ -load=@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so -break-constgeps -generate-header -kernel=${kernel} -header=${header} -disable-output $1
--else
--    @OPT@ -load=@pkglibdir@/llvmopencl.so -break-constgeps -generate-header -kernel=${kernel} -header=${header} -disable-output $1
-+# BEGIN REMOVE ONCE INSTALLED
-+@OPT@ -load=@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so -break-constgeps -generate-header -kernel=${kernel} -header=${header} -disable-output $1
-+if false ; then
-+# END REMOVE ONCE INSTALLED
-+@OPT@ -load=@pkglibdir@/llvmopencl.so -break-constgeps -generate-header -kernel=${kernel} -header=${header} -disable-output $1
-+# BEGIN REMOVE ONCE INSTALLED
- fi
-+# END REMOVE ONCE INSTALLED
- 
- @CLANG@ @HOST_CLANG_FLAGS@ -c -o ${output_file}.o -x c - <<EOF
- #include "${header}"
---- a/scripts/pocl-workgroup.in
-+++ b/scripts/pocl-workgroup.in
-@@ -79,27 +79,28 @@
-   x86_64-*)    target_dir="x86_64";;
- esac
- 
--llvm_ld="pocl-llvm-ld"
--if [ -f @abs_top_builddir@/tools/llvm-ld/pocl-llvm-ld ]
--then
--  llvm_ld="@abs_top_builddir@/tools/llvm-ld/pocl-llvm-ld"
--fi
--
--if [ -f @abs_top_builddir@/lib/kernel/${target_dir}/libkernel.a ]
--then
--    ${llvm_ld} --disable-opt -o ${linked_out} -b ${linked_bc} $1 -L@abs_top_builddir@/lib/kernel/${target_dir} -lkernel
--else
--    ${llvm_ld} --disable-opt -o ${linked_out} -b ${linked_bc} $1 -L@pkglibdir@/${target_dir} -lkernel
--fi
-+llvm_ld="@pkglibexecdir@/pocl-llvm-ld"
-+# BEGIN REMOVE ONCE INSTALLED
-+# Fixing llvm_ld until the script is installed
-+llvm_ld="@abs_top_builddir@/tools/llvm-ld/pocl-llvm-ld"
-+# END REMOVE ONCE INSTALLED
-+
-+full_target_dir="@pkglibdir@/${target_dir}"
-+# BEGIN REMOVE ONCE INSTALLED
-+# Fixing full_target_dir until the script is installed
-+full_target_dir="@abs_top_builddir@/lib/kernel/${target_dir}"
-+# END REMOVE ONCE INSTALLED
-+
-+${llvm_ld} --disable-opt -o ${linked_out} -b ${linked_bc} $1 -L"$full_target_dir" -lkernel
- rm ${linked_out}
- 
- header="`dirname $1`/`basename $1 .bc`_header.h"
- 
- pocl_lib=@pkglibdir@/llvmopencl.so
--if [ -f @abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so ]
--then
--    pocl_lib=@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so
--fi
-+# BEGIN REMOVE ONCE INSTALLED
-+# Fixing pocl_lib until the script is installed
-+pocl_lib=@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so
-+# END REMOVE ONCE INSTALLED
- 
- OPT_SWITCH="-O3"
- 
---- a/scripts/Makefile.am
-+++ b/scripts/Makefile.am
-@@ -22,7 +22,8 @@
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- # THE SOFTWARE.
- 
--bin_SCRIPTS = pocl-build pocl-kernel pocl-workgroup pocl-standalone
-+bin_SCRIPTS = pocl-standalone
-+pkgdata_SCRIPTS = pocl-build pocl-kernel pocl-workgroup
- CLEANFILES = pocl-build pocl-kernel pocl-workgroup pocl-standalone
- EXTRA_DIST = pocl-build.in pocl-kernel.in pocl-workgroup.in pocl-standalone.in
- 
-@@ -30,6 +31,7 @@
-                -e 's,[@]abs_top_builddir[@],$(abs_top_builddir),g'	\
-                -e 's,[@]pkgincludedir[@],$(pkgincludedir),g'		\
-                -e 's,[@]pkglibdir[@],$(pkglibdir),g'			\
-+               -e 's,[@]pkglibexecdir[@],$(pkglibexecdir),g'		\
-                -e 's,[@]CLANG[@],$(CLANG),g'				\
-                -e 's,[@]CLFLAGS[@],$(CLFLAGS),g'			\
-                -e 's,[@]TARGET[@],$(TARGET),g'	\
-@@ -42,18 +44,22 @@
-                -e 's,[@]LLC[@],$(LLC),g' \
-                -e 's,[@]LLVM_VERSION[@],$(LLVM_VERSION),g' 
- 
--pocl-build: pocl-build.in Makefile
-+pocl-build pocl-kernel pocl-workgroup pocl-standalone: %: %.in Makefile ../install-paths.h
- 	$(do_subst) < $< > $@
- 	chmod +x $@
- 
--pocl-kernel: pocl-kernel.in Makefile
--	$(do_subst) < $< > $@
--	chmod +x $@
--
--pocl-workgroup: pocl-workgroup.in Makefile
--	$(do_subst) < $< > $@
--	chmod +x $@
--
--pocl-standalone: pocl-standalone.in Makefile
--	$(do_subst) < $< > $@
--	chmod +x $@
-\ No newline at end of file
-+install-exec-hook: $(bin_SCRIPTS)
-+	for f in $(bin_SCRIPTS) ; do \
-+		sed -e '/^# BEGIN REMOVE ONCE INSTALLED$$/,/^# END REMOVE ONCE INSTALLED$$/d' \
-+			> "$(DESTDIR)$(bindir)/$$f" \
-+			< "$$f" && \
-+		chmod +x "$(DESTDIR)$(bindir)/$$f" ; \
-+	done
-+
-+install-data-hook: $(pkgdata_SCRIPTS)
-+	for f in $(pkgdata_SCRIPTS) ; do \
-+		sed -e '/^# BEGIN REMOVE ONCE INSTALLED$$/,/^# END REMOVE ONCE INSTALLED$$/d' \
-+			> "$(DESTDIR)$(pkgdatadir)/$$f" \
-+			< "$$f" && \
-+		chmod +x "$(DESTDIR)$(pkgdatadir)/$$f" ; \
-+	done
---- a/scripts/pocl-standalone.in
-+++ b/scripts/pocl-standalone.in
-@@ -82,44 +82,34 @@
- 
- kernel_bc="${tempdir}/kernel.bc"
- 
--if [ -f @abs_top_srcdir@/include/_kernel.h ]
--then 
--    @CLANG@ ${CLANG_FLAGS} $EXTRA_CLANG_FLAGS -c -emit-llvm -I@abs_top_builddir@ -include @abs_top_builddir@/include/${target_dir}/types.h -include @abs_top_srcdir@/include/_kernel.h -o ${kernel_bc} -x cl $1
--else
--    @CLANG@ ${CLANG_FLAGS} $EXTRA_CLANG_FLAGS -c -emit-llvm  -include @pkgincludedir@/${target_dir}/types.h -include @pkgincludedir@/_kernel.h -o ${kernel_bc} -x cl $1
--fi
--
-+# BEGIN REMOVE ONCE INSTALLED
-+@CLANG@ ${CLANG_FLAGS} $EXTRA_CLANG_FLAGS -c -emit-llvm -I@abs_top_builddir@ -include @abs_top_builddir@/include/${target_dir}/types.h -include @abs_top_srcdir@/include/_kernel.h -o ${kernel_bc} -x cl $1
- rm -f ${header}
--
--if [ -f @abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so ]
--then
--    @OPT@ -load=@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so -generate-header -disable-output -header=${header} ${kernel_bc}
--else
--    @OPT@ -load=@pkglibdir@/llvmopencl.so -generate-header -disable-output -header=${header} ${kernel_bc}
-+@OPT@ -load=@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so -generate-header -disable-output -header=${header} ${kernel_bc}
-+if false ; then
-+# END REMOVE ONCE INSTALLED
-+@CLANG@ ${CLANG_FLAGS} $EXTRA_CLANG_FLAGS -c -emit-llvm  -include @pkgincludedir@/${target_dir}/types.h -include @pkgincludedir@/_kernel.h -o ${kernel_bc} -x cl $1
-+rm -f ${header}
-+@OPT@ -load=@pkglibdir@/llvmopencl.so -generate-header -disable-output -header=${header} ${kernel_bc}
-+# BEGIN REMOVE ONCE INSTALLED
- fi
-+# END REMOVE ONCE INSTALLED
- 
- linked_bc="${tempdir}/linked.bc"
- linked_out="${linked_bc}.out"
--llvm_ld="pocl-llvm-ld"
--if [ -f @abs_top_builddir@/tools/llvm-ld/pocl-llvm-ld ]
--then
--  llvm_ld="@abs_top_builddir@/tools/llvm-ld/pocl-llvm-ld"
--fi
-+llvm_ld="@pkglibexecdir@/pocl-llvm-ld"
-+pocl_lib="@pkglibdir@/llvmopencl.so"
-+full_target_dir="@abs_top_builddir@/lib/kernel/${target_dir}"
-+# BEGIN REMOVE ONCE INSTALLED
-+# Fixing variables until the script is installed
-+llvm_ld="@abs_top_builddir@/tools/llvm-ld/pocl-llvm-ld"
-+pocl_lib="@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so"
-+full_target_dir="@pkglibdir@/${target_dir}"
-+# END REMOVE ONCE INSTALLED
- 
--if [ -f @abs_top_builddir@/lib/kernel/${target_dir}/libkernel.a ]
--then
--    ${llvm_ld} --disable-opt -o ${linked_out} -b ${linked_bc} ${kernel_bc} -L@abs_top_builddir@/lib/kernel/${target_dir} -lkernel
--else
--    ${llvm_ld} --disable-opt -o ${linked_out} -b ${linked_bc} ${kernel_bc} -L@pkglibdir/@${target_dir}} -lkernel
--fi
-+${llvm_ld} --disable-opt -o ${linked_out} -b ${linked_bc} ${kernel_bc} -L"$full_target_dir" -lkernel
- rm ${linked_out}
- 
--pocl_lib=@pkglibdir@/llvmopencl.so
--if [ -f @abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so ]
--then
--    pocl_lib=@abs_top_builddir@/lib/llvmopencl/.libs/llvmopencl.so
--fi
--
- OPT_SWITCH="-O3"
- 
- if test "x$POCL_KERNEL_COMPILER_OPT_SWITCH" != "x";
---- a/configure.ac
-+++ b/configure.ac
-@@ -733,9 +733,6 @@
-   fi
- fi
- 
--AC_DEFINE_UNQUOTED([POCL_INSTALLATION_ROOT],["$prefix"],[The installation directory])
--AC_DEFINE_UNQUOTED([POCL_INSTALLED_DATA],["$prefix/share/pocl"],[The installation directory])
--AC_SUBST([POCL_INSTALLED_DATA], $prefix/share/pocl)
- AC_DEFINE_UNQUOTED([LLVM_LD], ["pocl-llvm-ld"],[LLVM linker binary])
- AC_SUBST([LLVM_LD], [pocl-llvm-ld])
- 
---- a/lib/CL/clBuildProgram.c
-+++ b/lib/CL/clBuildProgram.c
-@@ -22,6 +22,7 @@
- */
- 
- #include "pocl_cl.h"
-+#include "install-paths.h"
- #include <assert.h>
- #include <string.h>
- #include <unistd.h>
-@@ -117,6 +118,13 @@
- 
-       fclose(source_file);
- 
-+      if (getenv("POCL_BUILDING") != NULL)
-+        pocl_build_script = BUILDDIR "/scripts/" POCL_BUILD;
-+      else if (access(PKGDATADIR "/" POCL_BUILD, X_OK) == 0)
-+        pocl_build_script = PKGDATADIR "/" POCL_BUILD;
-+      else
-+        pocl_build_script = POCL_BUILD;
-+
-       /* Build the fully linked non-parallel bitcode for all
-          devices. */
-       for (device_i = 0; device_i < real_num_devices; ++device_i)
-@@ -130,11 +138,6 @@
-             (binary_file_name, POCL_FILENAME_LENGTH, "%s/%s", 
-              device_tmpdir, POCL_PROGRAM_BC_FILENAME);
- 
--          if (access(BUILDDIR "/scripts/" POCL_BUILD, X_OK) == 0)
--            pocl_build_script = BUILDDIR "/scripts/" POCL_BUILD;
--          else
--            pocl_build_script = POCL_BUILD;
--          
-           if (real_device_list[device_i]->llvm_target_triplet != NULL)
-             {
-               error = snprintf(command, COMMAND_LENGTH,
---- a/lib/CL/clCreateKernel.c
-+++ b/lib/CL/clCreateKernel.c
-@@ -23,6 +23,7 @@
- */
- 
- #include "pocl_cl.h"
-+#include "install-paths.h"
- #include <string.h>
- #include <unistd.h>
- #include <sys/stat.h>
-@@ -41,12 +42,12 @@
-   FILE *binary_file;
-   size_t n;
-   char descriptor_filename[POCL_FILENAME_LENGTH];
--  struct stat buf;
-   char command[COMMAND_LENGTH];
-   int error;
-   lt_dlhandle dlhandle = NULL;
-   int i;
-   int device_i;
-+  char* pocl_kernel_fmt;
-   
-   if (program == NULL || program->num_devices == 0)
-     POCL_ERROR(CL_INVALID_PROGRAM);
-@@ -60,6 +61,13 @@
- 
-   POCL_INIT_OBJECT (kernel);
- 
-+  if (getenv("POCL_BUILDING") != NULL)
-+    pocl_kernel_fmt = BUILDDIR "/scripts/" POCL_KERNEL " -k %s -t %s -o %s %s";
-+  else if (access(PKGDATADIR "/" POCL_KERNEL, X_OK) == 0)
-+    pocl_kernel_fmt = PKGDATADIR "/" POCL_KERNEL " -k %s -t %s -o %s %s";
-+  else
-+    pocl_kernel_fmt = POCL_KERNEL " -k %s -t %s -o %s %s";
-+
-   for (device_i = 0; device_i < program->num_devices; ++device_i)
-     {
-       if (device_i > 0)
-@@ -99,20 +107,12 @@
-       if (error < 0)
-         POCL_ERROR(CL_OUT_OF_HOST_MEMORY);
- 
--      if (stat(BUILDDIR "/scripts/" POCL_KERNEL, &buf) == 0)
--        error = snprintf(command, COMMAND_LENGTH,
--                         BUILDDIR "/scripts/" POCL_KERNEL " -k %s -t %s -o %s %s",
--                         kernel_name,
--                         program->devices[device_i]->llvm_target_triplet,
--                         descriptor_filename,
--                         binary_filename);
--      else
--        error = snprintf(command, COMMAND_LENGTH,
--                         POCL_KERNEL " -k %s -t %s -o %s %s",
--                         kernel_name,
--                         program->devices[device_i]->llvm_target_triplet,
--                         descriptor_filename,
--                         binary_filename);
-+      error = snprintf(command, COMMAND_LENGTH,
-+                       pocl_kernel_fmt,
-+                       kernel_name,
-+                       program->devices[device_i]->llvm_target_triplet,
-+                       descriptor_filename,
-+                       binary_filename);
-       if (error < 0)
-         POCL_ERROR(CL_OUT_OF_HOST_MEMORY);
- 
---- a/lib/CL/devices/basic/basic.c
-+++ b/lib/CL/devices/basic/basic.c
-@@ -24,6 +24,7 @@
- 
- #include "basic.h"
- #include "cpuinfo.h"
-+#include "install-paths.h"
- 
- #include <assert.h>
- #include <string.h>
-@@ -31,7 +32,6 @@
- #include <unistd.h>
- #include <../dev_image.h>
- #include <sys/time.h>
--#include <sys/stat.h>
- 
- #define max(a,b) (((a) > (b)) ? (a) : (b))
- 
-@@ -157,13 +157,14 @@
-   if ( access (module, F_OK) != 0)
-     {
-       char *llvm_ld;
--      struct stat st;
-       error = snprintf (bytecode, POCL_FILENAME_LENGTH,
-                         "%s/linked.bc", tmpdir);
-       assert (error >= 0);
-       
--      if (stat( BUILDDIR "/tools/llvm-ld/pocl-llvm-ld", &st) == 0) 
-+      if (getenv("POCL_BUILDING") != NULL)
-         llvm_ld = BUILDDIR "/tools/llvm-ld/pocl-llvm-ld";
-+      else if (access(PKGLIBEXECDIR "/pocl-llvm-ld", X_OK) == 0)
-+        llvm_ld = PKGLIBEXECDIR "/pocl-llvm-ld";
-       else
-         llvm_ld = "pocl-llvm-ld";
- 
---- a/lib/CL/devices/cellspu/cellspu.c
-+++ b/lib/CL/devices/cellspu/cellspu.c
-@@ -22,13 +22,13 @@
- */
- 
- #include "cellspu.h"
-+#include "install-paths.h"
- #include <assert.h>
- #include <string.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <../dev_image.h>
- #include <sys/time.h>
--#include <sys/stat.h>
- 
- #include <libspe2.h>
- #include "pocl_device.h"
-@@ -205,13 +205,14 @@
-   if ( access (module, F_OK) != 0)
-     {
-       char *llvm_ld;
--      struct stat st;
-       error = snprintf (bytecode, POCL_FILENAME_LENGTH,
-                         "%s/linked.bc", tmpdir);
-       assert (error >= 0);
-       
--      if (stat( BUILDDIR "/tools/llvm-ld/pocl-llvm-ld", &st) == 0) 
-+      if (getenv("POCL_BUILDING") != NULL)
-         llvm_ld = BUILDDIR "/tools/llvm-ld/pocl-llvm-ld";
-+      else if (access(PKGLIBEXECDIR "/pocl-llvm-ld", X_OK) == 0)
-+        llvm_ld = PKGLIBEXECDIR "/pocl-llvm-ld";
-       else
-         llvm_ld = "pocl-llvm-ld";
- 
---- a/lib/CL/devices/pthread/pthread.c
-+++ b/lib/CL/devices/pthread/pthread.c
-@@ -23,13 +23,13 @@
- */
- 
- #include "pocl-pthread.h"
-+#include "install-paths.h"
- #include <assert.h>
- #include <pthread.h>
- #include <string.h>
- #include <stdlib.h>
- #include <errno.h>
- #include <unistd.h>
--#include <sys/stat.h>
- #include "utlist.h"
- 
- #include "config.h"
-@@ -483,15 +483,17 @@
-   if (access (module, F_OK) != 0)
-     {
-       char *llvm_ld;
--      struct stat st;
-       error = snprintf (bytecode, POCL_FILENAME_LENGTH,
-                         "%s/linked.bc", tmpdir);
-       assert (error >= 0);
-       
--      if (stat( BUILDDIR "/tools/llvm-ld/pocl-llvm-ld", &st) == 0) 
-+      if (getenv("POCL_BUILDING") != NULL)
-         llvm_ld = BUILDDIR "/tools/llvm-ld/pocl-llvm-ld";
-+      else if (access(PKGLIBEXECDIR "/pocl-llvm-ld", X_OK) == 0)
-+        llvm_ld = PKGLIBEXECDIR "/pocl-llvm-ld";
-       else
-         llvm_ld = "pocl-llvm-ld";
-+
-       error = snprintf (command, COMMAND_LENGTH,
- 			"%s --disable-opt -link-as-library -o %s %s/%s",
-                         llvm_ld, bytecode, tmpdir, POCL_PARALLEL_BC_FILENAME);
---- a/lib/CL/devices/tce/Makefile.am
-+++ b/lib/CL/devices/tce/Makefile.am
-@@ -33,9 +33,5 @@
- -I$(top_srcdir)/lib/CL/devices -I$(top_srcdir)/lib/CL/devices/tce \
- -I$(top_srcdir)/lib/CL
- 
--libpocl_devices_tce_ladir = ${datadir}
--libpocl_devices_tce_la_DATA = tta_device_main.c
--dist_data_DATA = tta_device_main.c
--
--datadir = @POCL_INSTALLED_DATA@
-+dist_pkgdata_DATA = tta_device_main.c
- 
---- a/tools/llvm-ld/Makefile.am
-+++ b/tools/llvm-ld/Makefile.am
-@@ -1,4 +1,4 @@
--bin_PROGRAMS = pocl-llvm-ld
-+pkglibexec_PROGRAMS = pocl-llvm-ld
- pocl_llvm_ld_SOURCES = llvm-ld.cpp Optimize.cpp
- pocl_llvm_ld_LDFLAGS = -L${LLVM_LIBDIR}
- pocl_llvm_ld_LDADD = -lLLVM-${LLVM_VERSION}
---- a/lib/CL/devices/tce/tce_common.cc
-+++ b/lib/CL/devices/tce/tce_common.cc
-@@ -24,9 +24,9 @@
- #include "pocl_util.h"
- 
- #include "config.h"
-+#include "install-paths.h"
- 
- #include <unistd.h>
--#include <sys/stat.h>
- 
- /* Supress some warnings because of including tce_config.h after pocl's config.h. */
- #undef PACKAGE
-@@ -257,12 +257,14 @@
-   if (access (assemblyFileName.c_str(), F_OK) != 0)
-     {
-       char *llvm_ld;
--      struct stat st;
-       error = snprintf (bytecode, POCL_FILENAME_LENGTH,
-                         "%s/linked.bc", cmd->command.run.tmp_dir);
-       assert (error >= 0);
--      if (stat( BUILDDIR "/tools/llvm-ld/pocl-llvm-ld", &st) == 0) 
-+
-+      if (getenv("POCL_BUILDING") != NULL)
-         llvm_ld = BUILDDIR "/tools/llvm-ld/pocl-llvm-ld";
-+      else if (access(PKGLIBEXECDIR "/pocl-llvm-ld", X_OK) == 0)
-+        llvm_ld = PKGLIBEXECDIR "/pocl-llvm-ld";
-       else
-         llvm_ld = "pocl-llvm-ld";
- 
-@@ -278,10 +280,12 @@
-       
-       std::string deviceMainSrc = "";
- 
--      if (access (BUILDDIR "/lib/CL/devices/tce/tta_device_main.c", R_OK) == 0)
-+      if (getenv("POCL_BUILDING") != NULL)
-         deviceMainSrc = BUILDDIR "/lib/CL/devices/tce/tta_device_main.c";
--      else
--        deviceMainSrc = POCL_INSTALLED_DATA "/tta_device_main.c";
-+      else {
-+	assert(access(PKGDATADIR "/tta_device_main.c", R_OK) == 0);
-+        deviceMainSrc = PKGDATADIR "/tta_device_main.c";
-+      }
-      
-       std::string kernelObjSrc = "";
-       kernelObjSrc += cmd->command.run.tmp_dir;
---- a/lib/CL/clEnqueueNDRangeKernel.c
-+++ b/lib/CL/clEnqueueNDRangeKernel.c
-@@ -24,6 +24,7 @@
- 
- #include "pocl_cl.h"
- #include "utlist.h"
-+#include "install-paths.h"
- #include <assert.h>
- #include <sys/stat.h>
- #include <unistd.h>
-@@ -55,7 +56,6 @@
-   char parallel_filename[POCL_FILENAME_LENGTH];
-   size_t n;
-   int i, count;
--  struct stat buf;
-   char command[COMMAND_LENGTH];
-   int error;
-   struct pocl_context pc;
-@@ -207,8 +207,10 @@
-   if (access (parallel_filename, F_OK) != 0) 
-     {
- 
--      if (stat(BUILDDIR "/scripts/" POCL_WORKGROUP, &buf) == 0)
-+      if (getenv("POCL_BUILDING") != NULL)
-         pocl_wg_script = BUILDDIR "/scripts/" POCL_WORKGROUP;
-+      else if (access(PKGDATADIR "/" POCL_WORKGROUP, X_OK) == 0)
-+        pocl_wg_script = PKGDATADIR "/" POCL_WORKGROUP;
-       else
-         pocl_wg_script = POCL_WORKGROUP;
- 
---- a/tests/atlocal.in
-+++ b/tests/atlocal.in
-@@ -2,4 +2,7 @@
- OCL_ICD_VENDORS="@abs_top_builddir@/ocl-vendors"
- export OCL_ICD_VENDORS
- 
-+POCL_BUILDING=1
-+export POCL_BUILDING
-+
- POAT_TESTSUITES="@POAT_TESTSUITES@"
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -29,6 +29,21 @@
- pkgconfigdir = $(libdir)/pkgconfig
- pkgconfig_DATA = pocl.pc
- 
-+BUILT_SOURCES = install-paths.h
-+CLEANFILES = install-paths.h
-+# Always rebuild install-paths.h as paths can be changed at each make invocation
-+.PHONY: install-paths.h
-+install-paths.h:
-+	echo "#define PKGDATADIR \"${pkgdatadir}\"" > $@.new
-+	echo "#define PKGLIBEXECDIR \"${pkglibexecdir}\"" >> $@.new
-+	@if cmp --quiet $@.new $@ ; then \
-+		: "Paths not changed" ;\
-+		$(RM) $@.new ;\
-+	else \
-+		echo "New paths, updating $@" ;\
-+		mv $@.new $@ ;\
-+	fi
-+
- if BUILD_ICD
- icddir = $(sysconfdir)/OpenCL/vendors/
- icd_DATA = pocl.icd
-@@ -37,7 +52,7 @@
- 	$(do_subst) < $(srcdir)/pocl.icd.in > $(builddir)/pocl.icd
- .PHONY: pocl.icd
- 
--CLEANFILES = pocl.icd
-+CLEANFILES += pocl.icd
- endif
- 
- EXTRA_DIST = config/xclang doc/envs.txt tools/data/test_machine.adf \
diff --git a/debian/patches/series b/debian/patches/series
index 27f53ea..2fb3768 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1 @@
 fix_linkage.patch
-fix_script_path.patch
-backport-install-fix.patch

commit 2d24d6b3df0fcd908504ff5c2a22c2a6ea6f906d
Author: Rebecca Palmer <R.Palmer@bham.ac.uk>
Date:   Fri Apr 18 13:28:19 2014 +0100

    set pkg-opencl-devel list as maintainer; update version number
    
    http://lists.alioth.debian.org/pipermail/pkg-opencl-devel/Week-of-Mon-20140203/000081.html

diff --git a/debian/changelog b/debian/changelog
index 323ca9c..022ece2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,5 @@
-pocl (0.7-1) unstable; urgency=low
+pocl (0.9-1) UNRELEASED; urgency=low
 
   * Initial release. (Closes: #676504: ITP: pocl -- Portable OpenCL)
 
- -- Vincent Danjean <vdanjean@debian.org>  Wed, 09 Jan 2013 16:22:22 +0100
+ -- Rebecca Palmer <R.Palmer@bham.ac.uk>  Fri, 18 Apr 2014 13:14:31 +0100
diff --git a/debian/control b/debian/control
index bd10101..fb06595 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,9 @@
 Source: pocl
 Section: devel
 Priority: extra
-Maintainer: Vincent Danjean <vdanjean@debian.org>
+Maintainer: Debian OpenCL Maintainers <pkg-opencl-devel@lists.alioth.debian.org>
+Uploaders: Vincent Danjean <vdanjean@debian.org>,
+ Rebecca Palmer <R.Palmer@bham.ac.uk>
 Build-Depends: debhelper (>= 9~), autotools-dev, autoconf, dh-autoreconf,
  pkg-config, libhwloc-dev, libltdl-dev, mesa-common-dev,
  ocl-icd-dev (>=1.3-3), ocl-icd-libopencl1 (>=1.3-3), ocl-icd-opencl-dev,

Reply to: