summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2b505c39a39c2400dd6006500c733b883d1290de (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
# Maintainer:  Vincent Grande <shoober420@gmail.com>
# Contributor: loathingkernel <loathingkernel @at gmail .dot com>
# Contributor: AdriƠ Cereto i MassaguƩ <ssorgatem at gmail.com>

# This package needs reinstalled after every Proton update.

pkgname=('dxvk-mingw-proton-ge-async-git')
pkgver=1.5.r3.ga265af74
pkgrel=1
pkgdesc="A Vulkan-based compatibility layer for Direct3D 9/10/11 which allows running 3D applications on Linux using Wine. Windows DLL version)"
arch=('x86_64')
url="https://github.com/doitsujin/dxvk"
license=('zlib/libpng')
depends=('vulkan-icd-loader' 'wine>=4.0rc1' 'lib32-vulkan-icd-loader')
provides=("dxvk" "d9vk" "dxvk=$pkgver")
makedepends=('ninja' 'meson>=0.43' 'glslang' 'mingw-w64-gcc' 'git' 'wine')
conflicts=('d9vk-mingw-git' 'dxvk-mingw-git' 'dxvk-mingw' 'dxvk-winelib' 'd9vk-bin' 'd9vk-winelib-git' "dxvk-bin" "dxvk-git" "dxvk-wine32-git" "dxvk-wine64-git" "dxvk-win32-git" "dxvk-win64-git" "dxvk-winelib-git")
options=(!strip staticlibs)
source=("git+https://github.com/doitsujin/dxvk.git"
	"dxvk-async.patch"
        "extraopts.patch")
sha256sums=("SKIP"
	    "SKIP"
            "SKIP")
install=$pkgname.install

pkgver() {
    cd dxvk
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g'
}

prepare() {
    cd dxvk

    # Uncomment to enable extra optimizations
    # Patch crossfiles with extra optimizations from makepkg.conf
    patch -p1 -i "$srcdir"/extraopts.patch
    local dxvk_cflags="$CFLAGS"
    local dxvk_ldflags="$LDFLAGS"
    # Filter known bad flags before applying optimizations
    # If using -march=native and the CPU supports AVX, launching a d3d9
    # game can cause an Unhandled exception. The cause seems to be the
    # combination of AVX instructions and tree vectorization (implied by O3),
    # all tested archictures from sandybridge to haswell are affected.
    # Disabling AVX (and AVX2 as a side-effect).
    # Relevant Wine issues
    # https://bugs.winehq.org/show_bug.cgi?id=45289
    # https://bugs.winehq.org/show_bug.cgi?id=43516                                               
    dxvk_cflags+=" -mno-avx"                                                                      
    # Filter fstack-protector{ ,-all,-strong} flag for MingW.
    # https://github.com/Joshua-Ashton/d9vk/issues/476                                            
    #dxvk_cflags+=" -fno-stack-protector"
    dxvk_cflags="${dxvk_cflags// -fstack-protector*([\-all|\-strong])/}"                          
    # Adjust optimization level in meson arguments. This is ignored
    # anyway because meson sets its own optimization level.
    dxvk_cflags="${dxvk_cflags// -O+([0-3s]|fast)/}"                                              
    # Doesn't compile with these flags in MingW so remove them.
    # They are also filtered in Wine PKGBUILDs so remove them
    # for winelib versions too.                                                                   
    dxvk_cflags="${dxvk_cflags/ -fno-plt/}"
    dxvk_ldflags="${dxvk_ldflags/,-z,now/}"
    dxvk_ldflags="${dxvk_ldflags/,-z,relro/}"                                                     
    sed -i build-win64.txt \
	-e "s|@CARGS@|\'${dxvk_cflags// /\',\'}\'|g" \
	-e "s|@LDARGS@|\'${dxvk_ldflags// /\',\'}\'|g"                                            
    sed -i build-win32.txt \
	-e "s|@CARGS@|\'${dxvk_cflags// /\',\'}\'|g" \
	-e "s|@LDARGS@|\'${dxvk_ldflags// /\',\'}\'|g"                                                                                              
    # Uncomment to enable dxvk async patch.
    # Enable at your own risk. If you don't know what it is,                                    
    # and its implications, leave it as is. You have been warned.                               
    # I am not liable if anything happens to you by using it.                                   
    # Patch enables async by default. YOU HAVE BEEN WARNED.
    patch -p1 -i "$srcdir"/dxvk-async.patch                                                     
}                                     

build() {
    meson dxvk "build/x64" \
        --cross-file dxvk/build-win64.txt \
        --prefix "/usr/share/dxvk/x64" \
        --bindir "" --libdir "" \
        --buildtype "release" \
        --strip \
        -D enable_tests=false
    ninja -C "build/x64"

    meson dxvk "build/x32" \
        --cross-file dxvk/build-win32.txt \
        --prefix "/usr/share/dxvk/x32" \
        --bindir "" --libdir "" \
        --buildtype "release" \
        --strip \
        -D enable_tests=false
    ninja -C "build/x32"
}

package_dxvk-mingw-proton-ge-async-git() {
        arch=('x86_64')
        conflicts=("dxvk-bin")
        DESTDIR="$pkgdir" ninja -C "build/x32" install
        DESTDIR="$pkgdir" ninja -C "build/x64" install
        install -Dm 644 dxvk/setup_dxvk.sh "$pkgdir/usr/share/dxvk/setup_dxvk.sh"
        mkdir -p "$pkgdir/usr/bin"
        ln -s /usr/share/dxvk/setup_dxvk.sh "$pkgdir/usr/bin/setup_dxvk"
        chmod +x "$pkgdir/usr/share/dxvk/setup_dxvk.sh"

        mkdir -p ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom/dist/lib/wine/dxvk/
	mkdir -p ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-stable/dist/lib/wine/dxvk/
	mkdir -p ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-legacy/dist/lib/wine/dxvk/

	mkdir -p ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom/dist/lib64/wine/dxvk/
	mkdir -p ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-stable/dist/lib64/wine/dxvk/
	mkdir -p ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-legacy/dist/lib64/wine/dxvk/

	cp -r ${pkgdir}/usr/share/dxvk/x32/* ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom/dist/lib/wine/dxvk/
	cp -r ${pkgdir}/usr/share/dxvk/x32/* ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-stable/dist/lib/wine/dxvk/
	cp -r ${pkgdir}/usr/share/dxvk/x32/* ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-legacy/dist/lib/wine/dxvk/

	cp -r ${pkgdir}/usr/share/dxvk/x64/* ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom/dist/lib64/wine/dxvk/
	cp -r ${pkgdir}/usr/share/dxvk/x64/* ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-stable/dist/lib64/wine/dxvk/
	cp -r ${pkgdir}/usr/share/dxvk/x64/* ${pkgdir}/usr/share/steam/compatibilitytools.d/proton-ge-custom-legacy/dist/lib64/wine/dxvk/
}