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

48 lines
1.2 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, makeWrapper, glibc, readline, ncurses, utillinux }:
2016-02-24 21:47:21 +00:00
with stdenv.lib;
let
makeFlags = ''
INCDIR=${glibc.dev}/include \
2016-02-24 21:47:21 +00:00
BINDIR=$out/bin LIBDIR=$out/lib CALC_INCDIR=$out/include/calc CALC_SHAREDIR=$out/share/calc MANDIR=$out/share/man/man1 \
USE_READLINE=-DUSE_READLINE READLINE_LIB=-lreadline READLINE_EXTRAS='-lhistory -lncurses' \
TERMCONTROL=-DUSE_TERMIOS \
'';
in
stdenv.mkDerivation rec {
name = "calc-${version}";
2017-07-31 22:27:29 +01:00
version = "2.12.6.1";
2016-02-24 21:47:21 +00:00
src = fetchurl {
2017-07-31 22:27:29 +01:00
url = "https://github.com/lcn2/calc/releases/download/${version}/${name}.tar.bz2";
sha256 = "1vy4jmhmpl3gzgpkpv0kqwjv8hn1cza8cn1g8c69gq3inqvr4fvd";
2016-02-24 21:47:21 +00:00
};
buildInputs = [ makeWrapper readline ncurses utillinux ];
2016-02-24 21:47:21 +00:00
configurePhase = ''
sed -i 's/all: check_include/all:/' Makefile
'';
buildPhase = ''
make ${makeFlags}
'';
installPhase = ''
make install ${makeFlags}
wrapProgram $out/bin/calc --prefix LD_LIBRARY_PATH : $out/lib
'';
# Hack to avoid TMPDIR in RPATHs.
preFixup = ''rm -rf "$(pwd)" '';
2016-02-24 21:47:21 +00:00
meta = {
description = "C-style arbitrary precision calculator";
homepage = http://www.isthe.com/chongo/tech/comp/calc/;
license = licenses.lgpl21;
maintainers = [ ];
platforms = platforms.all;
};
}