recipe 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. # Build recipe for ghostscript.
  2. #
  3. # Copyright (c) 2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # Exit immediately on any error
  17. set -e
  18. program=ghostscript
  19. version=10.0.0
  20. release=2
  21. # Define a category for the output of the package name
  22. pkgcategory=printing
  23. tarname=${program}-${version}.tar.gz
  24. tarname_fonts_one=ghostscript-fonts-std-8.11.tar.gz
  25. tarname_fonts_two=gnu-gs-fonts-other-6.0.tar.gz
  26. # Remote source(s)
  27. fetch="
  28. https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs1000/$tarname
  29. https://downloads.sourceforge.net/gs-fonts/$tarname_fonts_one
  30. https://downloads.sourceforge.net/gs-fonts/$tarname_fonts_two
  31. "
  32. description="
  33. An interpreter for the PostScript language and PDF files.
  34. Ghostscript is an interpreter for the PostScript language and PDF files.
  35. It is available under either the GNU GPL Affero license or licensed for
  36. commercial use from Artifex Software, Inc. It has been under active
  37. development for over 30 years and has been ported to several different
  38. systems during this time. Ghostscript consists of a PostScript
  39. interpreter layer and a graphics library.
  40. "
  41. homepage=https://www.ghostscript.com
  42. license=Custom
  43. # Source documentation
  44. docs="LICENSE"
  45. docsdir="${docdir}/${program}-${version}"
  46. build()
  47. {
  48. unpack "${tardir}/$tarname"
  49. cd "$srcdir"
  50. # Apply patch to fix the build (Patch borrowed from "Alpine Linux")
  51. patch -Np1 -i "${worktree}/patches/ghostscript/fix-sprintf.patch"
  52. # Apply patch to pick up the external zlib library ("Alpine Linux")
  53. patch -Np1 -i "${worktree}/patches/ghostscript/ghostscript-system-zlib.patch"
  54. # Set sane permissions
  55. chmod -R u+w,go-w,a+rX-s .
  56. # Build 'ghostscript' using external libraries
  57. rm -rf cups/libs freetype lcms2mt jpeg libpng openjpeg tiff zlib ijs
  58. ./configure CPPFLAGS="$QICPPFLAGS" \
  59. CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
  60. $configure_args \
  61. --libdir=/usr/lib${libSuffix} \
  62. --infodir=$infodir \
  63. --mandir=$mandir \
  64. --docdir=$docsdir \
  65. --htmldir=${docsdir}/html \
  66. --enable-dynamic \
  67. --enable-cups \
  68. --disable-compile-inits \
  69. --with-fontpath=/usr/share/fonts/X11/TTF:/usr/share/fonts/X11/Type1:/usr/share/fonts \
  70. --with-system-libtiff \
  71. --with-ijs \
  72. --build="$(gcc -dumpmachine)"
  73. make -j${jobs} V=1
  74. make -j${jobs} DESTDIR="$destdir" install
  75. make -j${jobs} V=1 so
  76. make -j${jobs} DESTDIR="$destdir" soinstall
  77. # Install more headers, making symlink for compatibility
  78. install -p -m 644 base/*.h "${destdir}/usr/include/ghostscript"
  79. ( cd "${destdir}/usr/include" && ln -sf ghostscript ps )
  80. # Ship additional fonts
  81. (
  82. cd "${destdir}/usr/share/ghostscript"
  83. unpack "${tardir}"/$tarname_fonts_one
  84. unpack "${tardir}"/$tarname_fonts_two
  85. chmod -R u+w,go-w,a+rX-s .
  86. )
  87. unset -v tarname_fonts_one tarname_fonts_two
  88. # Compress info documents deleting index file for the package
  89. if test -d "${destdir}/$infodir"
  90. then
  91. rm -f "${destdir}/${infodir}/dir"
  92. lzip -9 "${destdir}/${infodir}"/*
  93. fi
  94. # Compress and link man pages (if needed)
  95. if test -d "${destdir}/$mandir"
  96. then
  97. (
  98. cd "${destdir}/$mandir"
  99. find . -type f -exec lzip -9 {} +
  100. find . -type l | while read -r file
  101. do
  102. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  103. rm -- "$file"
  104. done
  105. )
  106. fi
  107. # Copy documentation
  108. mkdir -p "${destdir}/$docsdir"
  109. cp -p $docs "${destdir}/$docsdir"
  110. }