about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gsm
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/gsm
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gsm')
-rw-r--r--nixpkgs/pkgs/development/libraries/gsm/default.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gsm/default.nix b/nixpkgs/pkgs/development/libraries/gsm/default.nix
new file mode 100644
index 000000000000..33583a4c6bb3
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gsm/default.nix
@@ -0,0 +1,53 @@
+{ 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
+
+stdenv.mkDerivation rec {
+  name = "gsm-${version}";
+  version = "1.0.18";
+
+  src = fetchurl {
+    url = "http://www.quut.com/gsm/${name}.tar.gz";
+    sha256 = "041amvpz8cvxykl3pwqldrzxligmmzcg8ncdnxbg32rlqf3q1xh4";
+  };
+
+  patchPhase = ''
+    # Fix include directory
+    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}";
+
+  parallelBuild = false;
+
+  meta = with stdenv.lib; {
+    description = "Lossy speech compression codec";
+    homepage    = http://www.quut.com/gsm/;
+    license     = licenses.bsd2;
+    maintainers = with maintainers; [ codyopel raskin ];
+    platforms   = platforms.unix;
+  };
+}