summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c4f4076c00eda4e9e73be57eac062e830b0713e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Maintainer:  dreieck (https://aur.archlinux.org/account/dreieck)

_pkgname=libkazv
pkgname="${_pkgname}-git"
pkgver=0.6.0+10.r464.20240711.d942e18
pkgrel=1
pkgdesc="A matrix client sdk built upon lager and the value-oriented design it enables."
arch=(
  'aarch64'
  'armv6h'
  'armv7h'
  'i686'
  'x86_64'
)
license=('AGPL3')
url="https://lily-is.land/kazv/libkazv"
backup=()
depends=(
  'boost-libs'
  'crypto++'
  'gcc-libs'
  'glibc'
  'immer'
  'lager'
  'libolm'
  'nlohmann-json'
  'zug'
)
makedepends=(
  'boost'
  'cmake'
  # 'cpr' # Currently (2023-08-25) this makes build errors, so disabling.
  'git'
  'libhttpserver'
)
## Disabled until we re-enable `check()`.
# checkdepends=(
#   'catch2>=3.4.0'
# )
optdepends=(
  # 'cpr: for kazvjob.' # Currently (2023-08-25) this makes build errors, so disabling.
  'libhttpserver: For examples.'
)
provides=("${_pkgname}=${pkgver}")
conflicts=("${_pkgname}")
source=(
  "${_pkgname}::git+${url}.git"
)
sha256sums=(
  'SKIP'
)


prepare() {
  cd "${srcdir}/${_pkgname}"

  git log > git.log
}


pkgver() {
  cd "${srcdir}/${_pkgname}"

  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|-g[0-9a-f]+$||' | tr '-' '+')"
  # _ver_major="$(grep -Em1 '^[^#]*set\(libkazv_VERSION_MAJOR' CMakeLists.txt | sed -E 's|.*libkazv_VERSION_MAJOR[[:space:]]+([^\)]*)\).*|\1|')"
  # _ver_minor="$(grep -Em1 '^[^#]*set\(libkazv_VERSION_MINOR' CMakeLists.txt | sed -E 's|.*libkazv_VERSION_MINOR[[:space:]]+([^\)]*)\).*|\1|')"
  # _ver_patch="$(grep -Em1 '^[^#]*set\(libkazv_VERSION_PATCH' CMakeLists.txt | sed -E 's|.*libkazv_VERSION_PATCH[[:space:]]+([^\)]*)\).*|\1|')"
  # _ver="${_ver_major}.${_ver_minor}.${_ver_patch}"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Version could not be determined."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}


build() {
  cd "${srcdir}/${_pkgname}"

  mkdir -p build
  cd build

  ## KAZVJOB: Currently (2023-08-25) this makes build errors related to cpr, so disabling.
  #  TESTS, EXAMPLES: Depend on KAZVJOB.
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -Dlibkazv_BUILD_EXAMPLES=OFF \
    -Dlibkazv_BUILD_KAZVJOB=OFF \
    -Dlibkazv_BUILD_TESTS=OFF \
    -Dlibkazv_ENABLE_COVERAGE=OFF \
    -Dlibkazv_INSTALL_HEADERS=ON \
    -Dlibkazv_OUTPUT_LEVEL=20 \
    ..

  make
}


# check() {
## Disabled since currently TESTS are disabled.
#   cd "${srcdir}/${_pkgname}/build"
# }


package() {
  cd "${srcdir}/${_pkgname}/build"

  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/${_pkgname}"

  for _docfile in 'git.log' 'README.md' 'CHANGELOG.md'; do
    install -Dvm644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done
  for _licensefile in COPYING; do
    install -Dvm644 "${_licensefile}" "${pkgdir}/usr/share/licenses/${pkgname}/${_licensefile}"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/${_licensefile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_licensefile}"
  done
}