summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d7cec086faecc7b46af964e93162ca68e0eb5db4 (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
# Maintainer:
# Contributor: Yvaniak <Yvaniak 11 at gmail dot com>
# Contributor: Vladimir Svyatski <vsvyatski@yandex.ru>
# Contributor: Edoardo Brogiolo <edoardo@brogiolo.eu>
# Contributor: Dimitris Kiziridis <ragouel@outlook.com>

: ${_widgets:=gtk2}

[[ "${_widgets::3}" == "gtk" ]] \
  && : ${_cksum=26865cace53f0584595c5aba423ed418d755d4fcead89af0829b37faece78918}

: ${_pkgtype:=-${_widgets}-bin}

_pkgname="peazip"
pkgname="$_pkgname${_pkgtype:?}"
pkgver=10.5.0
pkgrel=1
pkgdesc="Cross-platform file and archive manager (${_widgets^^})"
url="https://github.com/peazip/PeaZip"
license=('LGPL-3.0-or-later')
arch=('x86_64')

_depends=(
  '7zip'
  'brotli'
  'zstd'
)
makedepends=(
  'patchelf'
)
optdepends=(
  'arc: Arc file archiver and compressor'
)

case "${_widgets::1}" in
  'g')
    _depends+=("${_widgets}")
    ;;
  'q')
    _depends+=("${_widgets}-base")
    ;;
esac

options=('!debug' '!emptydirs')

provides=("$_pkgname")
conflicts=("$_pkgname" "$pkgname-debug")

_pkgsrc_plugins="peazip-additional-formats-plugin.6.LINUX"
source=(
  "$url/releases/download/$pkgver/peazip-$pkgver.LINUX.${_widgets^^}-1.$CARCH.rpm"
  "https://cyfuture.dl.sourceforge.net/project/peazip/Resources/PeaZip%20Additional%20Formats%20Plugin/$_pkgsrc_plugins.tar"
)
sha256sums=(
  "${_cksum:-SKIP}"
  'd2ce07156ce170625008caf384b53bff9b087331d7e12ee711aa94a200316c84'
)

prepare() {
  local i _plugin_path _unwanted _plugins _symlinks
  _plugin_path="usr/lib/peazip/res/bin"

  # program
  ln -sf /usr/lib/peazip/peazip "usr/bin/peazip"
  ln -sf /usr/lib/peazip/pea "usr/bin/pea"

  patchelf --add-rpath '$ORIGIN' "usr/lib/peazip/peazip"
  patchelf --add-rpath '$ORIGIN' "usr/lib/peazip/pea"

  # remove extraneous
  _unwanted=(
    "$_plugin_path"/*/note.txt
    "$_plugin_path"/7z/*
    usr/lib/.build-id
    usr/lib/libQt6Pas.so*
    usr/share/doc
    usr/share/icons
    usr/share/peazip/*/readme*.txt
    usr/share/peazip/batch
    usr/share/peazip/copying
    usr/share/peazip/icons/peazip_seven.icl
    usr/share/peazip/lang-wincontext
    usr/share/peazip/readme
  )

  for i in "${_unwanted[@]}"; do
    [ -e "$i" ] || [ -L "$i" ] && rm -rf "$i"
  done

  # symlink plugins
  _symlinks=(
    7z
    arc
    brotli
    zstd
  )
  for i in "${_symlinks[@]}"; do
    install -dm755 "$_plugin_path/$i"
    ln -sf "/usr/bin/$i" "$_plugin_path/$i/$i"
  done

  # binary plugins
  _plugins=(
    lpaq
    paq
    quad
    upx
    zpaq
  )
  for i in "${_plugins[@]}"; do
    cp -a "$srcdir/$_pkgsrc_plugins/$i" "$_plugin_path/"
  done
}

package() {
  depends=("${_depends[@]}")
  cp -a usr "$pkgdir/"
  chmod -R u+rwX,go+rX,go-w "$pkgdir/"
}