Skip to content

Commit 5830ced

Browse files
committed
Merge branch 'msys2-3.6.4'
Seeing as Git for Windows tries to stay close to the upstream MSYS2 project, it makes sense to integrate their patches verbatim. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 0630711 + 23a25d4 commit 5830ced

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2724
-172
lines changed

.github/workflows/build.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
runs-on: windows-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: setup-msys2
17+
uses: msys2/setup-msys2@v2
18+
with:
19+
msystem: MSYS
20+
update: true
21+
install: msys2-devel base-devel autotools cocom diffutils gcc gettext-devel libiconv-devel make mingw-w64-cross-crt mingw-w64-cross-gcc mingw-w64-cross-zlib perl zlib-devel xmlto docbook-xsl
22+
23+
- name: Build
24+
shell: msys2 {0}
25+
run: |
26+
(cd winsup && ./autogen.sh)
27+
./configure --disable-dependency-tracking --with-msys2-runtime-commit="$GITHUB_SHA"
28+
make -j8
29+
30+
- name: Install
31+
shell: msys2 {0}
32+
run: |
33+
make DESTDIR="$(pwd)"/_dest install
34+
35+
- name: Upload
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: install
39+
path: _dest/
40+
41+
generate-msys2-tests-matrix:
42+
runs-on: ubuntu-latest
43+
outputs:
44+
matrix: ${{ steps.matrix.outputs.matrix }}
45+
steps:
46+
- id: matrix
47+
uses: msys2/msys2-tests/gha-matrix-gen@main
48+
49+
msys2-tests:
50+
needs: [build, generate-msys2-tests-matrix]
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
include: ${{ fromJson(needs.generate-msys2-tests-matrix.outputs.matrix) }}
55+
56+
name: msys2-tests ${{ matrix.msystem }}-${{ matrix.cc }}
57+
runs-on: ${{ matrix.runner }}
58+
env:
59+
CC: ${{ matrix.cc }}
60+
CXX: ${{ matrix.cxx }}
61+
FC: ${{ matrix.fc }}
62+
steps:
63+
- id: msys2
64+
uses: msys2/setup-msys2@v2
65+
with:
66+
msystem: ${{ matrix.msystem }}
67+
update: true
68+
install: ${{ matrix.packages }}
69+
70+
- name: Add staging repo
71+
shell: msys2 {0}
72+
run: |
73+
sed -i '1s|^|[staging]\nServer = https://repo.msys2.org/staging/\nSigLevel = Never\n|' /etc/pacman.conf
74+
75+
- name: Update using staging
76+
shell: pwsh
77+
run: |
78+
msys2 -c 'pacman --noconfirm -Suuy'
79+
$ErrorActionPreference = 'Stop'
80+
$PSNativeCommandUseErrorActionPreference = $true
81+
msys2 -c 'pacman --noconfirm -Suu'
82+
83+
- name: Download msys2-runtime artifact
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: install
87+
path: ${{ steps.msys2.outputs.msys2-location }}
88+
89+
- name: uname -a
90+
shell: msys2 {0}
91+
run: uname -a
92+
93+
- name: Run tests
94+
uses: msys2/msys2-tests@main
95+

.github/workflows/cygwin.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
name: cygwin
22

3-
on:
4-
push:
5-
# since master is a symbolic reference to main, don't run for both
6-
branches-ignore:
7-
- 'master'
8-
tags:
9-
- '*'
3+
on: workflow_dispatch
104

115
jobs:
126
fedora-build:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: sync-with-cygwin
2+
3+
# File: .github/workflows/repo-sync.yml
4+
5+
on:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: "42 * * * *"
9+
jobs:
10+
repo-sync:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Fetch Cygwin's latest master and tags
16+
run: |
17+
git init --bare
18+
# Potentially use git://sourceware.org/git/newlib-cygwin.git directly, but GitHub seems more reliable
19+
git fetch https://github.com/cygwin/cygwin master:refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'
20+
- name: Push to our fork
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
git push https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'

winsup/configure.ac

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,40 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
5757
AC_CHECK_TOOL(STRIP, strip, strip)
5858
AC_CHECK_TOOL(WINDRES, windres, windres)
5959

60+
# Record msys2-runtime commit
61+
AC_ARG_WITH([msys2-runtime-commit],
62+
[AS_HELP_STRING([--with-msys2-runtime-commit=COMMIT],
63+
[indicate the msys2-runtime commit corresponding to this build])],
64+
[MSYS2_RUNTIME_COMMIT=$withval], [MSYS2_RUNTIME_COMMIT=yes])
65+
case "$MSYS2_RUNTIME_COMMIT" in
66+
no)
67+
MSYS2_RUNTIME_COMMIT=
68+
MSYS2_RUNTIME_COMMIT_SHORT=
69+
MSYS2_RUNTIME_COMMIT_HEX=0
70+
;;
71+
yes|auto)
72+
if MSYS2_RUNTIME_COMMIT="$(git --git-dir="$srcdir/../.git" rev-parse HEAD)"
73+
then
74+
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
75+
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
76+
else
77+
AC_MSG_WARN([Could not determine msys2-runtime commit])
78+
MSYS2_RUNTIME_COMMIT=
79+
MSYS2_RUNTIME_COMMIT_SHORT=
80+
MSYS2_RUNTIME_COMMIT_HEX=0
81+
fi
82+
;;
83+
*)
84+
expr "$MSYS2_RUNTIME_COMMIT" : '@<:@0-9a-f@:>@\{6,64\}$' ||
85+
AC_MSG_ERROR([Invalid commit name: "$MSYS2_RUNTIME_COMMIT"])
86+
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
87+
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
88+
;;
89+
esac
90+
AC_SUBST(MSYS2_RUNTIME_COMMIT)
91+
AC_SUBST(MSYS2_RUNTIME_COMMIT_SHORT)
92+
AC_SUBST(MSYS2_RUNTIME_COMMIT_HEX)
93+
6094
AC_ARG_ENABLE(debugging,
6195
[AS_HELP_STRING([--enable-debugging],[Build a cygwin DLL which has more consistency checking for debugging])],
6296
[case "${enableval}" in
@@ -84,11 +118,10 @@ AM_CONDITIONAL(BUILD_DOC, [test $enable_doc != "no"])
84118
AC_CHECK_PROGS([DOCBOOK2XTEXI], [docbook2x-texi db2x_docbook2texi])
85119
if test -z "$DOCBOOK2XTEXI" ; then
86120
if test "x$enable_doc" != "xno"; then
87-
AC_MSG_ERROR([docbook2texi is required to build documentation])
88-
else
89-
unset DOCBOOK2XTEXI
90-
AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
121+
AC_MSG_WARN([docbook2texi is required to build documentation])
91122
fi
123+
unset DOCBOOK2XTEXI
124+
AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
92125
fi
93126

94127
AC_CHECK_PROGS([XMLTO], [xmlto])
@@ -106,6 +139,11 @@ if test "x$with_cross_bootstrap" != "xyes"; then
106139
test -n "$MINGW_CXX" || AC_MSG_ERROR([no acceptable MinGW g++ found in \$PATH])
107140
AC_CHECK_PROGS(MINGW_CC, ${target_cpu}-w64-mingw32-gcc)
108141
test -n "$MINGW_CC" || AC_MSG_ERROR([no acceptable MinGW gcc found in \$PATH])
142+
143+
AC_CHECK_PROGS(MINGW32_CC, i686-w64-mingw32-gcc)
144+
test -n "$MINGW32_CC" || AC_MSG_ERROR([no acceptable mingw32 gcc found in \$PATH])
145+
AC_CHECK_PROGS(MINGW64_CC, x86_64-w64-mingw32-gcc)
146+
test -n "$MINGW64_CC" || AC_MSG_ERROR([no acceptable mingw64 gcc found in \$PATH])
109147
fi
110148
AM_CONDITIONAL(CROSS_BOOTSTRAP, [test "x$with_cross_bootstrap" != "xyes"])
111149

winsup/cygserver/cygserver-config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ done
8686

8787
# Check if running on NT
8888
_sys="`uname`"
89-
_nt=`expr "${_sys}" : "CYGWIN_NT"`
89+
_nt=`expr "${_sys}" : "MSYS_NT"`
9090

9191
# Check for running cygserver processes first.
9292
if ps -e | grep -v grep | grep -q ${service_name}
@@ -178,7 +178,7 @@ then
178178
echo "Do you want to install cygserver as service?"
179179
if request "(Say \"no\" if it's already installed as service)"
180180
then
181-
if ! cygrunsrv -I ${service_name} -d "CYGWIN cygserver" -p /usr/sbin/cygserver
181+
if ! cygrunsrv -I ${service_name} -d "MSYS cygserver" -p /usr/sbin/cygserver
182182
then
183183
echo
184184
echo "Installation of cygserver as service failed. Please check the"

winsup/cygserver/transport_pipes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ details. */
1111
#ifndef _TRANSPORT_PIPES_H
1212
#define _TRANSPORT_PIPES_H
1313

14+
#ifdef __MSYS__
15+
#define PIPE_NAME_PREFIX L"\\\\.\\pipe\\msys-"
16+
#else
1417
#define PIPE_NAME_PREFIX L"\\\\.\\pipe\\cygwin-"
18+
#endif
1519
#define PIPE_NAME_SUFFIX L"-lpc"
1620

1721
/* Named pipes based transport, for security on NT */

winsup/cygwin/Makefile.am

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ if TARGET_X86_64
1717
COMMON_CFLAGS+=-mcmodel=small
1818
endif
1919

20+
VERSION_CFLAGS = -DMSYS2_RUNTIME_COMMIT="\"@MSYS2_RUNTIME_COMMIT@\""
21+
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_SHORT="\"@MSYS2_RUNTIME_COMMIT_SHORT@\""
22+
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_HEX="@MSYS2_RUNTIME_COMMIT_HEX@"
23+
COMMON_CFLAGS += $(VERSION_CFLAGS)
24+
2025
AM_CFLAGS=$(cflags_common) $(COMMON_CFLAGS)
2126
AM_CXXFLAGS=$(cxxflags_common) $(COMMON_CFLAGS) -fno-threadsafe-statics
2227

@@ -37,12 +42,12 @@ newlib_build=$(target_builddir)/newlib
3742
toollibdir=$(tooldir)/lib
3843
toolincludedir=$(tooldir)/include
3944

40-
# Parameters used in building the cygwin.dll.
45+
# Parameters used in building the msys-2.0.dll.
4146

42-
DLL_NAME=cygwin1.dll
43-
NEW_DLL_NAME=new-cygwin1.dll
44-
DEF_FILE=cygwin.def
45-
LIB_NAME=libcygwin.a
47+
DLL_NAME=msys-2.0.dll
48+
NEW_DLL_NAME=new-msys-2.0.dll
49+
DEF_FILE=msys.def
50+
LIB_NAME=libmsys-2.0.a
4651

4752
#
4853
# sources
@@ -314,6 +319,7 @@ DLL_FILES= \
314319
miscfuncs.cc \
315320
mktemp.cc \
316321
msg.cc \
322+
msys2_path_conv.cc \
317323
mount.cc \
318324
net.cc \
319325
netdb.cc \
@@ -450,7 +456,7 @@ uname_version.c: .FORCE
450456
version.cc: scripts/mkvers.sh include/cygwin/version.h winver.rc $(src_files)
451457
@echo "Making version.cc and winver.o";\
452458
export CC="$(CC)";\
453-
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS)
459+
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS) $(VERSION_CFLAGS)
454460

455461
winver.o: version.cc
456462

@@ -589,36 +595,35 @@ LIBSERVER = $(cygserver_blddir)/libcygserver.a
589595
$(LIBSERVER):
590596
$(MAKE) -C $(cygserver_blddir) libcygserver.a
591597

592-
# We build as new-cygwin1.dll and rename at install time to overcome native
598+
# We build as new-msys-2.0.dll and rename at install time to overcome native
593599
# rebuilding issues (we don't want the build tools to see a partially built
594-
# cygwin1.dll and attempt to use it instead of the old one).
600+
# msys-2.0.dll and attempt to use it instead of the old one).
595601

596602
# linker script
597603
LDSCRIPT=cygwin.sc
598604
$(LDSCRIPT): $(LDSCRIPT).in
599605
$(AM_V_GEN)$(CC) -E - -P < $^ -o $@
600606

601-
# cygwin dll
607+
# msys-2.0 dll
602608
# Set PE and export table header timestamps to zero for reproducible builds.
603609
$(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
604610
$(newlib_build)/libm.a $(newlib_build)/libc.a
605611
$(AM_V_CXXLD)$(CXX) $(CXXFLAGS) \
606612
-mno-use-libstdc-wrappers \
607-
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \
608-
-Wl,--dynamicbase -static \
613+
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) -static \
609614
$${SOURCE_DATE_EPOCH:+-Wl,--no-insert-timestamp} \
610-
-Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \
615+
-Wl,--heap=0 -Wl,--out-implib,msysdll.a -shared -o $@ \
611616
-e @DLL_ENTRY@ $(DEF_FILE) \
612617
-Wl,-whole-archive libdll.a -Wl,-no-whole-archive \
613618
$(VERSION_OFILES) \
614619
$(LIBSERVER) \
615620
$(newlib_build)/libm.a \
616621
$(newlib_build)/libc.a \
617-
-lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map
622+
-lgcc -lkernel32 -lntdll -Wl,-Map,msys.map
618623
@$(MKDIR_P) ${target_builddir}/winsup/testsuite/testinst/bin/
619624
$(AM_V_at)$(INSTALL_PROGRAM) $(NEW_DLL_NAME) ${target_builddir}/winsup/testsuite/testinst/bin/$(DLL_NAME)
620625

621-
# cygwin import library
626+
# msys-2.0 import library
622627
toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@
623628

624629
$(DEF_FILE): scripts/gendef cygwin.din
@@ -631,13 +636,14 @@ sigfe.s: $(DEF_FILE) tlsoffsets
631636

632637
LIBCOS=$(addsuffix .o,$(basename $(LIB_FILES)))
633638
$(LIB_NAME): $(DEF_FILE) $(LIBCOS) | $(NEW_DLL_NAME)
634-
$(AM_V_GEN)$(srcdir)/scripts/mkimport $(toolopts) $(NEW_FUNCTIONS) $@ cygdll.a $(wordlist 2,99,$^)
639+
$(AM_V_GEN)$(srcdir)/scripts/mkimport $(toolopts) $(NEW_FUNCTIONS) $@ msysdll.a $(wordlist 2,99,$^)
635640

636641
# sublibs
637642
# import libraries for some subset of symbols indicated by given objects
638643
speclib=\
639644
$(srcdir)/scripts/speclib $(toolopts) \
640645
--exclude='cygwin' \
646+
--exclude='msys' \
641647
--exclude='(?i:dll)' \
642648
--exclude='reloc' \
643649
--exclude='^main$$' \
@@ -687,7 +693,7 @@ all-local: $(LIB_NAME) $(SUBLIBS)
687693
clean-local:
688694
-rm -f $(BUILT_SOURCES)
689695
-rm -f $(DEF_FILE) sigfe.s
690-
-rm -f cygwin.sc cygdll.a cygwin.map
696+
-rm -f cygwin.sc msysdll.a msys.map
691697
-rm -f $(NEW_DLL_NAME)
692698
-rm -f $(LIB_NAME) $(SUBLIBS)
693699
-rm -f version.cc
@@ -705,7 +711,7 @@ man_MANS = regex/regex.3 regex/regex.7
705711
install-exec-hook: install-libs
706712
install-data-local: install-headers install-ldif
707713

708-
install-libs:
714+
install-libs: install-toollibDATA
709715
@$(MKDIR_P) $(DESTDIR)$(bindir)
710716
$(INSTALL_PROGRAM) $(NEW_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
711717
@$(MKDIR_P) $(DESTDIR)$(toollibdir)

winsup/cygwin/crt0.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@ details. */
99

1010
extern int main (int argc, char **argv);
1111

12+
#ifdef __MSYS__
13+
void msys_crt0 (int (*main) (int, char **));
14+
#else
1215
void cygwin_crt0 (int (*main) (int, char **));
16+
#endif
1317

1418
void
1519
mainCRTStartup ()
1620
{
21+
#ifdef __MSYS__
22+
msys_crt0 (main);
23+
#else
1724
cygwin_crt0 (main);
25+
#endif
1826

1927
/* These are never actually called. They are just here to force the inclusion
2028
of things like -lbinmode. */

winsup/cygwin/cygwin.din

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LIBRARY "cygwin1.dll" BASE=0x180040000
1+
LIBRARY "msys-2.0.dll" BASE=0x180040000
22

33
EXPORTS
44
# Exported variables
@@ -404,8 +404,8 @@ cygwin_attach_handle_to_fd SIGFE
404404
cygwin_conv_path SIGFE
405405
cygwin_conv_path_list SIGFE
406406
cygwin_create_path SIGFE
407-
cygwin_detach_dll SIGFE_MAYBE
408-
cygwin_dll_init NOSIGFE
407+
msys_detach_dll SIGFE_MAYBE
408+
msys_dll_init NOSIGFE
409409
cygwin_internal NOSIGFE
410410
cygwin_logon_user SIGFE
411411
cygwin_posix_path_list_p NOSIGFE

0 commit comments

Comments
 (0)