nixpkgs/pkgs/development/libraries/gsm/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl
, # Compile statically (support for packages that look for the static object)
staticSupport ? stdenv.hostPlatform.isStatic
}:
let
inherit (stdenv) isDarwin;
inherit (lib) optional optionalString;
in
2015-02-09 01:16:54 +00:00
stdenv.mkDerivation rec {
pname = "gsm";
2022-07-31 08:42:43 +00:00
version = "1.0.20";
2015-02-09 01:16:54 +00:00
src = fetchurl {
url = "http://www.quut.com/gsm/${pname}-${version}.tar.gz";
2022-07-31 08:42:43 +00:00
sha256 = "sha256-YxXDhRi4HomcP8LtRjzGI68pxcIxpIwTeyQwIjSukL8=";
2015-02-09 01:16:54 +00:00
};
patchPhase = ''
2021-02-26 23:46:35 +00:00
substituteInPlace Makefile \
--replace "= gcc " "?= gcc "
# Fix include directory
2015-02-09 15:30:10 +00:00
sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
'' + optionalString (!staticSupport) (
(if isDarwin then ''
# Build dylib on Darwin
sed -e 's,libgsm.a,libgsm.dylib,' -i Makefile
sed -e 's,$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS),$(LD) -o $(LIBGSM) -dynamiclib -install_name $(GSM_INSTALL_ROOT)/$(LIBGSM) $(GSM_OBJECTS) -lc,' -i Makefile
'' else ''
# Build ELF shared object by default
sed -e 's,libgsm.a,libgsm.so,' -i Makefile
sed -e 's/$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)/$(LD) -shared -Wl,-soname,libgsm.so -o $(LIBGSM) $(GSM_OBJECTS) -lc/' -i Makefile
'') + ''
# Remove line that is unused when building shared libraries
sed -e 's,$(RANLIB) $(LIBGSM),,' -i Makefile
''
);
makeFlags = [
"SHELL=${stdenv.shell}"
"INSTALL_ROOT=$(out)"
] ++ optional stdenv.cc.isClang "CC=clang";
preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";
2015-02-09 01:16:54 +00:00
parallelBuild = false;
meta = with lib; {
2015-02-09 01:16:54 +00:00
description = "Lossy speech compression codec";
homepage = "http://www.quut.com/gsm/";
2015-02-09 01:16:54 +00:00
license = licenses.bsd2;
maintainers = with maintainers; [ codyopel raskin ];
platforms = platforms.unix;
};
2015-02-09 01:16:54 +00:00
}