Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
73a7219
Fix msys library name in import libraries
ktbarrett Mar 14, 2021
3526df5
Rename dll from cygwin to msys
Alexpux Apr 14, 2019
7e1ed33
Add functionality for converting UNIX paths in arguments and environm…
Alexpux Apr 14, 2019
8d32258
Add functionality for changing OS name via MSYSTEM environment variab…
Alexpux Apr 14, 2019
4201baa
- Move root to /usr. - Change sorting mount points. - By default moun…
Alexpux Apr 14, 2019
ebcabc9
Instead of creating Cygwin symlinks, use deep copy by default
Alexpux Apr 14, 2019
3ac933f
Automatically rewrite TERM=msys to TERM=cygwin
Alexpux Apr 14, 2019
5fca257
Do not convert environment for strace
Alexpux Apr 14, 2019
e969c16
strace.cc: Don't set MSYS=noglob
mingwandroid Aug 23, 2015
c555085
Add debugging for strace make_command_line
mingwandroid Aug 21, 2015
d391a34
strace --quiet: be *really* quiet
dscho May 17, 2017
4eb7565
path_conv: special-case root directory to have trailing slash
Alexpux Apr 14, 2019
99dc14b
When converting to a Unix path, avoid double trailing slashes
dscho Nov 8, 2022
512870b
msys2_path_conv: pass PC_NOFULL to path_conv
lazka Nov 20, 2022
c6988f4
path-conversion: Introduce ability to switch off conversion.
Jun 17, 2015
439dd00
dcrt0.cc: Untangle allow_glob from winshell
mingwandroid Aug 21, 2015
0c9eab8
dcrt0.cc (globify): Don't quote literal strings differently when dos_…
mingwandroid Aug 23, 2015
4ab5217
Add debugging for build_argv
mingwandroid Aug 21, 2015
507970f
environ.cc: New facility/environment variable MSYS2_ENV_CONV_EXCL
mingwandroid Apr 10, 2016
294c7d0
Introduce the `enable_pcon` value for `MSYS`
dscho May 19, 2020
cb32c7c
popen: call /usr/bin/sh instead of /bin/sh
lazka Jun 5, 2020
d91ca3d
Disable the 'cygwin' GitHub workflow
dscho Mar 17, 2021
7ec84f1
CI: add a GHA for doing a basic build test
lazka Aug 9, 2020
f5fb59a
Set up a GitHub Action to keep in sync with Cygwin
dscho Nov 22, 2019
d8a8463
Expose full command-lines to other Win32 processes by default
dscho Aug 12, 2020
8a3f7d4
Add a helper to obtain a function's address in kernel32.dll
dscho Apr 16, 2018
1e023b3
Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
dscho Mar 20, 2015
49a8a21
kill: kill Win32 processes more gently
dscho Mar 20, 2015
b627b27
Cygwin: make option for native inner link handling.
jeremyd2019 Jul 22, 2021
856d272
docs: skip building texinfo and PDF files
dscho Nov 8, 2021
9fd4df8
install-libs: depend on the "toollibs"
dscho Nov 8, 2021
d1c4453
POSIX-ify the SHELL variable
dscho Nov 23, 2015
430be16
Handle ORIGINAL_PATH just like PATH
dscho Mar 21, 2017
0724bb6
uname: allow setting the system name to CYGWIN
lazka Jul 3, 2022
6783e02
Pass environment variables with empty values
dscho Feb 18, 2015
29df087
Optionally disallow empty environment values again
dscho Sep 6, 2022
46e3a90
build_env(): respect the `MSYS` environment variable
dscho Sep 6, 2022
428f270
Revert "Cygwin: Enable dynamicbase on the Cygwin DLL by default"
lazka Dec 17, 2022
c4e124e
Avoid sharing cygheaps across Cygwin versions
dscho Jan 30, 2023
389647a
uname: report msys2-runtime commit hash, too
dscho Feb 21, 2023
fad41cb
Cygwin: Adjust CWD magic to accommodate for the latest Windows previews
dscho May 22, 2023
4ebe060
Cygwin: Fix segfault when XSAVE area sizes are unaligned
Mar 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: build

on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: setup-msys2
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
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

- name: Build
shell: msys2 {0}
run: |
(cd winsup && ./autogen.sh)
./configure --disable-dependency-tracking --with-msys2-runtime-commit="$GITHUB_SHA"
make -j8

- name: Install
shell: msys2 {0}
run: |
make DESTDIR="$(pwd)"/_dest install

- name: Upload
uses: actions/upload-artifact@v4
with:
name: install
path: _dest/

generate-msys2-tests-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- id: matrix
uses: msys2/msys2-tests/gha-matrix-gen@main

msys2-tests:
needs: [build, generate-msys2-tests-matrix]
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-msys2-tests-matrix.outputs.matrix) }}

name: msys2-tests ${{ matrix.msystem }}-${{ matrix.cc }}
runs-on: ${{ matrix.runner }}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
FC: ${{ matrix.fc }}
steps:
- id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: ${{ matrix.packages }}

- name: Add staging repo
shell: msys2 {0}
run: |
sed -i '1s|^|[staging]\nServer = https://repo.msys2.org/staging/\nSigLevel = Never\n|' /etc/pacman.conf

- name: Update using staging
shell: pwsh
run: |
msys2 -c 'pacman --noconfirm -Suuy'
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
msys2 -c 'pacman --noconfirm -Suu'

- name: Download msys2-runtime artifact
uses: actions/download-artifact@v4
with:
name: install
path: ${{ steps.msys2.outputs.msys2-location }}

- name: uname -a
shell: msys2 {0}
run: uname -a

- name: Run tests
uses: msys2/msys2-tests@main

8 changes: 1 addition & 7 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: cygwin

on:
push:
# since master is a symbolic reference to main, don't run for both
branches-ignore:
- 'master'
tags:
- '*'
on: workflow_dispatch

jobs:
fedora-build:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/sync-with-cygwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: sync-with-cygwin

# File: .github/workflows/repo-sync.yml

on:
workflow_dispatch:
schedule:
- cron: "42 * * * *"
jobs:
repo-sync:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Fetch Cygwin's latest master and tags
run: |
git init --bare
# Potentially use git://sourceware.org/git/newlib-cygwin.git directly, but GitHub seems more reliable
git fetch https://github.com/cygwin/cygwin master:refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'
- name: Push to our fork
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'
46 changes: 42 additions & 4 deletions winsup/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,40 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
AC_CHECK_TOOL(STRIP, strip, strip)
AC_CHECK_TOOL(WINDRES, windres, windres)

# Record msys2-runtime commit
AC_ARG_WITH([msys2-runtime-commit],
[AS_HELP_STRING([--with-msys2-runtime-commit=COMMIT],
[indicate the msys2-runtime commit corresponding to this build])],
[MSYS2_RUNTIME_COMMIT=$withval], [MSYS2_RUNTIME_COMMIT=yes])
case "$MSYS2_RUNTIME_COMMIT" in
no)
MSYS2_RUNTIME_COMMIT=
MSYS2_RUNTIME_COMMIT_SHORT=
MSYS2_RUNTIME_COMMIT_HEX=0
;;
yes|auto)
if MSYS2_RUNTIME_COMMIT="$(git --git-dir="$srcdir/../.git" rev-parse HEAD)"
then
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
else
AC_MSG_WARN([Could not determine msys2-runtime commit])
MSYS2_RUNTIME_COMMIT=
MSYS2_RUNTIME_COMMIT_SHORT=
MSYS2_RUNTIME_COMMIT_HEX=0
fi
;;
*)
expr "$MSYS2_RUNTIME_COMMIT" : '@<:@0-9a-f@:>@\{6,64\}$' ||
AC_MSG_ERROR([Invalid commit name: "$MSYS2_RUNTIME_COMMIT"])
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
;;
esac
AC_SUBST(MSYS2_RUNTIME_COMMIT)
AC_SUBST(MSYS2_RUNTIME_COMMIT_SHORT)
AC_SUBST(MSYS2_RUNTIME_COMMIT_HEX)

AC_ARG_ENABLE(debugging,
[AS_HELP_STRING([--enable-debugging],[Build a cygwin DLL which has more consistency checking for debugging])],
[case "${enableval}" in
Expand Down Expand Up @@ -84,11 +118,10 @@ AM_CONDITIONAL(BUILD_DOC, [test $enable_doc != "no"])
AC_CHECK_PROGS([DOCBOOK2XTEXI], [docbook2x-texi db2x_docbook2texi])
if test -z "$DOCBOOK2XTEXI" ; then
if test "x$enable_doc" != "xno"; then
AC_MSG_ERROR([docbook2texi is required to build documentation])
else
unset DOCBOOK2XTEXI
AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
AC_MSG_WARN([docbook2texi is required to build documentation])
fi
unset DOCBOOK2XTEXI
AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
fi

AC_CHECK_PROGS([XMLTO], [xmlto])
Expand All @@ -106,6 +139,11 @@ if test "x$with_cross_bootstrap" != "xyes"; then
test -n "$MINGW_CXX" || AC_MSG_ERROR([no acceptable MinGW g++ found in \$PATH])
AC_CHECK_PROGS(MINGW_CC, ${target_cpu}-w64-mingw32-gcc)
test -n "$MINGW_CC" || AC_MSG_ERROR([no acceptable MinGW gcc found in \$PATH])

AC_CHECK_PROGS(MINGW32_CC, i686-w64-mingw32-gcc)
test -n "$MINGW32_CC" || AC_MSG_ERROR([no acceptable mingw32 gcc found in \$PATH])
AC_CHECK_PROGS(MINGW64_CC, x86_64-w64-mingw32-gcc)
test -n "$MINGW64_CC" || AC_MSG_ERROR([no acceptable mingw64 gcc found in \$PATH])
fi
AM_CONDITIONAL(CROSS_BOOTSTRAP, [test "x$with_cross_bootstrap" != "xyes"])

Expand Down
4 changes: 2 additions & 2 deletions winsup/cygserver/cygserver-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ done

# Check if running on NT
_sys="`uname`"
_nt=`expr "${_sys}" : "CYGWIN_NT"`
_nt=`expr "${_sys}" : "MSYS_NT"`

# Check for running cygserver processes first.
if ps -e | grep -v grep | grep -q ${service_name}
Expand Down Expand Up @@ -178,7 +178,7 @@ then
echo "Do you want to install cygserver as service?"
if request "(Say \"no\" if it's already installed as service)"
then
if ! cygrunsrv -I ${service_name} -d "CYGWIN cygserver" -p /usr/sbin/cygserver
if ! cygrunsrv -I ${service_name} -d "MSYS cygserver" -p /usr/sbin/cygserver
then
echo
echo "Installation of cygserver as service failed. Please check the"
Expand Down
4 changes: 4 additions & 0 deletions winsup/cygserver/transport_pipes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ details. */
#ifndef _TRANSPORT_PIPES_H
#define _TRANSPORT_PIPES_H

#ifdef __MSYS__
#define PIPE_NAME_PREFIX L"\\\\.\\pipe\\msys-"
#else
#define PIPE_NAME_PREFIX L"\\\\.\\pipe\\cygwin-"
#endif
#define PIPE_NAME_SUFFIX L"-lpc"

/* Named pipes based transport, for security on NT */
Expand Down
40 changes: 23 additions & 17 deletions winsup/cygwin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ if TARGET_X86_64
COMMON_CFLAGS+=-mcmodel=small
endif

VERSION_CFLAGS = -DMSYS2_RUNTIME_COMMIT="\"@MSYS2_RUNTIME_COMMIT@\""
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_SHORT="\"@MSYS2_RUNTIME_COMMIT_SHORT@\""
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_HEX="@MSYS2_RUNTIME_COMMIT_HEX@"
COMMON_CFLAGS += $(VERSION_CFLAGS)

AM_CFLAGS=$(cflags_common) $(COMMON_CFLAGS)
AM_CXXFLAGS=$(cxxflags_common) $(COMMON_CFLAGS) -fno-threadsafe-statics

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

# Parameters used in building the cygwin.dll.
# Parameters used in building the msys-2.0.dll.

DLL_NAME=cygwin1.dll
NEW_DLL_NAME=new-cygwin1.dll
DEF_FILE=cygwin.def
LIB_NAME=libcygwin.a
DLL_NAME=msys-2.0.dll
NEW_DLL_NAME=new-msys-2.0.dll
DEF_FILE=msys.def
LIB_NAME=libmsys-2.0.a

#
# sources
Expand Down Expand Up @@ -314,6 +319,7 @@ DLL_FILES= \
miscfuncs.cc \
mktemp.cc \
msg.cc \
msys2_path_conv.cc \
mount.cc \
net.cc \
netdb.cc \
Expand Down Expand Up @@ -450,7 +456,7 @@ uname_version.c: .FORCE
version.cc: scripts/mkvers.sh include/cygwin/version.h winver.rc $(src_files)
@echo "Making version.cc and winver.o";\
export CC="$(CC)";\
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS)
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS) $(VERSION_CFLAGS)

winver.o: version.cc

Expand Down Expand Up @@ -589,36 +595,35 @@ LIBSERVER = $(cygserver_blddir)/libcygserver.a
$(LIBSERVER):
$(MAKE) -C $(cygserver_blddir) libcygserver.a

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

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

# cygwin dll
# msys-2.0 dll
# Set PE and export table header timestamps to zero for reproducible builds.
$(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
$(newlib_build)/libm.a $(newlib_build)/libc.a
$(AM_V_CXXLD)$(CXX) $(CXXFLAGS) \
-mno-use-libstdc-wrappers \
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \
-Wl,--dynamicbase -static \
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) -static \
$${SOURCE_DATE_EPOCH:+-Wl,--no-insert-timestamp} \
-Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \
-Wl,--heap=0 -Wl,--out-implib,msysdll.a -shared -o $@ \
-e @DLL_ENTRY@ $(DEF_FILE) \
-Wl,-whole-archive libdll.a -Wl,-no-whole-archive \
$(VERSION_OFILES) \
$(LIBSERVER) \
$(newlib_build)/libm.a \
$(newlib_build)/libc.a \
-lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map
-lgcc -lkernel32 -lntdll -Wl,-Map,msys.map
@$(MKDIR_P) ${target_builddir}/winsup/testsuite/testinst/bin/
$(AM_V_at)$(INSTALL_PROGRAM) $(NEW_DLL_NAME) ${target_builddir}/winsup/testsuite/testinst/bin/$(DLL_NAME)

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

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

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

# sublibs
# import libraries for some subset of symbols indicated by given objects
speclib=\
$(srcdir)/scripts/speclib $(toolopts) \
--exclude='cygwin' \
--exclude='msys' \
--exclude='(?i:dll)' \
--exclude='reloc' \
--exclude='^main$$' \
Expand Down Expand Up @@ -687,7 +693,7 @@ all-local: $(LIB_NAME) $(SUBLIBS)
clean-local:
-rm -f $(BUILT_SOURCES)
-rm -f $(DEF_FILE) sigfe.s
-rm -f cygwin.sc cygdll.a cygwin.map
-rm -f cygwin.sc msysdll.a msys.map
-rm -f $(NEW_DLL_NAME)
-rm -f $(LIB_NAME) $(SUBLIBS)
-rm -f version.cc
Expand All @@ -705,7 +711,7 @@ man_MANS = regex/regex.3 regex/regex.7
install-exec-hook: install-libs
install-data-local: install-headers install-ldif

install-libs:
install-libs: install-toollibDATA
@$(MKDIR_P) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) $(NEW_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
@$(MKDIR_P) $(DESTDIR)$(toollibdir)
Expand Down
8 changes: 8 additions & 0 deletions winsup/cygwin/crt0.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ details. */

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

#ifdef __MSYS__
void msys_crt0 (int (*main) (int, char **));
#else
void cygwin_crt0 (int (*main) (int, char **));
#endif

void
mainCRTStartup ()
{
#ifdef __MSYS__
msys_crt0 (main);
#else
cygwin_crt0 (main);
#endif

/* These are never actually called. They are just here to force the inclusion
of things like -lbinmode. */
Expand Down
6 changes: 3 additions & 3 deletions winsup/cygwin/cygwin.din
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBRARY "cygwin1.dll" BASE=0x180040000
LIBRARY "msys-2.0.dll" BASE=0x180040000

EXPORTS
# Exported variables
Expand Down Expand Up @@ -404,8 +404,8 @@ cygwin_attach_handle_to_fd SIGFE
cygwin_conv_path SIGFE
cygwin_conv_path_list SIGFE
cygwin_create_path SIGFE
cygwin_detach_dll SIGFE_MAYBE
cygwin_dll_init NOSIGFE
msys_detach_dll SIGFE_MAYBE
msys_dll_init NOSIGFE
cygwin_internal NOSIGFE
cygwin_logon_user SIGFE
cygwin_posix_path_list_p NOSIGFE
Expand Down
Loading
Loading