forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / gs / gsm / package.nix
bloba964c4e4bcb63e785d135bc374a270d806a14bcd
1 { lib, stdenv, fetchurl
2 , # Compile statically (support for packages that look for the static object)
3   staticSupport ? stdenv.hostPlatform.isStatic
4 }:
6 let
7   inherit (stdenv.hostPlatform) isDarwin;
8   inherit (lib) optional optionalString;
9 in
11 stdenv.mkDerivation rec {
12   pname = "gsm";
13   version = "1.0.22";
15   src = fetchurl {
16     url = "https://www.quut.com/gsm/${pname}-${version}.tar.gz";
17     sha256 = "sha256-8Acukfa7hah4svbb9KC3yFDE3rgEnVVMZTQLO/ad8Kw=";
18   };
20   patchPhase = ''
21     # Fix include directory
22     sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
23   '' + optionalString (!staticSupport) (
24     (if isDarwin then  ''
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
28     '' else ''
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
32     '') + ''
33       # Remove line that is unused when building shared libraries
34       sed -e 's,$(RANLIB) $(LIBGSM),,' -i Makefile
35     ''
36   );
38   preBuild = ''
39     makeFlagsArray+=(CC="$CC")
40   '';
42   makeFlags = [
43     "SHELL=${stdenv.shell}"
44     "INSTALL_ROOT=$(out)"
45   ];
47   preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";
49   parallelBuild = false;
51   meta = with lib; {
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;
57   };