Browse Source

Reuse CI machine's msys64 when possible

tmp/comercial-emacs
Kien Nguyen 4 years ago
parent
commit
08c661518a
  1. 6
      scripts/msys2.cmd
  2. 40
      scripts/setup-msys2.ps1

6
scripts/msys2.cmd

@ -2,7 +2,7 @@
setlocal
set MSYSTEM=MINGW64
set CHERE_INVOKING=1
set emacs_build_dir=%~dp0
set emacs_build_dir=%emacs_build_dir:~0,-9%
set msys2_dir=%emacs_build_dir%\msys64
set emacs_build_dir=%~dp0..
set msys2_dir=c:\msys64
if not exist %msys2_dir%\ (set msys2_dir=%emacs_build_dir%\msys64)
%msys2_dir%\usr\bin\bash.exe -leo pipefail %*

40
scripts/setup-msys2.ps1

@ -3,31 +3,43 @@
# https://github.com/msys2/setup-msys2/blob/master/main.js
$emacs_build_dir = $PSScriptRoot + '\..'
$msys2_dir = $emacs_build_dir + '\msys64'
$inst_url = 'https://github.com/msys2/msys2-installer/releases/download/2020-11-09/msys2-base-x86_64-20201109.sfx.exe'
$installer_checksum = 'f8a05b9353c42735521f393497dbbd0ce4db1a9de79ee1f6ef224bc9fae144b7'
$installer = ${msys2_dir} + '\msys2-base.exe'
$msys2_dir = 'c:/msys64'
if (!(Test-Path $msys2_dir))
{
$msys2_dir = $emacs_build_dir + '\msys64'
}
$inst_url = 'https://github.com/msys2/msys2-installer/releases/download/2021-04-19/msys2-base-x86_64-20210419.sfx.exe'
$installer_checksum = '1f2cfd8e13b0382096e53ead6fd52d0b656a1f81e1b5d82f44cb4ce8ab68755e'
$installer = $msys2_dir + '\msys2-base.exe'
if ( !(Test-Path ${msys2_dir}) ) {
echo "Creating MSYS2 directory ${msys2_dir}"
mkdir ${msys2_dir}
if (!(Test-Path $msys2_dir))
{
echo "Creating MSYS2 directory $msys2_dir"
mkdir $msys2_dir
}
if ( !(Test-Path ${msys2_dir}\msys2_shell.cmd) ) {
if ( !(Test-Path ${installer}) ) {
if (!(Test-Path ${msys2_dir}\msys2_shell.cmd))
{
if (!(Test-Path ${installer}))
{
echo "Downloading MSYS2 installer to ${installer}"
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
Invoke-WebRequest -Uri $inst_url -OutFile ${installer}
}
$checksum = (Get-FileHash ${installer} -Algorithm SHA256)[0].Hash
if ( $checksum -ne $installer_checksum ) {
if ($checksum -ne $installer_checksum)
{
echo "Downloaded file $installer has checksum $checksum"
echo "which differs from $installer_checksum"
}
echo "Emacs build root: $emacs_build_dir"
cd "${emacs_build_dir}"
echo "Unpack MSYS2"
& ${installer} -y
cd "${emacs_build_dir}"
# Reduce time required to install packages by disabling pacman's disk space checking
.\scripts\msys2.cmd -c 'sed -i "s/^CheckSpace/#CheckSpace/g" /etc/pacman.conf'
# Force update packages
@ -42,7 +54,9 @@ if ( !(Test-Path ${msys2_dir}\msys2_shell.cmd) ) {
# Final upgrade
echo "Final upgrade"
.\scripts\msys2.cmd -c 'pacman --noprogressbar --noconfirm -Syuu'
# Install packages required by emacs-build
echo "Install essential packages"
.\scripts\msys2.cmd -c 'pacman --noprogressbar --needed --noconfirm -S git unzip zip base-devel mingw-w64-x86_64-toolchain'
}
cd "${emacs_build_dir}"
# Install packages required by emacs-build
echo "Install essential packages"
.\scripts\msys2.cmd -c 'pacman --noprogressbar --needed --noconfirm -S git unzip zip base-devel mingw-w64-x86_64-toolchain'

Loading…
Cancel
Save