2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv, fetchurl
|
2021-01-03 21:40:14 +00:00
|
|
|
, # Compile statically (support for packages that look for the static object)
|
|
|
|
staticSupport ? stdenv.hostPlatform.isStatic
|
2015-04-09 02:17:11 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (stdenv) isDarwin;
|
2021-01-21 17:00:13 +00:00
|
|
|
inherit (lib) optional optionalString;
|
2015-04-09 02:17:11 +01:00
|
|
|
in
|
2011-06-07 15:42:24 +01:00
|
|
|
|
2015-02-09 01:16:54 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "gsm";
|
2020-04-05 20:31:53 +01:00
|
|
|
version = "1.0.19";
|
2011-06-07 15:42:24 +01:00
|
|
|
|
2015-02-09 01:16:54 +00:00
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "http://www.quut.com/gsm/${pname}-${version}.tar.gz";
|
2020-04-05 20:31:53 +01:00
|
|
|
sha256 = "1xkha9ss5g5qnfaybi8il0mcvp8knwg9plgh8404vh58d0pna0s9";
|
2015-02-09 01:16:54 +00:00
|
|
|
};
|
2011-06-07 15:42:24 +01:00
|
|
|
|
2015-02-14 02:04:03 +00:00
|
|
|
patchPhase = ''
|
2021-02-26 23:46:35 +00:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "= gcc " "?= gcc "
|
2015-02-14 02:04:03 +00:00
|
|
|
# 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
|
2015-04-09 02:17:11 +01: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 02:04:03 +00:00
|
|
|
|
|
|
|
makeFlags = [
|
2015-04-09 02:17:11 +01:00
|
|
|
"SHELL=${stdenv.shell}"
|
|
|
|
"INSTALL_ROOT=$(out)"
|
2015-05-11 22:37:53 +01:00
|
|
|
] ++ optional stdenv.cc.isClang "CC=clang";
|
2015-02-14 02:04:03 +00:00
|
|
|
|
2015-04-09 02:17:11 +01:00
|
|
|
preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";
|
2011-06-07 15:42:24 +01:00
|
|
|
|
2015-02-09 01:16:54 +00:00
|
|
|
parallelBuild = false;
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2015-02-09 01:16:54 +00:00
|
|
|
description = "Lossy speech compression codec";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.quut.com/gsm/";
|
2015-02-09 01:16:54 +00:00
|
|
|
license = licenses.bsd2;
|
|
|
|
maintainers = with maintainers; [ codyopel raskin ];
|
2015-04-09 02:17:11 +01:00
|
|
|
platforms = platforms.unix;
|
2011-06-07 15:42:24 +01:00
|
|
|
};
|
2015-02-09 01:16:54 +00:00
|
|
|
}
|