Skip to content

Commit

Permalink
editors/mg: Update to OpenBSD 7.4 version; modify location of source …
Browse files Browse the repository at this point in the history
…tarball

Changes in this release:

  * New command set-tab-width to change the tabulator width on a per-buffer
    basis.
  * Let the space-to-tabstop command move to the right position even if
    the line contains tabs, control characters, or non-ASCII bytes.
  * Fall back to /bin/sh if $SHELL is undefined.
  * Fix parsing of tag files with duplicate entries. Instead of erroring
    out, ignore duplicates. Fixes using /var/db/libc.tags again.
  * Change the visit-tags-table command to immediately load the tag
    file, and drop the lazy mechanics.
  * Do not leak memory in pop-tag-mark if it fails to switch buffers.
  * Fix a read buffer overrun caused by -u arguments longer than 1023 bytes.
  * Fix a write buffer overrun on the stack caused by blink-and-insert
    matching a very long line that is not currently visible in the
    window.
  * Skip checking permissions of conffile with access(2).
  * Resurrect no-tab-mode and add it to the list of modes that can be
    set with set-default-mode.

From: https://www.openbsd.org/74.html

PR:		274611
  • Loading branch information
mpwillson authored and clausecker committed Oct 27, 2023
1 parent c9ce4cf commit b47b763
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 31 deletions.
10 changes: 5 additions & 5 deletions editors/mg/Makefile
@@ -1,18 +1,18 @@
PORTNAME= mg
DISTVERSION= 20230501
DISTVERSION= 20231016
PORTEPOCH= 1
CATEGORIES= editors
MASTER_SITES= https://hydrus.org.uk/downloads/

MAINTAINER= cdr.nil@gmail.com
COMMENT= Small, fast Emacs-like editor
WWW= https://github.com/hboetes/mg
WWW= https://man.openbsd.org/mg

LICENSE= PD

USES= ncurses
USE_GITHUB= yes
GH_ACCOUNT= hboetes
STAGEOWN= ${USER}
# replace with STAGEGRP=${.MAKE.GID} once FreeBSD 12 is EOL
STAGEGRP!= id -gn
MAKE_ARGS+= BINOWN=${STAGEOWN} BINGRP=${STAGEGRP} MANOWN=${STAGEOWN} \
MANGRP=${STAGEGRP} BINDIR=${PREFIX}/bin \
Expand All @@ -28,7 +28,7 @@ PLIST_FILES= /rescue/mg
.else
PLIST_FILES= bin/mg \
man/man1/mg.1.gz
PORTDOCS= README README.md tutorial
PORTDOCS= README tutorial
OPTIONS_DEFINE= DOCS
.endif

Expand Down
6 changes: 3 additions & 3 deletions editors/mg/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1683455356
SHA256 (hboetes-mg-20230501_GH0.tar.gz) = e2878feca64067a0c524e456ffba68d8cb69bcdce0943d2f2b69cad06174462e
SIZE (hboetes-mg-20230501_GH0.tar.gz) = 158315
TIMESTAMP = 1698048672
SHA256 (mg-20231016.tar.gz) = ef16fb32aae1dc132d4250039eb0a057826c7e888beb39bdf4748c0a4b0179e9
SIZE (mg-20231016.tar.gz) = 154296
27 changes: 4 additions & 23 deletions editors/mg/files/patch-Makefile
@@ -1,31 +1,12 @@
--- Makefile.orig 2023-05-01 15:27:50 UTC
--- Makefile.orig 2023-10-22 13:42:02 UTC
+++ Makefile
@@ -2,7 +2,7 @@

PROG= mg

-LDADD+= `pkg-config --libs ncurses` -lutil
+LDADD+= -L${NCURSESLIB} -lncurses -lutil
DPADD+= ${LIBUTIL}

# (Common) compile-time options:
@@ -11,7 +11,7 @@ DPADD+= ${LIBUTIL}
# STARTUPFILE -- look for and handle initialization file.
# MGLOG -- debug mg internals to a log file.
#
-CFLAGS+=-Wall -DREGEX `pkg-config --cflags-only-I ncurses`
+CFLAGS+=-Wall -DREGEX -L${NCURSESINC}

SRCS= autoexec.c basic.c bell.c buffer.c cinfo.c dir.c display.c \
echo.c extend.c file.c fileio.c funmap.c help.c kbd.c keymap.c \
@@ -28,10 +28,5 @@ SRCS+= cmode.c cscope.c dired.c grep.c interpreter.c t
# -DMGLOG source file.
@@ -29,9 +29,4 @@ SRCS+= cmode.c cscope.c dired.c grep.c interpreter.c t
#
#SRCS+= log.c
-
-afterinstall:
- ${INSTALL} -d -o root -g wheel ${DESTDIR}${DOCDIR}/mg
- ${INSTALL} ${INSTALL_COPY} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} \
- ${.CURDIR}/tutorial ${DESTDIR}${DOCDIR}/mg
-
.include <bsd.prog.mk>
10 changes: 10 additions & 0 deletions editors/mg/files/patch-def.h
@@ -0,0 +1,10 @@
--- def.h.orig 2023-10-22 13:42:02 UTC
+++ def.h
@@ -10,6 +10,7 @@
* per-terminal definitions are in special header files.
*/

+#include <unistd.h>
#include "chrdef.h"

typedef int (*PF)(int, int); /* generally useful type */
19 changes: 19 additions & 0 deletions editors/mg/files/patch-fileio.c
@@ -0,0 +1,19 @@
--- fileio.c.orig 2023-10-22 13:42:02 UTC
+++ fileio.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/param.h>

#include "def.h"
#include "kbd.h"
@@ -705,7 +706,7 @@ expandtilde(const char *fn)
struct passwd *pw;
struct stat statbuf;
const char *cp;
- char user[LOGIN_NAME_MAX], path[NFILEN];
+ char user[MAXLOGNAME], path[NFILEN];
char *ret;
size_t ulen, plen;

47 changes: 47 additions & 0 deletions editors/mg/files/patch-main.c
@@ -0,0 +1,47 @@
--- main.c.orig 2023-10-20 07:56:18 UTC
+++ main.c
@@ -16,7 +16,7 @@
#include <string.h>
#include <termios.h>
#include <unistd.h>
-#include <util.h>
+#include <libutil.h>

#include "def.h"
#include "kbd.h"
@@ -43,6 +43,10 @@ struct mgwin *wheadp; /* MGWIN listhead */
struct vhead varhead; /* Variable list head */
char pat[NPAT]; /* pattern */

+#ifndef __dead
+#define __dead __attribute__ ((__noreturn__))
+#endif
+
static void edinit(struct buffer *);
static void pty_init(void);
static __dead void usage(void);
@@ -71,10 +75,6 @@ main(int argc, char **argv)
int nobackups = 0;
struct buffer *bp = NULL;

- if (pledge("stdio rpath wpath cpath fattr chown getpw tty proc exec",
- NULL) == -1)
- err(1, "pledge");
-
while ((o = getopt(argc, argv, "nRb:f:u:")) != -1)
switch (o) {
case 'b':
@@ -167,9 +167,11 @@ main(int argc, char **argv)
ffclose(ffp, NULL);
}

- if (batch)
+ if (batch) {
+ vttidy();
return (0);
-
+ }
+
/*
* Now ensure any default buffer modes from the startup file are
* given to any files opened when parsing the startup file.
11 changes: 11 additions & 0 deletions editors/mg/files/patch-tags.c
@@ -0,0 +1,11 @@
--- tags.c.orig 2023-10-22 13:42:02 UTC
+++ tags.c
@@ -18,7 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <util.h>
+#include <libutil.h>

#include "def.h"

0 comments on commit b47b763

Please sign in to comment.