From 1348464fdbce2a12d267a4035ef2f076e24c7806 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 20 Dec 2020 18:57:24 +0100
Subject: [PATCH] community/bear: properly fix installation of staging
 directory

By patching the CMake configuration, instead of removing the files
manually in package().

See: https://github.com/rizsotto/Bear/issues/337
---
 community/bear/0001-cmake-fix-337.patch | 24 ++++++++++++++++++++++++
 community/bear/APKBUILD                 | 12 +++++-------
 2 files changed, 29 insertions(+), 7 deletions(-)
 create mode 100644 community/bear/0001-cmake-fix-337.patch

diff --git a/community/bear/0001-cmake-fix-337.patch b/community/bear/0001-cmake-fix-337.patch
new file mode 100644
index 000000000000..193540dec40d
--- /dev/null
+++ b/community/bear/0001-cmake-fix-337.patch
@@ -0,0 +1,24 @@
+See: https://github.com/rizsotto/Bear/issues/337
+
+From 87ba190cf16569d219d44d3c204051b91172a66c Mon Sep 17 00:00:00 2001
+From: Laszlo Nagy <rizsotto@gmail.com>
+Date: Wed, 9 Dec 2020 00:06:18 +1100
+Subject: [PATCH] cmake: fix #337
+
+---
+ CMakeLists.txt | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 78e71a1..f15c14f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -58,8 +58,6 @@ ExternalProject_Add(BearSource
+             -DROOT_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+             -DENABLE_UNIT_TESTS:BOOL=${ENABLE_UNIT_TESTS}
+-        BUILD_ALWAYS
+-            1
+         TEST_BEFORE_INSTALL
+             1
+         TEST_COMMAND
diff --git a/community/bear/APKBUILD b/community/bear/APKBUILD
index fb9e939fa922..19c6bbbf3501 100644
--- a/community/bear/APKBUILD
+++ b/community/bear/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
 pkgname=bear
 pkgver=3.0.3
-pkgrel=1
+pkgrel=2
 pkgdesc="Tool which generates a compilation database for clang tooling"
 url="https://github.com/rizsotto/Bear"
 # ppc64le armv7 armhf: Limited by grpc
@@ -12,7 +12,8 @@ license="GPL-3.0-or-later"
 makedepends="cmake grpc grpc-dev fmt-dev spdlog-dev
 	nlohmann-json protobuf-dev gtest-dev c-ares-dev"
 subpackages="$pkgname-doc"
-source="https://github.com/rizsotto/Bear/archive/$pkgver/bear-$pkgver.tar.gz"
+source="https://github.com/rizsotto/Bear/archive/$pkgver/bear-$pkgver.tar.gz
+	0001-cmake-fix-337.patch"
 builddir="$srcdir/Bear-$pkgver"
 
 build() {
@@ -32,10 +33,7 @@ check() {
 
 package() {
 	make -C build DESTDIR="$pkgdir" install
-
-	# Remove stage directory
-	# See: https://github.com/rizsotto/Bear/issues/337
-	rm -rf "$pkgdir"/home
 }
 
-sha512sums="7e90aabcbbf138c4fd1cac0f187094874027e4d48c59389cfa6bef06e07fd4eaf18e9b83173d699131225ae88c6566e73849e9a5630bb2c7ec51f9af55652b67  bear-3.0.3.tar.gz"
+sha512sums="7e90aabcbbf138c4fd1cac0f187094874027e4d48c59389cfa6bef06e07fd4eaf18e9b83173d699131225ae88c6566e73849e9a5630bb2c7ec51f9af55652b67  bear-3.0.3.tar.gz
+f16c59d816531b494b8f6767b377fe57127c310dd491e826413eeba429b8cbd2653f905fbbf30638cfd117e826064f1bffd7a7244d8e813e022d1960a87c814a  0001-cmake-fix-337.patch"
-- 
GitLab