summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorCallum Parsey2023-06-26 12:50:02 +0930
committerCallum Parsey2023-06-26 12:50:02 +0930
commitc1200a44e58f8e5df2ae1f0a39d5e0ecd6136bff (patch)
treee18bce2caee7d840db8384ab0f59a08841ed135b /PKGBUILD
parent0081f0f9736e2a080622f2c5ab265d8fef1ce980 (diff)
downloadaur-c1200a44e58f8e5df2ae1f0a39d5e0ecd6136bff.tar.gz
Install library in dedicated namespace
Since adding encryption support changes the ABI, it is not feasible to simply replace the official package's files and require users to recompile all downstream software. To work around that, I have modified the build system of this package to install everything as `QuotientE2EE` instead of `Quotient`. So the headers are installed to `/usr/include/QuotientE2EE` instead of `/usr/include/Quotient`, the library itself is installed as `libQuotientE2EE.so` instead of `libQuotient.so` and the `pkg-config` and CMake configuration files have been renamed and adjusted accordingly to allow compilation against this separate library. As a side-effect of this, it should be possible to have `libquotient` and `libquotient-encryption` installed at the same time - there are no conflicting files between these packages now. The preprocessor macros passed to the compiler are unchanged, as are the CMake configuration options passed during the build process. At least in theory, all that needs to change in downstream software is to make the downstream build system use the `QuotientE2EE` library instead of `Quotient` and to include headers from the `QuotientE2EE` system directory instead of `Quotient` - all other variables should be able to remain unchanged. The header files are an interesting case, as they expect to be installed in a directory named `Quotient`. This is something I don't think I can change in the build system itself without moving the entire source tree or separating the headers from the source, so I'll probably have to leave the headers as-is during the build, and then change them in the `package()` step. All that should need to change in the headers is replacing instances of `#include <Quotient` with `#include <QuotientE2EE` - everything else should continue to work.
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD43
1 files changed, 30 insertions, 13 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 7fbfde65d18f..dbf01445dad7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,15 +5,39 @@ pkgname=libquotient-encryption
pkgver=0.7.2
pkgrel=1
pkgdesc="A Qt library to write cross-platform clients for Matrix (with experimental encryption support)"
-arch=(x86_64 aarch64)
+arch=("x86_64" "aarch64")
url="https://github.com/quotient-im/libQuotient"
license=("LGPL2.1")
depends=("gcc-libs" "glibc" "libolm" "openssl" "qt5-base" "qt5-multimedia" "qtkeychain-qt5")
makedepends=("cmake")
-provides=("libquotient" "libQuotient.so=${pkgver%.*}-64")
-conflicts=("libquotient")
-source=("https://github.com/quotient-im/libQuotient/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz")
-sha256sums=("62ff42c8fe321e582ce8943417c1d815ab3f373a26fa0d99a5926e713f6a9382")
+provides=("libQuotientE2EE.so=${pkgver%.*}-64")
+source=("https://github.com/quotient-im/libQuotient/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz"
+ "namespace.patch")
+sha256sums=("62ff42c8fe321e582ce8943417c1d815ab3f373a26fa0d99a5926e713f6a9382"
+ "cfb01b1855ac31fdfa614b3802b0cfc9890b92b7a4dade71f5f94f775773a94e")
+
+prepare() {
+ # This patch makes the following changes to CMakeLists.txt:
+ # - Adds a new variable called `${LIBRARY_NAME}` which is currently set
+ # to `QuotientE2EE`, which will replace `${PROJECT_NAME}` in all cases
+ # where the name needs to be changed
+ # - Replaces the name of the library target with `${LIBRARY_NAME}` so that
+ # the generated shared objects are called `libQuotientE2EE.so*`
+ # - All references to `${PROJECT_NAME}` which really refer to the library
+ # target instead of the CMake project as a whole have been changed
+ # - Changed the output names of the `pkg-config` script and the output
+ # CMake files (i.e. `QuotientE2EEConfig.cmake`,
+ # `QuotientE2EETargets.cmake` and so on)
+ # - Changed the install directories for the config files and headers to use
+ # `QuotientE2EE` instead of `Quotient`
+ # - Disable generating files for integration with the Android Native
+ # Development Kit, as these files have generic names which will conflict
+ # with the official Arch `libquotient` package
+ # Also, the template files for the `pkg-config` script (`Quotient.pc.in`)
+ # and CMake script (`QuotientConfig.cmake.in`) have been adjusted to use
+ # `${LIBRARY_NAME}` where necessary instead of hard-coding `Quotient`.
+ patch -Np0 -d . -i namespace.patch
+}
build() {
cmake -B build -S "libQuotient-${pkgver}" \
@@ -28,12 +52,5 @@ build() {
package() {
DESTDIR="${pkgdir}" cmake --install build
- install -Dm 644 "libQuotient-${pkgver}/README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
-
- # NOTE: There does not seem to be a way to inhibit generating the
- # Android Native Development Kit (NDK) build file without patching
- # libQuotient's build script. This file has a generic name which
- # will conflict with the official `libquotient` package, so it must
- # therefore be removed manually.
- rm -r "${pkgdir}/usr/share/ndk-modules"
+ install -Dm644 "libQuotient-${pkgver}/README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}