summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b21b7095593ae9d177f816a43590e6350888aa3b (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
# Maintainer: kharovtobi <tugboat_khatov at outlook dot com>

pkgname=qemu-3dfx
_pkgver=9.2.2
pkgver=9.2.2.r461.184ac91
pkgrel=1
pkgdesc="MESA GL/3Dfx Glide pass-through for QEMU"
arch=('x86_64')
url="https://github.com/kjliew/qemu-3dfx"
license=('GPL-2.0')
depends=('qemu-base' 'seabios')
makedepends=(
    "alsa-lib"
    "brltty"
    "bzip2"
    "cairo"
    "capstone"
    "cdrtools"
    "coreutils"
    "curl"
    "djgpp-binutils"
    "djgpp-djcrx"
    "djgpp-gcc"
    "dos2unix"
    "dtc"
    "fuse3"
    "gcc-libs"
    "gdk-pixbuf2"
    "git"
    "glib2"
    "glibc"
    "glib2-devel"
    "glusterfs"
    "gnutls"
    "gtk3"
    "jack"
    "keyutils"
    "libaio"
    "libbpf"
    "libcacard"
    "libcap-ng"
    "libepoxy"
    "libiscsi"
   "libnfs"
    "libpipewire"
    "libpng"
    "libpulse"
    "libsasl"
    "libseccomp"
    "libslirp"
    "libssh"
    "liburing"
    "libusb"
    "libx11"
    "libxdp"
    "libxkbcommon"
    "libxml2"
    "lzo"
    "mesa"
    "meson"
    "multipath-tools"
    "mingw-w64-binutils"
    "mingw-w64-gcc"
    "mingw-w64-tools"
    "ncurses"
    "ninja"
    "ndctl"
    "openwatcom-v2"
    "numactl"
    "patch"
    "pam"
    "pcre2"
    "python"
    "python-setuptools"
    "python-distlib"
    "python-pip"
    "python-sphinx"
    "python-sphinx_rtd_theme"
    "pixman"
    "rsync"
    "sdl2"
    "sdl2_image"
    "snappy"
    "spice"
    "spice-protocol"
    "systemd"
    "usbredir"
    "vde2"
    "virglrenderer"
    "vte3"
    "xxd"
    "zlib"
    "zstd"
)
optdepends=(
    "qemu-docs: for documentation and learning invocation"
    "openglide-3dfx: for host openglide support"
)

provides=('qemu-3dfx')
conflicts=('qemu-3dfx')
source=(
    "git+https://github.com/kjliew/qemu-3dfx.git"
    "https://download.qemu.org/qemu-${_pkgver}.tar.xz"
    "${pkgname}.install"
)
noextract=("qemu-${_pkgver}.tar.xz")
sha256sums=(
    'SKIP'
    '752eaeeb772923a73d536b231e05bcc09c9b1f51690a41ad9973d900e4ec9fbf'
    'b94ec59a18f2fc8c0eda31860d2eeed2bf92fe66db773b917de311dece796bf0'
)
install=${pkgname}.install

pkgver() {
    cd "$srcdir"/"$pkgname"
    echo ${_pkgver}.r$(git rev-list --count HEAD).$(git rev-parse --short=7 HEAD)
}

prepare() {
    cd "$srcdir"/
    tar xf qemu-${_pkgver}.tar.xz -C "$pkgname"
    cd "$pkgname"/qemu-${_pkgver}
    rsync -r ../qemu-0/hw/3dfx ../qemu-1/hw/mesa ./hw/

    # Change patch per major release
    patch -p0 -i  ../00-qemu92x-mesa-glide.patch

    bash ../scripts/sign_commit
    rm -rf "$srcdir"/"$pkgname"/build
    mkdir -p "$srcdir"/"$pkgname"/build
}

build() {
    # Build QEMU
    cd "$srcdir"/"$pkgname"/build
    ../qemu-${_pkgver}/configure --target-list="i386-softmmu" --prefix=/usr --disable-xen --disable-libnfs --extra-cflags="-march=native -mtune=native -O3 -flto=auto"
    make clean
    make -j$(nproc) qemu-system-i386

    # Build Wrappers
    source /opt/watcom/owsetenv.sh
    cd ../wrappers/3dfx
    rm -rf build && mkdir build && cd build
    bash ../../../scripts/conf_wrapper
    sed -i 's/^DXEGEN=dxe3gen$/DXEGEN=i686-pc-msdosdjgpp-dxe3gen/' ../dxe/Makefile
    make && make clean
    cd ../../mesa
    rm -rf build && mkdir build && cd build
    bash ../../../scripts/conf_wrapper

    # Add wglinfo.exe to makefile
    sed -i 's/^TOOLS=$/TOOLS=wglinfo.exe/' Makefile
    make && make clean

    # Package Wrappers
    cd ../../
    rm -rf iso && mkdir iso && cd iso
    mkdir wrapfx wrapgl
    cp -f ../3dfx/build/*.{vxd,sys,dll,dxe,ovl,exe} ./wrapfx/
    cp -f ../mesa/build/*.{dll,exe} ./wrapgl/
    cp -r ../../LICENSE license.txt
    echo ${pkgver} > commit\ id.txt
    unix2dos commit\ id.txt license.txt
    mkisofs -JR -V "VMWRAPPER-$(git log --format="%h" -n 1)" -o ../wrappers.iso ../iso
}

package() {
    install -Dm644 "$srcdir"/"$pkgname"/LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
    install -Dm644 "$srcdir"/"$pkgname"/wrappers/wrappers.iso "$pkgdir"/usr/share/"$pkgname"/wrappers.iso
    install -Dm755 "$srcdir"/"$pkgname"/build/qemu-system-i386 "$pkgdir"/usr/bin/qemu-3dfx-system-i386
    mkdir -p "$pkgdir"/usr/share/man/man1/
    ln -sf /usr/share/man/man1/qemu.1.gz "$pkgdir"/usr/share/man/man1/qemu-3dfx-system-i386.1.gz
}