2020-11-24 15:29:28 +00:00
|
|
|
{ stdenv, lib, fetchurl, util-linux, makeWrapper
|
2018-04-23 00:43:40 +01:00
|
|
|
, enableReadline ? true, readline, ncurses }:
|
2016-02-24 21:47:21 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "calc";
|
2022-01-11 02:54:44 +00:00
|
|
|
version = "2.14.0.14";
|
2016-02-24 21:47:21 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-04-23 00:43:40 +01:00
|
|
|
urls = [
|
2019-08-15 13:41:18 +01:00
|
|
|
"https://github.com/lcn2/calc/releases/download/${version}/${pname}-${version}.tar.bz2"
|
|
|
|
"http://www.isthe.com/chongo/src/calc/${pname}-${version}.tar.bz2"
|
2018-04-23 00:43:40 +01:00
|
|
|
];
|
2022-01-11 02:54:44 +00:00
|
|
|
sha256 = "sha256-93J4NaED2XEsVxlY6STpwlS9FI8I60NIAZvDT45xxV0=";
|
2016-02-24 21:47:21 +00:00
|
|
|
};
|
|
|
|
|
2021-02-22 04:51:06 +00:00
|
|
|
postPatch = ''
|
2018-04-23 00:43:40 +01:00
|
|
|
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
|
|
|
'';
|
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ util-linux ]
|
2018-04-23 00:43:40 +01:00
|
|
|
++ lib.optionals enableReadline [ readline ncurses ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"T=$(out)"
|
2019-08-14 17:54:07 +01:00
|
|
|
"INCDIR="
|
2018-04-23 00:43:40 +01:00
|
|
|
"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";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.isthe.com/chongo/tech/comp/calc/";
|
2021-02-22 18:05:57 +00:00
|
|
|
# The licensing situation depends on readline (see section 3 of the LGPL)
|
|
|
|
# If linked against readline then GPLv2 otherwise LGPLv2.1
|
|
|
|
license = with licenses; if enableReadline then gpl2Only else lgpl21Only;
|
2018-04-23 00:43:40 +01:00
|
|
|
maintainers = with maintainers; [ matthewbauer ];
|
2016-02-24 21:47:21 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|