summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 282b60f4d74e8495d8207fc9a88ccaedc78becfa (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
# Maintainer: czyt<czytcn@gmail.com>

pkgname=readest-bin
pkgver=0.9.0
pkgrel=1
pkgdesc="A reader application for EPUB files (AppImage version)"
arch=('x86_64')
url="https://github.com/chrox/readest"
license=('AGPL-3.0')
depends=(
    'fuse2'
    'appmenu-gtk-module'
    'gtk3'
    'libappindicator-gtk3'
)
optdepends=(
    'libappindicator-gtk2: GTK2 support'
    'libappindicator-gtk3: GTK3 support'
)
provides=('readest')
conflicts=('readest')
options=('!strip')
source=("https://github.com/chrox/readest/releases/download/v${pkgver}/Readest_${pkgver}_amd64.AppImage")
sha256sums=('8b125e02ae90ef2f65edffc7a73c25f021f47ee6cf1fcc1730c7f044bd6afb55')  

prepare() {
    cd "${srcdir}"
    chmod +x "Readest_${pkgver}_amd64.AppImage"
    
    # extract
    ./Readest_${pkgver}_amd64.AppImage --appimage-extract
}

package() {
    cd "${srcdir}"
    
    install -dm755 "${pkgdir}/usr/bin"
    install -dm755 "${pkgdir}/usr/share/applications"
    install -dm755 "${pkgdir}/usr/share/pixmaps"
    
    # install AppImage
    install -Dm755 "Readest_${pkgver}_amd64.AppImage" "${pkgdir}/opt/${pkgname}/readest.AppImage"
    
    # create launcher
    cat > "${pkgdir}/usr/bin/readest" << EOF
#!/bin/bash
exec "/opt/${pkgname}/readest.AppImage" "\$@"
EOF
    chmod 755 "${pkgdir}/usr/bin/readest"
    
    # install icon
    if [ -f squashfs-root/readest.png ]; then
        install -Dm644 squashfs-root/readest.png "${pkgdir}/usr/share/pixmaps/readest.png"
    elif [ -f squashfs-root/usr/share/icons/hicolor/256x256/apps/readest.png ]; then
        install -Dm644 squashfs-root/usr/share/icons/hicolor/256x256/apps/readest.png "${pkgdir}/usr/share/pixmaps/readest.png"
    elif [ -f squashfs-root/.DirIcon ]; then
        install -Dm644 squashfs-root/.DirIcon "${pkgdir}/usr/share/pixmaps/readest.png"
    fi
    
    # create desktop entry
    cat > "${pkgdir}/usr/share/applications/readest.desktop" << EOF
[Desktop Entry]
Name=Readest
Comment=EPUB Reader
Exec=readest %F
Icon=readest
Type=Application
Categories=Office;Viewer;
Terminal=false
MimeType=application/epub+zip;
EOF

rm -rf "${srcdir}/squashfs-root"
}