Skip to content

Commit

Permalink
print/ghostscript10: New port: Import new major version
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o authored and Daniel Engberg committed Mar 29, 2023
1 parent c2d137d commit d6b4669
Show file tree
Hide file tree
Showing 10 changed files with 677 additions and 0 deletions.
1 change: 1 addition & 0 deletions print/Makefile
Expand Up @@ -56,6 +56,7 @@
SUBDIR += fpdf
SUBDIR += freetype2
SUBDIR += ft2demos
SUBDIR += ghostscript10
SUBDIR += ghostscript7-base
SUBDIR += ghostscript7-commfont
SUBDIR += ghostscript7-jpnfont
Expand Down
101 changes: 101 additions & 0 deletions print/ghostscript10/Makefile
@@ -0,0 +1,101 @@
PORTNAME= ghostscript
DISTVERSION= 10.01.0
CATEGORIES= print
MASTER_SITES= https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${DISTVERSION:S/.//g}/

MAINTAINER= michael.osipov@siemens.com
COMMENT= PostScript and PDF interpreter
WWW= https://ghostscript.com/

LICENSE= AGPLv3
LICENSE_FILE= ${WRKSRC}/LICENSE

LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \
libfreetype.so:print/freetype2 \
libidn.so:dns/libidn \
libjbig2dec.so:graphics/jbig2dec \
liblcms2.so:graphics/lcms2 \
libopenjp2.so:graphics/openjpeg \
libpaper.so:print/libpaper \
libpng16.so:graphics/png \
libtiff.so:graphics/tiff
RUN_DEPENDS= poppler-data>=0.4.9:graphics/poppler-data \
urw-base35-fonts>=20200910:x11-fonts/urw-base35-fonts

USES= cpe gmake iconv jpeg localbase pkgconfig tar:xz
CPE_VENDOR= artifex

CONFLICTS_INSTALL= ghostscript[789]-base \
ghostscript[789]-x11 \
ghostscript9-agpl-base \
ghostscript9-agpl-x11
EXTRACT_AFTER_ARGS= --exclude cups/libs \
--exclude freetype \
--exclude ijs \
--exclude jbig2dec \
--exclude jpeg \
--exclude lcms2mt \
--exclude libpng \
--exclude openjpeg \
--exclude tiff \
--exclude zlib

DATADIR= ${PREFIX}/share/${PORTNAME}/${DISTVERSION}

GNU_CONFIGURE= yes

CONFIGURE_ARGS= --disable-compile-inits \
--disable-dbus \
--disable-gtk \
--disable-dynamic \
--enable-contrib \
--enable-fontconfig \
--enable-freetype \
--enable-openjpeg \
--with-fontpath=${LOCALBASE}/share/fonts \
--with-jbig2dec \
--with-libiconv=maybe \
--with-libidn \
--with-libpaper \
--with-system-libtiff \
--without-x

OPTIONS_DEFINE= CUPS IJS TESSERACT
OPTIONS_DEFAULT=CUPS

IJS_DESC= Support libijs based Ghostscript devices
TESSERACT_DESC= Enable bundled Tesseract OCR engine

CUPS_LIB_DEPENDS= libcups.so:print/cups
CUPS_CONFIGURE_ENABLE= cups

IJS_LIB_DEPENDS= libijs.so:print/libijs
IJS_CONFIGURE_WITH= ijs

TESSERACT_USES= compiler:c++17-lang
TESSERACT_CONFIGURE_WITH= tesseract
# No TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract
# See https://bugs.ghostscript.com/show_bug.cgi?id=706490

post-patch:
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${PATCH_WRKSRC}/man/gs.1

post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/gs
${RM} ${STAGEDIR}${PREFIX}/bin/lprsetup.sh
${RM} ${STAGEDIR}${PREFIX}/bin/unix-lpr.sh
${MKDIR} ${STAGEDIR}${PREFIX}/share/color/icc
${MV} ${STAGEDIR}${DATADIR}/iccprofiles \
${STAGEDIR}${PREFIX}/share/color/icc/ghostscript
${RLN} ${STAGEDIR}${PREFIX}/share/color/icc/ghostscript \
${STAGEDIR}${DATADIR}/iccprofiles
${RM} -r ${STAGEDIR}${PREFIX}/share/doc/${PORTNAME}
${MKDIR} ${STAGEDIR}${PREFIX}/share/cmap
${MV} ${STAGEDIR}${DATADIR}/Resource/CMap/Identity* \
${STAGEDIR}${PREFIX}/share/cmap
${RM} -r ${STAGEDIR}${DATADIR}/Resource/CMap
${RLN} ${STAGEDIR}${PREFIX}/share/cmap \
${STAGEDIR}${DATADIR}/Resource/CMap

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions print/ghostscript10/distinfo
@@ -0,0 +1,3 @@
TIMESTAMP = 1679593975
SHA256 (ghostscript-10.01.0.tar.xz) = dfc8c3180546ebd5550c71d4ac68b04eed0f14186d93d35abc9324364bd3eac4
SIZE (ghostscript-10.01.0.tar.xz) = 67564800
16 changes: 16 additions & 0 deletions print/ghostscript10/files/patch-configure
@@ -0,0 +1,16 @@
--- configure.orig 2022-04-04 13:48:49 UTC
+++ configure
@@ -11629,7 +11629,12 @@ if test "${enable_dynamic+set}" = set; then :
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
*bsd*)
- DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
+ INSTALL_SHARED="install-shared"
+ if test "x$X_DEVS" != x; then
+ DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
+ else
+ DYNAMIC_DEVS=""
+ fi
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
X11_DEVS=""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
126 changes: 126 additions & 0 deletions print/ghostscript10/files/patch-man_gs.1
@@ -0,0 +1,126 @@
--- man/gs.1.orig 2023-03-21 15:07:46 UTC
+++ man/gs.1
@@ -2,20 +2,14 @@
.SH NAME
gs \- Ghostscript (PostScript and PDF language interpreter and previewer)
.SH SYNOPSIS
-\fBgs\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(Unix, VMS)\fR
-.br
-\fBgswin32c\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(MS Windows)\fR
-.br
-\fBgswin32\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(MS Windows 3.1)\fR
-.br
-\fBgsos2\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(OS/2)\fR
+\fBgs\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ...
.de TQ
.br
.ns
.TP \\$1
..
.SH DESCRIPTION
-The \fBgs\fR (\fBgswin32c\fR, \fBgswin32\fR, \fBgsos2\fR)
+The \fBgs\fR
command invokes \fBGhostscript\fR, an interpreter of Adobe Systems'
\fBPostScript\fR(tm) and \fBPortable Document Format\fR (PDF) languages.
\fBgs\fR reads "files" in sequence and executes them as Ghostscript
@@ -32,8 +26,7 @@ below. Please see the usage documentation for complete
may appear anywhere in the command line and apply to all files thereafter.
Invoking Ghostscript with the \fB\-h\fR or \fB\-?\fR switch produces a
message which shows several useful switches, all the devices known to
-that executable, and the search path for fonts; on Unix it also shows the
-location of detailed documentation.
+that executable, and the search path for fonts.
.PP
Ghostscript may be built to use many different output devices. To see
which devices your executable includes, run "\fBgs -h\fR".
@@ -104,8 +97,8 @@ and the highest-density (best output quality) mode wit
.fi
.PP
If you select a printer as the output device, Ghostscript also allows you
-to choose where Ghostscript sends the output \-\- on Unix systems, usually
-to a temporary file. To send the output to a file "foo.xyz",
+to choose where Ghostscript sends the output.
+To send the output to a file "foo.xyz",
use the switch
.PP
.nf
@@ -124,17 +117,13 @@ Each resulting file receives one page of output, and t
in sequence. "%d" is a printf format specification; you can also use a
variant like "%02d".
.PP
-On Unix and MS Windows systems you can also send output to a pipe. For example, to
-pipe output to the "\fBlpr\fR" command (which, on many Unix systems,
-directs it to a printer), use the option
+You can also send output to a pipe. For example, to
+pipe output to the "\fBlpr\fR" command, use the option
.PP
.nf
\-sOutputFile=%pipe%lpr
.fi
.PP
-Note that the '%' characters need to be doubled on MS Windows to avoid
-mangling by the command interpreter.
-.PP
You can also send output to standard output:
.PP
.nf
@@ -316,31 +305,21 @@ and strongly NOT recommended in any other circumstance
.SH FILES
.PP
The locations of many Ghostscript run-time files are compiled into the
-executable when it is built. On Unix these are typically based in
-\fB/usr/local\fR, but this may be different on your system. Under DOS they
-are typically based in \fBC:\\GS\fR, but may be elsewhere, especially if
-you install Ghostscript with \fBGSview\fR. Run "\fBgs -h\fR" to find the
-location of Ghostscript documentation on your system, from which you can
-get more details.
+executable when it is built. Typically based in
+\fB%%LOCALBASE%%\fR.
.TP
-.B /usr/local/share/ghostscript/#.##/*
+.B %%LOCALBASE%%/share/ghostscript/#.##/*
Startup files, utilities, and basic font definitions
.TP
-.B /usr/local/share/ghostscript/fonts/*
+.B %%LOCALBASE%%/share/ghostscript/fonts/*
More font definitions
-.TP
-.B /usr/local/share/ghostscript/#.##/examples/*
-Ghostscript demonstration files
-.TP
-.B /usr/local/share/ghostscript/#.##/doc/*
-Diverse document files
.SH "INITIALIZATION FILES"
When looking for the initialization files "gs_*.ps", the files related to
fonts, or the file for the "run" operator, Ghostscript first tries to open
the file with the name as given, using the current working directory if no
directory is specified. If this fails, and the file name doesn't specify
-an explicit directory or drive (for instance, doesn't contain "/" on Unix
-systems or "\\" on MS Windows systems), Ghostscript tries directories in this
+an explicit directory,
+Ghostscript tries directories in this
order:
.TP 4
1.
@@ -353,9 +332,9 @@ if any;
.TP
3.
the directories specified by the \fBGS_LIB_DEFAULT\fR macro in the
-Ghostscript makefile when the executable was built. When \fBgs\fR is built
-on Unix, \fBGS_LIB_DEFAULT\fR is usually
-"/usr/local/share/ghostscript/#.##:/usr/local/share/ghostscript/fonts"
+Ghostscript makefile when the executable was built.
+Usually
+"%%LOCALBASE%%/share/ghostscript/#.##:%%LOCALBASE%%/share/ghostscript/fonts"
where "#.##" represents the Ghostscript version number.
.PP
Each of these (\fBGS_LIB_DEFAULT\fR, \fBGS_LIB\fR, and \fB\-I\fR parameter)
@@ -417,8 +396,6 @@ Then merge these resources into the X server's resourc
.nf
% xrdb \-merge ~/.Xresources
.fi
-.SH SEE ALSO
-The various Ghostscript document files (above), especially \fBUse.htm\fR.
.SH BUGS
See http://bugs.ghostscript.com/ and the Usenet news group
comp.lang.postscript.
44 changes: 44 additions & 0 deletions print/ghostscript10/files/patch-psi_imainarg.c
@@ -0,0 +1,44 @@
--- psi/imainarg.c.orig 2023-03-21 14:58:42 UTC
+++ psi/imainarg.c
@@ -109,7 +109,6 @@ static void print_usage(const gs_main_instance *);
static void print_devices(const gs_main_instance *);
static void print_emulators(const gs_main_instance *);
static void print_paths(gs_main_instance *);
-static void print_help_trailer(const gs_main_instance *);

/* ------ Main program ------ */

@@ -1262,7 +1261,6 @@ static const char help_debug[] = "\
--debug list debugging options\n";
#endif
static const char help_trailer[] = "\
-For more information, see %s.\n\
Please report bugs to bugs.ghostscript.com.\n";
static const char help_devices[] = "Available devices:";
static const char help_default_device[] = "Default output device:";
@@ -1305,7 +1303,7 @@ print_help(gs_main_instance * minst)
if (have_rom_device) {
outprintf(minst->heap, "Initialization files are compiled into the executable.\n");
}
- print_help_trailer(minst);
+ outprintf(minst->heap, "%s", help_trailer);
}

/* Print the revision, revision date, and copyright. */
@@ -1450,16 +1448,3 @@ print_paths(gs_main_instance * minst)
outprintf(minst->heap, "%s", help_fontconfig);
}

-/* Print the help trailer. */
-static void
-print_help_trailer(const gs_main_instance *minst)
-{
- char buffer[gp_file_name_sizeof];
- const char *use_htm = "Use.htm", *p = buffer;
- uint blen = sizeof(buffer);
-
- if (gp_file_name_combine(gs_doc_directory, strlen(gs_doc_directory),
- use_htm, strlen(use_htm), false, buffer, &blen) != gp_combine_success)
- p = use_htm;
- outprintf(minst->heap, help_trailer, p);
-}
34 changes: 34 additions & 0 deletions print/ghostscript10/files/patch-tesseract_src_arch_simddetect.cpp
@@ -0,0 +1,34 @@
--- tesseract/src/arch/simddetect.cpp.orig 2021-09-27 07:44:02 UTC
+++ tesseract/src/arch/simddetect.cpp
@@ -40,10 +40,13 @@
#if defined(HAVE_NEON) && !defined(__aarch64__)
#ifdef ANDROID
#include <cpu-features.h>
-#else
+#elif defined(__linux__)
/* Assume linux */
#include <sys/auxv.h>
#include <asm/hwcap.h>
+#elif defined(__FreeBSD__)
+#include <sys/auxv.h>
+#include <sys/elf.h>
#endif
#endif

@@ -188,9 +191,15 @@ SIMDDetect::SIMDDetect() {
neon_available_ = (android_getCpuFeatures() &
ANDROID_CPU_ARM_FEATURE_NEON);
}
-#else
+#elif defined(__linux__)
/* Assume linux */
neon_available_ = getauxval(AT_HWCAP) & HWCAP_NEON;
+#elif defined(__FreeBSD__)
+ unsigned long hwcap = 0;
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
+ neon_available_ = hwcap & HWCAP_NEON;
+#else
+ neon_available_ = 0;
#endif
#endif

3 changes: 3 additions & 0 deletions print/ghostscript10/pkg-descr
@@ -0,0 +1,3 @@
Ghostscript is an interpreter for PostScript and Portable Document
Format (PDF) files. It allows you to manipulate such files and to
convert them to various printer, image and other formats.
8 changes: 8 additions & 0 deletions print/ghostscript10/pkg-message
@@ -0,0 +1,8 @@
[
{ type: install
message: <<EOM
This package installs a script named dvipdf that depends on dvips. If you
want to use this script you need to install print/tex-dvipsk.
EOM
}
]

0 comments on commit d6b4669

Please sign in to comment.