summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 48ea61689c9b3c3555fe42a89ee1e81769840c89 (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
# Maintainer: dreieck
# Contributor: Cirk2

_pkgname=sdbus-cpp
_pkgvariant=nosystemd
pkgname="${_pkgname}-${_pkgvariant}-git"
_pkgver=latest
pkgver=2.1.0+.r446.d20241120.0261d0e
pkgrel=1
pkgdesc="sdbus-c++ is a high-level C++ D-Bus library for Linux designed to provide expressive, easy-to-use API in modern C++. This package is without systemd dependencies; it will have it's own static libsystemd baked in."
url="https://github.com/Kistler-Group/sdbus-cpp"
arch=('i686' 'x86_64')
license=(
  'LGPL-2.1-or-later'
  'LicenseRef-sdbus-c++_LGPL_Exception_1.0'
)
depends=(
  'expat'
  'gcc-libs'
  'glibc'
  'libcap'
)
makedepends=(
  'cmake'
  'doxygen'
  'git'
  'gperf'
  'meson'
  'rsync'  # See https://aur.archlinux.org/packages/sdbus-cpp-nosystemd-git#comment-935921
)
provides=(
  "${_pkgname}=${pkgver}"
  "${_pkgname}-git=${pkgver}"
  "${_pkgname}-${_pkgvariant}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
  "${_pkgname}-git"
  "${_pkgname}-${_pkgvariant}"
)
source=(
  "${_pkgname}::git+https://github.com/Kistler-Group/sdbus-cpp.git"
  "systemd-stable::git+https://github.com/systemd/systemd-stable.git"
)
sha256sums=(
  'SKIP'
  'SKIP'
)
noextract=('systemd-stable')

pkgver() {
  cd "${srcdir}/${_pkgname}"
  _ver="$(git describe --tags | sed 's|^v||' | awk -F'-' '{print $1}')"
  _subver="$(git describe --tags | awk -F'-' '{print $2}')"
  _rev="$(git rev-list --count HEAD)"
  _hash="$(git rev-parse --short HEAD)"
  _date="$(git log -n 1 --format=tformat:%ci | awk '{print $1}' | tr -d '-')"
  if [ -z ${_ver} ]; then
    error "Error in ${FUNCNAME[0]}: Version information could not determined."
    return 1
  fi
  printf '%s' "${_ver}+${_subver}.r${_rev}.d${_date}.${_hash}"
}

prepare() {
  mkdir -p "${srcdir}/build"
}

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

  cmake -S "${srcdir}/${_pkgname}" -B . \
    -DCMAKE_INSTALL_PREFIX=/ \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_LIBSYSTEMD=ON \
    -DBUILD_CODE_GEN=ON \
    -DBUILD_DOC=ON \
    -DBUILD_DOXYGEN_DOC=ON

  msg2 "Copying libsystemd source files into place ..."
  _libsystemd_version="$(grep -E '^[[:space:]]*set\(SDBUSCPP_LIBSYSTEMD_VERSION[[:space:]]+["]?[^"]+' "${srcdir}/${_pkgname}/CMakeLists.txt" | tail -n1 | sed -E -e 's|^[[:space:]]*set\(SDBUSCPP_LIBSYSTEMD_VERSION[[:space:]]+["]?([0-9a-zA-Z\._-]*)["]?[[:space:]]+.*$|\1|')"
  mkdir -p "${srcdir}/build/libsystemd-v${_libsystemd_version}/src/LibsystemdBuildProject"

  pushd "${srcdir}/systemd-stable" > /dev/null
  GIT_WORK_TREE="${srcdir}/build/libsystemd-v${_libsystemd_version}/src/LibsystemdBuildProject" git checkout "v${_libsystemd_version}-stable" -f
  popd > /dev/null

  #git submodule update --recursive --init

  make
  #make doc
}

package() {
  cd "${srcdir}/build"
  make DESTDIR="${pkgdir}" install
  install -Dm644 "${srcdir}/${_pkgname}/COPYING" "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
  install -Dm644 "${srcdir}/${_pkgname}/COPYING-LGPL-Exception" "${pkgdir}/usr/share/licenses/${pkgname}/COPYING-LGPL-Exception"
}