summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e86bc31c745730a3eae3d6b7bc92ceb91785f421 (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
# Maintainer : Daniel Bermond <dbermond@archlinux.org>
# Contributor: robertfoster
# Contributor: kurych
# Contributor: redfish
# Contributor: DDoSolitary <DDoSolitary@gmail.com>

pkgname=i2pd-git
pkgver=2.58.0.r48.g1891bd5b
pkgrel=1
pkgdesc='A full-featured C++ implementation of the I2P router (git version)'
arch=('x86_64')
url='https://i2pd.website/'
license=('BSD-3-Clause')
depends=(
    'boost-libs'
    'gcc-libs'
    'glibc'
    'libminiupnpc.so'
    'openssl'
    'zlib')
makedepends=(
    'boost'
    'check'
    'cmake'
    'git')
provides=('i2pd' 'i2p-router')
conflicts=('i2pd')
backup=('etc/i2pd/i2pd.conf'
        'etc/i2pd/tunnels.conf'
        'etc/logrotate.d/i2pd')
source=('git+https://github.com/PurpleI2P/i2pd.git#branch=openssl'
        '005-i2pd-tests-use-arch-flags.patch'
        '010-i2pd-config.patch'
        '020-i2pd-do-not-override-config.patch'
        '030-i2pd-systemd-service-hardening.patch'
        '040-i2pd-tunnels-d-readme.patch'
        'i2pd.sysusers'
        'i2pd.tmpfiles')
sha256sums=('SKIP'
            '2ddf15f1c1cdf5d747a0af667145238023fd126ab00c65f2897cacae935015b1'
            'ed1bde650139731921bf3c8091b3332620404e7700fb9c486a4a806fe34e2d3b'
            '3168e9bc1b15885b1658fac6efcd0741f7f82b571798380ecffa54eaa84aadde'
            'aebb352395341db9d912685d32611c1f61f55cc5ae045917a7b87c44cfe9ed6e'
            'cfcb6b07b67aff3e3af12767f4649d88b9320dc71907b6c01b465e5c138cdaa3'
            '2f91fd455ea801df9a9bcc5f3f83def231d9149eec8b206588c8be21654e5b7c'
            'fe8cc2ec83cb5b5c2b2ec8cce9a989e0cb6fd347e00b84e03a17b12efd152fac')

prepare() {
    patch -d i2pd -Np1 -i "${srcdir}/005-i2pd-tests-use-arch-flags.patch"
    patch -d i2pd -Np1 -i "${srcdir}/010-i2pd-config.patch"
    patch -d i2pd -Np1 -i "${srcdir}/020-i2pd-do-not-override-config.patch"
    patch -d i2pd -Np1 -i "${srcdir}/030-i2pd-systemd-service-hardening.patch"
    patch -d i2pd -Np1 -i "${srcdir}/040-i2pd-tunnels-d-readme.patch"
}

pkgver() {
    git -C i2pd describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

build() {
    cmake \
        -B build \
        -S i2pd/build \
        -G 'Unix Makefiles' \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DBUILD_SHARED_LIBS:BOOL='ON' \
        -DWITH_UPNP:BOOL='ON' \
        -DBUILD_TESTING:BOOL='ON' \
        -Wno-dev
    cmake --build build
}

check() {
    ctest --test-dir build --output-on-failure
}

package() {
    DESTDIR="$pkgdir" cmake --install build
    
    # config
    install -D -m644 i2pd/contrib/{i2pd,tunnels}.conf -t "${pkgdir}/etc/i2pd"
    install -d -m755 "${pkgdir}/etc/i2pd/tunnels.d"
    
    # certificates
    install -d -m755 "${pkgdir}/usr/share/i2pd"
    cp -dr --no-preserve='ownership' i2pd/contrib/certificates "${pkgdir}/usr/share/i2pd"
    
    # systemd
    install -D -m644 i2pd/contrib/i2pd.service -t "${pkgdir}/usr/lib/systemd/system"
    install -D -m644 i2pd.sysusers "${pkgdir}/usr/lib/sysusers.d/i2pd.conf"
    install -D -m644 i2pd.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/i2pd.conf"
    
    # logrotate
    install -D -m644 i2pd/contrib/i2pd.logrotate "${pkgdir}/etc/logrotate.d/i2pd"
    
    # tunnels.d examples
    install -D -m644 i2pd/contrib/tunnels.d/{*.conf,README} -t "${pkgdir}/usr/share/doc/i2pd/tunnels.d"
    
    # headers
    install -D -m644 i2pd/{i18n,libi2pd{,_client}}/*.h -t "${pkgdir}/usr/include/i2pd"
    
    # man page
    install -D -m644 i2pd/debian/i2pd.1 -t "${pkgdir}/usr/share/man/man1"
    
    # license
    install -D -m644 i2pd/LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}