diff options
Diffstat (limited to 'patches')
9 files changed, 687 insertions, 0 deletions
diff --git a/patches/packages/ghostscript-9.55.0-x86_64-2_slack15.0.txt b/patches/packages/ghostscript-9.55.0-x86_64-2_slack15.0.txt new file mode 100644 index 000000000..592df3421 --- /dev/null +++ b/patches/packages/ghostscript-9.55.0-x86_64-2_slack15.0.txt @@ -0,0 +1,11 @@ +ghostscript: ghostscript (Postscript and PDF interpreter) +ghostscript: +ghostscript: Ghostscript is an interpreter of Adobe Systems' PostScript(tm) +ghostscript: and Portable Document Format (PDF) languages. Ghostscript is an +ghostscript: essential part of the printing subsystem, taking PostScript output +ghostscript: from applications and converting it into an appropriate printer or +ghostscript: display format. Ghostscript supports many printers directly, and +ghostscript: more are supported through add-on packages. +ghostscript: +ghostscript: +ghostscript: diff --git a/patches/source/ghostscript/0974e4f2ac0005d3731e0b5c13ebc7e965540f4d.patch b/patches/source/ghostscript/0974e4f2ac0005d3731e0b5c13ebc7e965540f4d.patch new file mode 100644 index 000000000..7e56543ba --- /dev/null +++ b/patches/source/ghostscript/0974e4f2ac0005d3731e0b5c13ebc7e965540f4d.patch @@ -0,0 +1,57 @@ +From 0974e4f2ac0005d3731e0b5c13ebc7e965540f4d Mon Sep 17 00:00:00 2001 +From: Chris Liddell <chris.liddell@artifex.com> +Date: Wed, 14 Jun 2023 09:08:12 +0100 +Subject: [PATCH] Bug 706778: 706761 revisit + +Two problems with the original commit. The first a silly typo inverting the +logic of a test. + +The second was forgetting that we actually actually validate two candidate +strings for pipe devices. One with the expected "%pipe%" prefix, the other +using the pipe character prefix: "|". + +This addresses both those. +--- + base/gpmisc.c | 2 +- + base/gslibctx.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/base/gpmisc.c b/base/gpmisc.c +index 58511270e..2b0064bea 100644 +--- a/base/gpmisc.c ++++ b/base/gpmisc.c +@@ -1081,7 +1081,7 @@ gp_validate_path_len(const gs_memory_t *mem, + /* "%pipe%" do not follow the normal rules for path definitions, so we + don't "reduce" them to avoid unexpected results + */ +- if (len > 5 && memcmp(path, "%pipe", 5) != 0) { ++ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) { + bufferfull = buffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, len + 1, "gp_validate_path"); + if (buffer == NULL) + return gs_error_VMerror; +diff --git a/base/gslibctx.c b/base/gslibctx.c +index d2a1aa91d..42af99090 100644 +--- a/base/gslibctx.c ++++ b/base/gslibctx.c +@@ -743,7 +743,7 @@ gs_add_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type, co + /* "%pipe%" do not follow the normal rules for path definitions, so we + don't "reduce" them to avoid unexpected results + */ +- if (len > 5 && memcmp(path, "%pipe", 5) != 0) { ++ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) { + buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_add_control_path_len"); + if (buffer == NULL) + return gs_error_VMerror; +@@ -850,7 +850,7 @@ gs_remove_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type, + /* "%pipe%" do not follow the normal rules for path definitions, so we + don't "reduce" them to avoid unexpected results + */ +- if (len > 5 && memcmp(path, "%pipe", 5) != 0) { ++ if (path[0] == '|' || (len > 5 && memcmp(path, "%pipe", 5) == 0)) { + buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_remove_control_path_len"); + if (buffer == NULL) + return gs_error_VMerror; +-- +2.34.1 + + diff --git a/patches/source/ghostscript/505eab7782b429017eb434b2b95120855f2b0e3c.patch b/patches/source/ghostscript/505eab7782b429017eb434b2b95120855f2b0e3c.patch new file mode 100644 index 000000000..4ad76a1ec --- /dev/null +++ b/patches/source/ghostscript/505eab7782b429017eb434b2b95120855f2b0e3c.patch @@ -0,0 +1,143 @@ +From 505eab7782b429017eb434b2b95120855f2b0e3c Mon Sep 17 00:00:00 2001 +From: Chris Liddell <chris.liddell@artifex.com> +Date: Wed, 7 Jun 2023 10:23:06 +0100 +Subject: [PATCH] Bug 706761: Don't "reduce" %pipe% file names for permission + validation + +For regular file names, we try to simplfy relative paths before we use them. + +Because the %pipe% device can, effectively, accept command line calls, we +shouldn't be simplifying that string, because the command line syntax can end +up confusing the path simplifying code. That can result in permitting a pipe +command which does not match what was originally permitted. + +Special case "%pipe" in the validation code so we always deal with the entire +string. +--- + base/gpmisc.c | 31 +++++++++++++++++++-------- + base/gslibctx.c | 56 ++++++++++++++++++++++++++++++++++++------------- + 2 files changed, 64 insertions(+), 23 deletions(-) + +diff --git a/base/gpmisc.c b/base/gpmisc.c +index 5f39ebba7..2fb87f769 100644 +--- a/base/gpmisc.c ++++ b/base/gpmisc.c +@@ -1076,16 +1076,29 @@ gp_validate_path_len(const gs_memory_t *mem, + && !memcmp(path + cdirstrl, dirsepstr, dirsepstrl)) { + prefix_len = 0; + } +- rlen = len+1; +- bufferfull = (char *)gs_alloc_bytes(mem->thread_safe_memory, rlen + prefix_len, "gp_validate_path"); +- if (bufferfull == NULL) +- return gs_error_VMerror; +- +- buffer = bufferfull + prefix_len; +- if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) +- return gs_error_invalidfileaccess; +- buffer[rlen] = 0; + ++ /* "%pipe%" do not follow the normal rules for path definitions, so we ++ don't "reduce" them to avoid unexpected results ++ */ ++ if (len > 5 && memcmp(path, "%pipe", 5) != 0) { ++ bufferfull = buffer = (char *)gs_alloc_bytes(mem->thread_safe_memory, len + 1, "gp_validate_path"); ++ if (buffer == NULL) ++ return gs_error_VMerror; ++ memcpy(buffer, path, len); ++ buffer[len] = 0; ++ rlen = len; ++ } ++ else { ++ rlen = len+1; ++ bufferfull = (char *)gs_alloc_bytes(mem->thread_safe_memory, rlen + prefix_len, "gp_validate_path"); ++ if (bufferfull == NULL) ++ return gs_error_VMerror; ++ ++ buffer = bufferfull + prefix_len; ++ if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) ++ return gs_error_invalidfileaccess; ++ buffer[rlen] = 0; ++ } + while (1) { + switch (mode[0]) + { +diff --git a/base/gslibctx.c b/base/gslibctx.c +index eb566ed06..d2a1aa91d 100644 +--- a/base/gslibctx.c ++++ b/base/gslibctx.c +@@ -740,14 +740,28 @@ gs_add_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type, co + return gs_error_rangecheck; + } + +- rlen = len+1; +- buffer = (char *)gs_alloc_bytes(core->memory, rlen, "gp_validate_path"); +- if (buffer == NULL) +- return gs_error_VMerror; ++ /* "%pipe%" do not follow the normal rules for path definitions, so we ++ don't "reduce" them to avoid unexpected results ++ */ ++ if (len > 5 && memcmp(path, "%pipe", 5) != 0) { ++ buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_add_control_path_len"); ++ if (buffer == NULL) ++ return gs_error_VMerror; ++ memcpy(buffer, path, len); ++ buffer[len] = 0; ++ rlen = len; ++ } ++ else { ++ rlen = len + 1; + +- if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) +- return gs_error_invalidfileaccess; +- buffer[rlen] = 0; ++ buffer = (char *)gs_alloc_bytes(core->memory, rlen, "gs_add_control_path_len"); ++ if (buffer == NULL) ++ return gs_error_VMerror; ++ ++ if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) ++ return gs_error_invalidfileaccess; ++ buffer[rlen] = 0; ++ } + + n = control->num; + for (i = 0; i < n; i++) +@@ -833,14 +847,28 @@ gs_remove_control_path_len_flags(const gs_memory_t *mem, gs_path_control_t type, + return gs_error_rangecheck; + } + +- rlen = len+1; +- buffer = (char *)gs_alloc_bytes(core->memory, rlen, "gp_validate_path"); +- if (buffer == NULL) +- return gs_error_VMerror; ++ /* "%pipe%" do not follow the normal rules for path definitions, so we ++ don't "reduce" them to avoid unexpected results ++ */ ++ if (len > 5 && memcmp(path, "%pipe", 5) != 0) { ++ buffer = (char *)gs_alloc_bytes(core->memory, len + 1, "gs_remove_control_path_len"); ++ if (buffer == NULL) ++ return gs_error_VMerror; ++ memcpy(buffer, path, len); ++ buffer[len] = 0; ++ rlen = len; ++ } ++ else { ++ rlen = len+1; + +- if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) +- return gs_error_invalidfileaccess; +- buffer[rlen] = 0; ++ buffer = (char *)gs_alloc_bytes(core->memory, rlen, "gs_remove_control_path_len"); ++ if (buffer == NULL) ++ return gs_error_VMerror; ++ ++ if (gp_file_name_reduce(path, (uint)len, buffer, &rlen) != gp_combine_success) ++ return gs_error_invalidfileaccess; ++ buffer[rlen] = 0; ++ } + + n = control->num; + for (i = 0; i < n; i++) { +-- +2.34.1 + + diff --git a/patches/source/ghostscript/cidfmap b/patches/source/ghostscript/cidfmap new file mode 100644 index 000000000..ef18631f5 --- /dev/null +++ b/patches/source/ghostscript/cidfmap @@ -0,0 +1,137 @@ +%! +% This is a sample map file for CIDFont category. + +% +% The map is a set of records, which must use one of the two formats : +% +% 1. A substutution of a CIDFont font with another CIDFont : +% +% /substituted /original ; +% +% Where 'substituted' is a name being used in a document, +% 'original' is a name of an available resource. +% +% 2. A substutution of a CIDFont font with a True Type font : +% +% /substituted << /FileType /TrueType /Path (path) /SubfontID 1 /CSI [(ordering) supplement] >> ; +% +% Where 'substituted' is a name being used in a document, +% 'path' is a path to a True Type font file, +% 'ordering' is a value of Ordering required for CIDSystemInfo dictionary, +% 'supplement' is a value of Supplement required for CIDSystemInfo dictionary. +% 'SubfontID' is the index of the desired font in a TTC - ignored if the target is not a TTC. +% +% The Ordering, and Registry (if present) entries should be PostScript string types +% ie enclosed in parentheses, not PostScript name type (initial character '/'). See +% gs/doc/Use.htm#CIDFontSubstitution +% +% Alternatively: +% (substituted name) << /FileType /TrueType /Path (path) /SubfontID 1 /CSI [(ordering) supplement] >> ; +% +% This is where the CIDFont name in the document contains a space character. Using a string instead of a name +% allows this work - Ghostscript will internally convert the key string with a space to a name. +% +% +% Examples : +% +% /ShinGo-Bold /HeiseiKakuGo-W5 ; +% /Ryumin-Medium << /FileType /TrueType /Path (H:/AuxFiles/Fonts/BATANG.TTC) /SubfontID 3 /CSI [(Japan1) 2] >> ; +% /Ryumin-Medium << /FileType /TrueType /Path (windir) getenv not {(c:/windows)}if (/Fonts/BATANG.TTC)concatstrings /SubfontID 3 /CSI [(Japan1) 2] >> ; +% +% NOTE: getenv returns a boolean to indicate success of or failure, as well as the value on success. In the example, it uses this +% to include a default value should getenv fail. +% +% (Century Gothic) << /FileType /TrueType /Path (/usr/share/fonts/truetype/fonts-japanese-gothic.ttf) /CSI [(Identity) 1] >> ; +% +% Note the use of a string to cope with the name containing a space. +% + + +%% cidfmap.zh_CN (simplified Chinese ; zh_CN) +%% This font will produce better results than the wqy-zenhei.ttc that we use +%% to get out-of-the-box output. +%% If you install it, uncomment the line below and comment the one below that. +%/BousungEG-Light-GB << /FileType /TrueType /Path (uming.ttf) /CSI [(GB1) 4] >> ; +/BousungEG-Light-GB << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(GB1) 4] >> ; +%% This font will produce better results than the wqy-zenhei.ttc that we use +%% to get out-of-the-box output. +%% If you install it, uncomment the line below and comment the one below that. +%/GBZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(GB1) 4] >> ; +/GBZenKai-Medium << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(GB1) 4] >> ; +/MSungGBK-Light << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(GB1) 4] >> ; +/MSung-Light /MSungGBK-Light ; +/MSung-Medium /GBZenKai-Medium ; +/MHei-Medium /BousungEG-Light-GB ; +/MKai-Medium /GBZenKai-Medium ; +/STSong-Light /BousungEG-Light-GB ; +/STFangsong-Light /BousungEG-Light-GB ; +/STHeiti-Regular /MSungGBK-Light ; +/STKaiti-Regular /GBZenKai-Medium ; +/Adobe-GB1 /BousungEG-Light-GB ; + +%% cidfmap.zh_TW (traditional Chinese ; zh_TW) +%% To use this example, install the missing uming.ttf and ukai.ttf fonts, and +%% uncomment everything in the block below. Also, fix the simplified Chinese +%% block as described above for "better output" so that there is no +%% interference (or comment the whole block out). +%/BousungEG-Light-GB << /FileType /TrueType /Path (uming.ttf) /CSI [(CNS1) 4] >> ; +%/ZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(CNS1) 4] >> ; +%/ShanHeiSun-Light << /FileType /TrueType /Path (wqy-zenhei.ttc) /CSI [(CNS1) 4] >> ; +%/STSong-Light /BousungEG-Light-GB ; +%/STKaiti-Regular /ZenKai-Medium-GB ; +%/STFangsong-Light /BousungEG-Light ; +%/STHeiti-Regular /MHei-Medium ; +%/MSung-Light /BousungEG-Light-GB ; +%/MSung-Medium /ZenKai-Medium ; +%/MHei-Medium /ShanHeiSun-Light ; +%/MKai-Medium /ZenKai-Medium ; +%/Adobe-CNS1 /BousungEG-Light-GB ; + +%% cidfmap.ja +/Sazanami-Gothic << /FileType /TrueType /Path (sazanami-gothic.ttf) /CSI [(Japan1) 6] >> ; +/Sazanami-Gothic-Regular /Sazanami-Gothic ; +/Sazanami-Gothic-JaH << /FileType /TrueType /Path (sazanami-gothic.ttf) /CSI [(Japan2) 0] >> ; +/Sazanami-Gothic-Regular-JaH /Sazanami-Gothic-JaH ; +/Sazanami-Mincho << /FileType /TrueType /Path (sazanami-mincho.ttf) /CSI [(Japan1) 6] >> ; +/Sazanami-Mincho-Regular /Sazanami-Mincho ; +/Sazanami-Mincho-JaH << /FileType /TrueType /Path (sazanami-mincho.ttf) /CSI [(Japan2) 0] >> ; +/Sazanami-Mincho-Regular-JaH /Sazanami-Mincho-JaH ; +/Ryumin-Light /Sazanami-Mincho ; +/Ryumin-Light-H /Sazanami-Mincho ; +/GothicBBB-Medium /Sazanami-Gothic ; +/GothicBBB-Medium-V /Sazanami-Gothic ; +/HeiseiMin-W3 /Ryumin-Light ; +/HeiseiKakuGo-W5 /GothicBBB-Medium ; +/HeiseiMin-W3-Acro /Ryumin-Light ; +/HeiseiKaKuGo-W5-Acro /GothicBBB-Medium ; +/Kochi-Gothic /Sazanami-Gothic ; +/Kochi-Mincho /Sazanami-Mincho ; +/WadaMin-Regular /Sazanami-Mincho ; +/WadaMin-Bold /Sazanami-Mincho ; +/WadaGo-Regular /Sazanami-Gothic ; +/WadaGo-Bold /Sazanami-Gothic ; +/Adobe-Japan1 /Sazanami-Gothic ; +/Adobe-Japan2 /Sazanami-Gothic-JaH ; + +%% cidfmap.ko +%% To enable Korean printing support, install the fonts shown in the example +%% here and uncomment the block below: +%/Baekmuk-Batang << /FileType /TrueType /Path (batang.ttf) /CSI [(Korea1) 2] >> ; +%/Baekmuk-Batang-Regular /Baekmuk-Batang ; +%/Baekmuk-Dotum << /FileType /TrueType /Path (dotum.ttf) /CSI [(Korea1) 2] >> ; +%/Baekmuk-Dotum-Regular /Baekmuk-Dotum ; +%/Baekmuk-Gulim << /FileType /TrueType /Path (gulim.ttf) /CSI [(Korea1) 2] >> ; +%/Baekmuk-Gulim-Regular /Baekmuk-Gulim ; +%/Baekmuk-Headline << /FileType /TrueType /Path (hline.ttf) /CSI [(Korea1) 2] >> ; +%/Baekmuk-Headline-Regular /Baekmuk-Headline ; +%/Adobe-Korea1 /Baekmuk-Batang ; + +%/BousungEG-Light-GB << /FileType /TrueType /Path (uming.ttf) /CSI [(GB1) 4] >> ; +%/GBZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(GB1) 4] >> ; +%/MSungGBK-Light /BousungEG-Light-GB ; +%/Adobe-GB1 /BousungEG-Light-GB ; + +%/ZenKai-Medium << /FileType /TrueType /Path (ukai.ttf) /CSI [(CNS1) 4] >> ; +%/ShanHeiSun-Light << /FileType /TrueType /Path (uming.ttf) /CSI [(CNS1) 4] >> ; +%/Adobe-CNS1 /ShanHeiSun-Light ; + diff --git a/patches/source/ghostscript/dump.unused.internal.libraries.from.sources.sh b/patches/source/ghostscript/dump.unused.internal.libraries.from.sources.sh new file mode 100755 index 000000000..6319442c7 --- /dev/null +++ b/patches/source/ghostscript/dump.unused.internal.libraries.from.sources.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Repacks the ghostscript tarball to remove old unmaintained libraries. +# The SlackBuild would remove them before building anyway, but this way +# we don't waste bandwidth and storage on useless junk. + +VERSION=${VERSION:-$(echo ghostscript-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} + +tar xf ghostscript-${VERSION}.tar.xz || exit 1 +mv ghostscript-${VERSION}.tar.xz ghostscript-${VERSION}.tar.xz.orig +( cd ghostscript-${VERSION} && rm -rf freetype jpeg lcms2 lcms2art/doc/* leptonica libpng libtiff png tesseract tiff zlib ) +# Dump huge PDFs: +( cd ghostscript-${VERSION} + find . -name GS9_Color_Management.pdf -exec rm {} \; + rm -f doc/colormanage/figures/*.pdf + rm -f lcms2mt/doc/* +) +tar cf ghostscript-${VERSION}.tar ghostscript-${VERSION} +rm -r ghostscript-${VERSION} +plzip -9 -n 6 ghostscript-${VERSION}.tar +touch -r ghostscript-${VERSION}.tar.xz.orig ghostscript-${VERSION}.tar.lz +rm ghostscript-${VERSION}.tar.xz.orig diff --git a/patches/source/ghostscript/ghostscript.SlackBuild b/patches/source/ghostscript/ghostscript.SlackBuild new file mode 100755 index 000000000..23541587f --- /dev/null +++ b/patches/source/ghostscript/ghostscript.SlackBuild @@ -0,0 +1,241 @@ +#!/bin/bash + +# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2016, 2017, 2018, 2021 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=ghostscript +if [ -r gnu-ghostscript-*.tar.?z ]; then + SRCPREFIX="gnu-" +fi +VERSION=${VERSION:-$(echo $SRCPREFIX$PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-2_slack15.0} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i586 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} + +TMP=${TMP:-/tmp} +PKG=$TMP/package-${PKGNAM} +rm -rf $PKG +mkdir -p $TMP $PKG + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +cd $TMP +rm -rf ${SRCPREFIX}${PKGNAM}-${VERSION} +tar xvf $CWD/${SRCPREFIX}${PKGNAM}-$VERSION.tar.?z || exit 1 +cd ${SRCPREFIX}${PKGNAM}-$VERSION || exit 1 + +# Remove unmaintained garbage: +rm -rf freetype jpeg lcms2 libpng libtiff png tiff zlib + +# Upstream security fix: +zcat $CWD/505eab7782b429017eb434b2b95120855f2b0e3c.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/0974e4f2ac0005d3731e0b5c13ebc7e965540f4d.patch.gz | patch -p1 --verbose || exit 1 + +# Regenerate ./configure. Needed if patched, or to prevent libtool mismatch. +autoreconf --force --install +( cd jbig2dec ; autoreconf --force --install ) +( cd ijs ; autoreconf --force --install ) + +# Make sure ownerships and permissions are sane: +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +# Build/install IJS: +( cd ijs + CFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --mandir=/usr/man \ + --enable-shared=yes \ + --enable-static=no \ + --program-prefix= \ + --program-suffix= \ + --build=$ARCH-slackware-linux || exit 1 + make $NUMJOBS || make || exit 1 + make install || exit 1 + make install DESTDIR=$PKG || exit 1 +) || exit 1 + +# Configure: +CFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --mandir=/usr/man \ + --docdir=/usr/share/ghostscript/$VERSION/tmpdoc \ + --with-fontpath=/usr/share/fonts/TTF \ + --with-ijs \ + --disable-compile-inits \ + --enable-dynamic \ + --with-system-libtiff \ + --enable-cups \ + --program-prefix= \ + --program-suffix= \ + --build=$ARCH-slackware-linux || exit 1 + +# Build and install: +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 +make clean || exit 1 +make $NUMJOBS so || make so || exit 1 +make soinstall DESTDIR=$PKG || exit 1 + +# Add back ijs-config, which is needed by at least gutenprint to find IJS +# and produce a ghostscript driver: +cat $CWD/ijs-config | sed -e "s/lib64/lib${LIBDIRSUFFIX}/g" > $PKG/usr/bin/ijs-config +chmod 755 $PKG/usr/bin/ijs-config + +# Replace the default cidfmap with one containing additional +# support for CJK printing: + +if [ -r $PKG/usr/share/ghostscript/*.*/Resource/Init/cidfmap ]; then + SHARE_VERSION=$(echo $PKG/usr/share/ghostscript/*.*/Resource/Init/cidfmap | rev | cut -f 4 -d / | rev) + mv $PKG/usr/share/ghostscript/${SHARE_VERSION}/Resource/Init/cidfmap $PKG/usr/share/ghostscript/${SHARE_VERSION}/Resource/Init/cidfmap.default.ghostscript-${VERSION} + zcat $CWD/cidfmap.gz > $PKG/usr/share/ghostscript/${SHARE_VERSION}/Resource/Init/cidfmap.new +fi + +# Strip binaries: +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +# Don't ship .la files: +pushd $PKG + for lafile in usr/lib${LIBDIRSUFFIX}/*.la ; do + rm -f ${lafile} /${lafile} + done +popd + +# Compress manual pages: +find $PKG/usr/man -type f -exec gzip -9 {} \+ +for i in $( find $PKG/usr/man -type l ) ; do + ln -s $( readlink $i ).gz $i.gz + rm $i +done + +# Compress info files, if any: +if [ -d $PKG/usr/info ]; then + ( cd $PKG/usr/info + rm -f dir + gzip -9 * + ) +fi + +# gs9.23 fails if you try to have --docdir put things in the proper place. +# Not much choice but to have things put in the wrong place and then move them. +# First, remove broken symlinks: +rm -f $PKG/usr/share/ghostscript/$VERSION/doc $PKG/usr/share/ghostscript/$VERSION/tmpdoc/$VERSION/$VERSION +# Then, move the docs to the proper location: +mv $PKG/usr/share/ghostscript/$VERSION/tmpdoc/$VERSION $PKG/usr/share/ghostscript/$VERSION/doc +# Remove this (probably empty) directory: +rm -rf $PKG/usr/share/ghostscript/$VERSION/tmpdoc +# And finally, pray for upstream to quit drinking while coding. ;-) + +# Add a documentation directory: +mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION +( cd doc + cp -a \ + AUTHORS COPYING* ../LICENSE* README* \ + $PKG/usr/doc/${PKGNAM}-$VERSION +) +( cd $PKG/usr/doc/${PKGNAM}-$VERSION + ln -sf /usr/share/ghostscript/$VERSION/doc doc +) + +# Version 9.02 fails to install History9.htm, but also the full unabridged +# history of Ghostscript is not required here. See the source for that. +( cd doc + cp -a \ + History*.htm \ + $PKG/usr/share/ghostscript/$VERSION/doc + rm -f $PKG/usr/share/ghostscript/$VERSION/doc/History{1,2,3,4,5,6,7,8}.htm + # More cruft: + rm -f $PKG/usr/share/ghostscript/$VERSION/doc/Details{1,2,3,4,5,6,7,8}.htm + # This is also bloat: + rm -f $PKG/usr/share/ghostscript/$VERSION/doc/*.pdf + chown root:root $PKG/usr/share/ghostscript/$VERSION/doc/History*htm + chmod 644 $PKG/usr/share/ghostscript/$VERSION/doc/History*htm +) + +# Install example files: +rm -rf $PKG/usr/share/ghostscript/${VERSION}/examples +cp -a $TMP/${PKGNAM}-${VERSION}/examples $PKG/usr/share/ghostscript/${VERSION} + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat << EOF > $PKG/install/doinst.sh +#!/bin/bash +config() { + NEW="\$1" + OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r \$OLD ]; then + mv \$NEW \$OLD + elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy + rm \$NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +config usr/share/ghostscript/${VERSION}/Resource/Init/cidfmap.new +EOF + +cd $PKG +/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz + diff --git a/patches/source/ghostscript/ghostscript.url b/patches/source/ghostscript/ghostscript.url new file mode 100644 index 000000000..df3354369 --- /dev/null +++ b/patches/source/ghostscript/ghostscript.url @@ -0,0 +1,2 @@ +https://github.com/ArtifexSoftware/ghostpdl-downloads +https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9550/ghostscript-9.55.0.tar.xz diff --git a/patches/source/ghostscript/ijs-config b/patches/source/ghostscript/ijs-config new file mode 100644 index 000000000..4c3a0043c --- /dev/null +++ b/patches/source/ghostscript/ijs-config @@ -0,0 +1,56 @@ +#!/bin/sh + +prefix=/usr +exec_prefix=${prefix} +exec_prefix_set=no + +usage="\ +Usage: ijs-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo 0.35 + ;; + --cflags) + includes=-I${prefix}/include/ijs + echo $includes + ;; + --libs) + libdirs=-L/usr/lib64 + echo $libdirs -lijs + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done + diff --git a/patches/source/ghostscript/slack-desc b/patches/source/ghostscript/slack-desc new file mode 100644 index 000000000..06d1a4a88 --- /dev/null +++ b/patches/source/ghostscript/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +ghostscript: ghostscript (Postscript and PDF interpreter) +ghostscript: +ghostscript: Ghostscript is an interpreter of Adobe Systems' PostScript(tm) +ghostscript: and Portable Document Format (PDF) languages. Ghostscript is an +ghostscript: essential part of the printing subsystem, taking PostScript output +ghostscript: from applications and converting it into an appropriate printer or +ghostscript: display format. Ghostscript supports many printers directly, and +ghostscript: more are supported through add-on packages. +ghostscript: +ghostscript: +ghostscript: |