aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 699ba7a30143dbc76d6a4dc39ba10e711d77758c (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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# Maintainer: Your Name <your.email@example.com>
pkgname=wine-asahi-git
pkgver=10.16
pkgrel=1
pkgdesc="Wine with ARM64EC support for Asahi Linux (16k pages)"
arch=('aarch64')
url="https://www.winehq.org/"
license=('LGPL-2.1-or-later')
depends=(
    'desktop-file-utils'
    'fontconfig'
    'freetype2'
    'gcc-libs'
    'gettext'
    'gst-plugins-base-libs'
    'libgphoto2'
    'libpcap'
    'libusb'
    'libx11'
    'libxext'
    'libxrandr'
    'libxrender'
    'libxinerama'
    'libxcomposite'
    'libxcursor'
    'libxi'
    'libxxf86vm'
    'alsa-lib'
    'gnutls'
    'vulkan-icd-loader'
    'sdl2'
    'v4l-utils'
    'libcups'
    'sane'
    'libgcrypt'
    'libpulse'
    'opencl-icd-loader'
    'libldap'
    'mpg123'
    'gst-plugins-base'
    'systemd-libs'
    'fex-emu-wine'
)
makedepends=(
    'git'
    'autoconf'
    'bison'
    'flex'
    'clang'
    'lld'
    'llvm'
    'gcc'
    'make'
    'linux-api-headers'
    'alsa-lib'
    'cups'
    'dbus'
    'fontconfig'
    'freetype2'
    'gettext'
    'giflib'
    'gnutls'
    'gst-plugins-base-libs'
    'libgphoto2'
    'libpcap'
    'libpulse'
    'libusb'
    'libx11'
    'libxcomposite'
    'libxcursor'
    'libxext'
    'libxi'
    'libxinerama'
    'libxrandr'
    'libxrender'
    'libxxf86vm'
    'mesa'
    'mpg123'
    'opencl-headers'
    'ocl-icd'
    'openldap'
    'sane'
    'sdl2'
    'systemd'
    'v4l-utils'
    'vulkan-headers'
    'vulkan-icd-loader'
    'libxkbcommon'
    'wayland'
    'icoutils'
    'librsvg'
    'unixodbc'
    'libieee1284'
    'libpcap'
    'gsm'
    'gtk3'
    'libva'
)
provides=('wine' 'wine-wow64' 'wine-arm64ec-git')
conflicts=('wine' 'wine-arm64ec-git')
options=('staticlibs' '!lto')
install=wine-asahi.install

source=(
    "wine::git+https://gitlab.winehq.org/wine/wine.git#tag=wine-10.16"
    "wine-staging::git+https://gitlab.winehq.org/wine/wine-staging.git#tag=v10.16"
    "2025.08.22_bylaws-wine_upstream-arm64ec_hack_v2.patch"
)
sha256sums=('SKIP'
            'SKIP'
            'SKIP')

pkgver() {
    cd "$srcdir/wine"
    git describe --tags | sed 's/^wine-//;s/-/./g'
}

prepare() {
    cd "$srcdir/wine"

    # Apply wine-staging patches
    "$srcdir/wine-staging/staging/patchinstall.py" DESTDIR="$PWD" --all -W server-Stored_ACLs

    # Apply ARM64EC patches
    # Note: Wine 10.16 already has built-in ntsync support, no patch needed
    patch -Np1 -F3 -i "$srcdir/2025.08.22_bylaws-wine_upstream-arm64ec_hack_v2.patch"

    # Remove -Wl,-WX flag that causes issues with --as-needed
    sed -i 's/-Wl,-WX//g' configure

    autoreconf -fiv
}

build() {
    cd "$srcdir/wine"

    # Remove problematic flags
    export CFLAGS="${CFLAGS/-fcf-protection/}"
    export CFLAGS="${CFLAGS/-fstack-protector-strong/}"
    export CFLAGS="${CFLAGS/-fstack-clash-protection/}"
    export CFLAGS="${CFLAGS/-mbranch-protection=standard/}"
    export CXXFLAGS="${CXXFLAGS/-fcf-protection/}"
    export CXXFLAGS="${CXXFLAGS/-fstack-protector-strong/}"
    export CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}"
    export CXXFLAGS="${CXXFLAGS/-mbranch-protection=standard/}"

    # Disable fortify
    export CPPFLAGS="${CPPFLAGS/-D_FORTIFY_SOURCE=2/}"
    export CPPFLAGS="${CPPFLAGS/-D_FORTIFY_SOURCE=3/}"

    # Clean LDFLAGS - remove problematic linker flags
    export LDFLAGS="${LDFLAGS/-Wl,-z,relro/}"
    export LDFLAGS="${LDFLAGS/-Wl,--as-needed/}"
    export LDFLAGS="${LDFLAGS/--as-needed/}"
    # Remove any empty -Wl, flags that might be left behind
    export LDFLAGS="${LDFLAGS/-Wl, /}"

    # Required for development files
    unset PKG_CONFIG_PATH

    ./configure \
        --prefix=/usr \
        --libdir=/usr/lib \
        --sysconfdir=/etc/wine \
        --with-x \
        --with-dbus \
        --with-wayland \
        --with-xattr \
        --enable-win64 \
        --enable-archs=arm64ec,aarch64,i386 \
        --with-mingw=clang \
        --disable-tests

    make
}

package() {
    cd "$srcdir/wine"

    make prefix="$pkgdir/usr" \
         libdir="$pkgdir/usr/lib" \
         dlldir="$pkgdir/usr/lib/wine" \
         install

    # Setup wine/wineserver alternatives
    mv "$pkgdir/usr/bin/wine" "$pkgdir/usr/bin/wine64"
    mv "$pkgdir/usr/bin/wineserver" "$pkgdir/usr/bin/wineserver64"
    ln -s wine64 "$pkgdir/usr/bin/wine"
    ln -s wineserver64 "$pkgdir/usr/bin/wineserver"

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