2015-04-09 03:17:11 +02:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, staticSupport ? false # Compile statically (support for packages that look for the static object)
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (stdenv) isDarwin;
|
|
|
|
inherit (stdenv.lib) optional optionalString;
|
|
|
|
in
|
2011-06-07 16:42:24 +02:00
|
|
|
|
2015-02-09 02:16:54 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "gsm-${version}";
|
2015-04-09 03:17:11 +02:00
|
|
|
version = "1.0.14";
|
2011-06-07 16:42:24 +02:00
|
|
|
|
2015-02-09 02:16:54 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.quut.com/gsm/${name}.tar.gz";
|
2015-04-09 03:17:11 +02:00
|
|
|
sha256 = "0b1mx69jq88wva3wk0hi6fcl5a52qhnq2f9p3f3jdh5k61ma252q";
|
2015-02-09 02:16:54 +01:00
|
|
|
};
|
2011-06-07 16:42:24 +02:00
|
|
|
|
2015-02-14 03:04:03 +01:00
|
|
|
patchPhase = ''
|
|
|
|
# Fix include directory
|
2015-02-09 16:30:10 +01:00
|
|
|
sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
|
2015-04-09 03:17:11 +02:00
|
|
|
'' + 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
|
|
|
|
''
|
|
|
|
);
|
2015-02-14 03:04:03 +01:00
|
|
|
|
|
|
|
makeFlags = [
|
2015-04-09 03:17:11 +02:00
|
|
|
"SHELL=${stdenv.shell}"
|
|
|
|
"INSTALL_ROOT=$(out)"
|
2015-05-11 23:37:53 +02:00
|
|
|
] ++ optional stdenv.cc.isClang "CC=clang";
|
2015-02-14 03:04:03 +01:00
|
|
|
|
2015-04-09 03:17:11 +02:00
|
|
|
preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";
|
2011-06-07 16:42:24 +02:00
|
|
|
|
2015-04-09 03:17:11 +02:00
|
|
|
NIX_CFLAGS_COMPILE = optional (!staticSupport) "-fPIC";
|
2015-02-10 18:51:54 +01:00
|
|
|
|
2015-02-09 02:16:54 +01:00
|
|
|
parallelBuild = false;
|
2014-11-06 01:44:33 +01:00
|
|
|
|
2015-04-09 03:17:11 +02:00
|
|
|
meta = with stdenv.lib; {
|
2015-02-09 02:16:54 +01:00
|
|
|
description = "Lossy speech compression codec";
|
|
|
|
homepage = http://www.quut.com/gsm/;
|
|
|
|
license = licenses.bsd2;
|
|
|
|
maintainers = with maintainers; [ codyopel raskin ];
|
2015-04-09 03:17:11 +02:00
|
|
|
platforms = platforms.unix;
|
2011-06-07 16:42:24 +02:00
|
|
|
};
|
2015-02-09 02:16:54 +01:00
|
|
|
}
|