summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 42c516bd8f7bcbe25f624516e78f382cde61057d (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
# Maintainer: bananasjim <bananasjim1@gmail.com>
pkgname=rdc-cli-git
pkgver=0.1.0.r0.g0000000
pkgrel=1
pkgdesc="Unix-friendly CLI for RenderDoc .rdc captures"
arch=('x86_64')
url="https://github.com/BANANASJIM/rdc-cli"
license=('MIT')
depends=(
  'python'
  'python-click'
  'python-pillow'
  'python-numpy'
  'libx11'
  'libxcb'
  'xcb-util-keysyms'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-setuptools-scm'
  'python-wheel'
  'cmake'
  'ninja'
  'pcre'
)
optdepends=(
  'python-rich: colored output support'
)
provides=('rdc-cli')
conflicts=('rdc-cli')
source=(
  "git+https://github.com/BANANASJIM/rdc-cli.git"
  "git+https://github.com/baldurk/renderdoc.git#tag=v1.41"
  "renderdoc-swig::https://github.com/baldurk/swig/archive/renderdoc-modified-7.zip"
)
sha256sums=('SKIP'
            'SKIP'
            '9d7e5013ada6c42ec95ab167a34db52c1cc8c09b89c8e9373631b1f10596c648')

pkgver() {
  cd rdc-cli
  git describe --long --tags 2>/dev/null | sed 's/^v//;s/-/.r/;s/-/./' ||
    printf "0.2.0.r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  # Build renderdoc Python module (pyrenderdoc only, no Qt UI)
  # Disable LTO — breaks SWIG-generated Python bindings
  export CFLAGS="${CFLAGS//-flto=auto/}"
  export CXXFLAGS="${CXXFLAGS//-flto=auto/}"
  export LDFLAGS="${LDFLAGS//-flto=auto/}"

  cd renderdoc
  cmake -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_PYRENDERDOC=ON \
    -DENABLE_QRENDERDOC=OFF \
    -DENABLE_RENDERDOCCMD=OFF \
    -DENABLE_GL=OFF \
    -DENABLE_GLES=OFF \
    -DENABLE_VULKAN=ON \
    -DRENDERDOC_SWIG_PACKAGE="$srcdir/renderdoc-swig"
  cmake --build build

  # Build rdc-cli wheel
  cd "$srcdir/rdc-cli"
  python -m build --wheel --no-isolation

  # Generate shell completion scripts
  PYTHONPATH="$srcdir/rdc-cli/src" python -c "
from rdc.commands.completion import _generate
for shell, path in [('bash','$srcdir/rdc.bash'),('zsh','$srcdir/_rdc'),('fish','$srcdir/rdc.fish')]:
    with open(path, 'w') as f:
        f.write(_generate(shell))
"
}

package() {
  # Install rdc-cli
  cd rdc-cli
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Install renderdoc Python module
  local _site="$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
  install -Dm755 "$srcdir/renderdoc/build/lib/renderdoc.so" "$pkgdir/$_site/renderdoc.so"
  install -Dm755 "$srcdir/renderdoc/build/lib/librenderdoc.so" "$pkgdir/$_site/librenderdoc.so"

  # Install shell completions
  install -Dm644 "$srcdir/rdc.bash" "$pkgdir/usr/share/bash-completion/completions/rdc"
  install -Dm644 "$srcdir/_rdc" "$pkgdir/usr/share/zsh/site-functions/_rdc"
  install -Dm644 "$srcdir/rdc.fish" "$pkgdir/usr/share/fish/vendor_completions.d/rdc.fish"

  # Install license
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}