From 437f86c9d5c4876677ce9befa31ee8906981ba02 Mon Sep 17 00:00:00 2001 From: Timo Aaltonen Date: Wed, 28 Apr 2021 20:54:04 +0300 Subject: [PATCH] Build libclc. (Closes: #942709) --- debian/changelog | 6 ++++++ debian/control | 37 ++++++++++++++++++++++++++++++++ debian/libclc-X.Y-dev.install.in | 2 ++ debian/libclc-X.Y.install.in | 1 + debian/qualify-clang.sh | 9 ++++++++ debian/rules | 29 ++++++++++++++++++++++--- 6 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 debian/libclc-X.Y-dev.install.in create mode 100644 debian/libclc-X.Y.install.in diff --git a/debian/changelog b/debian/changelog index d75b62f7..7178a8b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +llvm-toolchain-12 (1:12.0.0-4) UNRELEASED; urgency=medium + + * Build libclc. (Closes: #942709) + + -- Timo Aaltonen Sat, 01 May 2021 01:01:52 +0300 + llvm-toolchain-12 (1:12.0.0-3) unstable; urgency=medium * Upload to unstable diff --git a/debian/control b/debian/control index caec2d10..5a0e35fd 100644 --- a/debian/control +++ b/debian/control @@ -674,3 +674,40 @@ Description: LLVM low level support for a standard C++ library (development file . * Correctness as defined by the C++ standards. * Provide a portable sublayer to ease the porting of libc++ + +# ------------- libclc ------------- + +Package: libclc-12 +Section: libs +Architecture: all +Multi-Arch: foreign +Depends: + ${misc:Depends}, + libclc-12-dev (= ${binary:Version}), + libclang-common-12-dev, +Breaks: libclc-amdgcn, libclc-ptx, libclc-r600 +Provides: libclc-x.y +Conflicts: libclc-x.y +Replaces: libclc-x.y, libclc-amdgcn, libclc-ptx, libclc-r600, +Description: OpenCL C language implementation - platform support + libclc is an open implementation of the OpenCL C programming language, + as specified by the OpenCL 1.1 Specification. + . + This package contains support for the amdgcn (AMD GPU), PTX and r600 + platforms. + +Package: libclc-12-dev +Section: libdevel +Architecture: all +Multi-Arch: foreign +Depends: + ${misc:Depends}, +Breaks: libclc-dev +Provides: libclc-x.y-dev +Conflicts: libclc-x.y-dev +Replaces: libclc-dev, libclc-x.y-dev +Description: OpenCL C language implementation - development files + libclc is an open implementation of the OpenCL C programming language, + as specified by the OpenCL 1.1 Specification. + . + This package contains development header files. diff --git a/debian/libclc-X.Y-dev.install.in b/debian/libclc-X.Y-dev.install.in new file mode 100644 index 00000000..f49c8750 --- /dev/null +++ b/debian/libclc-X.Y-dev.install.in @@ -0,0 +1,2 @@ +usr/include +usr/lib/pkgconfig diff --git a/debian/libclc-X.Y.install.in b/debian/libclc-X.Y.install.in new file mode 100644 index 00000000..36023694 --- /dev/null +++ b/debian/libclc-X.Y.install.in @@ -0,0 +1 @@ +usr/lib/clc/*.bc diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index 976c31b1..bfd5a683 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -1020,6 +1020,15 @@ g++ -nostdinc++ -I/usr/lib/llvm-$VERSION/bin/../include/c++/v1/ -L/usr/lib/llvm- ./o > /dev/null fi +# libclc + +if test ! -f /usr/lib/clc/amdgcn--amdhsa.bc; then + echo "Install libclc-$VERSION"; + exit -1; +fi + +LLVM_CONFIG=llvm-config-$VERSION ./libclc/check_external_calls.sh /usr/lib/clc/amdgcn--amdhsa.bc > /dev/null + if test ! -f /usr/lib/llvm-$VERSION/include/polly/LinkAllPasses.h; then echo "Install libclang-common-$VERSION-dev for polly"; diff --git a/debian/rules b/debian/rules index dfee9877..732ed6c8 100755 --- a/debian/rules +++ b/debian/rules @@ -522,7 +522,26 @@ debian-libcxxabi-build: $(PRE_PROCESS_CONF) make $(NJOBS) $(VERBOSE) CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" touch $@ -override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libcxx-build debian-libcxxabi-build +debian-libclc-build: +# Builds libclc + + mkdir -p libclc/build + + CMAKE_BIN=cmake; \ + if test -f /tmp/cmake/bin/cmake; then \ + CMAKE_BIN=/tmp/cmake/bin/cmake; \ + fi; \ + echo "Using cmake: $$CMAKE_BIN"; \ + cd libclc/build && \ + $$CMAKE_BIN ../ \ + -DCMAKE_INSTALL_DATADIR=/usr/lib \ + -DCMAKE_INSTALL_INCLUDEDIR=/usr/include \ + -DLLVM_CONFIG=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-config \ + -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"; \ + make $(NJOBS) $(VERBOSE) + touch $@ + +override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libcxx-build debian-libcxxabi-build debian-libclc-build override_dh_prep: build_doc dh_prep @@ -656,6 +675,7 @@ endif $(MAKE) -C libcxxabi/build install DESTDIR=$(DEB_INST) $(MAKE) -C libcxx/build install DESTDIR=$(DEB_INST) + $(MAKE) -C libclc/build install DESTDIR=$(DEB_INST) # Rename binaries mkdir -p $(DEB_INST)/usr/bin/ @@ -855,6 +875,9 @@ endif # Libcxxabi $(MAKE) $(MAKE) -C libcxxabi/build check-libcxxabi || true +# Libclc + $(MAKE) $(MAKE) -C libclc/build test || true + # LLDB tests ifeq (,$(filter $(DEB_HOST_ARCH), $(LLDB_DISABLE_ARCHS) armhf armel)) ifneq (,$(filter codecoverage,$(DEB_BUILD_OPTIONS))) @@ -915,7 +938,7 @@ override_dh_auto_clean: rm -f $(CURDIR)/utils/vim/llvm-$(LLVM_VERSION).vim $(CURDIR)/utils/vim/tablegen-$(LLVM_VERSION).vim rm -f $(CURDIR)/clang/tools/clang-format/clang-format-diff-$(LLVM_VERSION) rm -f $(CURDIR)/clang/tools/clang-format/clang-format-$(LLVM_VERSION).py - rm -rf libcxx/build libcxxabi/build + rm -rf libcxx/build libcxxabi/build libclc/build if test -f lld/docs/ld.lld-$(LLVM_VERSION).1; then \ mv lld/docs/ld.lld-$(LLVM_VERSION).1 lld/docs/ld.lld.1; \ fi @@ -926,4 +949,4 @@ override_dh_auto_clean: : # for some reason, the docs are written to debian/usr and debian/man ... rm -rf debian/usr debian/man -.PHONY: override_dh_strip preconfigure debian-full-build debian-libfuzzer-build debian-libcxx-build debian-libcxxabi-build +.PHONY: override_dh_strip preconfigure debian-full-build debian-libfuzzer-build debian-libcxx-build debian-libcxxabi-build debian-libclc-build