debian: Include SPIR-V (*.spv) outputs in libclc package

This adds the following to the libclc-12 package:

/usr/lib/clc/spirv64-mesa3d-.spv
/usr/lib/clc/spirv-mesa3d-.spv

Since Debian buster & Ubuntu 18.04 don't have the llvm-spirv package,
they cannot support this feature. Therefore, as suggested by tjaalton,
we make the control Build-Depends for spirv dependencies include
"| hello".

This causes the simple "hello world" package to be installed on these
older distros, which is small and unrelated to llvm. Then, in
debian/rules, we check to see if llvm-spirv is installed.

Note that sbuild must use `--resolve-alternatives` for these older
distributions, or sbuild won't search for the "hello" alternatives in
the Build-Depends.

Signed-off-by: Jordan Justen <jljusten@debian.org>
This commit is contained in:
Jordan Justen 2021-07-09 11:42:10 -07:00
parent c5b9334be2
commit ff5ad94c9d
No known key found for this signature in database
GPG Key ID: 37F99F68CAF992EB
6 changed files with 38 additions and 3 deletions

2
debian/changelog vendored
View File

@ -1,7 +1,7 @@
llvm-toolchain-12 (1:12.0.1-5) unstable; urgency=medium
[ Jordan Justen ]
* libclc: Include libclc spir-v outputs (used by Mesa opencl)
* Include SPIR-V (*.spv) outputs in libclc package
-- Sylvestre Ledru <sylvestre@debian.org> Tue, 17 Aug 2021 10:19:22 +0200

4
debian/control vendored
View File

@ -19,7 +19,9 @@ Build-Depends: debhelper (>= 9.0), cmake, chrpath, texinfo, sharutils,
ocaml-findlib [amd64 arm64 armhf ppc64el s390x],
libctypes-ocaml-dev [amd64 arm64 armhf ppc64el s390x],
dh-exec, dh-ocaml [amd64 arm64 armhf ppc64el s390x],
libpfm4-dev [linux-any], python3-setuptools, libz3-dev
libpfm4-dev [linux-any], python3-setuptools, libz3-dev,
llvm-spirv | hello, spirv-tools | hello
# "| hello" is for older buster/bionic distros without spirv support
Build-Conflicts: oprofile, ocaml
Standards-Version: 4.2.1
Homepage: https://www.llvm.org/

View File

@ -1 +1,2 @@
usr/lib/clc/*.bc
#spv usr/lib/clc/*.spv

13
debian/patches/libclc-llvm-spirv.diff vendored Normal file
View File

@ -0,0 +1,13 @@
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index b8b5ceff086c..5964468358f2 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -95,7 +95,7 @@ find_program( LLVM_CLANG clang PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
find_program( LLVM_AS llvm-as PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
find_program( LLVM_LINK llvm-link PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
find_program( LLVM_OPT opt PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
-find_program( LLVM_SPIRV llvm-spirv PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
+find_program( LLVM_SPIRV llvm-spirv PATHS ${LLVM_BINDIR})
# Print toolchain
message( "clang: ${LLVM_CLANG}" )

View File

@ -144,3 +144,5 @@ lld-use-link-atomic-i386.diff
D99501-ignore-lto-auto.diff
scan-build-py-fix-analyze-path.diff
scan-build-py-fix-default-bin.diff
libclc-llvm-spirv.diff

19
debian/rules vendored
View File

@ -132,6 +132,17 @@ else
control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev'
endif
ifeq ($(shell which llvm-spirv),)
LLVM_SPIRV_INSTALLED = no
else
LLVM_SPIRV_INSTALLED = yes
endif
LIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"
ifeq ($(LLVM_SPIRV_INSTALLED),yes)
LIBCLC_TARGETS_TO_BUILD := $(LIBCLC_TARGETS_TO_BUILD)";spirv-mesa3d-;spirv64-mesa3d-"
endif
# Disabled:
# Host compiler does not support '-fuse-ld=lld'
# USE_LLD_ARCHS := amd64
@ -361,6 +372,12 @@ preconfigure:
fi; \
fi
# Conditionally enable *.spv files. Debian buster and Ubuntu 18.04
# don't have llvm-spirv to create the *.spv files.
if test "$(LLVM_SPIRV_INSTALLED)" = "yes"; then \
sed -i -e "s|#spv\ ||g" debian/libclc-$(LLVM_VERSION).install; \
fi
# Override this two targets. They are trying to manage the .in conversion for me
override_dh_ocamlinit:
override_dh_ocamlclean:
@ -541,7 +558,7 @@ debian-libclc-build:
-DCMAKE_INSTALL_DATADIR=lib \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-DLLVM_CONFIG=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-config \
-DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"; \
-DLIBCLC_TARGETS_TO_BUILD=$(LIBCLC_TARGETS_TO_BUILD); \
make $(NJOBS) $(VERBOSE)
touch $@