summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f3db9c08f21b4ddfce769ca3471df22627b1bb96 (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
# Contributor: Juanma Hernandez <juanmah@gmail.com>
# Maintainer: Zhaofeng Li <hello@zhaofeng.li>

pkgname=zotero-arm-bin
pkgver=5.0.89
pkgrel=3
pkgdesc="Zotero Standalone is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources (ARM Binaries)"
arch=('aarch64' 'armv7h')
url="http://www.zotero.org/download"
license=('GPL3')
depends=('dbus-glib' 'gtk3' 'nss' 'libxt' 'startup-notification')
provides=("zotero=${pkgver}")
conflicts=('zotero')
optdepends=(
  'zotero-xpdf: PDF indexing'
  'poppler-data: PDF indexing'
)

install='zotero.install'

source=(
  "zotero.desktop"
  "Zotero-${pkgver}_linux_x86_64.tar.bz2::https://www.zotero.org/download/client/dl?channel=release&platform=linux-x86_64&version=${pkgver}"
)
source_aarch64=(
  "firefox.deb::http://launchpadlibrarian.net/373617392/firefox_60.0.2+build1-0ubuntu0.18.04.1_arm64.deb"
)
source_armv7h=(
  "firefox.deb::http://launchpadlibrarian.net/373609086/firefox_60.0.2+build1-0ubuntu0.18.04.1_armhf.deb"
)
sha256sums=('2e700ebe97d332a894be80d232b037b0117d84b38c5fa99dffc727cb10918228'
            '74e1dbe47a3804bccfccdfd1f3d3fb92912c4f0bd30a776676c2a5eeacc5e4a2')
sha256sums_aarch64=('cad6ea6f971431ece476bda7499b30293dc6b533c1c35a41d1c90f46a0393729')
sha256sums_armv7h=('cad6ea6f971431ece476bda7499b30293dc6b533c1c35a41d1c90f46a0393729')

prepare() {
  ar x firefox.deb data.tar.xz
  tar xf data.tar.xz ./usr/lib/firefox --strip-components=3
  rm data.tar.xz
}

package() {
  install -dDm755 "$pkgdir"/usr/{bin,lib/zotero}
  mv "$srcdir"/Zotero_linux-x86_64/* "$pkgdir"/usr/lib/zotero
  ln -s /usr/lib/zotero/zotero "$pkgdir"/usr/bin/zotero
  install -Dm644 "$srcdir"/zotero.desktop "$pkgdir"/usr/share/applications/zotero.desktop
  # Copy zotero icons to a standard location
  install -Dm644 "$pkgdir"/usr/lib/zotero/chrome/icons/default/default16.png "$pkgdir"/usr/share/icons/hicolor/16x16/apps/zotero.png
  install -Dm644 "$pkgdir"/usr/lib/zotero/chrome/icons/default/default32.png "$pkgdir"/usr/share/icons/hicolor/32x32/apps/zotero.png
  install -Dm644 "$pkgdir"/usr/lib/zotero/chrome/icons/default/default48.png "$pkgdir"/usr/share/icons/hicolor/48x48/apps/zotero.png
  install -Dm644 "$pkgdir"/usr/lib/zotero/chrome/icons/default/default256.png "$pkgdir"/usr/share/icons/hicolor/256x256/apps/zotero.png
  # Disable APP update
  sed -i '/pref("app.update.enabled", true);/c\pref("app.update.enabled", false);' "$pkgdir"/usr/lib/zotero/defaults/preferences/prefs.js
  # No need to keep a shell around when launching Zotero
  sed -i -r 's/^("\$CALLDIR\/zotero-bin" -app "\$CALLDIR\/application.ini" "\$@")/exec \1/' "$pkgdir"/usr/lib/zotero/zotero

  # Remove poppler binaries
  rm -r "${pkgdir}/usr/lib/zotero/"{pdftotext,pdfinfo,poppler-data}

  # Link binaries from zotero-xpdf (optional)
  ln -s /usr/lib/zotero-xpdf/pdfinfo "${pkgdir}/usr/lib/zotero/pdfinfo"
  ln -s /usr/lib/zotero-xpdf/pdftotext "${pkgdir}/usr/lib/zotero/pdftotext"
  ln -s /usr/share/poppler "${pkgdir}/usr/lib/zotero/poppler-data"

  # Replace Firefox binaries
  #
  # I know you might want to vomit right now, but the official packaging
  # script from Zotero does the exact same thing (downloading pre-built
  # Firefox 60 binaries):
  #
  # https://github.com/zotero/zotero-standalone-build/blob/master/fetch_xulrunner.sh
  #
  # Please forgive me :P
  rm "${pkgdir}/usr/lib/zotero/"**.{so,chk}
  rm "${pkgdir}/usr/lib/zotero/gtk2/"*
  rm -r "${pkgdir}/usr/lib/zotero/gmp-clearkey"
  rm "${pkgdir}/usr/lib/zotero/"{updater,minidump-analyzer}
  install -Dm755 firefox/*.{so,chk} "${pkgdir}/usr/lib/zotero/"
  install -Dm755 firefox/gtk2/*.so "${pkgdir}/usr/lib/zotero/gtk2/"
  install -Dm755 firefox/plugin-container "${pkgdir}/usr/lib/zotero/plugin-container"
  install -Dm755 firefox/firefox "${pkgdir}/usr/lib/zotero/zotero-bin"
  install -Dm644 firefox/dependentlibs.list "${pkgdir}/usr/lib/zotero/dependentlibs.list"
}

# vim: et ts=2 sw=2: