Skip to content

Commit 349e4e1

Browse files
committed
Support building MSYS packages
There are two locations where Git for Windows maintains definitions for MSYS packages: in git-for-windows/MSYS2-packages, and the `git-for-windows-keyring` package in git-for-windows/build-extra. The main difference compared to MINGW packages is that we need to use `makepkg` instead of `makepkg-mingw`. Another difference is that we have to build MSYS packages separately for both supported architectures (i686 and x86_64, AKA "32-bit" and "64-bit") because they need to be built in the Git for Windows SDK of the same architecture. Finally, MSYS packages do not have a `mingw-w64-` prefix in their package name. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 97906b0 commit 349e4e1

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build-and-deploy
2-
run-name: Build${{ inputs.build_only == '' && ' and deploy' || '' }} ${{ !startsWith(inputs.package, 'mingw-w64-') && inputs.repo != 'MSYS2-packages' && inputs.package != 'git-extra' && inputs.package != 'git-for-windows-keyring' && 'mingw-w64-' || '' }}${{ inputs.package }}
2+
run-name: Build${{ inputs.build_only == '' && ' and deploy' || '' }} ${{ !startsWith(inputs.package, 'mingw-w64-') && inputs.repo != 'MSYS2-packages' && inputs.package != 'git-extra' && inputs.package != 'git-for-windows-keyring' && 'mingw-w64-' || '' }}${{ inputs.package }}${{ inputs.architecture && ' (${{ inputs.architecture }})' || '' }}
33

44
on:
55
workflow_dispatch:
@@ -16,6 +16,9 @@ on:
1616
ref:
1717
description: 'The ref containing the package definition'
1818
required: true
19+
architecture:
20+
description: 'The architecture to build for (only for MSYS packages)'
21+
required: false
1922
actor:
2023
description: The GitHub user on whose behalf this workflow is run
2124
required: false
@@ -26,6 +29,7 @@ env:
2629
OWNER: "git-for-windows"
2730
REPO: "${{ github.event.inputs.repo }}"
2831
REF: "${{ github.event.inputs.ref }}"
32+
ARCHITECTURE: "${{ github.event.inputs.architecture }}"
2933
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
3034
HOME: "${{ github.workspace }}\\home"
3135
ACTOR: "${{ github.event.inputs.actor || github.triggering_actor }}"
@@ -114,7 +118,10 @@ jobs:
114118
git config --global user.name "$USER_NAME" &&
115119
git config --global user.email "$USER_EMAIL" &&
116120
echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV &&
117-
if test git-extra != "$PACKAGE_TO_BUILD" && test "z${PACKAGE_TO_BUILD#mingw-w64-}" = "z$PACKAGE_TO_BUILD"
121+
if test MSYS2-packages != "$REPO" &&
122+
test git-extra != "$PACKAGE_TO_BUILD" &&
123+
test git-for-windows-keyring != "$PACKAGE_TO_BUILD" &&
124+
test "z${PACKAGE_TO_BUILD#mingw-w64-}" = "z$PACKAGE_TO_BUILD"
118125
then
119126
echo "PACKAGE_TO_BUILD=mingw-w64-$PACKAGE_TO_BUILD" >>$GITHUB_ENV
120127
fi
@@ -123,6 +130,8 @@ jobs:
123130
uses: git-for-windows/setup-git-for-windows-sdk@v1
124131
with:
125132
flavor: ${{ env.PACKAGE_TO_BUILD == 'mingw-w64-git' && 'build-installers' || 'full' }}
133+
architecture: ${{ env.ARCHITECTURE || 'x86_64' }}
134+
msys: ${{ env.REPO == 'MSYS2-packages' || env.PACKAGE_TO_BUILD == 'git-for-windows-keyring' }}
126135

127136
- name: Clone ${{ env.REPO }}
128137
shell: bash
@@ -186,6 +195,7 @@ jobs:
186195
- name: Build ${{env.PACKAGE_TO_BUILD}}
187196
env:
188197
GPGKEY: ${{secrets.GPGKEY}}
198+
MAKEPKG: ${{ env.REPO != 'MSYS2-packages' && env.PACKAGE_TO_BUILD != 'git-for-windows-keyring' && 'makepkg-mingw' || 'makepkg' }}
189199
shell: bash
190200
run: |
191201
dir="$(cygpath -au artifacts)" &&
@@ -197,10 +207,10 @@ jobs:
197207
} &&
198208
199209
cd "/usr/src/$REPO/$PACKAGE_TO_BUILD" &&
200-
MAKEFLAGS=-j6 PKGEXT='.pkg.tar.xz' MINGW_ARCH="mingw32 mingw64" makepkg-mingw -s --noconfirm &&
210+
MAKEFLAGS=-j6 PKGEXT='.pkg.tar.xz' MINGW_ARCH="mingw32 mingw64" $MAKEPKG -s --noconfirm &&
201211
cp *.pkg.tar* "$dir/" &&
202212
203-
MAKEFLAGS=-j6 SRCEXT='.src.tar.gz' MINGW_ARCH=mingw64 makepkg-mingw --allsource &&
213+
MAKEFLAGS=-j6 SRCEXT='.src.tar.gz' MINGW_ARCH=mingw64 $MAKEPKG --allsource &&
204214
cp *.src.tar* "$dir/" &&
205215
206216
# Ensure that the Git worktree is still clean

0 commit comments

Comments
 (0)