summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 43548e4e75f8d789534f5d261db51e03d9682d0c (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
# Maintainer:

## options
: ${_widgets:=qt6}
: ${_branch=develop}

_pkgname="transgui"
pkgname="$_pkgname-git"
pkgver=5.18.8.r1.ga704302
pkgrel=1
pkgdesc="Transmission BitTorrent client (${_widgets^})"
url="https://github.com/lighterowl/transgui"
license=("GPL-2.0-or-later")
arch=('x86_64')

case "${_widgets::1}" in
  g)
    depends=("${_widgets}")
    ;;
  q)
    depends=("${_widgets}pas")
    ;;
esac
makedepends=(
  'git'
  'lazarus'
)

provides=("transgui=${pkgver%%.g*}")
conflicts=(
  "transgui"
  "transgui-gtk"
  "transgui-qt"
)

options=('!strip' '!debug')

_pkgsrc="lighterowl.transgui"
source=("$_pkgsrc"::"git+$url.git#branch=${_branch:-develop}")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 | sed -r 's/([^-]*-g)/r\1/;s/-/./g;s/^v//g;s&\.[a-zA-Z]+\.&.&'
}

prepare() {
  cd "$_pkgsrc"
  git submodule update --init --recursive --depth 1

  # set compiler options
  sed -E 's&<CustomOptions Value=".*".*/>&<CustomOptions Value="-O3 -Sa -CX -XX -k--sort-common -k--as-needed -k-z -krelro -k-z -know"/>&' \
    -i "transgui.lpi"
}

build() {
  mkdir -p build

  local _laz_opts=(
    --build-all
    --cpu="$CARCH"
    --lazarusdir="/usr/lib/lazarus"
    --os=linux
    --primary-config-path=build
    --widgetset="$_widgets"
  )

  lazbuild "${_laz_opts[@]}" "$_pkgsrc/transgui.lpi"
}

package() {
  install -Dm755 "$_pkgsrc/units/transgui" "$pkgdir/usr/bin/transgui"

  install -Dm644 "$_pkgsrc/transgui.png" -t "$pkgdir/usr/share/pixmaps/"

  install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/transgui.desktop" << END
[Desktop Entry]
Name=Transmission Remote GUI
Comment=Cross platform remote GUI for the Transmission daemon
Exec=transgui %U
Icon=transgui
Terminal=false
Type=Application
Categories=Network;FileTransfer;P2P;GTK;
MimeType=application/x-bittorrent;application/x-torrent;x-scheme-handler/magnet;
END

  install -Dm644 "$_pkgsrc/lang"/transgui.* -t "$pkgdir/usr/share/transgui/lang"
  rm "$pkgdir/usr/share/transgui/lang/transgui.template"
}