recipe 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # Build recipe for openjpeg.
  2. #
  3. # Copyright (c) 2018 Markus Tornow, <tornow@riseup.net>.
  4. # Copyright (c) 2021 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=openjpeg
  20. version=2.4.0
  21. release=1
  22. # Define a category for the output of the package name
  23. pkgcategory=x-libs
  24. tarname=${program}-${version}.tar.gz
  25. # Remote source(s)
  26. fetch=https://github.com/uclouvain/openjpeg/archive/v${version}/$tarname
  27. description="
  28. OpenJPEG is an open-source JPEG 2000 codec.
  29. OpenJPEG is written in C language. It has been developed in order to
  30. promote the use of JPEG 2000, a still-image compression standard from
  31. the Joint Photographic Experts Group (JPEG). Since may 2015, it is
  32. officially recognized by ISO/IEC and ITU-T as a JPEG 2000 Reference
  33. Software.
  34. "
  35. homepage=https://www.openjpeg.org
  36. license="BSD 2-clause"
  37. # Source documentation
  38. docs="AUTHORS.md LICENSE CHANGELOG.md NEWS.md README.md THANKS.md"
  39. docsdir="${docdir}/${program}-${version}"
  40. build()
  41. {
  42. unpack "${tardir}/$tarname"
  43. cd "$srcdir"
  44. # Set sane permissions
  45. chmod -R u+w,go-w,a+rX-s .
  46. rm -rf BUILD
  47. mkdir BUILD
  48. cd BUILD
  49. cmake \
  50. -DCMAKE_C_FLAGS:STRING="$QICFLAGS" \
  51. -DCMAKE_CXX_FLAGS:STRING="$QICXXFLAGS" \
  52. -DCMAKE_EXE_LINKER_FLAGS:STRING="$QILDFLAGS" \
  53. -DCMAKE_SHARED_LINKER_FLAGS:STRING="$QILDFLAGS" \
  54. -DCMAKE_INSTALL_PREFIX=/usr \
  55. -DOPENJPEG_INSTALL_LIB_DIR=lib${libSuffix} \
  56. -DCMAKE_INSTALL_MANDIR=$mandir \
  57. -DCMAKE_INSTALL_DOCDIR=$docsdir \
  58. -DCMAKE_BUILD_TYPE=Release \
  59. -DCMAKE_VERBOSE_MAKEFILE=ON \
  60. -DCMAKE_SKIP_INSTALL_RPATH=YES \
  61. -DBUILD_STATIC_LIBS=OFF \
  62. -G Ninja ..
  63. ninja -j${jobs}
  64. DESTDIR="$destdir" ninja -j${jobs} install
  65. # Leave the temporary BUILD directory
  66. cd ..
  67. # Install manual pages (manually)
  68. cd doc
  69. for file in man/man?/*
  70. do
  71. install -p -m 644 "$file" -D "${destdir}/usr/share/$file"
  72. done
  73. unset -v file
  74. cd ..
  75. # Compress and link man pages (if needed)
  76. if test -d "${destdir}/$mandir"
  77. then
  78. (
  79. cd "${destdir}/$mandir"
  80. find . -type f -exec lzip -9 '{}' +
  81. find . -type l | while read -r file
  82. do
  83. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  84. rm -- "$file"
  85. done
  86. )
  87. fi
  88. # Copy documentation
  89. mkdir -p "${destdir}/$docsdir"
  90. cp -p $docs "${destdir}/$docsdir"
  91. }