@@ -10,10 +10,25 @@ stdenv.mkDerivation rec {
1010 sha256 = "1bcjl2h60gvr1dc5a963h3vnz9zl6n8qrfa3qmb2x3229lj1iiaj";
1111 };
1212
13− preConfigure = ''
13+ patchPhase = ''
14+ # Fix include directory
1415 sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
15− mkdir -p "$out/"{bin,lib,man/man1,man/man3,include/gsm}
16+
1617 makeFlags="$makeFlags INSTALL_ROOT=$out"
18+
19+ # Build shared library instead of static
20+ sed -e 's,-c -O2 -DNeedFunctionPrototypes=1,-c -O2 -fPIC -DNeedFunctionPrototypes=1,' -i Makefile
21+ sed -e 's,libgsm.a,libgsm.so,' -i Makefile
22+ sed -e 's/$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)/$(LD) -shared -Wl,-soname,libgsm.so -o $(LIBGSM) $(GSM_OBJECTS) -lc/' -i Makefile
23+ sed -e 's,$(RANLIB) $(LIBGSM),,' -i Makefile
24+ '';
25+
26+ makeFlags = [
27+ ''SHELL=${stdenv.shell}''
28+ ];
29+
30+ preInstall = ''
31+ mkdir -p "$out/"{bin,lib,man/man1,man/man3,include/gsm}
1732 '';
1833
1934 NIX_CFLAGS_COMPILE = "-fPIC";