summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 76a556ce627e0b12cc6b9b521c43c74a41942cde (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
102
103
104
105
106
107
# Maintainer:
# Contributor: Alynx Zhou <alynx.zhou@gmail.com>

## links
# https://gyroflow.xyz
# https://github.com/gyroflow/gyroflow

## options
: ${_commit=4b284ad1f22b3b7f8b1c51921442ff54599b12ef} # 1.6.0

## basic info
_pkgname="gyroflow"
pkgname="$_pkgname"
pkgver=1.6.0
pkgrel=1
pkgdesc="Video stabilization using gyroscope data"
url="https://github.com/gyroflow/gyroflow"
license=("GPL-3.0-or-later")
arch=("x86_64")

depends=(
  'ffmpeg'
  'libc++'
  'ocl-icd'
  'opencv'
  'qt6-declarative'
)
makedepends=(
  'cargo'
  'clang'
  'git'
  'opencl-headers'
  'p7zip'
)
optdepends=(
  'opencl-driver: OpenCL driver for GPU accelerated stabilization'
  'libva-mesa-driver: VAAPI video acceleration for NVIDIA and AMD GPU'
  'intel-media-driver: VAAPI video acceleration for Intel GPU'
)

options=('!lto')

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git#commit=$_commit")
sha256sums=('SKIP')

prepare() {
  [ ! -e "$_pkgsrc/.cargo/config.toml" ] \
    && [ -e "$_pkgsrc/.cargo/config" ] \
    && mv "$_pkgsrc/.cargo/config" "$_pkgsrc/.cargo/config.toml"

  export RUSTUP_TOOLCHAIN=stable

  cd "$_pkgsrc"
  cargo fetch --target "${CARCH}-unknown-linux-gnu"
}

build() {
  export QMAKE="/usr/bin/qmake6"

  # Use system libraries
  export FFMPEG_DIR="/usr"
  export OPENCV_LINK_PATHS="/usr"
  export OPENCV_LINK_LIBS="opencv_core,opencv_calib3d,opencv_features2d,opencv_imgproc,opencv_video,opencv_flann,opencv_dnn"

  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target

  cd "$_pkgsrc"
  cargo build --frozen --release --all-features
}

package() {
  # program files
  install -Dm755 "$_pkgsrc/target/release/$_pkgname" "$pkgdir/opt/$_pkgname/$_pkgname"
  install -Dm755 "$_pkgsrc/target/release/libmdk.so.0" -t "$pkgdir/opt/$_pkgname/"

  # camera presets
  cp -a "$_pkgsrc/resources/camera_presets" "$pkgdir/opt/$_pkgname"

  # scripts
  install -Dm755 /dev/stdin "$pkgdir/usr/bin/$_pkgname" << END
#!/usr/bin/env sh
export LD_LIBRARY_PATH="/opt/$_pkgname"
exec /opt/$_pkgname/$_pkgname
END

  # desktop file
  install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/$_pkgname.desktop" << END
[Desktop Entry]
Type=Application
Name=${_pkgname^}
Comment=$pkgdesc
Exec=$_pkgname %u
Icon=$_pkgname
Terminal=false
StartupNotify=true
Categories=Graphics;Photography;AudioVideo;
MimeType=video/mp4;video/mpeg;
END

  # icon
  install -Dm644 "$_pkgsrc/resources/icon.svg" "$pkgdir/usr/share/pixmaps/$_pkgname.svg"

  # permissions
  chmod -R u+rwX,go+rX,go-w "$pkgdir/"
}