about summary refs log tree commit diff
path: root/pkgs/development/libraries/gsm
diff options
context:
space:
mode:
authorcodyopel <codyopel@gmail.com>2015-02-13 21:04:03 -0500
committercodyopel <codyopel@gmail.com>2015-02-13 21:04:03 -0500
commitfc27383909eb04a660fa3813778db1dcf8a82b92 (patch)
treefe394edd7db355ba909ee104fd981a6900c874a6 /pkgs/development/libraries/gsm
parent700f04b8da33dc7a8ea1f5c5c1a945bf003b57ec (diff)
gsm: seperate phases & fix shared library
Diffstat (limited to 'pkgs/development/libraries/gsm')
-rw-r--r--pkgs/development/libraries/gsm/default.nix19
1 files changed, 17 insertions, 2 deletions
diff --git a/pkgs/development/libraries/gsm/default.nix b/pkgs/development/libraries/gsm/default.nix
index f13d055520be3..8a869433b7e01 100644
--- a/pkgs/development/libraries/gsm/default.nix
+++ b/pkgs/development/libraries/gsm/default.nix
@@ -10,10 +10,25 @@ stdenv.mkDerivation rec {
     sha256 = "1bcjl2h60gvr1dc5a963h3vnz9zl6n8qrfa3qmb2x3229lj1iiaj";
   };
 
-  preConfigure = ''
+  patchPhase = ''
+    # Fix include directory
     sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
-    mkdir -p "$out/"{bin,lib,man/man1,man/man3,include/gsm}
+
     makeFlags="$makeFlags INSTALL_ROOT=$out"
+
+    # Build shared library instead of static
+    sed -e 's,-c -O2 -DNeedFunctionPrototypes=1,-c -O2 -fPIC -DNeedFunctionPrototypes=1,' -i Makefile
+    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
+    sed -e 's,$(RANLIB) $(LIBGSM),,' -i Makefile
+  '';
+
+  makeFlags = [
+    ''SHELL=${stdenv.shell}''
+  ];
+
+  preInstall = ''
+    mkdir -p "$out/"{bin,lib,man/man1,man/man3,include/gsm}
   '';
 
   parallelBuild = false;