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.
This commit is contained in:
parent
6b5a531bc4
commit
88cbe74d05
|
@ -1,41 +1,20 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, audiofile, libtiff, autoreconfHook
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchFromGitHub
|
||||||
|
, audiofile
|
||||||
|
, libtiff
|
||||||
|
, autoreconfHook
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, buildPackages }:
|
, buildPackages
|
||||||
stdenv.mkDerivation rec {
|
, callPackage
|
||||||
|
}:
|
||||||
|
|
||||||
|
(callPackage ./common.nix {}).overrideAttrs(finalAttrs: {
|
||||||
version = "3.0.0";
|
version = "3.0.0";
|
||||||
pname = "spandsp";
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "freeswitch";
|
owner = "freeswitch";
|
||||||
repo = pname;
|
repo = finalAttrs.pname;
|
||||||
rev = "6ec23e5a7e411a22d59e5678d12c4d2942c4a4b6"; # upstream does not seem to believe in tags
|
rev = "6ec23e5a7e411a22d59e5678d12c4d2942c4a4b6"; # upstream does not seem to believe in tags
|
||||||
sha256 = "03w0s99y3zibi5fnvn8lk92dggfgrr0mz5255745jfbz28b2d5y7";
|
sha256 = "03w0s99y3zibi5fnvn8lk92dggfgrr0mz5255745jfbz28b2d5y7";
|
||||||
};
|
};
|
||||||
|
})
|
||||||
patches = [
|
|
||||||
# submitted upstream: https://github.com/freeswitch/spandsp/pull/47
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/freeswitch/spandsp/commit/1f810894804d3fa61ab3fc2f3feb0599145a3436.patch";
|
|
||||||
hash = "sha256-Cf8aaoriAvchh5cMb75yP2gsZbZaOLha/j5mq3xlkVA=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ autoreconfHook ];
|
|
||||||
propagatedBuildInputs = [ audiofile libtiff ];
|
|
||||||
|
|
||||||
makeFlags = [
|
|
||||||
"CC=${stdenv.cc.targetPrefix}cc"
|
|
||||||
"CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc"
|
|
||||||
];
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "A portable and modular SIP User-Agent with audio and video support";
|
|
||||||
homepage = "https://github.com/freeswitch/spandsp";
|
|
||||||
platforms = with lib.platforms; unix;
|
|
||||||
maintainers = with lib.maintainers; [ ajs124 misuzu ];
|
|
||||||
license = lib.licenses.gpl2;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
52
pkgs/development/libraries/spandsp/common.nix
Normal file
52
pkgs/development/libraries/spandsp/common.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchurl
|
||||||
|
, audiofile
|
||||||
|
, libtiff
|
||||||
|
, buildPackages
|
||||||
|
, fetchpatch
|
||||||
|
, autoreconfHook
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "spandsp";
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# submitted upstream: https://github.com/freeswitch/spandsp/pull/47
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/freeswitch/spandsp/commit/1f810894804d3fa61ab3fc2f3feb0599145a3436.patch";
|
||||||
|
hash = "sha256-Cf8aaoriAvchh5cMb75yP2gsZbZaOLha/j5mq3xlkVA=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ autoreconfHook ];
|
||||||
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||||
|
propagatedBuildInputs = [ audiofile libtiff ];
|
||||||
|
|
||||||
|
configureFlags = [
|
||||||
|
# This flag is required to prevent linking error in the cross-compilation case.
|
||||||
|
# I think it's fair to assume that realloc(NULL, size) will return a valid memory
|
||||||
|
# block for most libc implementation, so let's just assume that and hope for the best.
|
||||||
|
"ac_cv_func_malloc_0_nonnull=yes"
|
||||||
|
];
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
makeFlags = [
|
||||||
|
"CC=${stdenv.cc.targetPrefix}cc"
|
||||||
|
"CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc"
|
||||||
|
];
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "A portable and modular SIP User-Agent with audio and video support";
|
||||||
|
homepage = "https://github.com/freeswitch/spandsp";
|
||||||
|
platforms = with lib.platforms; unix;
|
||||||
|
maintainers = with lib.maintainers; [ ajs124 misuzu ];
|
||||||
|
license = lib.licenses.gpl2;
|
||||||
|
downloadPage = "http://www.soft-switch.org/downloads/spandsp/";
|
||||||
|
};
|
||||||
|
})
|
|
@ -1,48 +1,18 @@
|
||||||
{ lib, stdenv, fetchurl, audiofile, libtiff, buildPackages
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchurl
|
||||||
|
, audiofile
|
||||||
|
, libtiff
|
||||||
|
, buildPackages
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, autoreconfHook }:
|
, autoreconfHook
|
||||||
|
, callPackage
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
(callPackage ./common.nix {}).overrideAttrs(_: rec {
|
||||||
version = "0.0.6";
|
version = "0.0.6";
|
||||||
pname = "spandsp";
|
src = fetchurl {
|
||||||
|
|
||||||
patches = [
|
|
||||||
# submitted upstream: https://github.com/freeswitch/spandsp/pull/47
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/freeswitch/spandsp/commit/1f810894804d3fa61ab3fc2f3feb0599145a3436.patch";
|
|
||||||
hash = "sha256-Cf8aaoriAvchh5cMb75yP2gsZbZaOLha/j5mq3xlkVA=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
src=fetchurl {
|
|
||||||
url = "https://www.soft-switch.org/downloads/spandsp/spandsp-${version}.tar.gz";
|
url = "https://www.soft-switch.org/downloads/spandsp/spandsp-${version}.tar.gz";
|
||||||
sha256 = "0rclrkyspzk575v8fslzjpgp4y2s4x7xk3r55ycvpi4agv33l1fc";
|
sha256 = "0rclrkyspzk575v8fslzjpgp4y2s4x7xk3r55ycvpi4agv33l1fc";
|
||||||
};
|
};
|
||||||
|
})
|
||||||
outputs = [ "out" "dev" ];
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
makeFlags = [
|
|
||||||
"CC=${stdenv.cc.targetPrefix}cc"
|
|
||||||
"CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/cc"
|
|
||||||
];
|
|
||||||
|
|
||||||
configureFlags = [
|
|
||||||
# This flag is required to prevent linking error in the cross-compilation case.
|
|
||||||
# I think it's fair to assume that realloc(NULL, size) will return a valid memory
|
|
||||||
# block for most libc implementation, so let's just assume that and hope for the best.
|
|
||||||
"ac_cv_func_malloc_0_nonnull=yes"
|
|
||||||
];
|
|
||||||
|
|
||||||
strictDeps = true;
|
|
||||||
nativeBuildInputs = [ autoreconfHook ];
|
|
||||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
||||||
propagatedBuildInputs = [audiofile libtiff];
|
|
||||||
meta = {
|
|
||||||
description = "A portable and modular SIP User-Agent with audio and video support";
|
|
||||||
homepage = "http://www.creytiv.com/baresip.html";
|
|
||||||
platforms = with lib.platforms; linux;
|
|
||||||
maintainers = with lib.maintainers; [raskin];
|
|
||||||
license = lib.licenses.gpl2;
|
|
||||||
downloadPage = "http://www.soft-switch.org/downloads/spandsp/";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue