summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2e97a89917237215624eacd83a8a6c993a5b5434 (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
153
154
155
156
157
158
159
160
161
# Maintainer: HamletDuFromage <https://github.com/HamletDuFromage/slippi-mainline-PKGBUILD/issues>

pkgname="slippi-mainline"
pkgver='v4.0.0.mainline.beta.6.r0.ge47ee53b56'
pkgrel=1
pkgdesc='https://slippi.gg/about'
arch=('x86_64')
url="https://github.com/project-slippi/dolphin"
license=('GPL2')
depends=('alsa-lib'
         'bluez-libs'
         'bzip2'
         'enet'
         'gcc-libs'
         'glibc'
         'hidapi'
         'libavcodec.so'
         'libavformat.so'
         'libavutil.so'
         'libcurl.so'
         'libevdev'
         'libfmt.so'
         'libgl'
         'libpulse'
         'libsfml-network.so'
         'libsfml-system.so'
         'libspng.so'
         'libswscale.so'
         'libudev.so'
         'libusb-1.0.so'
         'libx11'
         'libxi'
         'libxrandr'
         'libxxhash.so'
         'lzo'
         'mbedtls2'
         'pugixml'
         'qt6-base'
         'qt6-svg'
         'sfml'
         'speexdsp'
         'xz'
         'zlib-ng'
         'zstd'
)

makedepends=('cmake' 'git' 'miniupnpc' 'ninja' 'python' 'qt6-base' 'qt6-svg' 'cargo')
optdepends=('pulseaudio: PulseAudio backend')
options=('!lto')

#commit='bdd90056759b59928f21d6e8f21697c4df0ee04d'
tag='v4.0.0-mainline-beta.6'

source=(
        #"$pkgname::git+https://github.com/project-slippi/dolphin.git#commit=${commit}"
        "$pkgname::git+https://github.com/project-slippi/dolphin.git#tag=${tag}"
        "$pkgname-implot::git+https://github.com/epezent/implot.git"
        "$pkgname-rcheevos::git+https://github.com/RetroAchievements/rcheevos.git"
        "$pkgname-corrosion::git+https://github.com/corrosion-rs/corrosion.git"
        "$pkgname-slippi-rust-extensions::git+https://github.com/project-slippi/slippi-rust-extensions.git"
        "$pkgname-vma::git+https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git"
        "$pkgname-enet::git+https://github.com/lsalzman/enet.git"
        "$pkgname-cubeb::git+https://github.com/mozilla/cubeb.git"
        "$pkgname-sanitizers-cmake::git+https://github.com/arsenm/sanitizers-cmake.git"
        "$pkgname.svg"
        "$pkgname.desktop"
)
sha512sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
)

_sourcedirectory="$pkgname"
_dolphinemu="dolphin-emu"

prepare() {
        cd "$srcdir/$_sourcedirectory/"
        if [ -d 'build/' ]; then rm -rf 'build/'; fi
        mkdir 'build/'

        if ["$(grep 'if (IsOpen())' "$srcdir/$_sourcedirectory/Source/Core/Common/IOFile.h")" == ""]; then
            curl -o $srcdir/001_fix_nonnull.patch https://github.com/dolphin-emu/dolphin/commit/3da2e15e6b95f02f66df461e87c8b896e450fdab.patch
            patch --forward -p1 < "$srcdir/001_fix_nonnull.patch"
        fi

        # Provide submodules
        declare -A _submodules=(
                [enet]='enet/enet'
                [implot]='implot/implot'
                [rcheevos]='rcheevos/rcheevos'
                [vma]='VulkanMemoryAllocator'
                [corrosion]='corrosion'
                [slippi-rust-extensions]='SlippiRustExtensions'
                [cubeb]='cubeb'
        )

        for _submod in "${!_submodules[@]}"; do
                _path="Externals/${_submodules[$_submod]}"
                git submodule init "$_path"
                git config "submodule.$_path.url" "$srcdir/$pkgname-$_submod/"
                git -c protocol.file.allow=always submodule update "$_path"
        done

        cd Externals/cubeb/cubeb
        git submodule init cmake/sanitizers-cmake
        git config submodule.cmake/sanitizers-cmake.url "${srcdir}"/"$pkgname"-sanitizers-cmake
        git -c protocol.file.allow=always submodule update cmake/sanitizers-cmake
}

pkgver() {
        cd "$srcdir/$_sourcedirectory/"
        git checkout --quiet "$(git rev-list -n 1 $(git describe --tags --abbrev=0))"
        git describe --long --tags | sed -e 's/-\([^-]*-g[^-]*\)$/-r\1/' -e 's/-/./g'
}

build() {
        cd "$srcdir/$_sourcedirectory/"
        export LDFLAGS+=" -Wl,--copy-dt-needed-entries"

        cmake -S '.' -B 'build/' -G Ninja \
                -DLINUX_LOCAL_DEV=true \
                -DCMAKE_BUILD_TYPE=None \
                -DSLIPPI_PLAYBACK=false \
                -DUSE_SYSTEM_LIBS=ON \
                -DENABLE_TESTS=OFF \
                -DENABLE_NOGUI=OFF \
                -DENABLE_CLI_TOOL=OFF \
                -DUSE_SYSTEM_LIBMGBA=OFF \
                -DUSE_SYSTEM_ENET=OFF \
                -DUSE_SYSTEM_MINIZIP=OFF \
                -Wno-dev

        cmake --build 'build/'
}

package() {
        pkgdesc="$pkgdesc"
        provides=("$pkgname")
        conflicts=("$pkgname" "slippi-online")

        cd "$srcdir/$_sourcedirectory/"
        DESTDIR="$pkgdir" cmake --install 'build/'
        mv "$pkgdir/usr/local/bin/$_dolphinemu" "$pkgdir/usr/local/bin/$pkgname"
        cp -r "Data/Sys/" "$pkgdir/usr/local/bin/"
        rm -r "$pkgdir/usr/local/share/man/"
        install -Dm644 'build/cargo/build/x86_64-unknown-linux-gnu/release/libslippi_rust_extensions.so' "$pkgdir/usr/lib/libslippi_rust_extensions.so"
        rm -rf "$pkgdir/usr/include"
        rm -rf "$pkgdir/usr/lib/libdiscord-rpc.a"

        mkdir "$pkgdir/usr/local/share/pixmaps/"
        cp "$srcdir/$pkgname.svg" "$pkgdir/usr/local/share/pixmaps/$pkgname.svg"
        cp "$srcdir/$pkgname.desktop" "$pkgdir/usr/local/share/applications/$pkgname.desktop"
}