Tuesday, October 25, 2022

new print/epstool

I have attached a new port print/epstool. There is also an inline diff
for math/octave to add print/epstool to RUN_DEPENDS.

Motivation: In updating editors/TeXmacs I discovered that epstool was
needed for the octave plugin to work with eps files.

Here are two example octave sessions (without and with epstool)
demonstrating creating eps files.

source:
https://stackoverflow.com/questions/20598761/how-to-save-plots-as-colorful-eps-in-octave

without epstool:
--8<---------------cut here---------------start------------->8---
octave:1> clf();
octave:2> surf(peaks);
octave:3> print -depsc test.eps
error: print: 'epstool' is required for specified output format, but
binary is not available in PATH
error: called from
print>epstool at line 893 column 7
__opengl_print__ at line 49 column 16
print at line 771 column 16
--8<---------------cut here---------------end--------------->8---

with epstool:
--8<---------------cut here---------------start------------->8---
octave:1> clf();
octave:2> surf(peaks);
octave:3> print -depsc test.eps
exit

use ghostscript to view:
$ gs test.eps
--8<---------------cut here---------------end--------------->8---

As an aside, gnuplot is happy without epstool.
see: https://sourceforge.net/p/gnuplot/discussion/5925/thread/b028261a/
--8
<---------------cut here---------------start------------->8---
set terminal postscript eps
set output "sinx.eps"
plot sin(x)

$ gs sinx.eps
--8<---------------cut here---------------end--------------->8---

Some notes on epstool port itself:
- gentoo notes dependency on ghostscript and reverse-dependency on
octave
see: https://packages.gentoo.org/packages/app-text/epstool/dependencies
- combination of FIX_EXTRACT_PERMISSIONS, FIX_CLEANUP_PERMISSIONS,
FIX_CRLF_FILES and chmod is needed for patches to apply correctly
- patch unixcom.mak to use ${CC}
- patch ceps.c to address compiler warnings for strncat

--8<---------------cut here---------------start------------->8---
./src/ceps.c:1525:30: warning: the value of the size argument in
'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size]
strncat(platename, ".", sizeof(platename) - strlen(platename));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ceps.c:1525:30: note: change the argument to be the free space in
the destination buffer minus the terminating null byte
strncat(platename, ".", sizeof(platename) - strlen(platename));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sizeof(platename) - strlen(platename) - 1
--8<---------------cut here---------------end--------------->8---

Comment:
tool to create previews and fix bounding boxes in EPS files

Description:
Epstool is a utility to create or extract preview images in EPS files,
fix bounding boxes and convert to bitmaps.

Features:
- Add EPSI, DOS EPS or Mac PICT previews.
- Extract PostScript from DOS EPS files.
- Uses Ghostscript to create preview bitmaps.
- Create a TIFF, WMF, PICT or Interchange preview from part of a
bitmap created by Ghostscript.
- works under Win32, Win64, OS/2 and Unix.
- works on little-endian machines (Intel) or big endian (Sun Sparc,
Motorola) machines.

Maintainer: The OpenBSD ports mailing-list <ports@openbsd.org>

WWW: http://www.ghostgum.com.au/software/epstool.htm

Feedback and tests are welcome. OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/math/octave/Makefile,v
retrieving revision 1.131
diff -u -p -u -p -r1.131 Makefile
--- Makefile 24 Aug 2022 19:53:38 -0000 1.131
+++ Makefile 26 Oct 2022 02:16:44 -0000
@@ -4,6 +4,7 @@ VERSION = 7.2.0
DISTNAME = octave-${VERSION}
EXTRACT_SUFX = .tar.xz
CATEGORIES = math
+REVISION = 0

SHARED_LIBS += octave 15.0
SHARED_LIBS += octgui 9.0
@@ -33,6 +34,7 @@ BUILD_DEPENDS +=devel/desktop-file-utils

RUN_DEPENDS = devel/desktop-file-utils \
archivers/gtar \
+ print/epstool \
x11/gtk+3,-guic

LIB_DEPENDS = ${MODFORTRAN_LIB_DEPENDS} \

No comments:

Post a Comment