slang: 2.3.2 -> 2.3.3
Dropped upstreaed patch. While at it added trivial updater script. Changes: http://lists.jedsoft.org/lists/slang-users/2022/0000005.html
This commit is contained in:
parent
5c37f7fa7e
commit
3cc71806a9
|
@ -5,21 +5,20 @@
|
|||
, pcre
|
||||
, readline
|
||||
, zlib
|
||||
, writeScript
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "slang";
|
||||
version = "2.3.2";
|
||||
version = "2.3.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.jedsoft.org/releases/slang/${pname}-${version}.tar.bz2";
|
||||
sha256 = "sha256-/J47D8T2fDwfbUPJDBalxC0Re44oRXxbRoMbi1064xo=";
|
||||
sha256 = "sha256-+RRQVK4TGXPGEgjqgkhtXdEOPFza0jt8SgYXdDyPWhg=";
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" "man" "doc" ];
|
||||
|
||||
patches = [ ./terminfo-dirs.patch ];
|
||||
|
||||
# Fix some wrong hardcoded paths
|
||||
preConfigure = ''
|
||||
sed -ie "s|/usr/lib/terminfo|${ncurses.out}/lib/terminfo|" configure
|
||||
|
@ -51,14 +50,27 @@ stdenv.mkDerivation rec {
|
|||
makeFlagsArray+=(AR_CR="${stdenv.cc.targetPrefix}ar cr")
|
||||
'';
|
||||
|
||||
# slang 2.3.2 does not support parallel building
|
||||
enableParallelBuilding = false;
|
||||
enableParallelBuilding = true;
|
||||
|
||||
postInstall = ''
|
||||
find "$out"/lib/ -name '*.so' -exec chmod +x "{}" \;
|
||||
sed '/^Libs:/s/$/ -lncurses/' -i "$dev"/lib/pkgconfig/slang.pc
|
||||
'';
|
||||
|
||||
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"
|
||||
'';
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A small, embeddable multi-platform programming library";
|
||||
longDescription = ''
|
||||
|
|
|
@ -1,172 +0,0 @@
|
|||
commit c7aa0c07b6522fbbb47ef47bd22f47f1611e7423
|
||||
Author: John E. Davis <jed@jedsoft.org>
|
||||
Date: Wed Nov 28 00:46:28 2018 -0500
|
||||
|
||||
pre2.3.3-5: Added support for TERMINFO_DIRS env var
|
||||
|
||||
Modified: removed changes to changelog and version number.
|
||||
|
||||
diff --git a/src/sltermin.c b/src/sltermin.c
|
||||
index a06d0e4..65d3bbc 100644
|
||||
--- a/src/sltermin.c
|
||||
+++ b/src/sltermin.c
|
||||
@@ -133,6 +133,9 @@ static FILE *open_terminfo (char *file, SLterminfo_Type *h)
|
||||
unsigned char buf[12];
|
||||
int magic;
|
||||
|
||||
+#ifdef SLANG_UNTIC
|
||||
+ (void) fprintf (stdout,"# Trying %s\n", file);
|
||||
+#endif
|
||||
/* Alan Cox reported a security problem here if the application using the
|
||||
* library is setuid. So, I need to make sure open the file as a normal
|
||||
* user. Unfortunately, there does not appear to be a portable way of
|
||||
@@ -269,10 +272,73 @@ static char *read_string_table (FILE *fp, SLterminfo_Type *t)
|
||||
* are implemented by multiple links to the same compiled file.
|
||||
*/
|
||||
|
||||
+static FILE *try_open_tidir (SLterminfo_Type *ti, const char *tidir, const char *term)
|
||||
+{
|
||||
+ char file[1024];
|
||||
+
|
||||
+ if (sizeof (file) > strlen (tidir) + 5 + strlen (term))
|
||||
+ {
|
||||
+ FILE *fp;
|
||||
+
|
||||
+ sprintf (file, "%s/%c/%s", tidir, *term, term);
|
||||
+ if (NULL != (fp = open_terminfo (file, ti)))
|
||||
+ return fp;
|
||||
+
|
||||
+ sprintf (file, "%s/%02x/%s", tidir, (unsigned char)*term, term);
|
||||
+ if (NULL != (fp = open_terminfo (file, ti)))
|
||||
+ return fp;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static FILE *try_open_env (SLterminfo_Type *ti, const char *term, const char *envvar)
|
||||
+{
|
||||
+ char *tidir;
|
||||
+
|
||||
+ if (NULL == (tidir = _pSLsecure_getenv (envvar)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return try_open_tidir (ti, tidir, term);
|
||||
+}
|
||||
+
|
||||
+static FILE *try_open_home (SLterminfo_Type *ti, const char *term)
|
||||
+{
|
||||
+ char home_ti[1024];
|
||||
+ char *env;
|
||||
+
|
||||
+ if (NULL == (env = _pSLsecure_getenv ("HOME")))
|
||||
+ return NULL;
|
||||
+
|
||||
+ strncpy (home_ti, env, sizeof (home_ti) - 11);
|
||||
+ home_ti [sizeof(home_ti) - 11] = 0;
|
||||
+ strcat (home_ti, "/.terminfo");
|
||||
+
|
||||
+ return try_open_tidir (ti, home_ti, term);
|
||||
+}
|
||||
+
|
||||
+static FILE *try_open_env_path (SLterminfo_Type *ti, const char *term, const char *envvar)
|
||||
+{
|
||||
+ char tidir[1024];
|
||||
+ char *env;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ if (NULL == (env = _pSLsecure_getenv (envvar)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ i = 0;
|
||||
+ while (-1 != SLextract_list_element (env, i, ':', tidir, sizeof(tidir)))
|
||||
+ {
|
||||
+ FILE *fp = try_open_tidir (ti, tidir, term);
|
||||
+ if (fp != NULL) return fp;
|
||||
+ i++;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
static SLCONST char *Terminfo_Dirs [] =
|
||||
{
|
||||
- "", /* $TERMINFO */
|
||||
- "", /* $HOME/.terminfo */
|
||||
#ifdef MISC_TERMINFO_DIRS
|
||||
MISC_TERMINFO_DIRS,
|
||||
#endif
|
||||
@@ -287,6 +353,23 @@ static SLCONST char *Terminfo_Dirs [] =
|
||||
NULL,
|
||||
};
|
||||
|
||||
+static FILE *try_open_hardcoded (SLterminfo_Type *ti, const char *term)
|
||||
+{
|
||||
+ const char *tidir, **tidirs;
|
||||
+
|
||||
+ tidirs = Terminfo_Dirs;
|
||||
+ while (NULL != (tidir = *tidirs++))
|
||||
+ {
|
||||
+ FILE *fp;
|
||||
+
|
||||
+ if ((*tidir != 0)
|
||||
+ && (NULL != (fp = try_open_tidir (ti, tidir, term))))
|
||||
+ return fp;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
void _pSLtt_tifreeent (SLterminfo_Type *t)
|
||||
{
|
||||
if (t == NULL)
|
||||
@@ -305,11 +388,7 @@ void _pSLtt_tifreeent (SLterminfo_Type *t)
|
||||
|
||||
SLterminfo_Type *_pSLtt_tigetent (SLCONST char *term)
|
||||
{
|
||||
- SLCONST char **tidirs, *tidir;
|
||||
FILE *fp = NULL;
|
||||
- char file[1024];
|
||||
- static char home_ti [1024];
|
||||
- char *env;
|
||||
SLterminfo_Type *ti;
|
||||
|
||||
if (
|
||||
@@ -341,33 +420,10 @@ SLterminfo_Type *_pSLtt_tigetent (SLCONST char *term)
|
||||
/* If we are on a termcap based system, use termcap */
|
||||
if (0 == tcap_getent (term, ti)) return ti;
|
||||
|
||||
- if (NULL != (env = _pSLsecure_getenv ("TERMINFO")))
|
||||
- Terminfo_Dirs[0] = env;
|
||||
-
|
||||
- if (NULL != (env = _pSLsecure_getenv ("HOME")))
|
||||
- {
|
||||
- strncpy (home_ti, env, sizeof (home_ti) - 11);
|
||||
- home_ti [sizeof(home_ti) - 11] = 0;
|
||||
- strcat (home_ti, "/.terminfo");
|
||||
- Terminfo_Dirs [1] = home_ti;
|
||||
- }
|
||||
-
|
||||
- tidirs = Terminfo_Dirs;
|
||||
- while (NULL != (tidir = *tidirs++))
|
||||
- {
|
||||
- if (*tidir == 0)
|
||||
- continue;
|
||||
-
|
||||
- if (sizeof (file) > strlen (tidir) + 5 + strlen (term))
|
||||
- {
|
||||
- sprintf (file, "%s/%c/%s", tidir, *term, term);
|
||||
- if (NULL != (fp = open_terminfo (file, ti)))
|
||||
- break;
|
||||
- sprintf (file, "%s/%02x/%s", tidir, (unsigned char)*term, term);
|
||||
- if (NULL != (fp = open_terminfo (file, ti)))
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
+ fp = try_open_env_path (ti, term, "TERMINFO_DIRS");
|
||||
+ if (fp == NULL) fp = try_open_env (ti, term, "TERMINFO");
|
||||
+ if (fp == NULL) fp = try_open_home (ti, term);
|
||||
+ if (fp == NULL) fp = try_open_hardcoded (ti, term);
|
||||
|
||||
#ifdef SLANG_UNTIC
|
||||
fp_open_label:
|
Loading…
Reference in a new issue