lp_solve: 5.5.2.5 -> 5.5.2.11

- Use the generic builder and override build and install phases instead
of using buildCommand and missing phases and hooks, like fixup.

- Fix build on Darwin by using the proper build script (ccc.osx).

- Add cctools to build inputs because ccc.osx uses the libtool
command.

- The install_name of the library is not set so fix it with
fixDarwinDylibNames.

- Install headers into the expected location $out/include/lpsolve
instead of $out/include. This follows what other distro do.

+35 -43
+32 -29
pkgs/applications/science/math/lp_solve/default.nix
··· 1 - { lib, stdenv, fetchurl }: 1 + { lib, stdenv, fetchurl, cctools, fixDarwinDylibNames }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 5 5 pname = "lp_solve"; 6 - version = "5.5.2.5"; 6 + version = "5.5.2.11"; 7 7 8 8 src = fetchurl { 9 9 url = "mirror://sourceforge/project/lpsolve/lpsolve/${version}/lp_solve_${version}_source.tar.gz"; 10 - sha256 = "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0"; 10 + sha256 = "sha256-bUq/9cxqqpM66ObBeiJt8PwLZxxDj2lxXUHQn+gfkC8="; 11 11 }; 12 12 13 - patches = [ ./isnan.patch ]; 13 + nativeBuildInputs = lib.optionals stdenv.isDarwin [ 14 + cctools 15 + fixDarwinDylibNames 16 + ]; 17 + 18 + dontConfigure = true; 19 + 20 + buildPhase = let 21 + ccc = if stdenv.isDarwin then "ccc.osx" else "ccc"; 22 + in '' 23 + runHook preBuild 24 + 25 + (cd lpsolve55 && bash -x -e ${ccc}) 26 + (cd lp_solve && bash -x -e ${ccc}) 27 + 28 + runHook postBuild 29 + ''; 30 + 31 + installPhase = '' 32 + runHook preInstall 33 + 34 + install -d -m755 $out/bin $out/lib $out/include/lpsolve 35 + install -m755 lp_solve/bin/*/lp_solve -t $out/bin 36 + install -m644 lpsolve55/bin/*/liblpsolve* -t $out/lib 37 + install -m644 lp_*.h -t $out/include/lpsolve 14 38 15 - buildCommand = '' 16 - . $stdenv/setup 17 - tar xvfz $src 18 - ( 19 - cd lp_solve* 20 - eval patchPhase 21 - ) 22 - ( 23 - cd lp_solve*/lpsolve55 24 - bash ccc 25 - mkdir -pv $out/lib 26 - find bin -type f -exec cp -v "{}" $out/lib \; 27 - ) 28 - ( 29 - cd lp_solve*/lp_solve 30 - bash ccc 31 - mkdir -pv $out/bin 32 - find bin -type f -exec cp -v "{}" $out/bin \; 33 - ) 34 - ( 35 - mkdir -pv $out/include 36 - cp -v lp_solve*/*.h $out/include 37 - ) 39 + rm $out/lib/liblpsolve*.a 40 + rm $out/include/lpsolve/lp_solveDLL.h # A Windows header 41 + 42 + runHook postInstall 38 43 ''; 39 44 40 45 meta = with lib; { ··· 44 49 maintainers = with maintainers; [ smironov ]; 45 50 platforms = platforms.unix; 46 51 }; 47 - 48 52 } 49 -
-13
pkgs/applications/science/math/lp_solve/isnan.patch
··· 1 - diff -u a/lp_lib.h b/lp_lib.h 2 - --- a/lp_lib.h 2016-05-04 19:45:15.753143720 +0900 3 - +++ b/lp_lib.h 2016-05-04 19:53:59.536920722 +0900 4 - @@ -59,9 +59,6 @@ 5 - # if defined _WIN32 && !defined __GNUC__ 6 - # define isnan _isnan 7 - # endif 8 - -#if defined NOISNAN 9 - -# define isnan(x) FALSE 10 - -#endif 11 - 12 - #define SETMASK(variable, mask) variable |= mask 13 - #define CLEARMASK(variable, mask) variable &= ~(mask)
+3 -1
pkgs/top-level/all-packages.nix
··· 4910 4910 4911 4911 libbtbb = callPackage ../development/libraries/libbtbb { }; 4912 4912 4913 - lp_solve = callPackage ../applications/science/math/lp_solve { }; 4913 + lp_solve = callPackage ../applications/science/math/lp_solve { 4914 + inherit (darwin) cctools; 4915 + }; 4914 4916 4915 4917 fabric-installer = callPackage ../tools/games/minecraft/fabric-installer { }; 4916 4918