summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e0c9e92545f50615169549f375339b23b8a150ad (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
# Maintainer: quietvoid <tcChlisop0@gmail.com>

_pkgname=libhdr10plus-rs
pkgname=${_pkgname}-git
pkgver=2.1.5.r3.g2ab405a
pkgrel=1
pkgdesc='Library to read and write HDR10+ metadata (C-API) - git version'
arch=('x86_64')
url='https://github.com/quietvoid/hdr10plus_tool/hdr10plus'
license=('MIT')
depends=('gcc-libs' 'glibc')
makedepends=('git' 'cargo' 'cargo-c')
conflicts=('libhdr10plus-rs')
provides=('libhdr10plus-rs' 'libhdr10plus-rs.so')
source=(git+https://github.com/quietvoid/hdr10plus_tool.git)
sha256sums=(SKIP)
_libdir="hdr10plus_tool/hdr10plus"

pkgver() {
  cd hdr10plus_tool

  git describe --match "libhdr10plus-[0-9]*" --long HEAD --tags | sed 's/^libhdr10plus-//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  export RUSTUP_TOOLCHAIN=stable

  cd "${_libdir}"
  cargo fetch --locked --target host-tuple
}

build() {
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target

  cd "${_libdir}"
  cargo cbuild --frozen \
    --profile release-deploy \
    --prefix=/usr
}

check() {
  export RUSTUP_TOOLCHAIN=stable

  cd "${_libdir}"
  cargo test --frozen --all-features
}

package() {
  export CARGO_TARGET_DIR=target

  cd "${_libdir}"
  cargo cinstall --frozen \
    --profile release-deploy \
    --prefix /usr \
    --destdir "${pkgdir}"

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}