Subject: [PATCH 1/4] community/pugixml: install pkg-config file

From: Bart Ribbers <[email-masked]>
Date: Sat, 10 Aug 2019 19:26:45 +0200

---
 community/pugixml/APKBUILD        | 14 +++---
 community/pugixml/pkgconfig.patch | 72 +++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 7 deletions(-)
 create mode 100644 community/pugixml/pkgconfig.patch

diff --git a/community/pugixml/APKBUILD b/community/pugixml/APKBUILD
index 7642122d40..494fa81cf4 100644
--- a/community/pugixml/APKBUILD
+++ b/community/pugixml/APKBUILD
@@ -2,19 +2,19 @@
 # Maintainer: Kevin Daudt <[email-masked]>
 pkgname=pugixml
 pkgver=1.9
-pkgrel=0
+pkgrel=1
 pkgdesc="Light-weight, simple and fast XML parser for C++ with XPath support"
 url="http://pugixml.org"
 arch="all"
 license="MIT"
 makedepends="cmake"
 subpackages="$pkgname-dev"
-source="http://github.com/zeux/pugixml/releases/download/v${pkgver}/pugixml-$pkgver.tar.gz"
-builddir="$srcdir/$pkgname-$pkgver"
+source="http://github.com/zeux/pugixml/releases/download/v${pkgver}/pugixml-$pkgver.tar.gz
+	pkgconfig.patch"
 
 build() {
-	cd "$builddir"
-	cmake -DCMAKE_INSTALL_PREFIX=/usr \
+	cmake \
+		-DCMAKE_INSTALL_PREFIX=/usr \
 		-DCMAKE_INSTALL_LIBDIR=lib \
 		-DBUILD_SHARED_LIBS=True \
 		-DCMAKE_BUILD_TYPE=Release
@@ -22,8 +22,8 @@ build() {
 }
 
 package() {
-	cd "$builddir"
 	make DESTDIR="$pkgdir" install
 }
 
-sha512sums="853a9d985aae537391c6524d5413ef4de237d99d96cc58ea7fe7152f786df1e408cdacd2e4387697e23c3e67cdc1d42b29de554501309eae16d86edd0e24785f  pugixml-1.9.tar.gz"
+sha512sums="853a9d985aae537391c6524d5413ef4de237d99d96cc58ea7fe7152f786df1e408cdacd2e4387697e23c3e67cdc1d42b29de554501309eae16d86edd0e24785f  pugixml-1.9.tar.gz
+5a170e9f9f0fa7f1b5db2942992bd7eab997f7d984bc383ef9864ba33c74085c8985b249fef930cc628346852f4ba87ce7c32842f9fe9a2483472e363ac3be4d  pkgconfig.patch"
diff --git a/community/pugixml/pkgconfig.patch b/community/pugixml/pkgconfig.patch
new file mode 100644
index 0000000000..3a1d942d09
--- /dev/null
+++ b/community/pugixml/pkgconfig.patch
@@ -0,0 +1,72 @@
+From 314dc6a95baaca90294a8ea957d9810e3bee0f62 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email-masked]>
+Date: Mon, 9 Apr 2018 01:46:30 -0400
+Subject: [PATCH] cmake: always install the pkg-config file
+
+There's really never a reason to *not* want this installed. If an option
+is needed to specify installing in a versioned subdirectory, this option
+should be explicitly described rather than hidden in something else.
+
+As an added bonus, this makes the CMake install code slightly *less*
+complicated.
+---
+ CMakeLists.txt        | 10 ++++------
+ scripts/pugixml.pc.in |  6 +++---
+ 2 files changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 90fa6793..d7bc1b20 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -4,7 +4,7 @@ project(pugixml)
+ 
+ option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
+ option(BUILD_TESTS "Build tests" OFF)
+-option(BUILD_PKGCONFIG "Build in PKGCONFIG mode" OFF)
++option(USE_VERSIONED_LIBDIR "Use a private subdirectory to install the headers and libs" OFF)
+ 
+ set(BUILD_DEFINES "" CACHE STRING "Build defines")
+ 
+@@ -55,7 +55,7 @@ endif()
+ set_target_properties(pugixml PROPERTIES VERSION 1.9 SOVERSION 1)
+ get_target_property(PUGIXML_VERSION_STRING pugixml VERSION)
+ 
+-if(BUILD_PKGCONFIG)
++if(USE_VERSIONED_LIBDIR)
+ 	# Install library into its own directory under LIBDIR
+ 	set(INSTALL_SUFFIX /pugixml-${PUGIXML_VERSION_STRING})
+ endif()
+@@ -71,10 +71,8 @@ install(TARGETS pugixml EXPORT pugixml-config
+ install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX})
+ install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml)
+ 
+-if(BUILD_PKGCONFIG)
+-	configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY)
+-	install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+-endif()
++configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY)
++install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+ 
+ if(BUILD_TESTS)
+ 	file(GLOB TEST_SOURCES tests/*.cpp)
+diff --git a/scripts/pugixml.pc.in b/scripts/pugixml.pc.in
+index 3c97c28d..804c4d38 100644
+--- a/scripts/pugixml.pc.in
++++ b/scripts/pugixml.pc.in
+@@ -1,11 +1,11 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=${prefix}
+-includedir=${prefix}/include/pugixml-@PUGIXML_VERSION_STRING@
+-libdir=${exec_prefix}/lib/pugixml-@PUGIXML_VERSION_STRING@
++includedir=${prefix}/include@INSTALL_SUFFIX@
++libdir=${exec_prefix}/lib@INSTALL_SUFFIX@
+ 
+ Name: pugixml
+ Description: Light-weight, simple and fast XML parser for C++ with XPath support.
+ URL: http://pugixml.org/
+ Version: @PUGIXML_VERSION_STRING@
+ Cflags: -I${includedir}
+-Libs: -L${libdir} -lpugixml
+\ No newline at end of file
++Libs: -L${libdir} -lpugixml
+
-- 
2.21.0

---

From: Bart Ribbers <[email-masked]>
Date: Sat, 10 Aug 2019 19:26:48 +0200

All files required except for the display specific binaries are in
"kodi". X11 is in "kodi-bin" and Wayland is in "kodi-wayland" and GBM in
"kodi-gbm". Unless the user explicitely installs "kodi-wayland" or
"kodi-gbm" first, "kodi-bin" (so X11) will be installed by default when
installing "kodi".
---
 community/kodi/APKBUILD | 104 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 98 insertions(+), 6 deletions(-)

diff --git a/community/kodi/APKBUILD b/community/kodi/APKBUILD
index e96d075706..7a6d168331 100644
--- a/community/kodi/APKBUILD
+++ b/community/kodi/APKBUILD
@@ -3,7 +3,7 @@
 pkgname=kodi
 pkgver=18.2
 _realname=Leia
-pkgrel=0
+pkgrel=1
 _libdvdcss_pkgver="1.4.2-Leia-Beta-5"
 _libdvdread_pkgver="6.0.0-Leia-Alpha-3"
 _libdvdnav_pkgver="6.0.0-Leia-Alpha-3"
@@ -42,7 +42,21 @@ depends_dev="libass-dev
 	mesa-dev
 	glu-dev
 	libjpeg-turbo-dev
+"
 
+# Required for Wayland
+depends_dev="$depends_dev
+	waylandpp-dev
+	libxkbcommon-dev
+"
+
+# Required for gbm
+depends_dev="$depends_dev
+	libinput-dev
+"
+
+# Optional for extra features
+depends_dev="$depends_dev
 	alsa-lib-dev
 	avahi-dev
 	bluez-dev
@@ -71,8 +85,9 @@ makedepends="$depends_dev
 	graphviz
 	xz
 	tar
-	openjdk8-jre-base"
-subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg"
+	openjdk8-jre-base
+	wayland-protocols"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg $pkgname-bin $pkgname-wayland $pkgname-gbm"
 replaces="xbmc"
 options="ldpath-recursive !check" # No testsuite
 source="https://github.com/xbmc/xbmc/archive/$pkgver-$_realname.tar.gz
@@ -93,12 +108,16 @@ builddir="$srcdir/xbmc-$pkgver-$_realname"
 prepare() {
 	default_prepare
 
-	mkdir "$builddir"/build
+	mkdir "$builddir"/build-x11
+	mkdir "$builddir"/build-wayland
+	mkdir "$builddir"/build-gbm
 }
 
 build() {
 	make -C tools/depends/target/crossguid PREFIX="$PWD"/usr
-	cd "$builddir"/build
+
+	# X11
+	cd "$builddir"/build-x11
 	cmake "$builddir" \
 		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
 		-DCMAKE_INSTALL_PREFIX=/usr \
@@ -114,11 +133,84 @@ build() {
 		-Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
 		-DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz
 	make
+	make preinstall
+
+	# Wayland
+	cd "$builddir"/build-wayland
+	cmake "$builddir" \
+		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=lib \
+		-DENABLE_INTERNAL_CROSSGUID=ON \
+		-DENABLE_INTERNAL_FFMPEG=OFF \
+		-DENABLE_INTERNAL_RapidJSON=OFF \
+		-DENABLE_INTERNAL_FMT=OFF \
+		-DENABLE_INTERNAL_FSTRCMP=OFF \
+		-DENABLE_INTERNAL_FLATBUFFERS=OFF \
+		-Dlibdvdcss_URL="$srcdir"/libdvdcss-$_libdvdcss_pkgver.tar.gz \
+		-Dlibdvdread_URL="$srcdir"/libdvdread-$_libdvdread_pkgver.tar.gz \
+		-Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
+		-DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz \
+		-DCORE_PLATFORM_NAME=wayland \
+		-DWAYLAND_RENDER_SYSTEM=gl
+	make
+	make preinstall
+
+	# GBM
+	cd "$builddir"/build-gbm
+	cmake "$builddir" \
+		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=lib \
+		-DENABLE_INTERNAL_CROSSGUID=ON \
+		-DENABLE_INTERNAL_FFMPEG=OFF \
+		-DENABLE_INTERNAL_RapidJSON=OFF \
+		-DENABLE_INTERNAL_FMT=OFF \
+		-DENABLE_INTERNAL_FSTRCMP=OFF \
+		-DENABLE_INTERNAL_FLATBUFFERS=OFF \
+		-Dlibdvdcss_URL="$srcdir"/libdvdcss-$_libdvdcss_pkgver.tar.gz \
+		-Dlibdvdread_URL="$srcdir"/libdvdread-$_libdvdread_pkgver.tar.gz \
+		-Dlibdvdnav_URL="$srcdir"/libdvdnav-$_libdvdnav_pkgver.tar.gz \
+		-DCROSSGUID_URL="$srcdir"/crossguid-$_crossguid_hash.tar.gz \
+		-DCORE_PLATFORM_NAME=gbm \
+		-DGBM_RENDER_SYSTEM=gles
+	make
+	make preinstall
 }
 
 package() {
-	cd "$builddir"/build
+	depends="$pkgname-bin"
+
+	cd "$builddir"/build-x11
 	make DESTDIR="$pkgdir" install
+
+	rm \
+		"$pkgdir"/usr/lib/kodi/kodi-x11 \
+		"$pkgdir"/usr/lib/kodi/kodi-xrandr
+}
+
+bin() {
+	pkgdesc="X11 Kodi binary"
+
+	cd "$builddir"/build-x11
+	install -Dm755 kodi-x11 "$subpkgdir"/usr/lib/kodi/kodi-x11
+	install -Dm755 kodi-xrandr "$subpkgdir"/usr/lib/kodi/kodi-xrandr
+}
+
+wayland() {
+	pkgdesc="Wayland Kodi binary"
+	provides="$pkgname-bin"
+
+	cd "$builddir"/build-wayland
+	install -Dm755 kodi-wayland "$subpkgdir"/usr/lib/kodi/kodi-wayland
+}
+
+gbm() {
+	pkgdesc="GBM Kodi binary"
+	provides="$pkgname-bin"
+
+	cd "$builddir"/build-gbm
+	install -Dm755 kodi-gbm "$subpkgdir"/usr/lib/kodi/kodi-gbm
 }
 
 sha512sums="7b63dc9c082f538690d28dd6da10999888af2b9de2e532bca54420753f64238f42e1c2aa0f7481c823e544260a1e4d68e1ba50f84db53307d08f0749992dff2f  18.2-Leia.tar.gz
-- 
2.21.0