summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b36ae7a7e0129198ea260dfdcfd3c02adfc7c07b (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
# Maintainer : Gustavo Alvarez <sl1pkn07@gmail.com>

_plug=fsrcnn-ncnn-vulkan
pkgname=vapoursynth-plugin-${_plug}-git
pkgver=r3.c9dad37
pkgrel=1
pkgdesc="Plugin for Vapoursynth: ${_plug} (GIT version)"
arch=('x86_64')
url='https://github.com/Sg4Dylan/vapoursynth-fsrcnn-ncnn-vulkan'
license=('MIT')
depends=('vapoursynth'
         'vulkan-icd-loader'
         )
makedepends=('git'
             'cmake'
             'ncnn-git'
             'opencv-cuda'
             )
provides=("vapoursynth-plugin-${_plug}")
conflicts=("vapoursynth-plugin-${_plug}")
source=("${_plug}::git+https://github.com/Sg4Dylan/vapoursynth-${_plug}.git"
#         'https://github.com/Nlzy/vapoursynth-waifu2x-ncnn-vulkan/releases/download/r0.1/models.7z'
        )
sha256sums=('SKIP'
#             'e3b7b0b71ca606031821ac5d63b4ff25ab6874e8521521585de4a308b2f974c9'
            )

pkgver() {
  cd "${_plug}"
#   echo "$(git describe --long --tags | tr - .)"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  mkdir -p build


  sed -e 's|D:/ProgramData/opencv/build|/usr|g' \
      -e 's|D:/ProgramData/VulkanSDK/1.1.126.0|/usr|g' \
      -e 's|D:/Workspace/ncnn-master/build-vs2017/install|/usr|g' \
      -e 's|D:/Program Files/VapourSynth/sdk|/usr|g' \
      -e 's|Include|include|g' \
      -e 's|{OpenCV}/include|{OpenCV}/include/opencv4|g' \
      -e 's|Lib|lib|g' \
      -e 's|lib64|lib|g' \
      -e 's|x64/vc15/||g' \
      -e 's|vulkan-1|vulkan|g' \
      -e 's|opencv_world412|opencv_core opencv_imgproc opencv_highgui|g' \
      -e 's|vsscript|vapoursynth-script|g' \
      -i "${_plug}/CMakeLists.txt"

  sed -e "26a#ifndef min\\
\#define min(a,b) ((a) <= (b) ? (a) : (b))\\
\#endif\\
\#ifndef max\\
\#define max(a,b) ((a) >= (b) ? (a) : (b))\\
\#endif" -i "${_plug}/fsrcnn.cpp"

}

build() {
  cd build
  cmake "../${_plug}" \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr

  LC_ALL=C make
}

package(){
  install -Dm755 "build/libvs_fsrcnn_vulkan.so" "${pkgdir}/usr/lib/vapoursynth/libvs_fsrcnn_vulkan.so"


  install -Dm644 "${_plug}/README.md" "${pkgdir}/usr/share/doc/vapoursynth/plugins/${_plug}/README"
  install -Dm644 "${_plug}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}