summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7c7c225272f11b703569e1c9f14fbf80ad3e88f9 (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
# Maintainer:
# Contributor: Patrick Northon <northon_patrick3@yahoo.ca>

## links
# https://localsend.org/
# https://github.com/localsend/localsend

## options
: ${_install_path:=opt}

# basic info
_pkgname="localsend"
pkgname="$_pkgname"
pkgver=1.15.0
pkgrel=2
pkgdesc="An open source cross-platform alternative to AirDrop"
url="https://github.com/localsend/localsend"
license=('MIT')
arch=('x86_64')

depends=(
  'libayatana-appindicator'
)
makedepends=(
  'clang'
  'cmake'
  'git'
  'lld'
  'llvm'
  'ninja'
  'patchelf'

  ## AUR
  'fvm'
)

_pkgsrc="$_pkgname-$pkgver"
_pkgext="tar.gz"
source=("$_pkgsrc.$_pkgext"::"$url/archive/refs/tags/v$pkgver.$_pkgext")
sha256sums=('81869c30da552661602a2b9c678273577bb6c13a748df79901f6e0abb226caa2')

build() {
  export FVM_CACHE_PATH="$SRCDEST/fvm-cache"

  cd "$_pkgsrc/app"
  fvm install

  fvm flutter --disable-telemetry
  #fvm flutter pub upgrade --major-versions
  fvm flutter --no-version-check pub get
  fvm flutter build linux --release
}

package() {
  cd "$_pkgsrc/app/build/linux/x64/release/bundle"

  # app files
  install -Dm755 "localsend_app" "$pkgdir/$_install_path/$_pkgname/$_pkgname"
  cp --reflink=auto -r lib/ "$pkgdir/$_install_path/$_pkgname/"
  cp --reflink=auto -r data/ "$pkgdir/$_install_path/$_pkgname/"

  # runpath
  patchelf --set-rpath '$ORIGIN/lib' "$pkgdir/$_install_path/$_pkgname/$_pkgname"
  for i in "$pkgdir/$_install_path/$_pkgname/lib"/*.so; do
    [ -z "$(patchelf --print-rpath "$i")" ] && continue
    patchelf --set-rpath '$ORIGIN' "$i"
  done

  # symlink
  install -dm755 "${pkgdir}/usr/bin"
  ln -sfr "$pkgdir/$_install_path/$_pkgname/$_pkgname" "$pkgdir/usr/bin/${_pkgname}"

  # icon
  install -Dm644 "$srcdir/$_pkgsrc/app/build/flutter_assets/assets/img/logo-512.png" "$pkgdir/usr/share/pixmaps/$_pkgname.png"

  # .desktop file
  install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/$_pkgname.desktop" << END
[Desktop Entry]
Type=Application
Name=LocalSend
Comment=$pkgdesc
Exec=$_pkgname
Icon=$_pkgname
Terminal=false
Categories=Utility;Network;
END

  #license
  install -Dm644 "$srcdir/$_pkgsrc/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"

  # permissions
  chmod -R u+rwX,go+rX,go-w "$pkgdir/"
}