summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 48536576c76bee507c249623bbf26fe45a375dd8 (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
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: David Mougey <imapiekindaguy at gmail dot com>

# Set this variable to anything to disable translations.
# Or specify the two-letter language code of the translation you wish to keep.
_localepurge=

pkgname=sigil-git
pkgname_="${pkgname%-git}"
pkgver=1.9.20.r12.gf5fe387a1
pkgrel=1
pkgdesc='multi-platform EPUB2/EPUB3 ebook editor'
arch=('x86_64')
url="https://github.com/Sigil-Ebook/Sigil"
license=('GPL3')
depends=(
    hicolor-icon-theme
    hunspell
    mathjax2
    minizip
    python-css-parser
    python-dulwich
    python-lxml
    qt5-svg
    qt5-webengine
    )
makedepends=(
    cmake
    qt5-tools
    )
optdepends=(
    'hunspell-en_US: for English dictionary support'
    'hyphen-en: for English hyphenation support in plugins'
    'pageedit: external editor to replace BookView'
    'python-chardet: recommended for plugins'
    'python-cssselect: recommended for plugins'
    'python-html5lib: recommended for plugins'
    'python-pillow: recommended for plugins'
    'python-pyqt5: recommended for plugins'
    'python-pyqt5-webengine: recommended for plugins'
    'python-regex: recommended for plugins'
    'tk: recommended for plugins'
    )
provides=("${pkgname_}")
conflicts=("${pkgname_}")
source=(
    "${pkgname}"::"git+${url}"
    default_nav_css.patch
    skip_ver_mod_tags.patch
    skip_version_check.patch
    )
sha256sums=(
    'SKIP'
    '298928226e4e5cf9d2cf5298d2fe8c87357b92c8962c09c0683bc9af4ed9516c'
    '9414dfd43a18d83f82c099838faca1bba8e70fe9e66e5691e652345c5d2286ab'
    'ad10e067885809f0fab8aebcbc907f317ad7a43251d1cf9ffd0802dfb77cc540'
)

prepare() {
    cd "${srcdir}/${pkgname}"

    patch -p1 < "${srcdir}/default_nav_css.patch"
    patch -p1 < "${srcdir}/skip_ver_mod_tags.patch"
    patch -p1 < "${srcdir}/skip_version_check.patch"

    if [[ "${_localepurge}" != "" ]]; then
        for trans in src/Resource_Files/ts/*; do
            if [[ "$(basename $trans | sed -r 's/(_.*)_.*/\1/g')" != "sigil_${_localepurge}" ]]; then
                rm $trans
            fi
        done
    fi
}

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

build() {
    mkdir -p "${srcdir}/${pkgname}/build"
    cd "${srcdir}/${pkgname}/build"

    cmake -G "Unix Makefiles" \
        -DUSE_SYSTEM_LIBS=1 \
        -DSYSTEM_LIBS_REQUIRED=1 \
        -DINSTALL_BUNDLED_DICTS=0 \
        -DINSTALL_HICOLOR_ICONS=1 \
        -DDISABLE_UPDATE_CHECK=1 \
        -DMATHJAX_DIR=/usr/share/mathjax2 \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_C_FLAGS:STRING="$CFLAGS" \
        -DCMAKE_CXX_FLAGS:STRING="$CXXFLAGS" \
        -DCMAKE_SKIP_RPATH=ON ..
    make
}

package() {
    cd "${srcdir}/${pkgname}/build"
    make install DESTDIR="${pkgdir}"

    # Compile python bytecode
    python -m compileall "$pkgdir/usr/share/sigil/"{plugin_launchers/python/,python3lib}
    python -O -m compileall "$pkgdir/usr/share/sigil/"{plugin_launchers/python/,python3lib}
}