summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 28a39edf9d7124729b0489229c1d85d0e85d3652 (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
# Maintainer: robertfoster
# Contributor: kurych
# Contributor: redfish

pkgname=i2pd-git
_pkgname=i2pd
pkgver=2.14.0.r35.g14ca3fc2
pkgrel=1
pkgdesc="Simplified C++ implementation of I2P client"
arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/PurpleI2P/i2pd"
license=('BSD')
depends=('boost-libs' 'miniupnpc' 'openssl' 'zlib' 'websocketpp')
makedepends=('boost')
source=("${_pkgname}::git+https://github.com/PurpleI2P/i2pd.git#branch=master"
        "${_pkgname}.service"
        "${_pkgname}.tmpfiles.conf"
)
install="${_pkgname}.install"

backup=("etc/${_pkgname}/${_pkgname}.conf"
        "etc/${_pkgname}/tunnels.conf"
)
conflicts=('${_pkgname}')

build() {
  cd $srcdir/${_pkgname}
  cd build
  cmake . -DCMAKE_CXX_FLAGS="-w" \
	  -DCMAKE_INSTALL_PREFIX=/usr \
	  -DWITH_UPNP=1 -DWITH_PCH=0 \
	  -DCMAKE_BUILD_TYPE=Release
  make
}

package(){
        _conf_dest="etc/${_pkgname}"
        _home_dest="var/lib/${_pkgname}"
        _share_dest="usr/share"

	cd $srcdir/${_pkgname}

	cd build
	make DESTDIR=$pkgdir install
  install -Dm0644 $srcdir/${_pkgname}.service $pkgdir/usr/lib/systemd/system/${_pkgname}.service
  install -Dm0644 $srcdir/${_pkgname}.tmpfiles.conf $pkgdir/usr/lib/tmpfiles.d/${_pkgname}.conf

  install -Dm0644 $srcdir/${_pkgname}/contrib/i2pd.conf $pkgdir/${_conf_dest}/${_pkgname}.conf
  install -Dm0644 $srcdir/${_pkgname}/contrib/tunnels.conf $pkgdir/${_conf_dest}/tunnels.conf
  install -Dm0644 $srcdir/${_pkgname}/contrib/subscriptions.txt $pkgdir/${_conf_dest}/subscriptions.txt

  install -d -m0750 $pkgdir/${_home_dest}
  ln -s /${_conf_dest}/${_pkgname}.conf $pkgdir/${_home_dest}/${_pkgname}.conf
  ln -s /${_conf_dest}/tunnels.conf $pkgdir/${_home_dest}/tunnels.conf
  ln -s /${_conf_dest}/subscriptions.txt $pkgdir/${_home_dest}/subscriptions.txt

  cd $srcdir/${_pkgname}/contrib
  _dest="$pkgdir/${_share_dest}/${_pkgname}"
  find ./certificates -type d -exec install -d {} ${_dest}/{} \;
  find ./certificates -type f -exec install -Dm644 {} ${_dest}/{} \;
  ln -s /${_share_dest}/${_pkgname}/certificates $pkgdir/${_home_dest}/certificates

  # license
  install -Dm644 $srcdir/${_pkgname}/LICENSE $pkgdir/${_share_dest}/licenses/${_pkgname}/LICENSE

  # docs
  _dest="$pkgdir/${_share_dest}/doc/${_pkgname}"
  install -Dm644 $srcdir/${_pkgname}/README.md "${_dest}/README.md"

  # remove src folder and LICENSE
  rm -r $pkgdir/usr/{src,LICENSE}

  #man
  install -Dm644 $srcdir/${_pkgname}/debian/${_pkgname}.1 $pkgdir/${_share_dest}/man/man1/${_pkgname}.1

  chmod -R o= $pkgdir/${_home_dest}
}
pkgver() {
  cd ${_pkgname}
  echo $(git describe --tags --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')
}

md5sums=('SKIP'
         '6e9869d619464902e635e520d21a8a56'
         '384658d2792ef6433d2de70ebc9d40d4')