2018-04-23 01:43:40 +02:00
|
|
|
{ stdenv, lib, fetchurl, utillinux, makeWrapper
|
|
|
|
, enableReadline ? true, readline, ncurses }:
|
2016-02-24 22:47:21 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "calc-${version}";
|
2018-03-08 05:08:56 +01:00
|
|
|
version = "2.12.6.6";
|
2016-02-24 22:47:21 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-04-23 01:43:40 +02:00
|
|
|
urls = [
|
|
|
|
"https://github.com/lcn2/calc/releases/download/${version}/${name}.tar.bz2"
|
|
|
|
"http://www.isthe.com/chongo/src/calc/${name}.tar.bz2"
|
|
|
|
];
|
2018-03-08 05:08:56 +01:00
|
|
|
sha256 = "03sg1xhin6qsrz82scf96mmzw8lz1yj68rhj4p4npp4s0fawc9d5";
|
2016-02-24 22:47:21 +01:00
|
|
|
};
|
|
|
|
|
2018-04-23 01:43:40 +02:00
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'all: check_include' 'all:' \
|
|
|
|
--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 22:47:21 +01:00
|
|
|
'';
|
|
|
|
|
2018-04-23 01:43:40 +02:00
|
|
|
buildInputs = [ utillinux makeWrapper ]
|
|
|
|
++ lib.optionals enableReadline [ readline ncurses ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"T=$(out)"
|
|
|
|
"INCDIR=${lib.getDev stdenv.cc.libc}/include"
|
|
|
|
"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 22:47:21 +01:00
|
|
|
description = "C-style arbitrary precision calculator";
|
|
|
|
homepage = http://www.isthe.com/chongo/tech/comp/calc/;
|
|
|
|
license = licenses.lgpl21;
|
2018-04-23 01:43:40 +02:00
|
|
|
maintainers = with maintainers; [ matthewbauer ];
|
2016-02-24 22:47:21 +01:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|