1 { lib, stdenv, fetchurl
2 , # Compile statically (support for packages that look for the static object)
3 staticSupport ? stdenv.hostPlatform.isStatic
7 inherit (stdenv.hostPlatform) isDarwin;
8 inherit (lib) optional optionalString;
11 stdenv.mkDerivation rec {
16 url = "https://www.quut.com/gsm/${pname}-${version}.tar.gz";
17 sha256 = "sha256-8Acukfa7hah4svbb9KC3yFDE3rgEnVVMZTQLO/ad8Kw=";
21 # Fix include directory
22 sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
23 '' + optionalString (!staticSupport) (
25 # Build dylib on Darwin
26 sed -e 's,libgsm.a,libgsm.dylib,' -i Makefile
27 sed -e 's,$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS),$(LD) -o $(LIBGSM) -dynamiclib -install_name $(GSM_INSTALL_ROOT)/$(LIBGSM) $(GSM_OBJECTS) -lc,' -i Makefile
29 # Build ELF shared object by default
30 sed -e 's,libgsm.a,libgsm.so,' -i Makefile
31 sed -e 's/$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)/$(LD) -shared -Wl,-soname,libgsm.so -o $(LIBGSM) $(GSM_OBJECTS) -lc/' -i Makefile
33 # Remove line that is unused when building shared libraries
34 sed -e 's,$(RANLIB) $(LIBGSM),,' -i Makefile
39 makeFlagsArray+=(CC="$CC")
43 "SHELL=${stdenv.shell}"
47 preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";
49 parallelBuild = false;
52 description = "Lossy speech compression codec";
53 homepage = "https://www.quut.com/gsm/";
54 license = licenses.bsd2;
55 maintainers = with maintainers; [ codyopel raskin ];
56 platforms = platforms.unix;