uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,113 @@
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config
, libX11, glfw, glew, fftwFloat, volk, AppKit
# Sources
, airspy_source ? true, airspy
, airspyhf_source ? true, airspyhf
, bladerf_source ? false, libbladeRF
, file_source ? true
, hackrf_source ? true, hackrf
, limesdr_source ? false, limesuite
, sddc_source ? false
, rtl_sdr_source ? true, librtlsdr, libusb1
, rtl_tcp_source ? true
, sdrplay_source ? false, sdrplay
, soapy_source ? true, soapysdr
, spyserver_source ? true
, plutosdr_source ? stdenv.isLinux, libiio, libad9361
# Sinks
, audio_sink ? true, rtaudio
, portaudio_sink ? false, portaudio
, network_sink ? true
# Decoders
, falcon9_decoder ? false
, m17_decoder ? false, codec2
, meteor_demodulator ? true
, radio ? true
, weather_sat_decoder ? true
# Misc
, discord_presence ? true
, frequency_manager ? true
, recorder ? true
, rigctl_server ? true
}:
stdenv.mkDerivation rec {
pname = "sdrpp";
version = "1.0.4";
src = fetchFromGitHub {
owner = "AlexandreRouma";
repo = "SDRPlusPlus";
rev = version;
hash = "sha256-g9tpWvVRMXRhPfgvOeJhX6IMouF9+tLUr9wo5r35i/c=";
};
patches = [ ./runtime-prefix.patch ];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "/usr/share" "share" \
--replace "set(CMAKE_INSTALL_PREFIX" "#set(CMAKE_INSTALL_PREFIX"
substituteInPlace decoder_modules/m17_decoder/src/m17dsp.h \
--replace "codec2.h" "codec2/codec2.h"
'';
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ glfw glew fftwFloat volk ]
++ lib.optional stdenv.isDarwin AppKit
++ lib.optional stdenv.isLinux libX11
++ lib.optional airspy_source airspy
++ lib.optional airspyhf_source airspyhf
++ lib.optional bladerf_source libbladeRF
++ lib.optional hackrf_source hackrf
++ lib.optional limesdr_source limesuite
++ lib.optionals rtl_sdr_source [ librtlsdr libusb1 ]
++ lib.optional sdrplay_source sdrplay
++ lib.optional soapy_source soapysdr
++ lib.optionals plutosdr_source [ libiio libad9361 ]
++ lib.optional audio_sink rtaudio
++ lib.optional portaudio_sink portaudio
++ lib.optional m17_decoder codec2;
cmakeFlags = lib.mapAttrsToList (k: v: "-D${k}=${if v then "ON" else "OFF"}") {
OPT_BUILD_AIRSPY_SOURCE = airspy_source;
OPT_BUILD_AIRSPYHF_SOURCE = airspyhf_source;
OPT_BUILD_BLADERF_SOURCE = bladerf_source;
OPT_BUILD_FILE_SOURCE = file_source;
OPT_BUILD_HACKRF_SOURCE = hackrf_source;
OPT_BUILD_LIMESDR_SOURCE = limesdr_source;
OPT_BUILD_SDDC_SOURCE = sddc_source;
OPT_BUILD_RTL_SDR_SOURCE = rtl_sdr_source;
OPT_BUILD_RTL_TCP_SOURCE = rtl_tcp_source;
OPT_BUILD_SDRPLAY_SOURCE = sdrplay_source;
OPT_BUILD_SOAPY_SOURCE = soapy_source;
OPT_BUILD_SPYSERVER_SOURCE = spyserver_source;
OPT_BUILD_PLUTOSDR_SOURCE = plutosdr_source;
OPT_BUILD_AUDIO_SINK = audio_sink;
OPT_BUILD_PORTAUDIO_SINK = portaudio_sink;
OPT_BUILD_NETWORK_SINK = network_sink;
OPT_BUILD_NEW_PORTAUDIO_SINK = portaudio_sink;
OPT_BUILD_FALCON9_DECODER = falcon9_decoder;
OPT_BUILD_M17_DECODER = m17_decoder;
OPT_BUILD_METEOR_DEMODULATOR = meteor_demodulator;
OPT_BUILD_RADIO = radio;
OPT_BUILD_WEATHER_SAT_DECODER = weather_sat_decoder;
OPT_BUILD_DISCORD_PRESENCE = discord_presence;
OPT_BUILD_FREQUENCY_MANAGER = frequency_manager;
OPT_BUILD_RECORDER = recorder;
OPT_BUILD_RIGCTL_SERVER = rigctl_server;
};
NIX_CFLAGS_COMPILE = "-fpermissive";
hardeningDisable = lib.optional stdenv.cc.isClang "format";
meta = with lib; {
description = "Cross-Platform SDR Software";
homepage = "https://github.com/AlexandreRouma/SDRPlusPlus";
license = licenses.gpl3Only;
platforms = platforms.unix;
maintainers = with maintainers; [ sikmir ];
};
}

View file

@ -0,0 +1,60 @@
From a80a739163d2013ec400223a68a387f4f9297b2a Mon Sep 17 00:00:00 2001
From: Nikolay Korotkiy <sikmir@gmail.com>
Date: Fri, 29 Oct 2021 01:38:21 +0300
Subject: [PATCH] Fix sdrpp breaking every time the package is rebuilt.
On NixOS, the INSTALL_PREFIX changes on every rebuild to the package, but sdrpp
fills it in as part of the default config and then installs that config
to the users home folder. Fix this by not substituting @INSTALL_PREFIX@ in the
default config until runtime.
---
core/src/core.cpp | 8 ++++++--
core/src/gui/main_window.cpp | 6 ++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/src/core.cpp b/core/src/core.cpp
index 9546e60..98d6065 100644
--- a/core/src/core.cpp
+++ b/core/src/core.cpp
@@ -242,8 +242,8 @@ int sdrpp_main(int argc, char *argv[]) {
defConfig["modulesDirectory"] = "./modules";
defConfig["resourcesDirectory"] = "./res";
#else
- defConfig["modulesDirectory"] = INSTALL_PREFIX "/lib/sdrpp/plugins";
- defConfig["resourcesDirectory"] = INSTALL_PREFIX "/share/sdrpp";
+ defConfig["modulesDirectory"] = "@prefix@/lib/sdrpp/plugins";
+ defConfig["resourcesDirectory"] = "@prefix@/share/sdrpp";
#endif
// Load config
@@ -290,6 +290,10 @@ int sdrpp_main(int argc, char *argv[]) {
int winHeight = core::configManager.conf["windowSize"]["h"];
maximized = core::configManager.conf["maximized"];
std::string resDir = core::configManager.conf["resourcesDirectory"];
+ {
+ std::size_t pos = resDir.find("@prefix@");
+ if (pos != std::string::npos) resDir.replace(pos, 8, INSTALL_PREFIX);
+ }
json bandColors = core::configManager.conf["bandColors"];
core::configManager.release();
diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp
index 954dbd6..52f0eed 100644
--- a/core/src/gui/main_window.cpp
+++ b/core/src/gui/main_window.cpp
@@ -44,6 +44,12 @@ void MainWindow::init() {
json menuElements = core::configManager.conf["menuElements"];
std::string modulesDir = core::configManager.conf["modulesDirectory"];
std::string resourcesDir = core::configManager.conf["resourcesDirectory"];
+ {
+ std::size_t pos = modulesDir.find("@prefix@");
+ if (pos != std::string::npos) modulesDir.replace(pos, 8, INSTALL_PREFIX);
+ pos = resourcesDir.find("@prefix@");
+ if (pos != std::string::npos) resourcesDir.replace(pos, 8, INSTALL_PREFIX);
+ }
core::configManager.release();
// Load menu elements
--
2.33.0