From d68b2059e5ed41d96aeec0d1299adc43f433f5d2 Mon Sep 17 00:00:00 2001 From: Batuhan Apaydin Date: Sun, 25 Jun 2023 20:28:41 +0300 Subject: [PATCH] add ghostscript & openjpeg Signed-off-by: Batuhan Apaydin Co-authored-by: Furkan Turkal Signed-off-by: Batuhan Apaydin --- ghostscript.yaml | 128 ++++++++++++++++++++++ ghostscript/fix-sprintf.patch | 18 +++ ghostscript/ghostscript-system-zlib.patch | 15 +++ openjpeg.yaml | 64 +++++++++++ openjpeg/fix-cmakelists.patch | 12 ++ packages.txt | 2 + 6 files changed, 239 insertions(+) create mode 100644 ghostscript.yaml create mode 100644 ghostscript/fix-sprintf.patch create mode 100644 ghostscript/ghostscript-system-zlib.patch create mode 100644 openjpeg.yaml create mode 100644 openjpeg/fix-cmakelists.patch diff --git a/ghostscript.yaml b/ghostscript.yaml new file mode 100644 index 00000000000..4b90b56a8fd --- /dev/null +++ b/ghostscript.yaml @@ -0,0 +1,128 @@ +package: + name: ghostscript + version: 10.01.2 + epoch: 0 + description: Interpreter for the PostScript language and for PDF + copyright: + - license: AGPL-3.0-or-later + +environment: + contents: + packages: + - busybox + - ca-certificates-bundle + - build-base + - autoconf + - automake + - cups-dev + - expat-dev + - freetype-dev + - gtk-2.0-dev + - jbig2dec-dev + - lcms2-dev + - libjpeg-turbo + - libpng-dev + - libtool + - openjpeg-dev + - tiff-dev + - zlib-dev + +var-transforms: + - from: ${{package.version}} + match: \. + replace: '' + to: mangled-package-version + +pipeline: + - uses: fetch + with: + expected-sha512: 11887850d440b8bbd8b83b8b58df8c743cf94be8fdbcfbda1a5fce55ce7c6a963d94b41a4ebcf1ba48f64f8af01e76dec789e2711212b1f7a32f98c42d75e0ff + uri: https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${{vars.mangled-package-version}}/ghostscript-${{package.version}}.tar.gz + + - uses: patch + with: + patches: fix-sprintf.patch + + - uses: patch + with: + patches: ghostscript-system-zlib.patch + + - runs: | + rm -r jpeg libpng zlib tiff lcms2mt cups/libs jbig2dec \ + freetype + + # fix parallel builds + sed -i -e 's/ECHO_XE/ECHOGS_XE/g' \ + -e 's/^\($(GLOBJ)md5.$(OBJ) :.*\)/\1 $(ECHOGS_XE)/' \ + base/lib.mak + aclocal && autoconf --force + + cd ./ijs + libtoolize --force && aclocal && autoconf && automake --add-missing + + - uses: autoconf/configure + with: + dir: ijs + opts: | + CFLAGS="$CFLAGS -flto=auto" \ + --enable-shared \ + --disable-static + + - uses: autoconf/make + with: + dir: ijs + + - uses: autoconf/make-install + with: + dir: ijs + + - uses: autoconf/configure + with: + dir: . + opts: | + --docdir=/usr/share/doc/ghostscript \ + --with-system-libtiff \ + --with-ijs \ + --with-jbig2dec \ + --without-libpaper \ + --without-versioned-path \ + --enable-gtk \ + --with-drivers=ALL \ + --with-fontpath=/usr/share/fonts/Type1:/usr/share/fonts \ + --disable-compile-inits + + - runs: | + make so all + make -j1 DESTDIR="${{targets.destdir}}" install soinstall + # create empty dir for future fonts + mkdir -p "${{targets.destdir}}"/usr/share/fonts/Type1 + + - uses: strip + +subpackages: + - name: ghostscript-doc + pipeline: + - uses: split/manpages + description: ghostscript manpages + + - name: "ghostscript-dbg" + description: "ghostscript Debug Symbols" + pipeline: + - uses: split/debug + dependencies: + runtime: + - ghostscript + + - name: ghostscript-dev + pipeline: + - uses: split/dev + description: ghostscript dev + dependencies: + runtime: + - ghostscript + +update: + enabled: true + manual: true + release-monitor: + identifier: 1157 diff --git a/ghostscript/fix-sprintf.patch b/ghostscript/fix-sprintf.patch new file mode 100644 index 00000000000..0f00211b6db --- /dev/null +++ b/ghostscript/fix-sprintf.patch @@ -0,0 +1,18 @@ +# https://git.alpinelinux.org/aports/tree/main/ghostscript/fix-sprintf.patch +diff --git a/cups/gdevcups.c b/cups/gdevcups.c +index c00e758..35b4035 100644 +--- a/cups/gdevcups.c ++++ b/cups/gdevcups.c +@@ -4353,10 +4353,10 @@ cups_set_color_info(gx_device *pdev) /* I - Device info */ + */ + + if (pdev->HWResolution[0] != pdev->HWResolution[1]) +- sprintf(resolution, "%.0fx%.0fdpi", pdev->HWResolution[0], ++ snprintf(resolution, sizeof(resolution), "%.0fx%.0fdpi", pdev->HWResolution[0], + pdev->HWResolution[1]); + else +- sprintf(resolution, "%.0fdpi", pdev->HWResolution[0]); ++ snprintf(resolution, sizeof(resolution), "%.0fdpi", pdev->HWResolution[0]); + + for (i = 0, profile = cups->PPD->profiles; + i < cups->PPD->num_profiles; \ No newline at end of file diff --git a/ghostscript/ghostscript-system-zlib.patch b/ghostscript/ghostscript-system-zlib.patch new file mode 100644 index 00000000000..9d46d1e2d50 --- /dev/null +++ b/ghostscript/ghostscript-system-zlib.patch @@ -0,0 +1,15 @@ +# https://git.alpinelinux.org/aports/tree/main/ghostscript/ghostscript-system-zlib.patch +diff --git a/base/lib.mak b/base/lib.mak +index e8ee4e7..4abaa05 100644 +--- a/base/lib.mak ++++ b/base/lib.mak +@@ -589,7 +589,9 @@ srlx_h=$(GLSRC)srlx.h + sstring_h=$(GLSRC)sstring.h + strimpl_h=$(GLSRC)strimpl.h $(scommon_h) $(gstypes_h) $(gsstruct_h) + szlibx_h=$(GLSRC)szlibx.h ++ifneq ($(SHARE_ZLIB),1) + zlib_h=$(ZSRCDIR)$(D)zlib.h ++endif + # We have two of the following, for shared zlib (_1) + # and 'local' zlib (_0) + szlibxx_h_1=$(GLSRC)szlibxx.h $(szlibx_h) \ No newline at end of file diff --git a/openjpeg.yaml b/openjpeg.yaml new file mode 100644 index 00000000000..ccd41e5ae27 --- /dev/null +++ b/openjpeg.yaml @@ -0,0 +1,64 @@ +package: + name: openjpeg + version: 2.5.0 + epoch: 0 + description: "Open-source implementation of JPEG2000 image codec" + copyright: + - license: BSD-2-Clause-NetBSD + +environment: + contents: + packages: + - wolfi-base + - busybox + - ca-certificates-bundle + - build-base + - libpng-dev + - tiff-dev + - lcms2-dev + - doxygen + - cmake + - samurai + +pipeline: + - uses: fetch + with: + uri: https://github.com/uclouvain/openjpeg/archive/v${{package.version}}/openjpeg-v${{package.version}}.tar.gz + expected-sha512: 08975a2dd79f1e29fd1824249a5fbe66026640ed787b3a3aa8807c2c69f994240ff33e2132f8bf15bbc2202bef7001f98e42d487231d4eebc8e503538658049a + + # - uses: patch + # with: + # patches: fix-cmakelists.patch + + - uses: cmake/configure + with: + opt: | + -G Ninja \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DOPENJPEG_INSTALL_LIB_DIR=lib + + - uses: cmake/build + + - uses: cmake/install + +subpackages: + - name: "openjpeg-dev" + description: "headers for openjpeg" + pipeline: + - uses: split/dev + dependencies: + runtime: + - openjpeg + + - name: openjpeg-tools + pipeline: + - runs: | + mkdir -p ${{targets.subpkgdir}}/usr/bin + mv ${{targets.destdir}}/usr/bin/ ${{targets.subpkgdir}}/usr/bin/ + description: openjpeg (development tools) + +update: + enabled: true + release-monitor: + identifier: 2550 diff --git a/openjpeg/fix-cmakelists.patch b/openjpeg/fix-cmakelists.patch new file mode 100644 index 00000000000..55d20f4680d --- /dev/null +++ b/openjpeg/fix-cmakelists.patch @@ -0,0 +1,12 @@ +# https://git.alpinelinux.org/aports/tree/main/openjpeg/fix-cmakelists.patch +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -148,7 +148,7 @@ + # We could install *.cmake files in share/ however those files contains + # hardcoded path to libraries on a multi-arch system (fedora/debian) those + # path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu) +- set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}") ++ set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/cmake/${OPENJPEG_INSTALL_SUBDIR}") + endif() + + if (APPLE) \ No newline at end of file diff --git a/packages.txt b/packages.txt index 28fe851c58f..5d9c205fb6e 100644 --- a/packages.txt +++ b/packages.txt @@ -188,11 +188,13 @@ cups alsa-lib zip libpng +openjpeg freetype fontconfig giflib libjpeg-turbo lcms2 +ghostscript su-exec llvm15 postgresql-11,postgresql