summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6255ed544af8de2fd53bbe781b6cbbf9ee88c55f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: pingplug < aur at pingplug dot me >
# Contributor: Schala Zeal < schalaalexiazeal at gmail dot com >

_android_arch=armv7a-eabi

pkgname=android-${_android_arch}-openjpeg2
pkgver=2.5.2
pkgrel=2
arch=('any')
pkgdesc="An open source JPEG 2000 codec (Android ${_android_arch})"
license=('BSD')
url="https://www.openjpeg.org"
depends=('android-ndk'
         "android-${_android_arch}-libpng"
         "android-${_android_arch}-lcms2"
         'openjpeg2')
makedepends=('android-cmake')
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://github.com/uclouvain/openjpeg/archive/v${pkgver}.tar.gz")
md5sums=('f9ee64845881a15109ed0aa73a12202f')

build() {
    cd "${srcdir}"/openjpeg-${pkgver}
    source android-env ${_android_arch}

    mkdir "build-${_android_arch}-static" && pushd "build-${_android_arch}-static"
    android-${_android_arch}-cmake \
        -DCMAKE_BUILD_TYPE=Release \
        -DBUILD_DOC=OFF \
        -DBUILD_TESTING=OFF \
        -DBUILD_SHARED_LIBS=OFF \
        -DTIFF_LIBRARY="${ANDROID_PREFIX_LIB}/libtiff.a" \
        -DTIFF_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DLCMS2_LIBRARY="${ANDROID_PREFIX_LIB}/liblcms2.a" \
        -DLCMS2_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        ..
    make $MAKEFLAGS
    popd


    mkdir "build-${_android_arch}-shared" && pushd "build-${_android_arch}-shared"
    android-${_android_arch}-cmake \
        -DCMAKE_BUILD_TYPE=Release \
        -DBUILD_DOC=OFF \
        -DBUILD_TESTING=OFF \
        -DBUILD_PKGCONFIG_FILES=ON \
        -DTIFF_LIBRARY="${ANDROID_PREFIX_LIB}/libtiff.so" \
        -DTIFF_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DLCMS2_LIBRARY="${ANDROID_PREFIX_LIB}/liblcms2.so" \
        -DLCMS2_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        ..
    make $MAKEFLAGS
    popd
}

package() {
    source android-env ${_android_arch}

    cd "${srcdir}/openjpeg-${pkgver}/build-${_android_arch}-static"
    make DESTDIR="$pkgdir" install
    cd "${srcdir}/openjpeg-${pkgver}/build-${_android_arch}-shared"
    make DESTDIR="$pkgdir" install

    # Link tools to our host versions
    rm -r "${pkgdir}"/${ANDROID_PREFIX_BIN}/*

    for f in opj_compress opj_decompress opj_dump; do
        ln -s "/usr/bin/$f" "$pkgdir/${ANDROID_PREFIX_BIN}/$f"
    done

    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}"/${ANDROID_PREFIX_LIB}/*.so
    ${ANDROID_STRIP} -g "$pkgdir"/${ANDROID_PREFIX_LIB}/*.a
}