diff options
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | PKGBUILD | 220 |
2 files changed, 133 insertions, 105 deletions
@@ -1,38 +1,34 @@ pkgbase = sigil-git pkgdesc = multi-platform EPUB2/EPUB3 ebook editor - pkgver = 2.0.2.r11.gb9438a876 + pkgver = 2.0.2.r50.gd3016cd17 pkgrel = 1 url = https://github.com/Sigil-Ebook/Sigil arch = x86_64 - license = GPL3 + license = GPL-3.0-or-later makedepends = cmake makedepends = git - makedepends = python makedepends = qt6-tools depends = hicolor-icon-theme depends = hunspell depends = mathjax depends = minizip - depends = pcre2 - depends = python-cchardet - depends = python-certifi - depends = python-chardet depends = python-css-parser depends = python-dulwich - depends = python-html5lib depends = python-lxml depends = qt6-5compat + depends = qt6-svg depends = qt6-webengine optdepends = hunspell-en_US: for English dictionary support optdepends = hyphen-en: for English hyphenation support in plugins optdepends = pageedit: external editor to replace BookView + optdepends = pyside6: recommended for plugins + optdepends = python-chardet: recommended for plugins optdepends = python-cssselect: recommended for plugins + optdepends = python-html5lib: recommended for plugins optdepends = python-pillow: recommended for plugins - optdepends = python-pyqt6-webengine: recommended for plugins - optdepends = python-pyqt6: recommended for plugins optdepends = python-regex: recommended for plugins optdepends = tk: recommended for plugins - provides = sigil + provides = sigil=2.0.2 conflicts = sigil options = !debug source = sigil::git+https://github.com/Sigil-Ebook/Sigil.git @@ -2,105 +2,133 @@ # 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= +## options +# set to two letter code of language to keep +: ${_localepurge=} +: ${_build_git:=true} + +[[ "${_build_git::1}" == "t" ]] && _pkgtype+="-git" + +# basic info _pkgname=sigil -pkgname="$_pkgname-git" -pkgver=2.0.2.r11.gb9438a876 +pkgname="$_pkgname${_pkgtype:-}" +pkgver=2.0.2.r50.gd3016cd17 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' - 'mathjax' - 'minizip' - 'pcre2' - 'python-cchardet' - 'python-certifi' - 'python-chardet' - 'python-css-parser' - 'python-dulwich' - 'python-html5lib' - 'python-lxml' - 'qt6-5compat' - 'qt6-webengine' -) -makedepends=( - 'cmake' - 'git' - 'python' - 'qt6-tools' -) -optdepends=( - 'hunspell-en_US: for English dictionary support' - 'hyphen-en: for English hyphenation support in plugins' - 'pageedit: external editor to replace BookView' - 'python-cssselect: recommended for plugins' - 'python-pillow: recommended for plugins' - 'python-pyqt6-webengine: recommended for plugins' - 'python-pyqt6: recommended for plugins' - 'python-regex: recommended for plugins' - 'tk: recommended for plugins' -) - - -if [ x"$pkgname" == x"$_pkgname" ] ; then - # normal package +license=('GPL-3.0-or-later') +arch=('x86_64') + +# main package +_main_package() { + depends=( + 'hicolor-icon-theme' + 'hunspell' + 'mathjax' + 'minizip' + 'python-css-parser' + 'python-dulwich' + 'python-lxml' + 'qt6-5compat' + 'qt6-svg' + 'qt6-webengine' + ) + makedepends=( + 'cmake' + 'git' + 'qt6-tools' + ) + optdepends=( + 'hunspell-en_US: for English dictionary support' + 'hyphen-en: for English hyphenation support in plugins' + 'pageedit: external editor to replace BookView' + 'pyside6: recommended for plugins' + 'python-chardet: recommended for plugins' + 'python-cssselect: recommended for plugins' + 'python-html5lib: recommended for plugins' + 'python-pillow: recommended for plugins' + 'python-regex: recommended for plugins' + 'tk: recommended for plugins' + ) + + options=(!debug) + + if [ x"$pkgname" == x"$_pkgname" ] ; then + _main_stable + else + _main_git + fi + + _source_patches +} + +_source_patches() { + source+=( + '0001-modify-default-navigation-css.patch' + '0002-skip-epub-version-check.patch' + '0003-don-t-write-version-and-modified-tags.patch' + ) + + sha256sums+=( + '157504daff4a410fc14cbe78820940b27e6790e5cd723f1764ca78134630dbee' + '7d213fa2b5eae33723b1e1a17f0ed28a518e9edcc0496e2a67afc8d0e5cb36e3' + '820e012907c70260af2cc2be6d1697037e1527f346727f3b4378ea215038b0d6' + ) + + _prepare_patches() ( + cd "${srcdir:?}/$_pkgsrc" + apply-patch "${srcdir:?}/0001-modify-default-navigation-css.patch" + apply-patch "${srcdir:?}/0002-skip-epub-version-check.patch" + apply-patch "${srcdir:?}/0003-don-t-write-version-and-modified-tags.patch" + ) +} + +# stable package +_main_stable() { _pkgsrc="$_pkgname" source+=("$_pkgsrc"::"git+$url.git#tag=${pkgver%%.r*}") sha256sums+=('SKIP') pkgver() { - echo "${pkgver%%.r*}" + local _pkgver="${pkgver%%.r*}" + echo "${_pkgver:?}" } -else - # git package - provides=("$_pkgname") +} + +# git package +_main_git() { + provides=("$_pkgname=${pkgver%%.r*}") conflicts=("$_pkgname") _pkgsrc="$_pkgname" source+=("$_pkgsrc"::"git+$url.git") sha256sums+=('SKIP') - pkgver() { + pkgver() ( cd "$_pkgsrc" - git describe --long --tags --exclude='*[a-zA-Z][a-zA-Z]*' | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g' - } -fi - -options=(!debug) - -source+=( - '0001-modify-default-navigation-css.patch' - '0002-skip-epub-version-check.patch' - '0003-don-t-write-version-and-modified-tags.patch' -) + local _pkgver=$( + git describe --long --tags --exclude='*[a-zA-Z][a-zA-Z]*' 2>/dev/null \ + | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g' + ) -sha256sums+=( - '157504daff4a410fc14cbe78820940b27e6790e5cd723f1764ca78134630dbee' - '7d213fa2b5eae33723b1e1a17f0ed28a518e9edcc0496e2a67afc8d0e5cb36e3' - '820e012907c70260af2cc2be6d1697037e1527f346727f3b4378ea215038b0d6' -) + echo "${_pkgver:?}" + ) +} +# common funtions prepare() { - cd "$_pkgsrc" + apply-patch() { + printf '\nApplying patch %s\n' "$1" + patch -Np1 -F100 -i "$1" + } - local src - for src in "${source[@]}"; do - src="${src%%::*}" - src="${src##*/}" - src="${src%.zst}" - if [[ $src == *.patch ]] ; then - printf '\nApplying patch: %s\n' "$src" - patch -Np1 -F100 -i "${srcdir:?}/$src" - fi - done + _prepare_patches + cd "$_pkgsrc" + # Set _localepurge to disable or keep translations. + # Specify the two-letter language code of the translation to keep. + # If language does not exist, all languages will be purged. if [[ "${_localepurge}" != "" ]]; then for trans in src/Resource_Files/ts/*; do if [[ "$(basename $trans | sed -r 's/(_.*)_.*/\1/g')" != "sigil_${_localepurge}" ]]; then @@ -111,30 +139,34 @@ prepare() { } build() { - cmake -G "Unix Makefiles" \ - -B build \ - -S "$_pkgname" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX='/usr' \ - -DCMAKE_INSTALL_LIBDIR='lib' \ - -DMATHJAX3_DIR='/usr/share/mathjax' \ - -DUSE_QT6=1 \ - -DUSE_SYSTEM_LIBS=1 \ - -DSYSTEM_LIBS_REQUIRED=1 \ - -DINSTALL_BUNDLED_DICTS=0 \ - -DINSTALL_HICOLOR_ICONS=1 \ - -DDISABLE_UPDATE_CHECK=1 \ - -DCMAKE_C_FLAGS:STRING="$CFLAGS" \ - -DCMAKE_CXX_FLAGS:STRING="$CXXFLAGS" \ + local _cmake_config=( + -B build + -S "$_pkgname" + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX='/usr' + -DCMAKE_INSTALL_LIBDIR='lib' + -DMATHJAX3_DIR='/usr/share/mathjax' + -DSYSTEM_LIBS_REQUIRED=1 + -DUSE_SYSTEM_LIBS=1 + -DDISABLE_UPDATE_CHECK=1 + -DINSTALL_BUNDLED_DICTS=0 + -DINSTALL_HICOLOR_ICONS=1 + -DCMAKE_CXX_FLAGS="$CXXFLAGS" + -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_SKIP_RPATH=ON + ) + cmake "${_cmake_config[@]}" cmake --build build } package() { - DESTDIR="$pkgdir" cmake --install build + DESTDIR="${pkgdir:?}" cmake --install build # 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} + python -m compileall "${pkgdir:?}/usr/share/sigil/"{plugin_launchers/python/,python3lib} + python -O -m compileall "${pkgdir:?}/usr/share/sigil/"{plugin_launchers/python/,python3lib} } + +# execute +_main_package |