summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c05e8172c6aab44c8d3251f05148eae01591eeba (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Maintainer: Leonid Lednev <leonidledn at gmail dot com>
# Contributor: Aaron Keesing <agkphysics at gmail dot com>
# Contributor: Siddhartha <dev@sdht.in>

pkgname=zotero-git
_pkgname="${pkgname%-git}"
pkgver=9.0.1.r16273.a487dd9
pkgrel=1
pkgdesc="A free, easy-to-use tool to help you collect, organize, cite, and share your research sources, git version"
arch=('x86_64' 'i686')
url="https://www.zotero.org"
license=('AGPL-3.0-or-later')
provides=("$_pkgname")
conflicts=("$_pkgname")
depends=(
  'dbus-glib'
  'gtk3'
  'nss'
  'libxt'
  'alsa-lib'
)
makedepends=(
  'npm'
  'git'
  'zip'
  'unzip'
  'perl'
  'python>=3'
  'curl'
  'wget'
  'rsync'
  'nodejs'
  'patch'
  'tar'
)
source=(
  "zotero.desktop"
  "zotero-client::git+https://github.com/zotero/zotero.git"
  "zotero-translators::git+https://github.com/zotero/translators.git"
  "zotero-styles::git+https://github.com/zotero/bundled-styles.git"
  "zotero-pdf-worker::git+https://github.com/zotero/pdf-worker.git"
  "zotero-note-editor::git+https://github.com/zotero/note-editor.git"
  "zotero-reader::git+https://github.com/zotero/reader.git"
  "zotero-schema::git+https://github.com/zotero/zotero-schema.git"
  "zotero-SingleFile::git+https://github.com/gildas-lormeau/SingleFile.git"
  "zotero-utilities::git+https://github.com/zotero/utilities.git"
  "zotero-translate::git+https://github.com/zotero/translate.git"
  "zotero-csl::git+https://github.com/citation-style-language/locales.git"
  "zotero-libreoffice-integration::git+https://github.com/zotero/zotero-libreoffice-integration.git"
  "zotero-pdf-js::git+https://github.com/zotero/pdf.js.git"
  "zotero-epub-js::git+https://github.com/zotero/epub.js.git"
  "disable-updater.patch"
)
sha256sums=(
  '6eab457a19ab59732ae97f4c6561458462c3fd5ab6ae0a0eaf7b64df113d16bd'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'dc1894ac2e1520c3dae8e9cd5e09608f4bb3298bdede2891a77118187edffa9d'
)

pkgver() {
  cd zotero-client
  _tag="$(git tag | sort -V | tail -1)"
  printf "%s.r%s.%s" "$_tag" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

prepare() {
  cd zotero-client

  patch -N -p1 < "$srcdir/disable-updater.patch"

  npm i --legacy-peer-deps

  git submodule init
  git submodule deinit --force app/modules/zotero-word-for-mac-integration app/modules/zotero-word-for-windows-integration
  git config submodule.translators.url "$srcdir/zotero-translators"
  git config submodule.styles.url "$srcdir/zotero-styles"
  git config submodule.pdf-worker.url "$srcdir/zotero-pdf-worker"
  git config submodule.note-editor.url "$srcdir/zotero-note-editor"
  git config submodule.pdf-reader.url "$srcdir/zotero-reader"
  git config submodule.resource/schema/global.url "$srcdir/zotero-schema"
  git config submodule.resource/SingleFile.url "$srcdir/zotero-SingleFile"
  git config submodule.chrome/content/zotero/xpcom/utilities.url "$srcdir/zotero-utilities"
  git config submodule.chrome/content/zotero/xpcom/translate.url "$srcdir/zotero-translate"
  git config submodule.chrome/content/zotero/locale/csl.url "$srcdir/zotero-csl"
  git config submodule.app/modules/zotero-libreoffice-integration.url "$srcdir/zotero-libreoffice-integration"
  git -c protocol.file.allow=always submodule update

  cd "$srcdir/zotero-client/chrome/content/zotero/xpcom/utilities"
  git config submodule.resource/schema/global.url "$srcdir/zotero-schema"
  git -c protocol.file.allow=always submodule update

  cd "$srcdir/zotero-client/chrome/content/zotero/xpcom/translate/modules/utilities"
  git config submodule.resource/schema/global.url "$srcdir/zotero-schema"
  git -c protocol.file.allow=always submodule update

  cd "$srcdir/zotero-client/reader"
  git submodule init
  git config submodule.pdfjs/pdf.js.url "$srcdir/zotero-pdf-js"
  git config submodule.epubjs/epub.js.url "$srcdir/zotero-epub-js"
  git -c protocol.file.allow=always submodule update

  cd "$srcdir/zotero-client/document-worker"
  git submodule init
  git config submodule.pdf.js.url "$srcdir/zotero-pdf-js"
  git -c protocol.file.allow=always submodule update
}

build() {
  cd zotero-client
  _NODE_OPTIONS="--openssl-legacy-provider"
  if (( $(vercmp "$(node --version)" "25.2.0") >= 0 )); then
    _NODE_OPTIONS="$_NODE_OPTIONS --no-experimental-webstorage"
  fi
  NODE_OPTIONS="$_NODE_OPTIONS" npm run build
  app/scripts/dir_build -q
}

package() {
  install -dDm755 "$pkgdir"/usr/{bin,lib/zotero}
  cp -r "$srcdir/zotero-client/app/staging/Zotero_linux-$CARCH"/* "$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/icons/icon32.png" "$pkgdir/usr/share/icons/hicolor/32x32/apps/zotero.png"
  install -Dm644 "$pkgdir/usr/lib/zotero/icons/icon64.png" "$pkgdir/usr/share/icons/hicolor/64x64/apps/zotero.png"
  install -Dm644 "$pkgdir/usr/lib/zotero/icons/icon128.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/zotero.png"
  install -Dm644 "$pkgdir/usr/lib/zotero/icons/symbolic.svg" "$pkgdir/usr/share/icons/hicolor/symbolic/apps/zotero-symbolic.svg"

  # Close shell when launching
  sed -i -r 's:^("\$CALLDIR/zotero-bin" -app "\$CALLDIR/application.ini" "\$@"):exec \1:' "$pkgdir/usr/lib/zotero/zotero"
}
# vim: ts=2 sw=2 et: