nixpkgs/pkgs/applications/science/math/calc/default.nix

49 lines
1.5 KiB
Nix
Raw Normal View History

2020-11-24 15:29:28 +00:00
{ stdenv, lib, fetchurl, util-linux, makeWrapper
, enableReadline ? true, readline, ncurses }:
2016-02-24 21:47:21 +00:00
stdenv.mkDerivation rec {
pname = "calc";
2021-02-18 06:00:33 +00:00
version = "2.12.8.1";
2016-02-24 21:47:21 +00:00
src = fetchurl {
urls = [
"https://github.com/lcn2/calc/releases/download/${version}/${pname}-${version}.tar.bz2"
"http://www.isthe.com/chongo/src/calc/${pname}-${version}.tar.bz2"
];
2021-02-18 06:00:33 +00:00
sha256 = "sha256-TwVcuGaWIgzEc34DFEGFcmckXrwZ4ruRqselJClz15o=";
2016-02-24 21:47:21 +00:00
};
patchPhase = ''
substituteInPlace Makefile \
--replace '-install_name ''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' \
--replace '-install_name ''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}'
2016-02-24 21:47:21 +00:00
'';
2020-11-24 15:29:28 +00:00
buildInputs = [ util-linux makeWrapper ]
++ lib.optionals enableReadline [ readline ncurses ];
makeFlags = [
"T=$(out)"
"INCDIR="
"BINDIR=/bin"
"LIBDIR=/lib"
"CALC_SHAREDIR=/share/calc"
"CALC_INCDIR=/include"
"MANDIR=/share/man/man1"
# Handle LDFLAGS defaults in calc
"DEFAULT_LIB_INSTALL_PATH=$(out)/lib"
] ++ lib.optionals enableReadline [
"READLINE_LIB=-lreadline"
"USE_READLINE=-DUSE_READLINE"
];
meta = with lib; {
2016-02-24 21:47:21 +00:00
description = "C-style arbitrary precision calculator";
homepage = "http://www.isthe.com/chongo/tech/comp/calc/";
2016-02-24 21:47:21 +00:00
license = licenses.lgpl21;
maintainers = with maintainers; [ matthewbauer ];
2016-02-24 21:47:21 +00:00
platforms = platforms.all;
};
}