summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: de78459e313ccc609157912dfa2d73b0c4e3f7b5 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Maintainer: LetalexAlex <letalexalexx@gmail.com>
pkgname=arrowvortex-linux-git
pkgver=r363.06b8454
pkgver() {
    cd "$srcdir/ArrowVortex"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
pkgrel=4
pkgdesc="Stepmania .sm/.ssc simfile editor (linux port branch)"
arch=('x86_64')
options=('!debug' '!lto')
url="https://github.com/uvcat7/ArrowVortex/tree/linux"
license=('GPL-3.0-or-later')
provides=('arrowvortex')
conflicts=('arrowvortex')
depends=(
    'libgl'
    'libx11'
    'libxext'
    'libxrandr'
    'libxcursor'
    'libxfixes'
    'libxi'
    'libxss'
    'wayland'
    'libxkbcommon'
    'libdrm'
    'mesa'
    'alsa-lib'
    'libpulse'
    'jack'
)
makedepends=(
    'git'
    'cmake'
    'ninja'
    'pkg-config'
    'python'
    'python-jinja'
    'curl'
    'zip'
    'unzip'
    'tar'
    'libxrandr'
    'libxcursor'
    'libxfixes'
    'libxi'
    'libxss'
    'wayland-protocols'
    'libdecor'
    'libusb'
    'sndio'
    'libltdl'
    'autoconf'
    'autoconf-archive'
    'nasm'
    'automake'
    'libtool'
    'libxft'
)
source=(
    "ArrowVortex::git+https://github.com/uvcat7/ArrowVortex.git#branch=linux"
    "vcpkg::git+https://github.com/microsoft/vcpkg.git"
    'disable-warning-override-init.patch'
    'arrowvortex.desktop'
)
sha256sums=('SKIP' 'SKIP' '30d7372ac951080222f866d76e5aa89b0616af0ebfb559646faa37d3b8b5b8b3' '9b625ea1fffd71cd165f195244ed979b8723d4d6531f7c48b08a6824dd82e963')

prepare() {
    cd "$srcdir"

    # Ensure we use system tools (important for clean-chroot reproducibility;
    # also avoids picking up user pyenv shims during local builds).
    export PATH='/usr/bin:/usr/sbin:/bin:/sbin'

    # CMakeLists.txt unconditionally sets CMAKE_CXX_CLANG_TIDY with
    # --warnings-as-errors=*, which fires on SDL3 headers we don't control.
    # Patch it out before configuring.
    sed -i 's/^set(CMAKE_CXX_CLANG_TIDY.*/# clang-tidy disabled for packaging/' \
        ArrowVortex/CMakeLists.txt

    # Pin vcpkg to the exact baseline declared in vcpkg.json for reproducibility
    local baseline
    baseline=$(grep -o '"baseline": *"[^"]*"' ArrowVortex/vcpkg.json | grep -o '[a-f0-9]\{40\}')
    echo "Checking out vcpkg baseline: $baseline"
    git -C vcpkg checkout "$baseline"

    cd vcpkg
    VCPKG_DISABLE_METRICS=1 ./bootstrap-vcpkg.sh -disableMetrics

    # vcpkg's libsystemd port can fail on newer glibc errno sets (e.g. EFSBADCRC)
    # due to systemd using -Werror=override-init in its Meson warning list.
    # Overlay the port and relax that one flag.
    local overlay="$srcdir/vcpkg-overlays/libsystemd"
    mkdir -p "$overlay"
    cp -a "$srcdir/vcpkg/ports/libsystemd/." "$overlay/"
    cp "$srcdir/disable-warning-override-init.patch" "$overlay/"
    if ! grep -q disable-warning-override-init "$overlay/portfile.cmake"; then
        sed -i '/disable-warning-nonnull.patch/a\    disable-warning-override-init.patch' \
            "$overlay/portfile.cmake"
    fi
}

build() {
    cd "$srcdir/ArrowVortex"

    export PATH='/usr/bin:/usr/sbin:/bin:/sbin'
    export VCPKG_ROOT="$srcdir/vcpkg"
    export VCPKG_DISABLE_METRICS=1

    cmake \
        -B build \
        -S . \
        -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
        -DVCPKG_OVERLAY_PORTS="$srcdir/vcpkg-overlays" \
        -DVCPKG_TARGET_TRIPLET=x64-linux \
        -DYML=1

    cmake --build build
}

package() {
    cd "$srcdir/ArrowVortex"

    # Binary
    install -Dm755 build/src/System/ArrowVortex "$pkgdir/usr/bin/ArrowVortex"

    # Data directories
    install -dm755 "$pkgdir/usr/share/arrowvortex"
    cp -r bin/assets    "$pkgdir/usr/share/arrowvortex/"
    cp -r bin/noteskins "$pkgdir/usr/share/arrowvortex/"
    cp -r bin/settings  "$pkgdir/usr/share/arrowvortex/"

    # Wrapper script: sets working directory so the binary finds its assets
    install -Dm755 /dev/stdin "$pkgdir/usr/bin/arrowvortex" <<'EOF'
#!/bin/sh
cd /usr/share/arrowvortex
exec /usr/bin/ArrowVortex "$@"
EOF

    # Desktop entry
    install -Dm644 "$srcdir/arrowvortex.desktop" \
        "$pkgdir/usr/share/applications/arrowvortex.desktop"

    # Icon
    install -Dm644 \
        "bin/assets/arrow vortex icon.png" \
        "$pkgdir/usr/share/pixmaps/arrowvortex.png"
}