8 , enableReadline ? true
11 stdenv.mkDerivation (finalAttrs: {
17 "https://github.com/lcn2/calc/releases/download/v${finalAttrs.version}/calc-${finalAttrs.version}.tar.bz2"
18 "http://www.isthe.com/chongo/src/calc/calc-${finalAttrs.version}.tar.bz2"
20 hash = "sha256-dPEj32SiR7RhI9fBa9ny9+EEuuiXS2WswRcDVuOMJXc=";
24 substituteInPlace Makefile.target \
25 --replace '-install_name ''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' \
26 --replace '-install_name ''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}'
34 buildInputs = lib.optionals enableReadline [
44 "CALC_SHAREDIR=/share/calc"
45 "CALC_INCDIR=/include"
46 "MANDIR=/share/man/man1"
48 # Handle LDFLAGS defaults in calc
49 "DEFAULT_LIB_INSTALL_PATH=$(out)/lib"
51 ++ lib.optionals enableReadline [
52 "READLINE_LIB=-lreadline"
53 "USE_READLINE=-DUSE_READLINE"
57 homepage = "http://www.isthe.com/chongo/tech/comp/calc/";
58 description = "C-style arbitrary precision calculator";
60 changelog = "https://github.com/lcn2/calc/blob/v${finalAttrs.version}/CHANGES";
61 # The licensing situation depends on readline (see section 3 of the LGPL)
62 # If linked against readline then GPLv2 otherwise LGPLv2.1
63 license = if enableReadline
64 then lib.licenses.gpl2Only
65 else lib.licenses.lgpl21Only;
66 maintainers = with lib.maintainers; [ matthewbauer ];
67 platforms = lib.platforms.all;