summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 88f0ff48458fa1b07530bef4ba33fb573e0ea81b (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
# Maintainer: L. Bradley LaBoon <me@bradleylaboon.com>

_pkgname="qflipper"
pkgname="$_pkgname-git"
pkgver=1.3.2.r0.g7b0839e
pkgrel=1
pkgdesc="Desktop application for updating Flipper Zero firmware via PC"
license=('GPL3')
arch=('x86_64')
depends=(
  'libusb'
  'qt6-5compat'
  'qt6-quickcontrols2'
  'qt6-serialport'
  'qt6-svg'
)
makedepends=(
  'git'
  'qt6-tools'
)
source=(
  "libwdi"::"git+https://github.com/pbatard/libwdi"
  "nanopb"::"git+https://github.com/nanopb/nanopb"
)
sha256sums=(
  'SKIP'
  'SKIP'
)

if [ x"$_pkgname" == x"$pkgname" ] ; then
  # normal package
  url="https://flipperzero.one/update"

  source+=("$_pkgname"::"git+https://github.com/flipperdevices/qFlipper#tag=$pkgver")
  sha256sums+=('SKIP')
else
  # x-git package
  url="https://github.com/flipperdevices/qFlipper"

  provides+=("$_pkgname")
  conflicts+=("$_pkgname")

  source+=("$_pkgname"::"git+https://github.com/flipperdevices/qFlipper")
  sha256sums+=('SKIP')

  pkgver() {
    cd "$_pkgname"
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/; s/-/./g; s/^v//'
  }
fi

prepare() {
  cd "$_pkgname"
  git submodule init
  git config submodule.driver-tool/libwdi.url "$srcdir/libwdi"
  git config submodule.3rdparty/nanopb.url "$srcdir/nanopb"
  git -c protocol.file.allow=always submodule update

  # Use uucp group instead of dialout for udev rules
  sed -i 's/dialout/uucp/g' installer-assets/udev/42-flipperzero.rules
}

build() {
  local _qmake_options=(
    ../qFlipper.pro
    -spec linux-g++
    CONFIG+=qtquickcompiler
    DEFINES+=DISABLE_APPLICATION_UPDATES
    PREFIX=/usr
  )

  mkdir -p "$_pkgname/build"
  cd "$_pkgname/build"

  qmake6 "${_qmake_options[@]}"

  make qmake_all
  make
}

package() {
  make -C "$_pkgname/build" INSTALL_ROOT="$pkgdir" install
}