tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
freedv: 1.9.9.2 -> 2.0
Weijia Wang
7 months ago
3587eb72
e0ba322b
+109
-28
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
fr
freedv
no-framework.patch
package.nix
+28
pkgs/by-name/fr/freedv/no-framework.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
2
+
index 38b3b262..3be9bfee 100644
3
+
--- a/src/CMakeLists.txt
4
+
+++ b/src/CMakeLists.txt
5
+
@@ -146,21 +146,16 @@ if(APPLE)
6
+
TARGET FreeDV
7
+
POST_BUILD
8
+
COMMAND rm -rf dist_tmp FreeDV.dmg || true
9
+
- COMMAND DYLD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src:${portaudio_BINARY_DIR}:${samplerate_BINARY_DIR}/src:${Python3_ROOT_DIR}:${DYLD_LIBRARY_PATH} ${CMAKE_SOURCE_DIR}/macdylibbundler/dylibbundler ARGS -od -b -x FreeDV.app/Contents/MacOS/FreeDV -d FreeDV.app/Contents/libs -p @loader_path/../libs/ -i /usr/lib -s ${CODEC2_BUILD_DIR}/src -s ${CMAKE_BINARY_DIR}/codec2_build/src ${PORTAUDIO_BUNDLE_ARG} -s ${samplerate_BINARY_DIR}/src -s ${rade_BINARY_DIR}/src -s ${Python3_ROOT_DIR}
10
+
+ COMMAND DYLD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src:${portaudio_BINARY_DIR}:${samplerate_BINARY_DIR}/src:${DYLD_LIBRARY_PATH} ${CMAKE_SOURCE_DIR}/macdylibbundler/dylibbundler ARGS -od -b -x FreeDV.app/Contents/MacOS/FreeDV -d FreeDV.app/Contents/libs -p @loader_path/../libs/ -i /usr/lib -s ${CODEC2_BUILD_DIR}/src -s ${CMAKE_BINARY_DIR}/codec2_build/src ${PORTAUDIO_BUNDLE_ARG} -s ${samplerate_BINARY_DIR}/src -s ${rade_BINARY_DIR}/src
11
+
COMMAND cp ARGS ${CMAKE_CURRENT_SOURCE_DIR}/freedv.icns FreeDV.app/Contents/Resources
12
+
COMMAND rm ARGS -rf FreeDV.app/Contents/Frameworks
13
+
COMMAND mkdir ARGS FreeDV.app/Contents/Frameworks
14
+
- COMMAND cp ARGS -a ${Python3_ROOT_DIR}/../../../Python.framework FreeDV.app/Contents/Frameworks
15
+
- COMMAND install_name_tool ARGS -add_rpath @loader_path/../Frameworks/Python.framework FreeDV.app/Contents/libs/librade*.dylib
16
+
COMMAND cp ARGS ../rade_src/radae_*e.py FreeDV.app/Contents/Resources
17
+
COMMAND cp ARGS -a ../rade_src/radae FreeDV.app/Contents/Resources
18
+
COMMAND cp ARGS -a ../rade_src/model19_check3 FreeDV.app/Contents/Resources
19
+
20
+
- # Precompile Python code to improve startup time
21
+
- COMMAND cd FreeDV.app/Contents/Resources && ../Frameworks/Python.framework/Versions/Current/bin/python3 -c "import radae_txe\; import radae_rxe\;" && cd ../../..
22
+
-
23
+
# Codesign binary so that it can execute
24
+
- COMMAND codesign --force --options runtime --timestamp --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/entitlements.plist --sign ${MACOS_CODESIGN_IDENTITY} ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app `find ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app -name '*.so' -o -name '*.dylib'` `find ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app/Contents/Frameworks/Python.framework/Versions/3.12/bin -name 'Python' -o -name 'python3.12*'` `find ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app/Contents/Frameworks/Python.framework/ -name 'Python'` ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app/Contents/MacOS/FreeDV ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app/Contents/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/torch/bin/* ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app/Contents/Frameworks/Python.framework/Versions/3.12/Python
25
+
+ COMMAND codesign --force --options runtime --timestamp --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/entitlements.plist --sign ${MACOS_CODESIGN_IDENTITY} ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app `find ${CMAKE_CURRENT_BINARY_DIR}/FreeDV.app -name '*.so' -o -name '*.dylib'`
26
+
)
27
+
28
+
if (MACOS_CODESIGN_KEYCHAIN_PROFILE)
+81
-28
pkgs/by-name/fr/freedv/package.nix
···
1
{
2
-
config,
3
lib,
4
stdenv,
5
fetchFromGitHub,
6
cmake,
0
0
0
7
macdylibbundler,
8
makeWrapper,
9
darwin,
···
17
hamlib_4,
18
wxGTK32,
19
sioclient,
20
-
pulseSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux,
0
21
nix-update-script,
22
}:
23
0
0
0
0
0
0
0
0
24
stdenv.mkDerivation (finalAttrs: {
25
pname = "freedv";
26
-
version = "1.9.9.2";
27
28
src = fetchFromGitHub {
29
owner = "drowe67";
30
repo = "freedv-gui";
31
tag = "v${finalAttrs.version}";
32
-
hash = "sha256-oFuAH81mduiSQGIDgDDy1IPskqqCBmfWbpqQstUIw9g=";
33
};
34
35
-
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
36
-
substituteInPlace CMakeLists.txt \
37
-
--replace-fail "-Wl,-ld_classic" ""
38
-
substituteInPlace src/CMakeLists.txt \
39
-
--replace-fail "\''${CMAKE_SOURCE_DIR}/macdylibbundler/dylibbundler" "dylibbundler"
40
-
sed -i "/codesign/d;/hdiutil/d" src/CMakeLists.txt
41
-
'';
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
42
43
nativeBuildInputs =
44
[
45
cmake
0
0
46
]
47
++ lib.optionals stdenv.hostPlatform.isDarwin [
48
macdylibbundler
49
makeWrapper
50
darwin.autoSignDarwinBinariesHook
0
51
];
52
53
-
buildInputs = [
54
-
codec2
55
-
libsamplerate
56
-
libsndfile
57
-
lpcnet
58
-
speexdsp
59
-
hamlib_4
60
-
wxGTK32
61
-
sioclient
62
-
] ++ (if pulseSupport then [ libpulseaudio ] else [ portaudio ]);
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
63
64
cmakeFlags = [
65
(lib.cmakeBool "USE_INTERNAL_CODEC2" false)
66
(lib.cmakeBool "USE_STATIC_DEPS" false)
67
(lib.cmakeBool "UNITTEST" true)
68
-
(lib.cmakeBool "USE_PULSEAUDIO" pulseSupport)
69
];
70
71
-
doCheck = true;
0
0
72
73
-
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
74
-
mkdir -p $out/Applications
75
-
mv $out/bin/FreeDV.app $out/Applications
76
-
makeWrapper $out/Applications/FreeDV.app/Contents/MacOS/FreeDV $out/bin/freedv
77
-
'';
0
0
0
0
78
79
passthru.updateScript = nix-update-script {
80
extraArgs = [
···
1
{
0
2
lib,
3
stdenv,
4
fetchFromGitHub,
5
cmake,
6
+
pkg-config,
7
+
python3,
8
+
libopus,
9
macdylibbundler,
10
makeWrapper,
11
darwin,
···
19
hamlib_4,
20
wxGTK32,
21
sioclient,
22
+
dbus,
23
+
apple-sdk_15,
24
nix-update-script,
25
}:
26
27
+
let
28
+
radaeSrc = fetchFromGitHub {
29
+
owner = "drowe67";
30
+
repo = "radae";
31
+
rev = "2354cd2a4b3af60c7feb1c0d6b3d6dd7417c2ac9";
32
+
hash = "sha256-yEr/OCXV83qXi89QHXMrUtQ2UwNOsijQMN35Or2JP+Y=";
33
+
};
34
+
in
35
stdenv.mkDerivation (finalAttrs: {
36
pname = "freedv";
37
+
version = "2.0.0";
38
39
src = fetchFromGitHub {
40
owner = "drowe67";
41
repo = "freedv-gui";
42
tag = "v${finalAttrs.version}";
43
+
hash = "sha256-3vwFB+3LloumEAGlSJZc2+/I8uI6KLP/KuDGeDOj87k=";
44
};
45
46
+
patches = [
47
+
./no-framework.patch
48
+
];
49
+
50
+
postPatch =
51
+
''
52
+
cp -R ${radaeSrc} radae
53
+
chmod -R u+w radae
54
+
substituteInPlace radae/cmake/BuildOpus.cmake \
55
+
--replace-fail "https://gitlab.xiph.org/xiph/opus/-/archive/main/opus-main.tar.gz" "${libopus.src}" \
56
+
--replace-fail "./autogen.sh && " ""
57
+
substituteInPlace cmake/BuildRADE.cmake \
58
+
--replace-fail "GIT_REPOSITORY https://github.com/drowe67/radae.git" "URL $(realpath radae)" \
59
+
--replace-fail "GIT_TAG main" ""
60
+
patchShebangs test/test_*.sh
61
+
''
62
+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
63
+
substituteInPlace CMakeLists.txt \
64
+
--replace-fail "-Wl,-ld_classic" ""
65
+
substituteInPlace src/CMakeLists.txt \
66
+
--replace-fail "\''${CMAKE_SOURCE_DIR}/macdylibbundler/dylibbundler" "dylibbundler"
67
+
sed -i "/codesign/d;/hdiutil/d" src/CMakeLists.txt
68
+
'';
69
70
nativeBuildInputs =
71
[
72
cmake
73
+
pkg-config
74
+
python3
75
]
76
++ lib.optionals stdenv.hostPlatform.isDarwin [
77
macdylibbundler
78
makeWrapper
79
darwin.autoSignDarwinBinariesHook
80
+
darwin.sigtool
81
];
82
83
+
buildInputs =
84
+
[
85
+
codec2
86
+
libsamplerate
87
+
libsndfile
88
+
lpcnet
89
+
speexdsp
90
+
hamlib_4
91
+
wxGTK32
92
+
sioclient
93
+
python3.pkgs.numpy
94
+
]
95
+
++ (
96
+
if stdenv.hostPlatform.isLinux then
97
+
[
98
+
libpulseaudio
99
+
dbus
100
+
]
101
+
else if stdenv.hostPlatform.isDarwin then
102
+
[
103
+
apple-sdk_15
104
+
]
105
+
else
106
+
[
107
+
portaudio
108
+
]
109
+
);
110
111
cmakeFlags = [
112
(lib.cmakeBool "USE_INTERNAL_CODEC2" false)
113
(lib.cmakeBool "USE_STATIC_DEPS" false)
114
(lib.cmakeBool "UNITTEST" true)
115
+
(lib.cmakeBool "USE_NATIVE_AUDIO" (with stdenv.hostPlatform; isLinux || isDarwin))
116
];
117
118
+
env.NIX_CFLAGS_COMPILE = "-I${codec2.src}/src";
119
+
120
+
doCheck = false;
121
122
+
postInstall =
123
+
''
124
+
install -Dm755 rade_build/src/librade.* -t $out/lib
125
+
''
126
+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
127
+
mkdir -p $out/Applications
128
+
mv $out/bin/FreeDV.app $out/Applications
129
+
makeWrapper $out/Applications/FreeDV.app/Contents/MacOS/FreeDV $out/bin/freedv
130
+
'';
131
132
passthru.updateScript = nix-update-script {
133
extraArgs = [