summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ea2a51214561a40f0f852d2b7baeafce26ba571b (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
# Maintainer: Davide Depau <davide@depau.eu>

_pkgname=libdbuslog
pkgbase="${_pkgname}-git"
pkgname=(
  "${_pkgname}-tools-git"
  "${_pkgname}server-common-git"
  "${_pkgname}server-dbus-git"
  "${_pkgname}server-gio-git"
)
pkgver=1.0.15.r0.gd0dbccb
pkgrel=2
pkgdesc="D-Bus based logging"
arch=('i686' 'x86_64')
depends=('glib2' 'dbus' 'libglibutil' 'libdbusaccess')
makedepends=('git' 'make')
url="https://git.sailfishos.org/mer-core/libdbuslog"
license=('BSD')
source=(${_pkgname}::git+https://git.sailfishos.org/mer-core/libdbuslog.git)
sha256sums=('SKIP')


pkgver() {
  cd "$_pkgname"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "$srcdir/$_pkgname"
  _tmpdir="$srcdir/package"

  msg2 "Building client tools..."
  
  # Dirty workaround: make seems to fail to build first time for some reason I
  # can't figure out. Running it twice seems to fix it
  make -C tools/dbuslog-client KEEP_SYMBOLS=1 release || make -C tools/dbuslog-client KEEP_SYMBOLS=1 release

  msg2 "Building server..."
  make -C server KEEP_SYMBOLS=1 release pkgconfig
  
  msg2 "Preparing files for packaging..."
  make -C tools/dbuslog-client install DESTDIR="${_tmpdir}"
  make -C server install DESTDIR=${_tmpdir}
}

package_libdbuslog-tools-git() {
  pkgdesc="Command line client for libdbuslogserver"
  depends+=()
  provides=("libdbuslog-tools")
  conflicts=("libdbuslog-tools")

  cd "$srcdir/package"
  
  install -Dm755 "usr/bin/dbuslog-client" "$pkgdir/usr/bin/dbuslog-client"
}

package_libdbuslogserver-common-git() {
  pkgdesc="Common development headers for libdbuslogserver"
  depends+=()
  provides=("libdbuslogserver-common")
  conflicts=("libdbuslogserver-common")

  cd "$srcdir/package"

  ls "usr/include/dbuslogserver" | grep '\.h$' | while read header; do
    install -Dm644 "usr/include/dbuslogserver/$header" "$pkgdir/usr/include/dbuslogserver/$header"
  done
}

_package_server() {
  cd "$srcdir/package"

  # Install libraries
  find "usr/lib" -maxdepth 1 -type f | grep '/libdbuslogserver-'"$1"'\.so' | while read lib; do
    install -Dm755 "$lib" "$pkgdir/$lib"
  done
  
  # Copy links
  find "usr/lib" -maxdepth 1 -type l | grep '/libdbuslogserver-'"$1"'\.so' | while read lib; do
    cp -d "$lib" "$pkgdir/$lib"
  done
  
  ls "usr/include/dbuslogserver/$1" | grep '\.h$' | while read header; do
    install -Dm644 "usr/include/dbuslogserver/$1/$header" "$pkgdir/usr/include/dbuslogserver/$1/$header"
  done
  
  install -Dm644 "usr/lib/pkgconfig/libdbuslogserver-$1.pc" "$pkgdir/usr/lib/pkgconfig/libdbuslogserver-$1.pc"
}

package_libdbuslogserver-dbus-git() {
  pkgdesc="Library of logging utilities for libdbus based programs"
  depends+=(
    "libdbuslogserver-common"
  )
  provides=("libdbuslogserver-dbus")
  conflicts=("libdbuslogserver-dbus")

  _package_server dbus
}

package_libdbuslogserver-gio-git() {
  pkgdesc="Library of logging utilities for gio based programs"
  depends+=(
    "libdbuslogserver-common"
  )
  provides=("libdbuslogserver-gio")
  conflicts=("libdbuslogserver-gio")

  _package_server gio
}