Skip to content

Commit 88cbe74

Browse files
author
Adam Joseph
committed
spandsp: refactor
The `spandsp` derivation has the clauses in the wrong order (e.g. `makeFlags` before `configureFlags`) which makes it hard to understand. This commit fixes the clause order, factors out `common.nix` from the two versions of spandsp, and also tries to normalize the coding style.
1 parent 6b5a531 commit 88cbe74

3 files changed

Lines changed: 77 additions & 76 deletions

File tree

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,20 @@
1-
{ lib, stdenv, fetchFromGitHub, audiofile, libtiff, autoreconfHook
1+
{ lib
2+
, stdenv
3+
, fetchFromGitHub
4+
, audiofile
5+
, libtiff
6+
, autoreconfHook
27
, fetchpatch
3-
, buildPackages }:
4-
stdenv.mkDerivation rec {
8+
, buildPackages
9+
, callPackage
10+
}:
11+
12+
(callPackage ./common.nix {}).overrideAttrs(finalAttrs: {
513
version = "3.0.0";
6-
pname = "spandsp";
714
src = fetchFromGitHub {
815
owner = "freeswitch";
9-
repo = pname;
16+
repo = finalAttrs.pname;
1017
rev = "6ec23e5a7e411a22d59e5678d12c4d2942c4a4b6"; # upstream does not seem to believe in tags
1118
sha256 = "03w0s99y3zibi5fnvn8lk92dggfgrr0mz5255745jfbz28b2d5y7";
1219
};
13-
14-
patches = [
15-
# submitted upstream: https://github.com/freeswitch/spandsp/pull/47
16-
(fetchpatch {
17-
url = "https://github.com/freeswitch/spandsp/commit/1f810894804d3fa61ab3fc2f3feb0599145a3436.patch";
18-
hash = "sha256-Cf8aaoriAvchh5cMb75yP2gsZbZaOLha/j5mq3xlkVA=";
19-
})
20-
];
21-
22-
outputs = [ "out" "dev" ];
23-
24-
enableParallelBuilding = true;
25-
26-
nativeBuildInputs = [ autoreconfHook ];
27-
propagatedBuildInputs = [ audiofile libtiff ];
28-
29-
makeFlags = [
30-
"CC=${stdenv.cc.targetPrefix}cc"
31-
"CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc"
32-
];
33-
34-
meta = {
35-
description = "A portable and modular SIP User-Agent with audio and video support";
36-
homepage = "https://github.com/freeswitch/spandsp";
37-
platforms = with lib.platforms; unix;
38-
maintainers = with lib.maintainers; [ ajs124 misuzu ];
39-
license = lib.licenses.gpl2;
40-
};
41-
}
20+
})
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{ lib
2+
, stdenv
3+
, fetchurl
4+
, audiofile
5+
, libtiff
6+
, buildPackages
7+
, fetchpatch
8+
, autoreconfHook
9+
}:
10+
11+
stdenv.mkDerivation (finalAttrs: {
12+
pname = "spandsp";
13+
14+
patches = [
15+
# submitted upstream: https://github.com/freeswitch/spandsp/pull/47
16+
(fetchpatch {
17+
url = "https://github.com/freeswitch/spandsp/commit/1f810894804d3fa61ab3fc2f3feb0599145a3436.patch";
18+
hash = "sha256-Cf8aaoriAvchh5cMb75yP2gsZbZaOLha/j5mq3xlkVA=";
19+
})
20+
];
21+
22+
outputs = [ "out" "dev" ];
23+
24+
nativeBuildInputs = [ autoreconfHook ];
25+
depsBuildBuild = [ buildPackages.stdenv.cc ];
26+
propagatedBuildInputs = [ audiofile libtiff ];
27+
28+
configureFlags = [
29+
# This flag is required to prevent linking error in the cross-compilation case.
30+
# I think it's fair to assume that realloc(NULL, size) will return a valid memory
31+
# block for most libc implementation, so let's just assume that and hope for the best.
32+
"ac_cv_func_malloc_0_nonnull=yes"
33+
];
34+
35+
enableParallelBuilding = true;
36+
37+
makeFlags = [
38+
"CC=${stdenv.cc.targetPrefix}cc"
39+
"CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc"
40+
];
41+
42+
strictDeps = true;
43+
44+
meta = {
45+
description = "A portable and modular SIP User-Agent with audio and video support";
46+
homepage = "https://github.com/freeswitch/spandsp";
47+
platforms = with lib.platforms; unix;
48+
maintainers = with lib.maintainers; [ ajs124 misuzu ];
49+
license = lib.licenses.gpl2;
50+
downloadPage = "http://www.soft-switch.org/downloads/spandsp/";
51+
};
52+
})
Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,18 @@
1-
{ lib, stdenv, fetchurl, audiofile, libtiff, buildPackages
1+
{ lib
2+
, stdenv
3+
, fetchurl
4+
, audiofile
5+
, libtiff
6+
, buildPackages
27
, fetchpatch
3-
, autoreconfHook }:
8+
, autoreconfHook
9+
, callPackage
10+
}:
411

5-
stdenv.mkDerivation rec {
12+
(callPackage ./common.nix {}).overrideAttrs(_: rec {
613
version = "0.0.6";
7-
pname = "spandsp";
8-
9-
patches = [
10-
# submitted upstream: https://github.com/freeswitch/spandsp/pull/47
11-
(fetchpatch {
12-
url = "https://github.com/freeswitch/spandsp/commit/1f810894804d3fa61ab3fc2f3feb0599145a3436.patch";
13-
hash = "sha256-Cf8aaoriAvchh5cMb75yP2gsZbZaOLha/j5mq3xlkVA=";
14-
})
15-
];
16-
17-
src=fetchurl {
14+
src = fetchurl {
1815
url = "https://www.soft-switch.org/downloads/spandsp/spandsp-${version}.tar.gz";
1916
sha256 = "0rclrkyspzk575v8fslzjpgp4y2s4x7xk3r55ycvpi4agv33l1fc";
2017
};
21-
22-
outputs = [ "out" "dev" ];
23-
enableParallelBuilding = true;
24-
makeFlags = [
25-
"CC=${stdenv.cc.targetPrefix}cc"
26-
"CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc"
27-
];
28-
29-
configureFlags = [
30-
# This flag is required to prevent linking error in the cross-compilation case.
31-
# I think it's fair to assume that realloc(NULL, size) will return a valid memory
32-
# block for most libc implementation, so let's just assume that and hope for the best.
33-
"ac_cv_func_malloc_0_nonnull=yes"
34-
];
35-
36-
strictDeps = true;
37-
nativeBuildInputs = [ autoreconfHook ];
38-
depsBuildBuild = [ buildPackages.stdenv.cc ];
39-
propagatedBuildInputs = [audiofile libtiff];
40-
meta = {
41-
description = "A portable and modular SIP User-Agent with audio and video support";
42-
homepage = "http://www.creytiv.com/baresip.html";
43-
platforms = with lib.platforms; linux;
44-
maintainers = with lib.maintainers; [raskin];
45-
license = lib.licenses.gpl2;
46-
downloadPage = "http://www.soft-switch.org/downloads/spandsp/";
47-
};
48-
}
18+
})

0 commit comments

Comments
 (0)