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