summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 95bdc2a10e3e279e80a39bcad085b2f0af96fd09 (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
#Maintainer: archdevlab <https://github.com/archdevlab>

major=2024.Q1.3

pkgbase=amdvlk-bin
pkgname=(amdvlk-bin lib32-amdvlk-bin)
pkgver=${major}
pkgrel=1
arch=(x86_64)
url='https://github.com/GPUOpen-Drivers/AMDVLK'
license=(MIT)
source=(https://github.com/GPUOpen-Drivers/AMDVLK/releases/download/v-${major}/amdvlk_${major}_amd64.deb
        https://github.com/GPUOpen-Drivers/AMDVLK/releases/download/v-${major}/amdvlk_${major}_i386.deb)

extract_deb(){
  local tmpdir="$(basename "${1%.deb}")"
  rm -Rf "$tmpdir"
  mkdir "$tmpdir"
  cd "$tmpdir"
  ar x "$1"
  tar -C "${pkgdir}" -xf data.tar.gz
}

move_libdir(){
  local deb_libdir="$1"
  local arch_libdir="$2"

  if [ -d "${pkgdir}/${deb_libdir}" ]; then
    if [ ! -d "${pkgdir}/${arch_libdir}" ]; then
      mkdir -p "${pkgdir}/${arch_libdir}"
    fi
    mv -t "${pkgdir}/${arch_libdir}/" "${pkgdir}/${deb_libdir}"/*
    find ${pkgdir} -type d -empty -delete
  fi
}

move_copyright(){
  find ${pkgdir}/usr/share/doc -name "changelog.Debian.gz" -delete
  mkdir -p ${pkgdir}/usr/share/licenses/${pkgname}
  find ${pkgdir}/usr/share/doc -name "copyright" -exec mv {} ${pkgdir}/usr/share/licenses/${pkgname} \;
  find ${pkgdir}/usr/share/doc -type d -empty -delete
}

package_amdvlk-bin(){
  pkgdesc="AMD's standalone Vulkan driver (Stable DEB Release)"
  arch=(x86_64)
  conflicts=(amdvlk)
  provides=(amdvlk vulkan-driver)

  extract_deb "${srcdir}"/amdvlk_${major}_amd64.deb

  move_libdir "usr/lib/x86_64-linux-gnu" "usr/lib"
  move_libdir "etc" "usr/share"

  sed -i 's|/x86_64-linux-gnu||' "$pkgdir/"usr/share/vulkan/icd.d/amd_icd64.json
  sed -i 's|/x86_64-linux-gnu||' "$pkgdir/"usr/share/vulkan/implicit_layer.d/amd_icd64.json
  mv "$pkgdir/"usr/share/vulkan/implicit_layer.d/amd_icd64.json "$pkgdir/"usr/share/vulkan/implicit_layer.d/amd_icd64.json.hide

  move_copyright
  mv "$pkgdir"/usr/share/doc/amdvlk/LICENSE.txt "$pkgdir"/usr/share/licenses/${pkgname}/
  rm -rf "$pkgdir"/usr/share/doc

  # fix package file permission
  # filesystem: 755  package: 775
  chmod -R 755 "$pkgdir"/usr
}

package_lib32-amdvlk-bin(){
  pkgdesc="AMD's standalone Vulkan driver (32-bit) (Stable DEB Release)"
  arch=(i686 x86_64)
  depends=(amdvlk-bin=${major})
  conflicts=(lib32-amdvlk)
  provides=(lib32-amdvlk lib32-vulkan-driver)

  extract_deb "${srcdir}"/amdvlk_${major}_i386.deb

  move_libdir "usr/lib/i386-linux-gnu" "usr/lib32"
  move_libdir "etc" "usr/share"

  sed -i 's|/i386-linux-gnu||' "$pkgdir/"usr/share/vulkan/icd.d/amd_icd32.json
  sed -i 's|/lib|/lib32|' "$pkgdir/"usr/share/vulkan/icd.d/amd_icd32.json
  sed -i 's|/i386-linux-gnu||' "$pkgdir/"usr/share/vulkan/implicit_layer.d/amd_icd32.json
  sed -i 's|/lib|/lib32|' "$pkgdir/"usr/share/vulkan/implicit_layer.d/amd_icd32.json

  mv "$pkgdir/"usr/share/vulkan/implicit_layer.d/amd_icd32.json "$pkgdir/"usr/share/vulkan/implicit_layer.d/amd_icd32.json.hide

  move_copyright
  mv "$pkgdir"/usr/share/doc/amdvlk/LICENSE.txt "$pkgdir"/usr/share/licenses/${pkgname}/
  rm -rf "$pkgdir"/usr/share/doc

  # fix package file permission
  # filesystem: 755  package: 775
  chmod -R 755 "$pkgdir"/usr
}

sha256sums=('be39b8eaf9124239b389841a21e39b9279e53aab1740fa27f3e4f31ddce9dbea'
            'b103190996520cef587edfdf575bfdb7bea76b23ecef8870da8622b118b901c9')

# vim:set ts=8 sts=2 sw=2 et: