summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 55c9eaaad6c8efbb2cc95eb2f66b84bfcdb64f04 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
pkgname=lib32-rav1e
pkgver=0.7.1
pkgrel=2
pkgdesc='An AV1 encoder focused on speed and safety. (32-bits)'
arch=('x86_64')
url='https://github.com/xiph/rav1e'
license=('BSD')
depends=(
  'lib32-gcc-libs'
  'lib32-glibc'
  "rav1e=${pkgver}"
)
makedepends=(
  'cargo-c'
  'git'
  'nasm'
  'rust'
  'lib32-rust-libs'
)
provides=('librav1e.so')
_tag=a8d05d0c43826a465b60dbadd0ab7f1327d75371
source=(
  "git+https://github.com/xiph/rav1e.git#tag=${_tag}"
  "Cargo-rav1e-${pkgver}.lock::https://github.com/xiph/rav1e/releases/download/v${pkgver}/Cargo.lock"
)
b2sums=(
  'SKIP'
  '7cbeaff87ca4e9db469be06cbead0c5b05af2064d6d5f12f97f5999992017b66a24bc19ed4eaf69f7d6579732f843f3e93f30d9581b8c8344728d3e3773a0f79'
)
options=('!lto')

pkgver() {
  cd rav1e
  git describe --tags | sed 's/^v//'
}

prepare() {

  export CARGO_HOME="${srcdir}/fakehome/cargo"

  cp -f "Cargo-rav1e-${pkgver}.lock" rav1e/Cargo.lock
  cargo fetch \
    --locked \
    --manifest-path rav1e/Cargo.toml
}

build() {
  export CARGO_HOME="${srcdir}/fakehome/cargo"

  cargo build --target i686-unknown-linux-gnu \
    --release \
    --frozen \
    --no-default-features \
    --features binaries,asm,threading,signal_support \
    --manifest-path rav1e/Cargo.toml
  cargo cbuild --target i686-unknown-linux-gnu\
    --release \
    --frozen \
    --no-default-features \
    --features binaries,asm,threading,signal_support \
    --prefix=/usr \
    --manifest-path rav1e/Cargo.toml \
    --libdir /usr/lib32
}

check() {
  export CARGO_HOME="${srcdir}/fakehome/cargo"

  cargo test --target i686-unknown-linux-gnu \
    --release \
    --frozen \
    --manifest-path rav1e/Cargo.toml
}

package() {
  export CARGO_HOME="${srcdir}/fakehome/cargo"

  cd rav1e
  cargo install --target i686-unknown-linux-gnu \
    --frozen \
    --offline \
    --no-default-features \
    --features binaries,asm,threading,signal_support \
    --no-track \
    --path . \
    --root "${pkgdir}/usr"
  cargo cinstall --target i686-unknown-linux-gnu \
    --release \
    --frozen \
    --no-default-features \
    --features binaries,asm,threading,signal_support \
    --prefix /usr \
    --destdir "${pkgdir}" \
    --libdir /usr/lib32

  rm -fr "${pkgdir}/usr/include"
  (cd "${pkgdir}/usr/bin"; mv rav1e rav1e-32)

  install -Dm 644 LICENSE PATENTS -t "${pkgdir}/usr/share/licenses/${pkgname}/"

}