Skip to content

Commit 87da318

Browse files
authored
Merge pull request #591 from dscho/fix-missing-i686-dlls
Fix missing i686 dlls
2 parents 614cb0c + 69e705a commit 87da318

File tree

8 files changed

+127
-55
lines changed

8 files changed

+127
-55
lines changed

.github/workflows/main.yml

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
shell: bash
130130
run: |
131131
./please.sh create-sdk-artifact \
132-
--bitness=64 \
132+
--architecture=x86_64 \
133133
--sdk=.sdk \
134134
--out=sdk-artifact \
135135
build-installers &&
@@ -213,12 +213,28 @@ jobs:
213213
fail-fast: false
214214
matrix:
215215
artifact: ['minimal', 'makepkg-git', 'build-installers', 'full']
216-
bitness: ['32', '64']
216+
arch:
217+
- name: i686
218+
mingw-prefix: mingw32
219+
msystem: MINGW32
220+
sdk-repo: git-sdk-32
221+
- name: x86_64
222+
mingw-prefix: mingw64
223+
msystem: MINGW64
224+
sdk-repo: git-sdk-64
217225
exclude:
218226
- artifact: minimal
219-
bitness: 32
227+
arch:
228+
name: i686
229+
mingw-prefix: mingw32
230+
msystem: MINGW32
231+
sdk-repo: git-sdk-32
220232
- artifact: makepkg-git
221-
bitness: 32
233+
arch:
234+
name: i686
235+
mingw-prefix: mingw32
236+
msystem: MINGW32
237+
sdk-repo: git-sdk-32
222238
steps:
223239
- uses: actions/checkout@v4
224240
- name: initialize bare SDK clone
@@ -229,54 +245,58 @@ jobs:
229245
*) partial=--filter=blob:none;;
230246
esac &&
231247
git clone --bare --depth=1 --single-branch --branch=main $partial \
232-
https://github.com/git-for-windows/git-sdk-${{ matrix.bitness }} .sdk
248+
https://github.com/git-for-windows/${{ matrix.arch.sdk-repo }} .sdk
233249
- name: build ${{ matrix.artifact }} artifact
234250
id: build-artifact
235251
shell: bash
236252
run: |
253+
set -x &&
237254
case "${{ matrix.artifact }}" in
238255
full)
239256
git --git-dir=.sdk worktree add --detach sdk-artifact
240257
;;
241258
*)
242259
./please.sh create-sdk-artifact \
243-
--bitness=${{ matrix.bitness }} \
260+
--architecture=${{ matrix.arch.name }} \
244261
--sdk=.sdk \
245262
--out=sdk-artifact \
246263
${{ matrix.artifact }}
247264
;;
248265
esac &&
249-
echo "git-version=$(sdk-artifact/cmd/git.exe version)" >>$GITHUB_OUTPUT &&
266+
ls -la sdk-artifact/ &&
267+
version="$(sdk-artifact/${{ matrix.arch.mingw-prefix }}/bin/git.exe version)" &&
268+
echo "git-version=$version" >>$GITHUB_OUTPUT &&
250269
cygpath -aw "$PWD/sdk-artifact/usr/bin/core_perl" >>$GITHUB_PATH &&
251270
cygpath -aw "$PWD/sdk-artifact/usr/bin" >>$GITHUB_PATH &&
252-
cygpath -aw "$PWD/sdk-artifact/mingw${{ matrix.bitness }}/bin" >>$GITHUB_PATH &&
253-
echo "MSYSTEM=MINGW${{ matrix.bitness }}" >>$GITHUB_ENV
271+
cygpath -aw "$PWD/sdk-artifact/${{ matrix.arch.mingw-prefix }}/bin" >>$GITHUB_PATH &&
272+
echo "MSYSTEM=${{ matrix.arch.msystem }}" >>$GITHUB_ENV &&
273+
cat $GITHUB_PATH
254274
- name: build installer
255275
if: matrix.artifact == 'build-installers'
256276
shell: bash
257-
run: ./installer/release.sh --include-self-check --output=$PWD/installer-${{ matrix.bitness }} 0-test
277+
run: ./installer/release.sh --include-self-check --output=$PWD/installer-${{ matrix.arch.name }} 0-test
258278
- uses: actions/upload-artifact@v4
259279
if: matrix.artifact == 'build-installers'
260280
with:
261-
name: installer-${{ matrix.bitness }}
262-
path: installer-${{ matrix.bitness }}
281+
name: installer-${{ matrix.arch.name }}
282+
path: installer-${{ matrix.arch.name }}
263283
- name: run the installer
264284
if: matrix.artifact == 'build-installers'
265285
shell: pwsh
266286
run: |
267-
$exePath = Get-ChildItem -Path installer-${{ matrix.bitness }}/*.exe | %{$_.FullName}
287+
$exePath = Get-ChildItem -Path installer-${{ matrix.arch.name }}/*.exe | %{$_.FullName}
268288
$installer = Start-Process -PassThru -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1 /ALLOWINSTALLING32ON64=1 /LOG=installer.log"
269289
$exitCode = $installer.ExitCode
270290
if ($exitCode -ne 0) {
271291
Write-Host "::error::Installer failed with exit code $exitCode!"
272292
exit 1
273293
}
274-
if ("${{ matrix.bitness }}" -eq 32) {
294+
if ("${{ matrix.arch.name }}" -eq "i686") {
275295
"${env:ProgramFiles(x86)}\Git\usr\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
276-
"${env:ProgramFiles(x86)}\Git\mingw32\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
296+
"${env:ProgramFiles(x86)}\Git\${{ matrix.arch.mingw-prefix }}\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
277297
} else {
278298
"$env:ProgramFiles\Git\usr\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
279-
"$env:ProgramFiles\Git\mingw${{ matrix.bitness }}\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
299+
"$env:ProgramFiles\Git\${{ matrix.arch.mingw-prefix }}\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
280300
}
281301
- name: show installer log
282302
# run this even if the installation failed (actually, _in particular_ when the installation failed)
@@ -306,30 +326,40 @@ jobs:
306326
strategy:
307327
fail-fast: false
308328
matrix:
309-
bitness: ['32', '64']
329+
arch:
330+
- name: i686
331+
mingw-prefix: mingw32
332+
msystem: MINGW32
333+
sdk-repo: git-sdk-32
334+
- name: x86_64
335+
mingw-prefix: mingw64
336+
msystem: MINGW64
337+
sdk-repo: git-sdk-64
310338
steps:
311339
- uses: actions/checkout@v4
312340
- name: initialize bare SDK clone
313341
shell: bash
314342
run: |
315343
git clone --bare --depth=1 --single-branch --branch=main --filter=blob:none \
316-
https://github.com/git-for-windows/git-sdk-${{ matrix.bitness }} .sdk
317-
- name: build build-installers-${{ matrix.bitness }} artifact
344+
https://github.com/git-for-windows/${{ matrix.arch.sdk-repo }} .sdk
345+
- name: build build-installers-${{ matrix.arch.name }} artifact
318346
shell: bash
319347
run: |
348+
set -x &&
320349
INCLUDE_OBJDUMP=t \
321350
./please.sh create-sdk-artifact \
322-
--bitness=${{ matrix.bitness }} \
351+
--architecture=${{ matrix.arch.name }} \
323352
--sdk=.sdk \
324353
--out=sdk-artifact \
325354
build-installers &&
326355
cygpath -aw "$PWD/sdk-artifact/usr/bin/core_perl" >>$GITHUB_PATH &&
327356
cygpath -aw "$PWD/sdk-artifact/usr/bin" >>$GITHUB_PATH &&
328-
cygpath -aw "$PWD/sdk-artifact/mingw${{ matrix.bitness }}/bin" >>$GITHUB_PATH &&
329-
echo "MSYSTEM=MINGW${{ matrix.bitness }}" >>$GITHUB_ENV
357+
cygpath -aw "$PWD/sdk-artifact/${{ matrix.arch.mingw-prefix }}/bin" >>$GITHUB_PATH &&
358+
echo "MSYSTEM=${{ matrix.arch.msystem }}" >>$GITHUB_ENV &&
359+
cat $GITHUB_PATH
330360
- name: check for missing DLLs
331361
shell: bash
332-
run: ./check-for-missing-dlls.sh
362+
run: sh -x ./check-for-missing-dlls.sh
333363
- name: check for missing DLLs (MinGit)
334364
shell: bash
335365
run: MINIMAL_GIT=1 ./check-for-missing-dlls.sh

check-for-missing-dlls.sh

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ ARCH="$(uname -m)" ||
2626
die "Could not determine architecture"
2727

2828
case "$ARCH" in
29-
i686) BITNESS=32;;
30-
x86_64) BITNESS=64;;
29+
i686) MINGW_PREFIX=mingw32;;
30+
x86_64) MINGW_PREFIX=mingw64;;
31+
aarch64) MINGW_PREFIX=clangarm64;;
3132
*) die "Unhandled architecture: $ARCH";;
3233
esac
3334

@@ -46,38 +47,36 @@ unused_dlls_file=/tmp/unused-dlls.$$.txt
4647
tmp_file=/tmp/tmp.$$.txt
4748
trap "rm \"$used_dlls_file\" \"$missing_dlls_file\" \"$unused_dlls_file\" \"$tmp_file\"" EXIT
4849

49-
all_files="$(export ARCH BITNESS && "$thisdir"/make-file-list.sh | tr A-Z a-z | grep -v '/getprocaddr64.exe$')" &&
50-
usr_bin_dlls="$(echo "$all_files" | grep '^usr/bin/[^/]*\.dll$')" &&
51-
mingw_bin_dlls="$(echo "$all_files" | grep '^mingw'$BITNESS'/bin/[^/]*\.dll$')" &&
52-
dirs="$(echo "$all_files" | sed -n 's/[^/]*\.\(dll\|exe\)$//p' | sort | uniq)" &&
50+
ARCH=$ARCH "$thisdir"/make-file-list.sh | tr A-Z a-z | grep -v '/getprocaddr64.exe$' >"$tmp_file.all" &&
51+
usr_bin_dlls="$(grep '^usr/bin/[^/]*\.dll$' "$tmp_file.all")" &&
52+
mingw_bin_dlls="$(grep '^'$MINGW_PREFIX'/bin/[^/]*\.dll$' "$tmp_file.all")" &&
53+
dirs="$(sed -n 's/[^/]*\.\(dll\|exe\)$//p' "$tmp_file.all" | sort | uniq)" &&
5354
for dir in $dirs
5455
do
5556
test -z "$print_dir" ||
5657
printf "dir: $dir\\033[K\\r" >&2
5758

5859
case "$dir" in
59-
usr/*) dlls="$sys_dlls$LF$usr_bin_dlls$LF";;
60-
mingw$BITNESS/*) dlls="$sys_dlls$LF$mingw_bin_dlls$LF";;
61-
*) dlls="$sys_dlls$LF";;
60+
usr/*) dlls="$usr_bin_dlls$LF";;
61+
$MINGW_PREFIX/*) dlls="$mingw_bin_dlls$LF";;
62+
*) dlls="";;
6263
esac
6364

64-
paths=$(echo "$all_files" |
65-
sed -ne 's,[][],\\&,g' -e "s,^$dir[^/]*\.\(dll\|exe\)$,/&,p")
66-
out="$(/usr/bin/objdump -p $paths 2>"$tmp_file")"
65+
paths=$(sed -ne 's,[][],\\&,g' -e "s,^$dir[^/]*\.\(dll\|exe\)$,/&,p" "$tmp_file.all")
66+
/usr/bin/objdump -p $paths 2>"$tmp_file" >"$tmp_file.ldd"
6767
paths="$(sed -n 's|^/usr/bin/objdump: \([^ :]*\): file format not recognized|\1|p' <"$tmp_file")"
6868
test -z "$paths" ||
69-
out="$out$LF$(ldd $paths)"
69+
ldd $paths >>"$tmp_file.ldd"
7070

71-
echo "$out" |
72-
tr A-Z\\r a-z\ |
71+
tr A-Z\\r a-z\ <"$tmp_file.ldd" |
7372
grep -e '^.dll name:' -e '^[^ ]*\.\(dll\|exe\):' -e '\.dll =>' |
7473
while read a b c d
7574
do
7675
case "$a,$b" in
7776
*.exe:,*|*.dll:,*) current="${a%:}";;
7877
*.dll,"=>") # `ldd` output
7978
echo "$a" >>"$used_dlls_file"
80-
case "$dlls" in
79+
case "$sys_dlls$LF$dlls" in
8180
*"/$a$LF"*) ;; # okay, it's included
8281
*)
8382
echo "$current is missing $a" >&2
@@ -87,7 +86,7 @@ do
8786
;;
8887
dll,name:) # `objdump -p` output
8988
echo "$c" >>"$used_dlls_file"
90-
case "$dlls" in
89+
case "$sys_dlls$LF$dlls" in
9190
*"/$c$LF"*) ;; # okay, it's included
9291
*)
9392
echo "$current is missing $c" >&2
@@ -105,8 +104,7 @@ used_dlls_regex="/\\($(test -n "$MINIMAL_GIT" || printf 'p11-kit-trust\\|';
105104
uniq |
106105
sed -e 's/+x/\\+/g' -e 's/\.dll$/\\|/' -e '$s/\\|//' |
107106
tr -d '\n')\\)\\.dll\$"
108-
echo "$all_files" |
109-
grep '\.dll$' |
107+
grep '\.dll$' "$tmp_file.all" |
110108
grep -v \
111109
-e "$used_dlls_regex" \
112110
-e '^usr/lib/perl5/' \

git-extra/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $(BUILDDIR)/%.res: $(SRCDIR)/%.rc
2121
$(WINDRES) --input $< --output $@ --output-format coff
2222

2323
$(BUILDDIR)/WhoUses.exe: $(BUILDDIR)/WhoUses.o $(BUILDDIR)/SystemInfo.o
24-
$(CXX) $(CXXFLAGS) -o $@ $(LDFLAGS) $^
24+
$(CXX) $(CXXFLAGS) -o $@ $(LDFLAGS) $^ -lmsvcrt-os
2525

2626
$(BUILDDIR)/WhoUses.o: $(SRCDIR)/WhoUses.cpp $(SRCDIR)/SystemInfo.h
2727
$(BUILDDIR)/SystemInfo.o: $(SRCDIR)/SystemInfo.cpp $(SRCDIR)/SystemInfo.h

git-extra/PKGBUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pkgbase="mingw-w64-${_realname}"
55
pkgname=($_realname
66
"${MINGW_PACKAGE_PREFIX}-${_realname}")
77
_ver_base=1.1
8-
pkgver=1.1.641.031e03baf
8+
pkgver=1.1.646.1654659da
99
pkgrel=1
1010
pkgdesc="Git for Windows extra files"
1111
arch=('any')
@@ -21,7 +21,7 @@ pkgver() {
2121
test ! -f "$(git rev-parse --git-path shallow)" || git -c http.sslbackend fetch --unshallow
2222
rev="$(git rev-list -1 HEAD -- .)"
2323
test -n "$(git show . |
24-
sed -n -e '1,/^@@/d' -e '/^[-+]pkgver=/d' -e '/^[-+]/p')" ||
24+
sed -n -e '1,/^@@/d' -e '/^[-+]pkgver=/d' -e '/^[-+]pkgver=/d' -e "/^[-+] *'[0-9a-f]\{64\}'$/d" -e '/^[-+]/p')" ||
2525
rev="$(git rev-list -1 $rev^ -- .)"
2626
printf "%s.%s.%s" "${_ver_base}" "$(git rev-list --count $rev -- .)" \
2727
"$(git rev-parse --short=9 $rev)"
@@ -68,7 +68,7 @@ sha256sums=('8ed76d1cb069ac8568f21c431f5e23caebea502d932ab4cdff71396f4f0d5b72'
6868
'3cd83627f1d20e1108533419fcf33c657cbcf777c3dc39fa7f13748b7d63858a'
6969
'd51229e5ec3653782a2c09aa5ad9af8f159aba94bc28498d7f358c33399b313d'
7070
'4716d520e7e6e0a1281bad1ae4c21e3e6442127c3030d27681162b9c40aa6b9d'
71-
'937e25c096e0fa91f86f689a00a5bf5442c2333fbedab30239a935e682ae2e80'
71+
'6d2e4285f5671247598446fb1876a137741b7ec87bfe1d7edbd2dc522918df60'
7272
'd212e1bbe75a9f81443126701324c9c44c3ed5750dd9822eba754a1799ed13b3'
7373
'402c51eba82453a76f5110f4754bb1005df507a6e4532574c2b9627ff4e1dc81'
7474
'8433a9e72b3bc9c3bc7903b54b868399bdb17a6c8de4af4dd5450dd42859c898'

git-extra/git-extra.install

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,13 @@ test -d "$TMPDIR" || test ! -d "$TMP" || {\
297297
# Work around /etc/xml/catalog being updated using the MINGW version of xmlcatalog
298298
! grep -q '"[CD]:/' /etc/xml/catalog ||
299299
sed -i -e 's|"[CD]:/[^"]*/usr/|"/usr/|g' /etc/xml/catalog
300+
301+
# Work around an outdated i686 gnupg/gnutls build that depends on a hence-updated libunistring
302+
if test i686 = $arch -a ! -e /usr/bin/msys-unistring-2.dll -a -e /usr/bin/msys-unistring-5.dll &&
303+
grep msys-unistring-2 /usr/bin/msys-gnutls-30.dll 2>&1 >/dev/null
304+
then
305+
cp /usr/bin/msys-unistring-5.dll /usr/bin/msys-unistring-2.dll
306+
fi
300307
}
301308

302309
post_upgrade () {

git-extra/git-extra.install.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ test -d "$TMPDIR" || test ! -d "$TMP" || {\
263263
# Work around /etc/xml/catalog being updated using the MINGW version of xmlcatalog
264264
! grep -q '"[CD]:/' /etc/xml/catalog ||
265265
sed -i -e 's|"[CD]:/[^"]*/usr/|"/usr/|g' /etc/xml/catalog
266+
267+
# Work around an outdated i686 gnupg/gnutls build that depends on a hence-updated libunistring
268+
if test i686 = $arch -a ! -e /usr/bin/msys-unistring-2.dll -a -e /usr/bin/msys-unistring-5.dll &&
269+
grep msys-unistring-2 /usr/bin/msys-gnutls-30.dll 2>&1 >/dev/null
270+
then
271+
cp /usr/bin/msys-unistring-5.dll /usr/bin/msys-unistring-2.dll
272+
fi
266273
}
267274

268275
post_upgrade () {

0 commit comments

Comments
 (0)