Skip to content

Instantly share code, notes, and snippets.

@1480c1
Last active February 17, 2023 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1480c1/9340585a2f8096f3b9ea992d147f3cc2 to your computer and use it in GitHub Desktop.
Save 1480c1/9340585a2f8096f3b9ea992d147f3cc2 to your computer and use it in GitHub Desktop.
msys2 on archlinux, maybe. Needs https://github.com/git-for-windows/git/pull/3875 and a few fixes
FROM archlinux:latest
ENV WINEARCH=win64 \
WINEPATH=C:/cmd;C:/mingw64/bin;C:/usr/bin \
WINEPREFIX=/msys64 \
WINEDEBUG=-all \
MSYS2_PREFIX=/msys64/drive_c/ \
PATH=/cmd:/msys64/drive_c/mingw64/bin:/msys64/drive_c/usr/bin:$PATH
RUN mkdir -p /etc/X11/xorg.conf.d/ && \
printf '%s\n' \
'Section "Monitor"' \
' Identifier "dummy_monitor"' \
' HorizSync 28.0-80.0' \
' VertRefresh 48.0-75.0' \
' Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118' \
'EndSection' \
'' \
'Section "Device"' \
' Identifier "dummy_card"' \
' VideoRam 256000' \
' Driver "dummy"' \
'EndSection' \
'' \
'Section "Screen"' \
' Identifier "dummy_screen"' \
' Device "dummy_card"' \
' Monitor "dummy_monitor"' \
' SubSection "Display"' \
' EndSubSection' \
'EndSection' \
> /etc/X11/xorg.conf.d/10-headless.conf
# Setup archlinux's pacman
RUN pacman-key --init && \
pacman-key --populate archlinux
RUN printf %s\\n \
'[multilib]' \
'SigLevel = PackageRequired' \
'Include = /etc/pacman.d/mirrorlist' \
>> /etc/pacman.conf && \
pacman -Syu --noconfirm && \
pacman -Syyuu --noconfirm --needed --overwrite '*' \
curl \
git \
make \
unzip \
parallel \
multilib/wine-staging \
extra/libunwind \
extra/pipewire-jack
# setup wine
RUN wine64 wineboot --init && \
while pgrep wineserver > /dev/null; do sleep 1; done
# Setup bare minimum to get the packages from msys2
# should ideally replicate https://github.com/msys2/msys2-installer/blob/main/make-msys2-installer#L63-L76
# first setup archlinux's pacman to use msys2's repos
RUN printf %s\\n \
'[options]' \
'Architecture = auto' \
'CheckSpace' \
'SigLevel = Required' \
'LocalFileSigLevel = Optional' \
'ILoveCandy' \
'VerbosePkgLists' \
'Color' \
'' \
'[staging]' \
'Server = https://repo.msys2.org/staging/' \
'SigLevel = Never' \
'' \
'[msys]' \
'Include = /etc/pacman.d/mirrorlist.msys' \
'SigLevel = Never' \
> /etc/msys2-pacman.conf
# Install msys2's keyring
RUN git -C / clone https://github.com/msys2/MSYS2-keyring.git && \
make -C /MSYS2-keyring PREFIX=/usr install && \
rm -rf /MSYS2-keyring
# populate msys2's keyring
RUN pacman-key --populate msys2 && \
LATEST_MIRROR=$(curl -Ls "https://repo.msys2.org/msys/x86_64" | grep -o '"pacman-mirrors.*.tar.zst"' | sort -n | tail -n 1 | tr -d '"') && \
pacman -U --noconfirm https://repo.msys2.org/msys/x86_64/${LATEST_MIRROR}
# # clean cache before trying to get the packages
RUN pacman -Scc --noconfirm --ask=20 && \
rm -rf /var/cache/pacman/pkg/*
WORKDIR ${MSYS2_PREFIX}
RUN mkdir -p etc/ var/lib/pacman/ var/log/ tmp/ var/cache/pacman/pkg
RUN pacman-key --init
RUN pacman-key --populate msys2
RUN pacman -Syu --config /etc/msys2-pacman.conf --root ${MSYS2_PREFIX} --noconfirm
RUN pacman -S --config /etc/msys2-pacman.conf --root ${MSYS2_PREFIX} --noconfirm filesystem msys2-runtime
RUN pacman -S --config /etc/msys2-pacman.conf --root ${MSYS2_PREFIX} --noconfirm base
# symlink .exe to non .exe
RUN find ${MSYS2_PREFIX} -name "*.exe" | parallel -n1 ln -s '{}' '{.}'
# RUN pacman --config ${MSYS2_PREFIX}/etc/pacman.conf --root ${MSYS2_PREFIX} -S base
# RUN mkdir -p /etc/profile.d/ && \
# printf '%s\n' \
# '#!/usr/bin/sh' \
# '' \
# 'disable_arch_repos() (' \
# ' for repo in core extra community multilib; do sed -i "/^\[$repo\]$/,/^Include/ s/^/#/" /etc/pacman.conf; done' \
# ')' \
# '' \
# 'enable_arch_repos() (' \
# ' for repo in core extra community multilib; do sed -i "/^#\[$repo\]$/,/^#Include/ s/^#//" /etc/pacman.conf; done' \
# ')' \
# '' \
# 'disable_msys2_repos() (' \
# ' for repo in git-for-windows staging mingw64 msys; do sed -i "/^\[$repo\]$/,/^Include/ s/^/#/" /etc/pacman.conf; done' \
# ')' \
# '' \
# 'enable_msys2_repos() (' \
# ' for repo in git-for-windows staging mingw64 msys; do sed -i "/^#\[$repo\]$/,/^#Include/ s/^#//" /etc/pacman.conf; done' \
# ')' \
# > /etc/profile.d/pac-helpers.sh
# ARG BUST=0
# # required to init the keyring
# RUN . /etc/profile.d/pac-helpers.sh && \
# pacman-key --init && \
# pacman-key --populate archlinux && \
# pacman -Syu --noconfirm && \
# pacman -Syyuu --noconfirm --needed --overwrite '*' curl git make unzip && \
# # Install msys2's keyring
# git -C / clone https://github.com/msys2/MSYS2-keyring.git && \
# make -C /MSYS2-keyring PREFIX=/usr install && \
# rm -rf /MSYS2-keyring && \
# # populate msys2's keyring
# pacman-key --populate msys2 && \
# LATEST_MIRROR=$(curl -Ls "https://repo.msys2.org/msys/x86_64" | grep -o '"pacman-mirrors.*.tar.zst"' | sort -n | tail -n 1 | tr -d '"') && \
# pacman -U --noconfirm https://repo.msys2.org/msys/x86_64/${LATEST_MIRROR} && \
# # add git 4 windows' keyring
# curl -L https://raw.githubusercontent.com/git-for-windows/build-extra/HEAD/git-for-windows-keyring/git-for-windows.gpg | \
# pacman-key --add - && \
# pacman-key --lsign-key E8325679DFFF09668AD8D7B67115A57376871B1C && \
# pacman-key --lsign-key 3B6D86A1BA7701CD0F23AED888138B9E1A9F3986 && \
# # misc changes for pacman.conf
# sed -i 's/^#Color/Color/' /etc/pacman.conf && \
# # Add the different repositories needed
# printf '%s\n' \
# '[multilib]' \
# 'Include = /etc/pacman.d/mirrorlist' \
# '[git-for-windows]' \
# 'Server = https://wingit.blob.core.windows.net/x86-64' \
# '[staging]' \
# 'Server = https://repo.msys2.org/staging/' \
# 'SigLevel = Never' \
# '[mingw64]' \
# 'Include = /etc/pacman.d/mirrorlist.mingw' \
# '[msys]' \
# 'Include = /etc/pacman.d/mirrorlist.msys' \
# >> /etc/pacman.conf && \
# pacman -Scc --noconfirm && \
# rm -rf /var/cache/pacman/pkg/*
# # remove the /bin -> /usr/bin symlink (causes an issue with git-wrappers)
# SHELL [ "/usr/bin/sh", "-c" ]
# CMD [ "/usr/bin/sh", "-l" ]
# RUN rm /bin && \
# mkdir -p /bin && \
# ln -s /usr/bin/sh /usr/bin/bash /usr/bin/perl /bin/ && \
# # pull the latest mirrors
# pacman -Syu --noconfirm --overwrite '*' core/pacman-mirrorlist msys/pacman-mirrors && \
# # finally install the needed mingw64 and wine stuff as needed; prefering arch's packages
# pacman -Syyuu --noconfirm --needed --overwrite '*' \
# core/diffutils \
# core/which \
# community/pacman-contrib \
# community/parallel \
# extra/pipewire-jack \
# extra/samba \
# multilib/wine-staging \
# mingw64/mingw-w64-x86_64-ccache \
# mingw64/mingw-w64-x86_64-cmake \
# mingw64/mingw-w64-x86_64-cppcheck \
# mingw64/mingw-w64-x86_64-curl \
# mingw64/mingw-w64-x86_64-gcc \
# mingw64/mingw-w64-x86_64-meson \
# mingw64/mingw-w64-x86_64-nasm \
# mingw64/mingw-w64-x86_64-ninja \
# mingw64/mingw-w64-x86_64-perl \
# mingw64/mingw-w64-x86_64-pkgconf \
# mingw64/mingw-w64-x86_64-yasm \
# mingw64/mingw-w64-x86_64-zstd \
# && \
# # initalize wine stuff
# wine64 wineboot --init && \
# while pgrep wineserver > /dev/null; do sleep 1; done && \
# pacman -Scc --noconfirm && \
# rm -rf /var/cache/pacman/pkg/*
# RUN . /etc/profile.d/pac-helpers.sh && \
# # temporary disable arch's repos to pull the needed binaries from msys/
# disable_arch_repos && \
# for pkg in diffutils make vim less; do \
# # enumerate all of the packages we need
# pactree -us "$pkg"; \
# done | sort -u | \
# # unpack the tarballs manually to prevent "conflicts" with arch's
# pacman -Sddp - | xargs -n 1 sh -c 'curl -Ls "$1" | bsdtar -xv' _ && \
# # Finally install git4windows' stuff at the end
# # pacman -S --noconfirm --overwrite '*' mingw-w64-x86_64-git git-extra && \
# enable_arch_repos && \
# grep -laR -- '#!/usr/bin/env perl' /usr/bin/ | xargs sed -i 's@#!/usr/bin/env perl@#!/usr/bin/perl@' && \
# # clean up the cache
# pacman -Scc --noconfirm && \
# rm -rf /var/cache/pacman/pkg/* && \
# :
# COPY archlinux-tests/docker-images/helper.cc /
# COPY archlinux-tests/pkg-x86_64 /pkg-x86_64
# RUN pacman -Sy && \
# pacman -U --noconfirm --overwrite '*' \
# /pkg-x86_64/*.pkg.tar.xz && \
# rm /pkg-x86_64/*.pkg.tar.xz && \
# pacman -S --noconfirm --overwrite '*' core/perl && \
# pacman -Scc --noconfirm && \
# rm -rf /var/cache/pacman/pkg/*
# RUN find /cmd /mingw64/bin -name "*.exe" | parallel -n1 ln -s '{}' '{.}' && \
# mkdir -p ~/global_hooks && \
# printf '%s\n' \
# '#!/usr/bin/bash' \
# '' \
# 'git ls-files --stage |' \
# ' awk '"'"'{printf "chmod "; printf "%d", substr($1, length($1) - 2, length($1)); print " -- ", $NF}'"'"' |' \
# ' parallel' \
# > ~/global_hooks/post-checkout && \
# chmod 755 ~/global_hooks/post-checkout && \
# git config --global core.hooksPath "%(prefix)/$HOME/global_hooks/" && \
# :
# RUN git.exe clone https://gitlab.com/AOMediaCodec/SVT-AV1.git && \
# cmake.exe -B bui -S SVT-AV1/ -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \
# ninja.exe -C bui
# GIT_TRACE2_CONFIG_PARAMS='*' GIT_TRACE2=1 /usr/sbin/git.exe -C /SVT-AV1 describe
# substr( $0, length($0) - 1, length($0) )
# mkdir -p ~/global_hooks && printf '%s\n' '#!/usr/bin/bash' '' 'git ls-files --stage |' " awk '{printf \"chmod \"; printf \"%d\", substr(\$1, length(\$1) - 2, length(\$1)); print \" -- \", \$NF}' |" ' parallel' > ~/global_hooks/post-checkout && chmod 755 ~/global_hooks/post-checkout && git config --global core.hooksPath %(prefix)/~/global_hooks/ && :
(33/92) installing ca-certificates [--------------------------------------------------------------------------------------------------------------] 100%
call to execv failed (No such file or directory)
error: command failed to execute correctly
(44/92) installing libxml2 [--------------------------------------------------------------------------------------------------------------] 100%
call to execv failed (No such file or directory)
error: command failed to execute correctly
(54/92) installing dash [--------------------------------------------------------------------------------------------------------------] 100%
call to execv failed (No such file or directory)
error: command failed to execute correctly
(62/92) installing msys2-keyring [--------------------------------------------------------------------------------------------------------------] 100%
call to execv failed (No such file or directory)
error: command failed to execute correctly
:: Running post-transaction hooks...
(1/1) Updating the info directory file...
call to execv failed (No such file or directory)
error: command failed to execute correctly
(30/31) installing mingw-w64-x86_64-perl [##################################################] 100%
call to execv failed (No such file or directory)
error: command failed to execute correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment