aboutsummaryrefslogtreecommitdiff
path: root/linux/makepkg/PKGBUILD
blob: cd21909d8f15cf4a61ea9805654107202e242df8 (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
# Maintainer: Aqua-sama <aqua@iserlohn-fortress.net>

pkgname=smolbote-hg
pkgver=0
pkgrel=1
pkgdesc='Yet another no-frills browser'
url="https://neueland.iserlohn-fortress.net/smolbote"

arch=('x86_64')
license=('GPL3')

# -hg replace the old -git package
replaces=('smolbote-git')

depends=('qt5-webengine>=5.10.1' 'boost-libs>=1.66.0')
optdepends=('firejail: launch a sandboxed instance')
makedepends=('mercurial' 'cmake' 'pkg-config' 'go-md2man')

# this is the central repository
source=("smolbote-hg::hg+https://neueland.iserlohn-fortress.net/smolbote.hg")
# if you're test building, you might want to hg serve your own repo
#source=("smolbote-hg::hg+http://localhost:8000")

sha512sums=('SKIP')
validgpgkeys=(# Aqua-sama <aqua@iserlohn-fortress.net>
              BB1C090188E3E32B375C13FD095DE26BC16D2E98)

prepare() {
    # go into src/smolbote-hg
    cd smolbote-hg

    msg2 "Verifying integrity"
    # get commit id
    _node="$(hg log -r tip --template='{node}')"
    # download checksums and signature
    curl -O https://neueland.iserlohn-fortress.net/smolbote/integrity/$_node \
         -O https://neueland.iserlohn-fortress.net/smolbote/integrity/$_node.sig
    # verify signature and files
    gpg --verify $_node.sig
    sha512sum --check --quiet $_node
}

pkgver() {
    cd smolbote-hg
    printf "r%s.%s" "$(hg identify -n)" "$(hg identify -i)"
}

build() {
    # clean build folder
    # src/smolbote-hg-r000.123456789012
    rm -rf "$pkgname-$pkgver"
    mkdir "$pkgname-$pkgver"
    cd "$pkgname-$pkgver"

    msg2 "Building smolbote"
    # CMake Options
    # Build Type
    # Debug builds don't have install rules.
    _cmake_options="-DCMAKE_BUILD_TYPE=Release"

    # Install Prefix
    # Where should the binary be installed? In this case /usr/local.
    _cmake_options="$_cmake_options -DCMAKE_INSTALL_PREFIX=$pkgdir/usr/local"

    # Compiler
    # Flavour: no need to change the compiler, gcc works just fine
    _cmake_options="$_cmake_options -DCMAKE_C_COMPILER=/usr/bin/clang"
    _cmake_options="$_cmake_options -DCMAKE_CXX_COMPILER=/usr/bin/clang++"

    # Use libc++ instead of libstdc++
    # Flavour, also requires clang
    #_cmake_options="$_cmake_options -DUseLibCpp=On"

    # Flavour: add some KF5 effects
    # this requires 'extra-cmake-modules'
    #_cmake_options="$_cmake_options -DPlasma=On"

    # Generate Makefile
    cmake $_cmake_options "$srcdir/smolbote-hg"

    # Build
    make

    msg2 "Generating manpage"
    go-md2man -in $srcdir/smolbote-hg/linux/man/smolbote.md -out smolbote.7
    gzip smolbote.7
}

package() {
    cd "$pkgname-$pkgver"

    # Install
    make install

    # icon and .desktop
    install -Dm644 "${srcdir}/smolbote-hg/data/poi.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/poi.svg"
    install -Dm644 "${srcdir}/smolbote-hg/linux/poi.desktop" "${pkgdir}/usr/share/applications/poi.desktop"

    # firejail profile
    install -Dm644 "${srcdir}/smolbote-hg/data/poi.profile" "${pkgdir}/usr/local/lib/smolbote/poi.profile"

    # man page
    install -Dm644 smolbote.7.gz $pkgdir/usr/local/man/man7/smolbote.7.gz
}