Update to libspectre-0.2.9.
Revert some upstream commits because our ghostscript version is super old.
This commit is contained in:
parent
3e969592a1
commit
53e962840c
@ -1,14 +1,13 @@
|
||||
# $OpenBSD: Makefile,v 1.30 2019/07/12 20:48:55 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.31 2021/09/11 09:19:19 ajacoutot Exp $
|
||||
|
||||
# libgs from ghostscript is only provided on shared libs archs
|
||||
|
||||
COMMENT= library for rendering Postscript documents
|
||||
|
||||
DISTNAME= libspectre-0.2.8
|
||||
DISTNAME= libspectre-0.2.9
|
||||
CATEGORIES= print
|
||||
REVISION= 3
|
||||
|
||||
SHARED_LIBS += spectre 0.1 # 2.8
|
||||
SHARED_LIBS += spectre 1.0 # 2.8
|
||||
|
||||
HOMEPAGE= http://libspectre.freedesktop.org/
|
||||
|
||||
@ -17,12 +16,12 @@ MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org>
|
||||
# GPLv2
|
||||
PERMIT_PACKAGE= Yes
|
||||
|
||||
WANTLIB += ICE SM X11 Xext Xt avahi-client avahi-common cups cupsimage
|
||||
WANTLIB += dbus-1 ffi freetype gmp gnutls gs hogweed iconv idn2
|
||||
WANTLIB += ijs intl jbig2dec jpeg lcms2 m nettle p11-kit png pthread
|
||||
WANTLIB += tasn1 tiff unistring xcb z
|
||||
WANTLIB += ICE SM X11 Xext Xt avahi-client avahi-common cups dbus-1
|
||||
WANTLIB += execinfo freetype gmp gnutls gs hogweed iconv idn2
|
||||
WANTLIB += ijs intl jbig2dec jpeg lcms2 lzma m nettle p11-kit
|
||||
WANTLIB += png pthread tasn1 tiff unistring xcb z zstd
|
||||
|
||||
MASTER_SITES= ${HOMEPAGE}/releases/
|
||||
MASTER_SITES= http://libspectre.freedesktop.org/releases/
|
||||
|
||||
# we want the 'display' device from ghostscript, which is not available
|
||||
# in the no_x11 FLAVOR
|
||||
@ -42,4 +41,6 @@ CONFIGURE_ARGS+=--enable-test
|
||||
CONFIGURE_ARGS+=--disable-test
|
||||
.endif
|
||||
|
||||
DEBUG_PACKAGES= ${BUILD_PACKAGES}
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (libspectre-0.2.8.tar.gz) = ZSVq84mCO7xO5NJb/RzBkCP/wprp+Wd/LSAPpumLx6g=
|
||||
SIZE (libspectre-0.2.8.tar.gz) = 421791
|
||||
SHA256 (libspectre-0.2.9.tar.gz) = Sa6cUrWvgbQFRVwZ/iQInXAXYdosRdIhZKmVds7t++0=
|
||||
SIZE (libspectre-0.2.9.tar.gz) = 433384
|
||||
|
@ -1,8 +1,23 @@
|
||||
$OpenBSD: patch-configure_ac,v 1.2 2017/09/27 16:09:45 dcoppa Exp $
|
||||
$OpenBSD: patch-configure_ac,v 1.3 2021/09/11 09:19:19 ajacoutot Exp $
|
||||
|
||||
First chunk, revert (our ghoscript version is too old):
|
||||
From 75e154f89565af475ef4c9c9a01a805eadb9405e Mon Sep 17 00:00:00 2001
|
||||
From: Christian Persch <chpe@src.gnome.org>
|
||||
Date: Sat, 20 Oct 2018 00:17:47 +0200
|
||||
Subject: spectre-gs: Enforce minimum ghostscript version
|
||||
|
||||
Index: configure.ac
|
||||
--- configure.ac.orig
|
||||
+++ configure.ac
|
||||
@@ -63,7 +63,7 @@ AC_CHECK_FUNC(vasprintf, [ AC_DEFINE(HAVE_VASPRINTF, 1
|
||||
|
||||
AC_CHECK_FUNC(_vscprintf, [ AC_DEFINE(HAVE__VSCPRINTF, 1, [Define if the '_vscprintf' function is available.]) ])
|
||||
|
||||
-LIBGS_REQUIRED="9.24"
|
||||
+LIBGS_REQUIRED="8.62"
|
||||
|
||||
AC_CHECK_LIB(gs, gsapi_new_instance, have_libgs=yes, have_libgs=no)
|
||||
if test "x$have_libgs" = "xyes"; then
|
||||
@@ -267,8 +267,7 @@ AC_CACHE_CHECK([whether va_lists can be copied by valu
|
||||
[[
|
||||
#include <stdarg.h>
|
||||
|
59
print/libspectre/patches/patch-libspectre_spectre-device_c
Normal file
59
print/libspectre/patches/patch-libspectre_spectre-device_c
Normal file
@ -0,0 +1,59 @@
|
||||
$OpenBSD: patch-libspectre_spectre-device_c,v 1.1 2021/09/11 09:19:19 ajacoutot Exp $
|
||||
|
||||
From 6928e8933e8b6c98c0590985866cc12e7321f491 Mon Sep 17 00:00:00 2001
|
||||
From: Albert Astals Cid <aacid@kde.org>
|
||||
Date: Sat, 26 Dec 2020 12:21:22 +0100
|
||||
Subject: Free the previous user_image in case spectre_presize is called multiple times
|
||||
|
||||
revert (our ghoscript version is too old):
|
||||
From 90000c9d5c1d0928e02da0a799bb81676589e073 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Persch <chpe@src.gnome.org>
|
||||
Date: Sat, 20 Oct 2018 00:17:47 +0200
|
||||
Subject: spectre-gs: Remove support for old ghostscript
|
||||
|
||||
Index: libspectre/spectre-device.c
|
||||
--- libspectre/spectre-device.c.orig
|
||||
+++ libspectre/spectre-device.c
|
||||
@@ -72,6 +72,7 @@ spectre_presize (void *handle, void *device, int width
|
||||
sd->height = height;
|
||||
sd->row_length = raster;
|
||||
sd->gs_image = NULL;
|
||||
+ free(sd->user_image);
|
||||
sd->user_image = malloc (sd->row_length * sd->height);
|
||||
|
||||
return 0;
|
||||
@@ -284,11 +285,14 @@ spectre_device_render (SpectreDevice *device,
|
||||
char *dsp_format, *dsp_handle;
|
||||
char *width_points = NULL;
|
||||
char *height_points = NULL;
|
||||
+ long gs_version;
|
||||
|
||||
gs = spectre_gs_new ();
|
||||
if (!gs)
|
||||
return SPECTRE_STATUS_NO_MEMORY;
|
||||
|
||||
+ gs_version = spectre_gs_get_version();
|
||||
+
|
||||
if (!spectre_gs_create_instance (gs, device)) {
|
||||
spectre_gs_cleanup (gs, CLEANUP_DELETE_INSTANCE);
|
||||
spectre_gs_free (gs);
|
||||
@@ -377,7 +381,7 @@ spectre_device_render (SpectreDevice *device,
|
||||
}
|
||||
|
||||
set = _spectre_strdup_printf ("<< /Orientation %d >> setpagedevice .locksafe",
|
||||
- SPECTRE_ORIENTATION_PORTRAIT);
|
||||
+ gs_version >= 908 ? SPECTRE_ORIENTATION_PORTRAIT : rc->orientation);
|
||||
if (!spectre_gs_send_string (gs, set)) {
|
||||
free (set);
|
||||
free (device->user_image);
|
||||
@@ -394,8 +398,8 @@ spectre_device_render (SpectreDevice *device,
|
||||
|
||||
*page_data = device->user_image;
|
||||
*row_length = device->row_length;
|
||||
-
|
||||
- rotate_image_to_orientation (page_data, row_length, width, height, rc->orientation);
|
||||
+ if (gs_version >= 908)
|
||||
+ rotate_image_to_orientation (page_data, row_length, width, height, rc->orientation);
|
||||
|
||||
spectre_gs_free (gs);
|
||||
|
89
print/libspectre/patches/patch-libspectre_spectre-gs_c
Normal file
89
print/libspectre/patches/patch-libspectre_spectre-gs_c
Normal file
@ -0,0 +1,89 @@
|
||||
$OpenBSD: patch-libspectre_spectre-gs_c,v 1.1 2021/09/11 09:19:19 ajacoutot Exp $
|
||||
|
||||
revert (our ghoscript version is too old):
|
||||
From 90000c9d5c1d0928e02da0a799bb81676589e073 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Persch <chpe@src.gnome.org>
|
||||
Date: Sat, 20 Oct 2018 00:17:47 +0200
|
||||
Subject: spectre-gs: Remove support for old ghostscript
|
||||
|
||||
revert (our ghoscript version is too old):
|
||||
From 75e154f89565af475ef4c9c9a01a805eadb9405e Mon Sep 17 00:00:00 2001
|
||||
From: Christian Persch <chpe@src.gnome.org>
|
||||
Date: Sat, 20 Oct 2018 00:17:47 +0200
|
||||
Subject: spectre-gs: Enforce minimum ghostscript version
|
||||
|
||||
Index: libspectre/spectre-gs.c
|
||||
--- libspectre/spectre-gs.c.orig
|
||||
+++ libspectre/spectre-gs.c
|
||||
@@ -29,10 +29,16 @@
|
||||
#include <ghostscript/iapi.h>
|
||||
#include <ghostscript/ierrors.h>
|
||||
|
||||
-/* Ghostscript before version 9.24 has a critial vulnerability
|
||||
- * where -dSAFER could be escaped from.
|
||||
- */
|
||||
-#define GS_MIN_VERSION (924)
|
||||
+/* e_ macros have been removed from Ghostscript in 9.18. */
|
||||
+#ifndef e_Fatal
|
||||
+#define e_Fatal gs_error_Fatal
|
||||
+#endif
|
||||
+#ifndef e_NeedInput
|
||||
+#define e_NeedInput gs_error_NeedInput
|
||||
+#endif
|
||||
+#ifndef e_ExecStackUnderflow
|
||||
+#define e_ExecStackUnderflow gs_error_ExecStackUnderflow
|
||||
+#endif
|
||||
|
||||
#define BUFFER_SIZE 32768
|
||||
|
||||
@@ -48,12 +54,12 @@ critic_error_code (int code)
|
||||
|
||||
if (code <= -100) {
|
||||
switch (code) {
|
||||
- case gs_error_Fatal:
|
||||
+ case e_Fatal:
|
||||
fprintf (stderr, "(libspectre) ghostscript reports: fatal internal error %d", code);
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
- case gs_error_ExecStackUnderflow:
|
||||
+ case e_ExecStackUnderflow:
|
||||
fprintf (stderr, "(libspectre) ghostscript reports: stack overflow %d", code);
|
||||
return TRUE;
|
||||
break;
|
||||
@@ -114,9 +120,9 @@ spectre_gs_process (SpectreGS *gs,
|
||||
set = _spectre_strdup_printf ("%d %d translate\n", -x, -y);
|
||||
error = gsapi_run_string_continue (ghostscript_instance, set, strlen (set),
|
||||
0, &exit_code);
|
||||
- error = error == gs_error_NeedInput ? 0 : error;
|
||||
+ error = error == e_NeedInput ? 0 : error;
|
||||
free (set);
|
||||
- if (error != gs_error_NeedInput && critic_error_code (error)) {
|
||||
+ if (error != e_NeedInput && critic_error_code (error)) {
|
||||
fclose (fd);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -131,7 +137,7 @@ spectre_gs_process (SpectreGS *gs,
|
||||
read = fread (buf, sizeof (char), to_read, fd);
|
||||
error = gsapi_run_string_continue (ghostscript_instance,
|
||||
buf, read, 0, &exit_code);
|
||||
- error = error == gs_error_NeedInput ? 0 : error;
|
||||
+ error = error == e_NeedInput ? 0 : error;
|
||||
left -= read;
|
||||
}
|
||||
|
||||
@@ -160,13 +166,8 @@ int
|
||||
spectre_gs_create_instance (SpectreGS *gs,
|
||||
void *caller_handle)
|
||||
{
|
||||
- int version;
|
||||
int error;
|
||||
-
|
||||
- version = spectre_gs_get_version ();
|
||||
- if (version < GS_MIN_VERSION)
|
||||
- return FALSE;
|
||||
-
|
||||
+
|
||||
error = gsapi_new_instance (&gs->ghostscript_instance, caller_handle);
|
||||
if (!critic_error_code (error)) {
|
||||
gsapi_set_stdio (gs->ghostscript_instance,
|
@ -1,4 +1,4 @@
|
||||
@comment $OpenBSD: PLIST,v 1.2 2009/01/19 14:03:53 ajacoutot Exp $
|
||||
@comment $OpenBSD: PLIST,v 1.3 2021/09/11 09:19:19 ajacoutot Exp $
|
||||
include/libspectre/
|
||||
include/libspectre/spectre-document.h
|
||||
include/libspectre/spectre-exporter.h
|
||||
@ -8,7 +8,7 @@ include/libspectre/spectre-render-context.h
|
||||
include/libspectre/spectre-status.h
|
||||
include/libspectre/spectre-version.h
|
||||
include/libspectre/spectre.h
|
||||
lib/libspectre.a
|
||||
@static-lib lib/libspectre.a
|
||||
lib/libspectre.la
|
||||
@lib lib/libspectre.so.${LIBspectre_VERSION}
|
||||
lib/pkgconfig/libspectre.pc
|
||||
|
Loading…
Reference in New Issue
Block a user