2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl
|
2021-01-15 22:18:51 +00:00
|
|
|
, libiconv
|
|
|
|
, libpng
|
|
|
|
, ncurses
|
|
|
|
, pcre
|
|
|
|
, readline
|
|
|
|
, zlib
|
2022-09-09 14:08:57 +00:00
|
|
|
, writeScript
|
2021-01-15 22:18:51 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-01-15 22:18:51 +00:00
|
|
|
pname = "slang";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "2.3.3";
|
2021-01-15 22:18:51 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
2021-01-15 22:18:51 +00:00
|
|
|
url = "https://www.jedsoft.org/releases/slang/${pname}-${version}.tar.bz2";
|
2022-09-09 14:08:57 +00:00
|
|
|
sha256 = "sha256-+RRQVK4TGXPGEgjqgkhtXdEOPFza0jt8SgYXdDyPWhg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "man" "doc" ];
|
|
|
|
|
|
|
|
# Fix some wrong hardcoded paths
|
|
|
|
preConfigure = ''
|
2021-01-15 22:18:51 +00:00
|
|
|
sed -ie "s|/usr/lib/terminfo|${ncurses.out}/lib/terminfo|" configure
|
|
|
|
sed -ie "s|/usr/lib/terminfo|${ncurses.out}/lib/terminfo|" src/sltermin.c
|
|
|
|
sed -ie "s|/bin/ln|ln|" src/Makefile.in
|
|
|
|
sed -ie "s|-ltermcap|-lncurses|" ./configure
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-pcre=${pcre.dev}"
|
2021-01-15 22:18:51 +00:00
|
|
|
"--with-png=${libpng.dev}"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-readline=${readline.dev}"
|
2021-01-15 22:18:51 +00:00
|
|
|
"--with-z=${zlib.dev}"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-01-15 22:18:51 +00:00
|
|
|
libpng
|
|
|
|
pcre
|
|
|
|
readline
|
|
|
|
zlib
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin) [ libiconv ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ ncurses ];
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
buildFlags = lib.optional stdenv.hostPlatform.isStatic "static";
|
|
|
|
installTargets = lib.optional stdenv.hostPlatform.isStatic "install-static";
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
makeFlagsArray+=(AR_CR="${stdenv.cc.targetPrefix}ar cr")
|
|
|
|
'';
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
enableParallelBuilding = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
find "$out"/lib/ -name '*.so' -exec chmod +x "{}" \;
|
|
|
|
sed '/^Libs:/s/$/ -lncurses/' -i "$dev"/lib/pkgconfig/slang.pc
|
|
|
|
'';
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = writeScript "update-slang" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl pcre common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# Expect the text in format of 'Version 2.3.3</td>'
|
|
|
|
new_version="$(curl -s https://www.jedsoft.org/slang/ |
|
|
|
|
pcregrep -o1 'Version ([0-9.]+)</td>')"
|
|
|
|
update-source-version ${pname} "$new_version"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-01-15 22:18:51 +00:00
|
|
|
description = "A small, embeddable multi-platform programming library";
|
|
|
|
longDescription = ''
|
|
|
|
S-Lang is an interpreted language that was designed from the start to be
|
|
|
|
easily embedded into a program to provide it with a powerful extension
|
|
|
|
language. Examples of programs that use S-Lang as an extension language
|
|
|
|
include the jed text editor and the slrn newsreader. Although S-Lang does
|
|
|
|
not exist as a separate application, it is distributed with a quite
|
|
|
|
capable program called slsh ("slang-shell") that embeds the interpreter
|
|
|
|
and allows one to execute S-Lang scripts, or simply experiment with S-Lang
|
|
|
|
at an interactive prompt. Many of the the examples in this document are
|
|
|
|
presented in the context of one of the above applications.
|
|
|
|
|
|
|
|
S-Lang is also a programmer's library that permits a programmer to develop
|
|
|
|
sophisticated platform-independent software. In addition to providing the
|
|
|
|
S-Lang interpreter, the library provides facilities for screen management,
|
|
|
|
keymaps, low-level terminal I/O, etc. However, this document is concerned
|
|
|
|
only with the extension language and does not address these other features
|
|
|
|
of the S-Lang library. For information about the other components of the
|
|
|
|
library, the reader is referred to the S-Lang Library C Programmer's
|
|
|
|
Guide.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://www.jedsoft.org/slang/";
|
|
|
|
license = licenses.gpl2Plus;
|
2021-01-15 22:18:51 +00:00
|
|
|
maintainers = with maintainers; [ AndersonTorres ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "slsh";
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|