Change the standalone version of sam to a maintained fork which

supports scalable fonts among many other changes.

The prior 1998 version frequently crashes on amd64.

ok markus@ who drops maintainership
This commit is contained in:
jsg 2019-11-12 02:45:32 +00:00
parent 83f07abb97
commit d67406629d
13 changed files with 114 additions and 252 deletions

View File

@ -1,32 +1,29 @@
# $OpenBSD: Makefile,v 1.31 2019/07/12 20:48:54 sthen Exp $
# $OpenBSD: Makefile,v 1.32 2019/11/12 02:45:32 jsg Exp $
COMMENT= X11 version of Rob Pike's editor, sam
DISTNAME= sam
PKGNAME= sam-4.3.19980506
REVISION= 3
DISTNAME= sam-4.3.20190427
GH_ACCOUNT= deadpixi
GH_PROJECT= sam
GH_COMMIT= 5893679bbbab2f50ceb6ef0805e4bb63f5f51df8
CATEGORIES= plan9
MASTER_SITES= ftp://netlib.bell-labs.com/netlib/research/ \
http://netlib.bell-labs.com/netlib/research/
EXTRACT_SUFX= .shar.gz
EXTRACT_CASES= *.shar.gz) ${GZIP_CMD} -dc ${FULLDISTDIR}/$$archive | /bin/sh;;
MAINTAINER= Markus Friedl <markus@openbsd.org>
PERMIT_PACKAGE= Yes
WANTLIB= X11 Xt c xcb
WANTLIB= X11 Xft Xi Xt c
WRKDIST= ${WRKDIR}
RUN_DEPENDS+= devel/desktop-file-utils
NO_TEST= Yes
SAMDOCDIR= ${PREFIX}/share/doc/sam
SAMDOCFILES= README doc/sam.ps doc/sam.tut.ms doc/se.ps doc/Sam.ad
SAMDOCFILES= README.rst doc/sam.ps doc/sam.tut.ms doc/se.ps
EXAMPLEDIR= ${PREFIX}/share/examples/sam
post-install:
${INSTALL_DATA_DIR} ${SAMDOCDIR}
${INSTALL_MAN} $(WRKSRC)/doc/sam.1 $(PREFIX)/man/man1
${INSTALL_DATA_DIR} ${EXAMPLEDIR}
${INSTALL_DATA} ${WRKSRC}/doc/samrc ${EXAMPLEDIR}
@set -e; for f in ${SAMDOCFILES}; do \
${INSTALL_DATA} ${WRKSRC}/$${f} ${SAMDOCDIR}; \
done

View File

@ -1,2 +1,2 @@
SHA256 (sam.shar.gz) = UiBRCBtC2LgRMn5OhbK8qb9pa6nfrz7c3JSp76CxU3k=
SIZE (sam.shar.gz) = 252281
SHA256 (sam-4.3.20190427-5893679b.tar.gz) = 17k1wL+Rv5Z43t79sLyj0Vn9UYzSVfpVxOYZNiAfB0E=
SIZE (sam-4.3.20190427-5893679b.tar.gz) = 311827

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-Makefile,v 1.1 2019/11/12 02:45:32 jsg Exp $
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -27,7 +27,8 @@ samtermdir:
cd samterm; $(MAKE)
install:
- @xdg-desktop-menu install --mode $(MODE) deadpixi-sam.desktop || echo "unable to install desktop entry"
+ mkdir -p ${PREFIX}/share/applications/
+ cp deadpixi-sam.desktop ${PREFIX}/share/applications/
cd libXg; $(MAKE) install
cd libframe; $(MAKE) install
cd sam; $(MAKE) install

View File

@ -0,0 +1,45 @@
$OpenBSD: patch-config_mk_def,v 1.1 2019/11/12 02:45:32 jsg Exp $
Index: config.mk.def
--- config.mk.def.orig
+++ config.mk.def
@@ -2,7 +2,6 @@
# copyright 2015 Rob King <jking@deadpixi.com>
# CC is the C compiler to use
-CC=gcc
CFLAGS?=
CFLAGS+=-std=c99
@@ -11,23 +10,23 @@ CFLAGS+=-std=c99
# environment.
#
# Mac OS X users need to add -D_DARWIN_C_SOURCE here.
-STANDARDS=-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500
+STANDARDS=-D_POSIX_C_SOURCE=200809L
# DESTDIR is the root of the installation tree
-DESTDIR?=/usr/local
+# DESTDIR?=/usr/local
# BINDIR is the directory where binaries go
-BINDIR?=$(DESTDIR)/bin
+BINDIR?=${PREFIX}/bin
# MANDIR is where manual pages go
-MANDIR?=$(DESTDIR)/share/man/
+MANDIR?=${PREFIX}/man/
# Add additional include and library directories
# BSD/Mac OS X users might need to add something like
-# INCLUDES=-I/usr/X11R6/include -I/usr/X11R6/include/freetype2
-# LDFLAGS=-L/usr/X11R6/lib
-INCLUDES=-I/usr/include/freetype2
-LDFLAGS=
+INCLUDES=-I${X11BASE}/include -I${X11BASE}/include/freetype2
+LDFLAGS=-L${X11BASE}/lib
+#INCLUDES=-I/usr/include/freetype2
+#LDFLAGS=
# Set this to your default remote shell.
RXPATH=/usr/bin/ssh

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-doc_Makefile,v 1.1 2019/11/12 02:45:32 jsg Exp $
Index: doc/Makefile
--- doc/Makefile.orig
+++ doc/Makefile
@@ -7,10 +7,6 @@ all:
install: sam.1
mkdir -p "$(MANDIR)/man1"
cp sam.1 "$(MANDIR)/man1"
- ln -sf "$(MANDIR)/man1/sam.1" "$(MANDIR)/man1/B.1"
- ln -sf "$(MANDIR)/man1/sam.1" "$(MANDIR)/man1/samterm.1"
- ln -sf "$(MANDIR)/man1/sam.1" "$(MANDIR)/man1/rsam.1"
- ln -sf "$(MANDIR)/man1/sam.1" "$(MANDIR)/man1/sam.save.1"
mkdir -p "$(MANDIR)/man5"
cp samrc.5 "$(MANDIR)/man5"

View File

@ -1,25 +1,16 @@
$OpenBSD: patch-doc_sam_1,v 1.2 2015/04/18 20:35:25 schwarze Exp $
Ignore .TF macro that is broken even with groff; use default indentation.
Delete unused .EX and .EE macros.
--- doc/sam.1.orig Sat Apr 18 15:40:50 2015
+++ doc/sam.1 Sat Apr 18 15:53:01 2015
@@ -15,19 +15,7 @@
.de CW
.ft B
..
-.\" This is gross but it avoids relying on internal implementation details
-.\" of the -man macros.
.de TF
-.br
-.IP "" \w'\fB\\$1\ \ \fP'u
-.PD0
-..
-.de EX
-.CW
-.nf
-..
-.de EE
-.fi
..
.\" delete above this point if your system has F, L, FR, LR, CW and TF macros
.ds a \fR*\ \fP
$OpenBSD: patch-doc_sam_1,v 1.3 2019/11/12 02:45:32 jsg Exp $
Index: doc/sam.1
--- doc/sam.1.orig
+++ doc/sam.1
@@ -3,6 +3,10 @@
.Os
.Sh NAME
.Nm sam
+.Nm B
+.Nm samterm
+.Nm rsam
+.Nm sam.save
.Nd screen editor with structural regular expressions
.Sh SYNOPSIS
.Nm

View File

@ -1,42 +0,0 @@
$OpenBSD: patch-libXg_Makefile,v 1.1 2002/11/04 10:28:56 markus Exp $
--- libXg/Makefile.orig Thu Oct 31 00:27:21 2002
+++ libXg/Makefile Thu Oct 31 00:27:59 2002
@@ -8,17 +8,17 @@
#
# Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
# if your compiler supports posix-compatible compilation
-OS=-DIRIX5 -ansiposix
+OS=-D_POSIX_SOURCE -DSOLARIS
# add -Iincludedir for any include directories that need to be searched
-INCS=-I../include
+INCS=-I../include -I${X11BASE}/include
# set this if your X libraries are in different locations
# or if you need extra libraries to load with X11 applications
XLIBS=-lXt
# add name of library orderer - use ":" if none
-RANLIB=:
+RANLIB=ranlib
# add name of librarian
AR=ar
@@ -26,8 +26,7 @@ AR=ar
# the name of the library
LIB=libXg.a
-CFLAGS=$(OS) -D_LIBXG_EXTENSION $(INCS)
-CC=cc
+CFLAGS+=$(OS) -D_LIBXG_EXTENSION $(INCS)
OBJS= arc.o arith.o balloc.o bitblt.o bitbltclip.o border.o bscreenrect.o\
circle.o clipline.o clipr.o copymasked.o cursorset.o cursorswitch.o\
@@ -50,7 +49,5 @@ nuke: clean
$(LIB): $(OBJS)
$(AR) rv $(LIB) $(OBJS)
$(RANLIB) $(LIB)
-
-$(LIB)(%.o): %.o
$(OBJS): ../include/libg.h libgint.h ../include/libc.h

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-libframe_Makefile,v 1.1 2002/11/04 10:28:56 markus Exp $
--- libframe/Makefile.orig Wed Oct 30 21:05:48 2002
+++ libframe/Makefile Wed Oct 30 21:05:50 2002
@@ -8,22 +8,21 @@
#
# Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
# if your compiler supports posix-compatible compilation
-OS=-DIRIX5 -ansiposix
+OS=-D_POSIX_SOURCE -DSOLARIS
# add -Iincludedir for any include directories that need to be searched
# for posix header files (for UMIPS, add -I/usr/include/posix)
INCS=-I../include
# add name of library orderer - use ":" if none exists
-RANLIB=:
+RANLIB=ranlib
# add name of library
AR=ar
-CFLAGS=-c $(OS) $(INCS) -D_LIBXG_EXTENSION
+CFLAGS+=-c $(OS) $(INCS) -D_LIBXG_EXTENSION
LIB=libframe.a
-CC=cc
OBJ=frbox.o frdelete.o frdraw.o frinit.o frinsert.o frptofchar.o\
frselect.o frstr.o frutil.o misc.o

View File

@ -1,18 +0,0 @@
$OpenBSD: patch-libframe_misc_c,v 1.1 2016/03/17 21:07:32 naddy Exp $
--- libframe/misc.c.orig Thu Mar 17 21:21:48 2016
+++ libframe/misc.c Thu Mar 17 21:27:16 2016
@@ -1,4 +1,5 @@
/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
+#include <errno.h>
#include <u.h>
#include <libc.h>
#include <pwd.h>
@@ -22,8 +23,6 @@ fprint(int fd, char *z, ...)
int errstr(char *buf)
{
- extern int errno;
-
strncpy(buf, strerror(errno), ERRLEN);
return 1;
}

View File

@ -1,53 +0,0 @@
$OpenBSD: patch-sam_Makefile,v 1.2 2016/03/17 21:07:32 naddy Exp $
--- sam/Makefile.orig Thu Mar 17 21:21:48 2016
+++ sam/Makefile Thu Mar 17 21:21:48 2016
@@ -8,7 +8,7 @@
#
# Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
# if your compiler supports posix-compatible compilation
-OS=-DIRIX5 -ansiposix
+OS=-D_POSIX_SOURCE -DSOLARIS
# add -Iincludedir for any include directories that need to be searched
# for posix header files (for UMIPS, add -I/usr/include/posix)
@@ -22,12 +22,12 @@ HOMEDIR=HOME
# where sam is to be installed. SAMSAVEDIR is the name of the directory
# where the samsave file restoration script is stored.
RSAMNAME=sam
-TERMNAME=/v/bin/samterm
-SAMDIR=/usr/bin
-SAMSAVEDIR=/v/bin
+TERMNAME=${PREFIX}/bin/samterm
+SAMDIR=${PREFIX}/bin
+SAMSAVEDIR=${PREFIX}/bin
# Set TMP to a good place for tmp files (with lots of room)
-TMP=/tmp
+TMP=/var/tmp
# Set SHELLNAME and SHELLPATH to the name of a shell and the pathname
# of its executable
@@ -36,12 +36,12 @@ SHELLPATH=/bin/sh
# Set RXNAME and RXPATHNAME to the name of the remote execution command
# and the pathname of its executable
-RXNAME=rsh
-RXPATHNAME=/usr/bsd/rsh
+RXNAME=ssh
+RXPATHNAME=/usr/bin/ssh
SAMSAVE=/bin/sh\\n$(SAMSAVEDIR)/samsave
-CFLAGS=$(OS) -D_LIBXG_EXTENSION $(INCS)
+CFLAGS+=$(OS) -D_LIBXG_EXTENSION $(INCS)
SYSFLAGS= -DHOMEDIR=\"$(HOMEDIR)\" -DRSAMNAME=\"$(RSAMNAME)\" \
-DTERMNAME=\"$(TERMNAME)\" -DTMP=\"$(TMP)\" \
@@ -50,7 +50,6 @@ SYSFLAGS= -DHOMEDIR=\"$(HOMEDIR)\" -DRSAMNAME=\"$(RSA
-DSAMSAVE=\"$(SAMSAVE)\"
LIB=../libframe/libframe.a ../libXg/libXg.a
-CC=cc
OBJ=sam.o address.o buffer.o cmd.o disc.o error.o file.o io.o \
list.o mesg.o moveto.o multi.o rasp.o regexp.o shell.o \

View File

@ -1,32 +0,0 @@
$OpenBSD: patch-sam_unix_c,v 1.2 2016/03/17 21:07:32 naddy Exp $
--- sam/unix.c.orig Thu Mar 17 21:21:48 2016
+++ sam/unix.c Thu Mar 17 21:21:48 2016
@@ -147,18 +147,18 @@ notifyf(void *a, char *b) /* never called */
int
newtmp(int i)
{
- char *s;
- FILE *f;
- extern char *tempnam(const char*, const char*);
+ char file[40];
+ int fd;
+ extern int mkstemp(char *);
- s = tempnam(TMPDIR, "sam.");
- if (!s)
+ snprintf(file, 40, "%s/sam.XXXXXXXXXX", TMPDIR);
+ fd = mkstemp(file);
+ if(fd < 0){
+ unlink(file);
return -1;
- f = fopen(s, "w+");
- if (!f)
- return -1;
- unlink(s);
- return fileno(f);
+ }
+ unlink(file);
+ return fd;
}
void

View File

@ -1,32 +0,0 @@
$OpenBSD: patch-samterm_Makefile,v 1.1 2002/11/04 10:28:56 markus Exp $
--- samterm/Makefile.orig Thu Oct 31 00:48:26 2002
+++ samterm/Makefile Thu Oct 31 00:49:03 2002
@@ -8,7 +8,7 @@
#
# Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
# if your compiler supports posix-compatible compilation
-OS=-DIRIX5 -ansiposix
+OS=-D_POSIX_SOURCE -DSOLARIS
# add -Iincludedir for any include directories that need to be searched
# for posix header files (for UMIPS, add -I/usr/include/posix)
@@ -16,16 +16,15 @@ INCS=-I../include
# SAMTERM contains the name of the file containing the samterm
# executable.
-SAMTERM=/v/bin/samterm
+SAMTERM=${PREFIX}/bin/samterm
# set this if your X libraries are in different locations
# or if you need extra libraries to load with X11 applications
-XLIBS=-lXt -lX11
+XLIBS=-L${X11BASE}/lib -lXt -lX11
-CFLAGS=$(OS) $(INCS) -D_LIBXG_EXTENSION
+CFLAGS+=$(OS) $(INCS) -D_LIBXG_EXTENSION
LIBS=../libframe/libframe.a ../libXg/libXg.a
-CC=cc
OBJ=main.o flayer.o icons.o io.o menu.o mesg.o rasp.o scroll.o unix.o

View File

@ -1,11 +1,15 @@
@comment $OpenBSD: PLIST,v 1.5 2016/03/17 21:07:32 naddy Exp $
@comment $OpenBSD: PLIST,v 1.6 2019/11/12 02:45:32 jsg Exp $
@bin bin/B
@bin bin/sam
bin/samsave
@bin bin/samterm
@man man/man1/sam.1
@man man/man5/samrc.5
share/applications/deadpixi-sam.desktop
share/doc/sam/
share/doc/sam/README
share/doc/sam/Sam.ad
share/doc/sam/README.rst
share/doc/sam/sam.ps
share/doc/sam/sam.tut.ms
share/doc/sam/se.ps
share/examples/sam/
share/examples/sam/samrc
@tag update-desktop-database