recipe 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Build recipe for libpng.
  2. #
  3. # Copyright (c) 2017 Mateus P. Rodrigues, <mprodrigues@dragora.org>.
  4. # Copyright (c) 2017-2019, 2022 Matias Fonzo, <selk@dragora.org>.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # Exit immediately on any error
  18. set -e
  19. program=libpng
  20. version=1.6.39
  21. release=1
  22. # Define a category for the output of the package name
  23. pkgcategory=libs
  24. description="
  25. The main PNG library.
  26. libpng is the official PNG reference library. It supports almost
  27. all PNG features, is extensible, and has been extensively tested
  28. for over 20 years.
  29. "
  30. homepage=https://www.libpng.org/pub/png/libpng.html
  31. license="libpng license"
  32. tarname=${program}-${version}.tar.gz
  33. # Remote source(s)
  34. fetch=https://downloads.sourceforge.net/project/libpng/libpng16/${version}/$tarname
  35. # Source documentation
  36. docs="ANNOUNCE CHANGES LICENSE README TODO"
  37. docsdir="${docdir}/${program}-${version}"
  38. build() {
  39. unpack "${tardir}/$tarname"
  40. cd "$srcdir"
  41. # Set sane permissions
  42. chmod -R u+w,go-w,a+rX-s .
  43. # Include animated PNG functionality in libpng
  44. # (Thanks to "Beyond Linux From Scratch"!)
  45. patch -p1 < "${worktree}/patches/libpng/libpng-1.6.39-apng.patch"
  46. ./configure CPPFLAGS="$QICPPFLAGS" \
  47. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LIBS='-lpthread' \
  48. $configure_args \
  49. --libdir=/usr/lib${libSuffix} \
  50. --infodir=$infodir \
  51. --mandir=$mandir \
  52. --docdir=$docsdir \
  53. --enable-static=no \
  54. --enable-shared=yes \
  55. --build="$(gcc -dumpmachine)"
  56. make -j${jobs} V=1
  57. make -j${jobs} DESTDIR="$destdir" install-strip
  58. # Compress manual pages
  59. if [ -d "${destdir}/$mandir" ] ; then
  60. (
  61. cd "${destdir}/$mandir"
  62. find . -type f -exec lzip -9 {} +
  63. find . -type l | while read -r file
  64. do
  65. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  66. rm -- "$file"
  67. done
  68. )
  69. fi
  70. # Copy documentation
  71. mkdir -p "${destdir}/$docsdir"
  72. cp -p $docs "${destdir}/$docsdir"
  73. }