pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel devel: Add libvterm01. Based on wip/libvterm in ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bf351f3106dd
branches:  trunk
changeset: 377394:bf351f3106dd
user:      nia <nia%pkgsrc.org@localhost>
date:      Wed Apr 20 17:14:20 2022 +0000

description:
devel: Add libvterm01. Based on wip/libvterm in wip, but with some
modifications to install in different directories in order to avoid
conflicts with newer versions of libvterm (0.2.x is out, but incompatible
with neovim)...

diffstat:

 devel/Makefile                              |   3 +-
 devel/libvterm01/DESCR                      |   5 +
 devel/libvterm01/Makefile                   |  26 +++++++++
 devel/libvterm01/PLIST                      |   5 +
 devel/libvterm01/buildlink3.mk              |  15 +++++
 devel/libvterm01/distinfo                   |  10 +++
 devel/libvterm01/patches/patch-Makefile     |  20 +++++++
 devel/libvterm01/patches/patch-src_screen.c |  76 +++++++++++++++++++++++++++++
 devel/libvterm01/patches/patch-src_state.c  |  34 ++++++++++++
 devel/libvterm01/patches/patch-src_vterm.c  |  66 +++++++++++++++++++++++++
 devel/libvterm01/patches/patch-vterm.pc.in  |  19 +++++++
 11 files changed, 278 insertions(+), 1 deletions(-)

diffs (truncated from 333 to 300 lines):

diff -r a7c0f1f4e15d -r bf351f3106dd devel/Makefile
--- a/devel/Makefile    Wed Apr 20 16:24:07 2022 +0000
+++ b/devel/Makefile    Wed Apr 20 17:14:20 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3714 2022/04/19 11:52:18 bsiegert Exp $
+# $NetBSD: Makefile,v 1.3715 2022/04/20 17:14:20 nia Exp $
 #
 
 COMMENT=       Development utilities
@@ -949,6 +949,7 @@
 SUBDIR+=       libuxre
 SUBDIR+=       libview
 SUBDIR+=       libvolume_id
+SUBDIR+=       libvterm01
 SUBDIR+=       libwhisker2
 SUBDIR+=       libwnck
 SUBDIR+=       libwnck3
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/DESCR    Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,5 @@
+An abstract C99 library which implements a VT220 or xterm-like terminal
+emulator. It doesn't use any particular graphics toolkit or output system,
+instead it invokes callback function pointers that its embedding program
+should provide it to draw on its behalf. It avoids calling malloc() during
+normal running state, allowing it to be used in embedded kernel situations.
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/Makefile Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,26 @@
+# $NetBSD: Makefile,v 1.1 2022/04/20 17:14:20 nia Exp $
+
+DISTNAME=      libvterm-0.1.4
+PKGNAME=       ${DISTNAME:S/libvterm/libvterm01/g}
+CATEGORIES=    devel
+MASTER_SITES=  https://www.leonerd.org.uk/code/libvterm/
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      https://www.leonerd.org.uk/code/libvterm/
+COMMENT=       Abstract VT220/xterm/ECMA-48 emulation library
+LICENSE=       mit
+
+USE_TOOLS+=    pkg-config gmake perl
+USE_LIBTOOL=   yes
+
+MAKE_FLAGS+=   PREFIX=${PREFIX}
+MAKE_FLAGS+=   INCDIR=${PREFIX}/include/${PKGBASE}
+MAKE_FLAGS+=   LIBDIR=${PREFIX}/lib/${PKGBASE}
+
+# Do not install programs, in case we conflict with a
+# package for a more recent version.
+INSTALL_TARGET=        install-lib install-inc
+
+PKGCONFIG_OVERRIDE+=   vterm.pc.in
+
+.include "../../mk/bsd.pkg.mk"
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/PLIST    Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 2022/04/20 17:14:20 nia Exp $
+include/libvterm01/vterm.h
+include/libvterm01/vterm_keycodes.h
+lib/libvterm01/libvterm.la
+lib/libvterm01/pkgconfig/vterm.pc
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/buildlink3.mk    Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,15 @@
+# $NetBSD: buildlink3.mk,v 1.1 2022/04/20 17:14:20 nia Exp $
+
+BUILDLINK_TREE+=       libvterm01
+
+.if !defined(LIBVTERM01_BUILDLINK3_MK)
+LIBVTERM01_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.libvterm01+=     libvterm01>=0.0.0
+BUILDLINK_PKGSRCDIR.libvterm01?=       ../../devel/libvterm01
+BUILDLINK_INCDIRS.libvterm01?=         include/libvterm01
+BUILDLINK_LIBDIRS.libvterm01?=         lib/libvterm01
+
+.endif # LIBVTERM01_BUILDLINK3_MK
+
+BUILDLINK_TREE+=       -libvterm01
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/distinfo Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,10 @@
+$NetBSD: distinfo,v 1.1 2022/04/20 17:14:20 nia Exp $
+
+BLAKE2s (libvterm-0.1.4.tar.gz) = 566a0a5fdcab3e8be63a8e2373a690ec6f7314b0643864ca23de3589a2c81173
+SHA512 (libvterm-0.1.4.tar.gz) = 90b5d47417e3f469df5c6574a27d12bd6bd1571d17cab7c4ac0ee61b1dbcb6361987f6fdfd11e314ea32f8958ec165c319a34d0f77288947c7cbc11de697d524
+Size (libvterm-0.1.4.tar.gz) = 69122 bytes
+SHA1 (patch-Makefile) = b45cabfdabb20bebc6837818dd89cc1b5e36fa3a
+SHA1 (patch-src_screen.c) = c41f68d526cd7f1b8a625be6a9a2e4a6adfe5ee6
+SHA1 (patch-src_state.c) = ada2ea37ec6642039011b55557b38cfb88f37cc6
+SHA1 (patch-src_vterm.c) = 5dc781dfe804f13f1b0a0f8b00bf24aa0f8804f2
+SHA1 (patch-vterm.pc.in) = 00cf19f04b87fe84b95e88984d62e95d79f1a965
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/patches/patch-Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/patches/patch-Makefile   Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,20 @@
+$NetBSD: patch-Makefile,v 1.1 2022/04/20 17:14:20 nia Exp $
+
+We want to install libvterm 0.1.4 to its own isolated include
+directories so that it doesn't conflict with (pontential)
+packages for newer versions.
+
+Inspired by Arch Linux:
+https://archlinux.org/packages/community/x86_64/libvterm01/
+
+--- Makefile.orig      2020-08-22 14:54:34.000000000 +0000
++++ Makefile
+@@ -97,7 +97,7 @@ install-inc:
+       install -d $(DESTDIR)$(INCDIR)
+       install -m644 $(HFILES) $(DESTDIR)$(INCDIR)
+       install -d $(DESTDIR)$(LIBDIR)/pkgconfig
+-      sed -e "s,@PREFIX@,$(PREFIX)," -e "s,@LIBDIR@,$(LIBDIR)," -e "s,@VERSION@,$(VERSION)," <vterm.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/vterm.pc
++      sed -e "s,@PREFIX@,$(PREFIX)," -e "s,@INCDIR@,$(INCDIR)," -e "s,@LIBDIR@,$(LIBDIR)," -e "s,@VERSION@,$(VERSION)," <vterm.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/vterm.pc
+ 
+ install-lib: $(LIBRARY)
+       install -d $(DESTDIR)$(LIBDIR)
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/patches/patch-src_screen.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/patches/patch-src_screen.c       Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,76 @@
+$NetBSD: patch-src_screen.c,v 1.1 2022/04/20 17:14:20 nia Exp $
+
+CVE-2018-20786 fix from vim cd929f7ba8cc5b6d6dcf35c8b34124e969fed6b8
+
+--- src/screen.c.orig  2022-03-13 06:09:38.851039573 +0000
++++ src/screen.c
+@@ -94,8 +94,7 @@ static ScreenCell *realloc_buffer(VTermS
+     }
+   }
+ 
+-  if(buffer)
+-    vterm_allocator_free(screen->vt, buffer);
++  vterm_allocator_free(screen->vt, buffer);
+ 
+   return new_buffer;
+ }
+@@ -517,8 +516,7 @@ static int resize(int new_rows, int new_
+   screen->rows = new_rows;
+   screen->cols = new_cols;
+ 
+-  if(screen->sb_buffer)
+-    vterm_allocator_free(screen->vt, screen->sb_buffer);
++  vterm_allocator_free(screen->vt, screen->sb_buffer);
+ 
+   screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * new_cols);
+ 
+@@ -619,13 +617,19 @@ static VTermStateCallbacks state_cbs = {
+   .setlineinfo = &setlineinfo,
+ };
+ 
++/*
++ * Allocate a new screen and return it.
++ * Return NULL when out of memory.
++ */
+ static VTermScreen *screen_new(VTerm *vt)
+ {
+   VTermState *state = vterm_obtain_state(vt);
+-  if(!state)
++  if (state == NULL)
+     return NULL;
+ 
+   VTermScreen *screen = vterm_allocator_malloc(vt, sizeof(VTermScreen));
++  if (screen == NULL)
++    return NULL;
+   int rows, cols;
+ 
+   vterm_get_size(vt, &rows, &cols);
+@@ -644,10 +648,13 @@ static VTermScreen *screen_new(VTerm *vt
+   screen->cbdata    = NULL;
+ 
+   screen->buffers[0] = realloc_buffer(screen, NULL, rows, cols);
+-
+   screen->buffer = screen->buffers[0];
+-
+   screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * cols);
++  if (screen->buffer == NULL || screen->sb_buffer == NULL)
++  {
++    vterm_screen_free(screen);
++    return NULL;
++  }
+ 
+   vterm_state_set_callbacks(screen->state, &state_cbs, screen);
+ 
+@@ -657,11 +664,8 @@ static VTermScreen *screen_new(VTerm *vt
+ INTERNAL void vterm_screen_free(VTermScreen *screen)
+ {
+   vterm_allocator_free(screen->vt, screen->buffers[0]);
+-  if(screen->buffers[1])
+-    vterm_allocator_free(screen->vt, screen->buffers[1]);
+-
++  vterm_allocator_free(screen->vt, screen->buffers[1]);
+   vterm_allocator_free(screen->vt, screen->sb_buffer);
+-
+   vterm_allocator_free(screen->vt, screen);
+ }
+ 
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/patches/patch-src_state.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/patches/patch-src_state.c        Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_state.c,v 1.1 2022/04/20 17:14:20 nia Exp $
+
+CVE-2018-20786 fix from vim cd929f7ba8cc5b6d6dcf35c8b34124e969fed6b8
+
+--- src/state.c.orig   2022-03-12 21:10:57.446471266 +0000
++++ src/state.c
+@@ -52,6 +52,8 @@ static VTermState *vterm_state_new(VTerm
+ {
+   VTermState *state = vterm_allocator_malloc(vt, sizeof(VTermState));
+ 
++  if (state == NULL)
++    return NULL;
+   state->vt = vt;
+ 
+   state->rows = vt->rows;
+@@ -1697,12 +1699,18 @@ static const VTermParserCallbacks parser
+   .resize  = on_resize,
+ };
+ 
++/*
++ * Return the existing state or create a new one.
++ * Returns NULL when out of memory.
++ */
+ VTermState *vterm_obtain_state(VTerm *vt)
+ {
+   if(vt->state)
+     return vt->state;
+ 
+   VTermState *state = vterm_state_new(vt);
++  if (state == NULL)
++    return NULL;
+   vt->state = state;
+ 
+   state->combine_chars_size = 16;
diff -r a7c0f1f4e15d -r bf351f3106dd devel/libvterm01/patches/patch-src_vterm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/libvterm01/patches/patch-src_vterm.c        Wed Apr 20 17:14:20 2022 +0000
@@ -0,0 +1,66 @@
+$NetBSD: patch-src_vterm.c,v 1.1 2022/04/20 17:14:20 nia Exp $
+
+CVE-2018-20786 fix from vim cd929f7ba8cc5b6d6dcf35c8b34124e969fed6b8
+
+--- src/vterm.c.orig   2020-08-22 14:54:34.000000000 +0000
++++ src/vterm.c
+@@ -37,6 +37,8 @@ VTerm *vterm_new_with_allocator(int rows
+   /* Need to bootstrap using the allocator function directly */
+   VTerm *vt = (*funcs->malloc)(sizeof(VTerm), allocdata);
+ 
++  if (vt == NULL)
++    return NULL;
+   vt->allocator = funcs;
+   vt->allocdata = allocdata;
+ 
+@@ -51,6 +53,12 @@ VTerm *vterm_new_with_allocator(int rows
+   vt->parser.strbuffer_len = 64;
+   vt->parser.strbuffer_cur = 0;
+   vt->parser.strbuffer = vterm_allocator_malloc(vt, vt->parser.strbuffer_len);
++  if (vt->parser.strbuffer == NULL)
++  {
++    vterm_allocator_free(vt, vt);
++    return NULL;
++  }
++ 
+ 
+   vt->outfunc = NULL;
+   vt->outdata = NULL;
+@@ -58,9 +66,22 @@ VTerm *vterm_new_with_allocator(int rows
+   vt->outbuffer_len = 64;
+   vt->outbuffer_cur = 0;
+   vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len);
++  if (vt->outbuffer == NULL)
++  {
++    vterm_allocator_free(vt, vt->parser.strbuffer);
++    vterm_allocator_free(vt, vt);
++    return NULL;
++  }
+ 
+   vt->tmpbuffer_len = 64;
+   vt->tmpbuffer = vterm_allocator_malloc(vt, vt->tmpbuffer_len);
++  if (vt->tmpbuffer == NULL)
++  {
++    vterm_allocator_free(vt, vt->outbuffer);
++    vterm_allocator_free(vt, vt->parser.strbuffer);
++    vterm_allocator_free(vt, vt);
++    return NULL;
++  }
+ 
+   return vt;
+ }
+@@ -85,9 +106,13 @@ INTERNAL void *vterm_allocator_malloc(VT
+   return (*vt->allocator->malloc)(size, vt->allocdata);
+ }
+ 
++/*



Home | Main Index | Thread Index | Old Index