1#!/bin/bash 2 3# Pull packages from msys2 repository that can be directly used. 4# We can use https://packages.msys2.org/ to retrieve the newest package 5mkdir ~/tmp 6pushd ~/tmp 7MINGW_PACKET_LIST=" 8mingw-w64-x86_64-headers-git-10.0.0.r14.ga08c638f8-1-any.pkg.tar.zst 9mingw-w64-x86_64-vulkan-loader-1.3.211-1-any.pkg.tar.zst 10mingw-w64-x86_64-libelf-0.8.13-6-any.pkg.tar.zst 11mingw-w64-x86_64-zlib-1.2.12-1-any.pkg.tar.zst 12mingw-w64-x86_64-zstd-1.5.2-2-any.pkg.tar.zst 13" 14 15for i in $MINGW_PACKET_LIST 16do 17 wget -q https://mirror.msys2.org/mingw/mingw64/$i 18 tar xf $i --strip-components=1 -C /usr/x86_64-w64-mingw32/ 19done 20popd 21rm -rf ~/tmp 22 23mkdir -p /usr/x86_64-w64-mingw32/bin 24 25# The output of `wine64 llvm-config --system-libs --cxxflags mcdisassembler` 26# containes absolute path like '-IZ:' 27# The sed is used to replace `-IZ:/usr/x86_64-w64-mingw32/include` 28# to `-I/usr/x86_64-w64-mingw32/include` 29 30# Debian's pkg-config wrapers for mingw are broken, and there's no sign that 31# they're going to be fixed, so we'll just have to fix it ourselves 32# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930492 33cat >/usr/x86_64-w64-mingw32/bin/pkg-config <<EOF 34#!/bin/sh 35 36PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/lib/pkgconfig:/usr/x86_64-w64-mingw32/share/pkgconfig pkg-config \$@ 37EOF 38chmod +x /usr/x86_64-w64-mingw32/bin/pkg-config 39 40cat >/usr/x86_64-w64-mingw32/bin/llvm-config <<EOF 41#!/bin/sh 42wine64 llvm-config \$@ | sed -e "s,Z:/,/,gi" 43EOF 44chmod +x /usr/x86_64-w64-mingw32/bin/llvm-config 45 46cat >/usr/x86_64-w64-mingw32/bin/clang <<EOF 47#!/bin/sh 48wine64 clang \$@ 49EOF 50chmod +x /usr/x86_64-w64-mingw32/bin/clang 51 52cat >/usr/x86_64-w64-mingw32/bin/llvm-as <<EOF 53#!/bin/sh 54wine64 llvm-as \$@ 55EOF 56chmod +x /usr/x86_64-w64-mingw32/bin/llvm-as 57 58cat >/usr/x86_64-w64-mingw32/bin/llvm-link <<EOF 59#!/bin/sh 60wine64 llvm-link \$@ 61EOF 62chmod +x /usr/x86_64-w64-mingw32/bin/llvm-link 63 64cat >/usr/x86_64-w64-mingw32/bin/opt <<EOF 65#!/bin/sh 66wine64 opt \$@ 67EOF 68chmod +x /usr/x86_64-w64-mingw32/bin/opt 69 70cat >/usr/x86_64-w64-mingw32/bin/llvm-spirv <<EOF 71#!/bin/sh 72wine64 llvm-spirv \$@ 73EOF 74chmod +x /usr/x86_64-w64-mingw32/bin/llvm-spirv 75