spacefrogg-overlay/lp_solve_java.nix

45 lines
1.2 KiB
Nix

{ stdenv, fetchurl, jdk, lp_solve, unzip }:
stdenv.mkDerivation rec {
name = "lp_solve_java-${version}";
version = "5.5.2.0";
src = fetchurl {
url = "mirror://sourceforge/project/lpsolve/lpsolve/${version}/lp_solve_${version}_java.zip";
sha256 = "1jfnl849i8fbfv3pmqspp6x1piq8ssyfgrg4bldzb564w0hwsk8a";
};
buildInputs = [ jdk lp_solve unzip ];
propagatedBuildInputs = [ lp_solve ];
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
fname = "lpsolve55j";
buildPhase = ''
$CXX -fpic -DPIC -I ${jdk}/include -I ${jdk}/include/linux -I ${lp_solve}/include -I ./src/c -c \
src/c/lpsolve5j.cpp -o $fname.o
$CXX -shared -Wl,-soname,lib$fname.so -o lib$fname.so $fname.o -L ${lp_solve}/lib -lc -llpsolve55
(cd ./src/java
javac lpsolve/*.java #*/
jar -cf ../../$fname.jar lpsolve/*.class #*/
)
'';
installPhase = ''
mkdir -p $out/lib
cp lib$fname.so $fname.jar $out/lib
'';
meta = with stdenv.lib; {
description = "Java bindings for the Mixed Integer Linear Programming solver lp_solve";
homepage = lp_solve.meta.homepage;
license = lp_solve.meta.license;
maintainers = with maintainers; [ spacefrogg ];
platforms = platforms.unix;
};
}