summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a37c85c80dc487fd0361644f24f2362ab647cc50 (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
# Maintainer: lod <aur@lod.sh>

pkgname=edgetx-companion
pkgver=2.12.5
pkgrel=1
pkgdesc="EEPROM Editor and Simulator for EdgeTX RC radio transmitter firmwares"
arch=('x86_64')
url='https://edgetx.org/'
license=('GPL-2.0-only')
depends=('dfu-util' 'glibc' 'hicolor-icon-theme' 'libgcc' 'libstdc++' 'qt6-base' 'qt6-multimedia' 'qt6-serialport' 'sdl2')
makedepends=('arm-none-eabi-binutils' 'arm-none-eabi-gcc' 'arm-none-eabi-newlib' 'avr-gcc' 'avr-libc' 'bc' 'clang' 'cmake' 'doxygen'
             'fox' 'gcc' 'git' 'ninja' 'python' 'python-jinja' 'python-lz4' 'python-pillow' 'qt6-svg' 'qt6-tools' 'sed')
options=('!debug')
provides=('companion')
conflicts=('companion')
source=("git+https://github.com/EdgeTX/edgetx.git#tag=v$pkgver"
        "git+https://github.com/raphaelcoeffic/AccessDenied.git"
        "git+https://github.com/FreeRTOS/FreeRTOS-Kernel.git"
        "git+https://github.com/FreeRTOS/FreeRTOS-Kernel-Community-Supported-Ports.git"
        "git+https://github.com/FreeRTOS/FreeRTOS-Kernel-Partner-Supported-Ports.git"
        "git+https://github.com/EdgeTX/lvgl.git"
        "git+https://github.com/nothings/stb.git"
        "git+https://github.com/microsoft/uf2"
        "git+https://github.com/signal11/hidapi")
b2sums=('aa5a4e0d897ffafc7fd512def14e7726f4c821d0037778c6d20323c9cffd5f589acbe6ba1c8dfabba211030041184babc26191cecc442f08250a1ec32d5a33c5'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP')

prepare() {
  # Deactivate this statement; it bundles the OPENSSL lib for AppImage.
  sed -i "s/if(OPENSSL_FOUND)/if(false)/g" edgetx/companion/src/CMakeLists.txt
  # Install the desktop files
  sed -i '/simulator.desktop.in.*)/a install(FILES ${COMPANION_DESKTOP_FILE} ${SIMULATOR_DESKTOP_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)' edgetx/companion/src/CMakeLists.txt

  cd "$srcdir/edgetx/radio/src/thirdparty/"
  git submodule init
  git config submodule.AccessDenied.url "$srcdir/AccessDenied"
  git config submodule.FreeRTOS-Kernel.url "$srcdir/FreeRTOS-Kernel"
  git config submodule.lvgl.url "$srcdir/lvgl"
  git config submodule.stb.url "$srcdir/stb"
  git config submodule.uf2.url "$srcdir/uf2"
  git submodule update --init

  cd "$srcdir/edgetx/radio/src/thirdparty/FreeRTOS/portable/ThirdParty/"
  git submodule init
  git config submodule.FreeRTOS-Kernel-Community-Supported-Ports.url "$srcdir/Community-Supported-Ports"
  git config submodule.FreeRTOS-Kernel-Partner-Supported-Ports.url "$srcdir/Partner-Supported-Ports"
  git submodule update --init

  cd "$srcdir/edgetx/radio/src/thirdparty/uf2/"
  git submodule init
  git config submodule.hidapi.url "$srcdir/hidapi"
  git -c protocol.file.allow=always submodule update --init
}

build() {
  cd edgetx
  export EDGETX_VERSION_TAG=$pkgver
  source tools/build-common.sh # Provides get_target_build_options() for retrieving individual build options per simulated radio.

  rm -rf build
  mkdir build
  cd build

  declare -a simulator_plugins=(x9lite x9lites x9d x9dp x9dp2019 x9e
                                x7 x7access
                                t8 t12 t12max tx12 tx12mk2 t15 t15pro t15h7 t16 t18 t18h7 t20 t20v2 t22
                                xlite xlites
                                x10 x10express x12s
                                zorro tx16s tx16smk3 tx15
                                commando8 boxer pocket mt12 gx12 gx15 h17
                                tlite tpro tprov2 tpros bumblebee lr3pro t14
                                nv14 el18 pl18 pl18ev pl18u st16 pa01
                                f16 v12 v14 v15 v16)

  for plugin in "${simulator_plugins[@]}"
  do
    echo "Building ${plugin}"
    BUILD_OPTIONS=""

    if ! get_target_build_options "$plugin"; then
        echo "Error: Failed to find a match for target '$plugin'"
        exit 1
    fi

    rm -f CMakeCache.txt native/CMakeCache.txt
    cmake \
      -S .. \
      -G Ninja \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
      -DGVARS=YES \
      -DHELI=YES \
      -DLUA=YES \
      -Wno-dev \
      ${BUILD_OPTIONS}
    cmake --build . --target native-configure
    cmake --build native --target libsimulator
  done

  cmake --build native --target companion
}

package() {
  DESTDIR="$pkgdir" ninja -C edgetx/build/native install
  install -Dm644 edgetx/LICENSE "$pkgdir/usr/share/licenses/edgetx-companion/LICENSE"
}