at 22.05-pre 56 lines 1.8 kB view raw
1{ lib, stdenv, fetchurl 2, # Compile statically (support for packages that look for the static object) 3 staticSupport ? stdenv.hostPlatform.isStatic 4}: 5 6let 7 inherit (stdenv) isDarwin; 8 inherit (lib) optional optionalString; 9in 10 11stdenv.mkDerivation rec { 12 pname = "gsm"; 13 version = "1.0.19"; 14 15 src = fetchurl { 16 url = "http://www.quut.com/gsm/${pname}-${version}.tar.gz"; 17 sha256 = "1xkha9ss5g5qnfaybi8il0mcvp8knwg9plgh8404vh58d0pna0s9"; 18 }; 19 20 patchPhase = '' 21 substituteInPlace Makefile \ 22 --replace "= gcc " "?= gcc " 23 # Fix include directory 24 sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile 25 '' + optionalString (!staticSupport) ( 26 (if isDarwin then '' 27 # Build dylib on Darwin 28 sed -e 's,libgsm.a,libgsm.dylib,' -i Makefile 29 sed -e 's,$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS),$(LD) -o $(LIBGSM) -dynamiclib -install_name $(GSM_INSTALL_ROOT)/$(LIBGSM) $(GSM_OBJECTS) -lc,' -i Makefile 30 '' else '' 31 # Build ELF shared object by default 32 sed -e 's,libgsm.a,libgsm.so,' -i Makefile 33 sed -e 's/$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)/$(LD) -shared -Wl,-soname,libgsm.so -o $(LIBGSM) $(GSM_OBJECTS) -lc/' -i Makefile 34 '') + '' 35 # Remove line that is unused when building shared libraries 36 sed -e 's,$(RANLIB) $(LIBGSM),,' -i Makefile 37 '' 38 ); 39 40 makeFlags = [ 41 "SHELL=${stdenv.shell}" 42 "INSTALL_ROOT=$(out)" 43 ] ++ optional stdenv.cc.isClang "CC=clang"; 44 45 preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}"; 46 47 parallelBuild = false; 48 49 meta = with lib; { 50 description = "Lossy speech compression codec"; 51 homepage = "http://www.quut.com/gsm/"; 52 license = licenses.bsd2; 53 maintainers = with maintainers; [ codyopel raskin ]; 54 platforms = platforms.unix; 55 }; 56}