edgetx: 2.7.2 -> 2.11.0-rc3, expand build for all targets (#398715)
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
mkDerivation,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
gcc-arm-embedded,
|
||||
python3Packages,
|
||||
qtbase,
|
||||
qtmultimedia,
|
||||
qttools,
|
||||
SDL,
|
||||
gtest,
|
||||
dfu-util,
|
||||
}:
|
||||
|
||||
mkDerivation rec {
|
||||
pname = "edgetx";
|
||||
version = "2.7.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "EdgeTX";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-bKMAyONy1Udd+2nDVEMrtIsnfqrNuBVMWU7nCqvZ+3E=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
gcc-arm-embedded
|
||||
python3Packages.pillow
|
||||
qttools
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
qtbase
|
||||
qtmultimedia
|
||||
SDL
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed -i companion/src/burnconfigdialog.cpp \
|
||||
-e 's|/usr/.*bin/dfu-util|${dfu-util}/bin/dfu-util|'
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
"-DGTEST_ROOT=${gtest.src}/googletest"
|
||||
"-DDFU_UTIL_PATH=${dfu-util}/bin/dfu-util"
|
||||
# file RPATH_CHANGE could not write new RPATH
|
||||
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "EdgeTX Companion transmitter support software";
|
||||
longDescription = ''
|
||||
EdgeTX Companion is used for many different tasks like loading EdgeTX
|
||||
firmware to the radio, backing up model settings, editing settings and
|
||||
running radio simulators.
|
||||
'';
|
||||
mainProgram = "companion" + lib.concatStrings (lib.take 2 (lib.splitVersion version));
|
||||
homepage = "https://edgetx.org/";
|
||||
license = licenses.gpl2Only;
|
||||
platforms = [
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
maintainers = with maintainers; [
|
||||
elitak
|
||||
lopsided98
|
||||
wucke13
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
diff --git a/radio/util/find_clang.py b/radio/util/find_clang.py
|
||||
index d9cdbb083..f78f87717 100644
|
||||
--- a/radio/util/find_clang.py
|
||||
+++ b/radio/util/find_clang.py
|
||||
@@ -59,6 +59,7 @@ def getBuiltinHeaderPath(library_path):
|
||||
return None
|
||||
|
||||
def findLibClang():
|
||||
+ return "@libclang@"
|
||||
if sys.platform == "darwin":
|
||||
knownPaths = [
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib",
|
||||
diff --git a/radio/util/generate_datacopy.py b/radio/util/generate_datacopy.py
|
||||
index a92b0c3e2..6385b2ff6 100755
|
||||
--- a/radio/util/generate_datacopy.py
|
||||
+++ b/radio/util/generate_datacopy.py
|
||||
@@ -5,7 +5,8 @@ import sys
|
||||
import clang.cindex
|
||||
import time
|
||||
import os
|
||||
-
|
||||
+from pathlib import Path
|
||||
+import re
|
||||
|
||||
structs = []
|
||||
extrastructs = []
|
||||
@@ -102,6 +103,11 @@ def main():
|
||||
if find_clang.builtin_hdr_path:
|
||||
args.append("-I" + find_clang.builtin_hdr_path)
|
||||
|
||||
+ args.append("-resource-dir")
|
||||
+ args.append("@resourceDir@")
|
||||
+ for path in ["@libc-cflags@", "@libcxx-cflags@"]:
|
||||
+ args.extend([flag.strip() for flag in re.split(r'\s+', Path(path).read_text()) if flag.strip()])
|
||||
+
|
||||
translation_unit = index.parse(sys.argv[1], args)
|
||||
|
||||
if translation_unit.diagnostics:
|
||||
@@ -0,0 +1,183 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
python3,
|
||||
cmake,
|
||||
ninja,
|
||||
libsForQt5,
|
||||
SDL2,
|
||||
fox_1_6,
|
||||
replaceVars,
|
||||
llvmPackages,
|
||||
dfu-util,
|
||||
gtest,
|
||||
miniz,
|
||||
yaml-cpp,
|
||||
# List of targets to build simulators for
|
||||
targetsToBuild ? import ./targets.nix,
|
||||
}:
|
||||
|
||||
let
|
||||
# Keep in sync with `cmake/FetchMaxLibQt.cmake`.
|
||||
maxlibqt = fetchFromGitHub {
|
||||
owner = "edgetx";
|
||||
repo = "maxLibQt";
|
||||
rev = "ac1988ffd005cd15a8449b92150ce6c08574a4f1";
|
||||
hash = "sha256-u8e4qseU0+BJyZkV0JE4sUiXaFeIYvadkMTGXXiE2Kg=";
|
||||
};
|
||||
|
||||
pythonEnv = python3.withPackages (
|
||||
pyPkgs: with pyPkgs; [
|
||||
pillow
|
||||
lz4
|
||||
jinja2
|
||||
libclang
|
||||
]
|
||||
);
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "edgetx";
|
||||
version = "2.11.0-rc3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "EdgeTX";
|
||||
repo = "edgetx";
|
||||
tag = "v${finalAttrs.version}";
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-ipiGkc+R7/itmnRRrlrc4iXn+fLWm4OKc227NfevFhI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
pythonEnv
|
||||
libsForQt5.qttools
|
||||
libsForQt5.wrapQtAppsHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libsForQt5.qtbase
|
||||
libsForQt5.qtmultimedia
|
||||
libsForQt5.qtserialport
|
||||
SDL2
|
||||
fox_1_6
|
||||
];
|
||||
|
||||
patches = [
|
||||
(replaceVars ./0001-libclang-paths.patch (
|
||||
let
|
||||
llvmMajor = lib.versions.major llvmPackages.llvm.version;
|
||||
in
|
||||
{
|
||||
resourceDir = "${llvmPackages.clang.cc.lib}/lib/clang/${llvmMajor}";
|
||||
libclang = "${lib.getLib llvmPackages.libclang}/lib/libclang.so";
|
||||
libc-cflags = "${llvmPackages.clang}/nix-support/libc-cflags";
|
||||
libcxx-cflags = "${llvmPackages.clang}/nix-support/libcxx-cxxflags";
|
||||
}
|
||||
))
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed -i companion/src/burnconfigdialog.cpp \
|
||||
-e 's|/usr/.*bin/dfu-util|${dfu-util}/bin/dfu-util|'
|
||||
patchShebangs companion/util radio/util
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
# Unvendoring these libraries is infeasible. At least lets reuse the same sources.
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_GOOGLETEST" "${gtest.src}")
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MINIZ" "${miniz.src}")
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_YAML-CPP" "${yaml-cpp.src}")
|
||||
# Custom library https://github.com/edgetx/maxLibQt.
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MAXLIBQT" "${maxlibqt}")
|
||||
(lib.cmakeFeature "DFU_UTIL_ROOT_DIR" "${lib.getBin dfu-util}/bin")
|
||||
# Superbuild machinery is only getting in the way.
|
||||
(lib.cmakeBool "EdgeTX_SUPERBUILD" false)
|
||||
# COMMON_OPTIONS from tools/build-companion.sh.
|
||||
(lib.cmakeBool "GVARS" true)
|
||||
(lib.cmakeBool "HELI" true)
|
||||
(lib.cmakeBool "LUA" true)
|
||||
# Build companion and not the firmware.
|
||||
(lib.cmakeBool "NATIVE_BUILD" true)
|
||||
# file RPATH_CHANGE could not write new RPATH.
|
||||
(lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
|
||||
];
|
||||
|
||||
env = {
|
||||
EDGETX_VERSION_SUFFIX = "nixpkgs";
|
||||
};
|
||||
|
||||
dontUseCmakeConfigure = true;
|
||||
# We invoke cmakeConfigurePhase multiple times, but only need this once.
|
||||
dontFixCmake = true;
|
||||
inherit targetsToBuild;
|
||||
__structuredAttrs = true; # To pass targetsToBuild as an array.
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
prependToVar cmakeFlags "-GNinja"
|
||||
fixCmakeFiles .
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cmakeCommonFlags="$''\{cmakeFlags[@]}"
|
||||
# This is the most sensible way to convert target name -> cmake options
|
||||
# aside from manually extracting bash variables from upstream's CI scripts
|
||||
# and converting that to nix expressions. Let's hope upstream doesn't break
|
||||
# this file too often.
|
||||
source $src/tools/build-common.sh
|
||||
|
||||
# Yes, this is really how upstream expects packaging to look like ¯\_(ツ)_/¯.
|
||||
# https://github.com/EdgeTX/edgetx/wiki/Build-Instructions-under-Ubuntu-20.04#building-companion-simulator-and-radio-simulator-libraries
|
||||
for plugin in "$''\{targetsToBuild[@]''\}"
|
||||
do
|
||||
# Variable modified by `get_target_build_options` from build-common.sh.
|
||||
local BUILD_OPTIONS=""
|
||||
get_target_build_options "$plugin"
|
||||
# With each invocation of `cmakeConfigurePhase` `cmakeFlags` gets
|
||||
# prepended to, so it has to be reset.
|
||||
cmakeFlags=()
|
||||
appendToVar cmakeFlags $cmakeCommonFlags $BUILD_OPTIONS
|
||||
pushd .
|
||||
cmakeConfigurePhase
|
||||
ninjaFlags=("libsimulator")
|
||||
ninjaBuildPhase
|
||||
rm CMakeCache.txt
|
||||
popd
|
||||
done
|
||||
|
||||
cmakeConfigurePhase
|
||||
ninjaFlags=()
|
||||
ninjaBuildPhase
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "EdgeTX Companion transmitter support software";
|
||||
longDescription = ''
|
||||
EdgeTX Companion is used for many different tasks like loading EdgeTX
|
||||
firmware to the radio, backing up model settings, editing settings and
|
||||
running radio simulators.
|
||||
'';
|
||||
mainProgram = "companion" + lib.concatStrings (lib.take 2 (lib.splitVersion finalAttrs.version));
|
||||
homepage = "https://edgetx.org/";
|
||||
license = lib.licenses.gpl2Only;
|
||||
platforms = [
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
maintainers = with lib.maintainers; [
|
||||
elitak
|
||||
lopsided98
|
||||
wucke13
|
||||
xokdvium
|
||||
];
|
||||
};
|
||||
})
|
||||
@@ -0,0 +1,46 @@
|
||||
# Keep in sync with tools/build-companion.sh
|
||||
[
|
||||
"x9lite"
|
||||
"x9lites"
|
||||
"x7"
|
||||
"x7access"
|
||||
"t8"
|
||||
"t12"
|
||||
"t12max"
|
||||
"tx12"
|
||||
"tx12mk2"
|
||||
"zorro"
|
||||
"commando8"
|
||||
"boxer"
|
||||
"pocket"
|
||||
"mt12"
|
||||
"gx12"
|
||||
"tlite"
|
||||
"tpro"
|
||||
"tprov2"
|
||||
"tpros"
|
||||
"bumblebee"
|
||||
"lr3pro"
|
||||
"t14"
|
||||
"x9d"
|
||||
"x9dp"
|
||||
"x9dp2019"
|
||||
"x9e"
|
||||
"xlite"
|
||||
"xlites"
|
||||
"nv14"
|
||||
"el18"
|
||||
"pl18"
|
||||
"pl18ev"
|
||||
"x10"
|
||||
"x10express"
|
||||
"x12s"
|
||||
"t15"
|
||||
"t16"
|
||||
"t18"
|
||||
"t20"
|
||||
"t20v2"
|
||||
"tx16s"
|
||||
"f16"
|
||||
"v16"
|
||||
]
|
||||
@@ -15152,8 +15152,6 @@ with pkgs;
|
||||
mopidy-ytmusic
|
||||
;
|
||||
|
||||
edgetx = libsForQt5.callPackage ../applications/misc/edgetx { };
|
||||
|
||||
mpg123 = callPackage ../applications/audio/mpg123 {
|
||||
inherit (darwin.apple_sdk.frameworks) AudioUnit AudioToolbox;
|
||||
jack = libjack2;
|
||||
|
||||
Reference in New Issue
Block a user