NAME="openjpeg"
DESC="Open-source implementation of the JPEG-2000 standard"
VERSION="2.5.0"
FILES=("https://github.com/uclouvain/openjpeg/archive/v$VERSION/openjpeg-$VERSION.tar.gz")
HASHES=("5cbb822a1203dd75b85639da4f4ecaab")
DEPENDS=("lcms2" "libpng" "libtiff")

PACKAGE() {
  tar xf $NAME-$VERSION.tar.gz
  cd $NAME-$VERSION
  
  mkdir -v build
  cd       build

  cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DBUILD_STATIC_LIBS=OFF ..
  make && make DESTDIR="$ROOTDIR" install

  pushd ../doc &&
    for man in man/man?/* ; do
      install -v -D -m 644 $man "$ROOTDIR/usr/share/$man"
    done
  popd

  cd ../.. && rm -r $NAME-$VERSION
}
