summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c4b9050ab65755fbdb8e8ce609ce5fd58c58cc61 (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
# Maintainer:
# Contributor: Leo Verto <leotheverto+aur@gmail.com>

: ${_build_v4:=true}

_pkgname="qlcplus"
pkgbase="$_pkgname-git"
pkgname=("${_pkgname}5-git")
pkgver=5.2.0.r43.ge4d8a4a
pkgrel=1
pkgdesc="Q Light Controller Plus to control professional DMX lighting fixtures"
url="https://github.com/mcallegari/qlcplus"
license=('Apache-2.0')
arch=('x86_64' 'i686' 'armv7h')

depends=(
  'fftw'
  'libftdi'
  'libmad'
  'libsndfile'
  'qt6-3d'
  'qt6-multimedia'
  'qt6-serialport'
  'qt6-svg'
  'qt6-websockets'
)
makedepends=(
  'cmake'
  'git'
  'ninja'
  'qt6-tools'
)
optdepends=(
  'ola: Open Lighting Architecture plugin'
)

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

options=('!lto')

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')

prepare() {
  cd "$_pkgsrc"

  # unset unnecessary warnings and errors
  sed -E -e 's&^.*set\(.*-W.*$&&' -i variables.cmake

  # force Qt6
  sed -e 's&Qt5 Qt6&Qt6&' CMakeLists.txt
}

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 --exclude='*[Rab]*' \
    | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  # for lrelease
  export PATH="/usr/lib/qt6/bin:$PATH"

  local _cmake_common=(
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX='/usr'
    -Wno-dev
  )

  local _cmake_5=(
    -B build5
    -Dqmlui=ON
  )

  echo "Building qlcplus5..."
  cmake "${_cmake_common[@]}" "${_cmake_5[@]}"
  cmake --build build5

  if [[ "${_build_v4::1}" == "t" ]]; then
    local _cmake_4=(
      -B build4
      -Dqmlui=OFF
    )

    echo "Building qlcplus4..."
    cmake "${_cmake_common[@]}" "${_cmake_4[@]}"
    cmake --build build4
  fi
}

package_qlcplus5-git() {
  DESTDIR="$pkgdir" cmake --install build5

  # unwanted
  rm "$pkgdir"/usr/lib/*.a
}

if [[ "${_build_v4::1}" == "t" ]]; then
  pkgname+=("${_pkgname}4-git")

  package_qlcplus4-git() {
    DESTDIR="$pkgdir" cmake --install build4
  }
fi