- Update to 20160912 snapshot

- Remove GNUmakefile patch, port doesn't use gmake
- Replace patches by another, when reallocarray(3) is missing
- Pass maintainership to submitter
- Add LICENSE
- Update pkg-descr

PR:		212634
Submitted by:	Tobias Kortkamp
Approved by:	<darcsis@gmail.com> (previous maintainer, timeout > 3 weeks)
This commit is contained in:
Olivier Duchateau 2016-10-06 19:51:19 +00:00
parent 2851c7e1e1
commit 0f3528e19a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=423435
10 changed files with 67 additions and 127 deletions

View File

@ -2,14 +2,15 @@
# $FreeBSD$
PORTNAME= mg
PORTVERSION= 20160421
PORTREVISION= 1
PORTVERSION= 20160912
CATEGORIES= editors
MASTER_SITES= http://homepage.boetes.org/software/mg/
MAINTAINER= darcsis@gmail.com
MAINTAINER= t@tobik.me
COMMENT= Small, fast Emacs-like editor
LICENSE= PD
USES= ncurses
PLIST_FILES= bin/mg man/man1/mg.1.gz
PORTDOCS= README tutorial
@ -22,6 +23,14 @@ OPTIONS_DEFINE= DOCS
BROKEN= does not build, requires futimens system call
.endif
.if ${OSVERSION} >= 1002506 && ${OSVERSION} < 1100072
EXTRA_PATCHES= ${FILESDIR}/extra-patch-def.h
post-patch:
${CP} ${FILESDIR}/reallocarray.c ${WRKSRC}
@${REINPLACE_CMD} -e 's| theo.c| theo.c reallocarray.c|' ${WRKSRC}/Makefile
.endif
pre-configure:
@${REINPLACE_CMD} -e 's|__dead|__dead2|' ${WRKSRC}/main.c

View File

@ -1,2 +1,3 @@
SHA256 (mg-20160421.tar.gz) = b5dd8fbecb8a0ff0f32588c448f22f25fafcbfb297857e76d2883598a3e63a9a
SIZE (mg-20160421.tar.gz) = 145187
TIMESTAMP = 1473715513
SHA256 (mg-20160912.tar.gz) = 0b050456b78d767d13839486e01705de6acf407f27052c204505e166eb698176
SIZE (mg-20160912.tar.gz) = 145176

View File

@ -0,0 +1,11 @@
--- def.h.orig 2016-09-01 15:30:59 UTC
+++ def.h
@@ -328,6 +328,8 @@ struct undo_rec {
* Prototypes.
*/
+void *reallocarray(void*, size_t, size_t);
+
/* tty.c X */
void ttinit(void);
void ttreinit(void);

View File

@ -1,22 +0,0 @@
--- GNUmakefile.orig 2016-01-18 15:01:49 UTC
+++ GNUmakefile
@@ -17,16 +17,10 @@ PKG_CONFIG= /usr/bin/pkg-config
INSTALL= /usr/bin/install
STRIP= /usr/bin/strip
-UNAME:= $(shell uname)
-ifeq ($(UNAME),FreeBSD)
- BSD_CPPFLAGS:=
- BSD_LIBS:= -lutil
-else
- BSD_CPPFLAGS:=$(shell $(PKG_CONFIG) --cflags libbsd-overlay)
- BSD_LIBS:= $(shell $(PKG_CONFIG) --libs libbsd-overlay)
-endif
+BSD_CPPFLAGS:=
+BSD_LIBS:= -lutil
-CURSES_LIBS= -lcurses
+CURSES_LIBS= -lncurses
CC?= gcc
CFLAGS?= -O2 -pipe

View File

@ -1,4 +1,4 @@
--- Makefile.orig 2016-01-07 18:55:54 UTC
--- Makefile.orig 2016-09-12 16:36:25 UTC
+++ Makefile
@@ -2,7 +2,7 @@

View File

@ -1,34 +0,0 @@
--- autoexec.c.orig 2015-03-23 11:03:05 UTC
+++ autoexec.c
@@ -2,12 +2,17 @@
/* this file is in the public domain */
/* Author: Vincent Labrecque <vincent@openbsd.org> April 2002 */
+#include <sys/param.h>
#include <sys/queue.h>
#include <fnmatch.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef __OpenBSD__
+#include <stdlib.h>
+#include <malloc_np.h>
+#endif
#include "def.h"
#include "funmap.h"
@@ -44,8 +49,13 @@ find_autoexec(const char *fname)
SLIST_FOREACH(ae, &autos, next) {
if (fnmatch(ae->pattern, fname, 0) == 0) {
if (used >= have) {
+ #if defined(__OpenBSD__)
npfl = reallocarray(pfl, have + AUTO_GROW + 1,
sizeof(PF));
+ #else
+ npfl = realloc(pfl, (have + AUTO_GROW + 1) *
+ sizeof(PF));
+ #endif
if (npfl == NULL)
panic("out of memory");
pfl = npfl;

View File

@ -1,11 +0,0 @@
--- def.h.orig 2015-03-23 11:23:30 UTC
+++ def.h
@@ -13,6 +13,8 @@
#include "chrdef.h"
#include "ttydef.h"
+#include <sys/types.h>
+
/* necesarry to get asprintf & friends with glibc XXX doesn't work for some
* mysterious reason! */

View File

@ -1,40 +0,0 @@
--- display.c.orig 2015-03-16 14:39:00 UTC
+++ display.c
@@ -170,14 +170,6 @@ vtresize(int force, int newrow, int newc
(a) = tmp; \
} while (0)
-#define TRYREALLOCARRAY(a, n, m) do { \
- void *tmp; \
- if ((tmp = reallocarray((a), (n), (m))) == NULL) {\
- panic("out of memory in display code"); \
- } \
- (a) = tmp; \
- } while (0)
-
/* No update needed */
if (!first_run && !force && !rowchanged && !colchanged)
return (TRUE);
@@ -206,10 +198,10 @@ vtresize(int force, int newrow, int newc
}
}
- TRYREALLOCARRAY(score, newrow, newrow * sizeof(struct score));
- TRYREALLOCARRAY(vscreen, (newrow - 1), sizeof(struct video *));
- TRYREALLOCARRAY(pscreen, (newrow - 1), sizeof(struct video *));
- TRYREALLOCARRAY(video, (newrow - 1), 2 * sizeof(struct video));
+ TRYREALLOC(score, newrow * newrow * sizeof(struct score));
+ TRYREALLOC(vscreen, (newrow - 1) * sizeof(struct video *));
+ TRYREALLOC(pscreen, (newrow - 1) * sizeof(struct video *));
+ TRYREALLOC(video, ((newrow - 1) * 2) * sizeof(struct video));
/*
* Zero-out the entries we just allocated.
@@ -247,7 +239,6 @@ vtresize(int force, int newrow, int newc
}
#undef TRYREALLOC
-#undef TRYREALLOCARRAY
/*
* Initialize the data structures used

View File

@ -0,0 +1,39 @@
/* $OpenBSD: reallocarray.c,v 1.3 2015/09/13 08:31:47 guenther Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
/*
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
*/
#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
void *
reallocarray(void *optr, size_t nmemb, size_t size)
{
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
nmemb > 0 && SIZE_MAX / nmemb < size) {
errno = ENOMEM;
return NULL;
}
return realloc(optr, size * nmemb);
}

View File

@ -3,17 +3,4 @@ editor maintained by the OpenBSD Project. It is intended for people
who can't, or don't want to, run the real GNU Emacs, or are not
familiar with the vi(1) editor.
Although it is intended to be largely compatible with GNU Emacs, Mg
doesn't have special modes for tasks other than editing plain text.
Moreover, since it is written entirely in C, there is no language in
which to write extensions in (read: no builtin Lisp interpreter).
If you are looking for something that looks like Emacs (don't want to
learn another editor) but don't have the resources to run the latter,
this may be what you're looking for.
Enjoy!
Dima Dorfman
dima@unixfreak.org
14 May 2001
WWW: http://homepage.boetes.org/software/mg/