https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=437d2d6862b47c6cf10c989706eddf55e5f41efd

commit 437d2d6862b47c6cf10c989706eddf55e5f41efd
Author: Radek Bartoň <radek.bar...@microsoft.com>
Date:   Sat Jun 21 22:56:58 2025 +0200

    Cygwin: configure: add possibility to skip build of cygserver and utils
    
    This patch adds configure options allowing to disable build of cygserver
    and Cygwin utilities. This is useful when one needs to build only
    cygwin1.dll and crt0.o with stage1 compiler that is not yet capable of
    linking executables as it is missing cygwin1.dll and crt0.o.
    
    Signed-off-by: Radek Bartoň <radek.bar...@microsoft.com>

Diff:
---
 winsup/Makefile.am             | 20 ++++++++++++++++++--
 winsup/configure.ac            | 12 ++++++++++++
 winsup/cygserver/Makefile.am   |  2 ++
 winsup/doc/faq-programming.xml | 17 ++++++++++++++++-
 4 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/winsup/Makefile.am b/winsup/Makefile.am
index 9efdd4cb1..877c4e6b9 100644
--- a/winsup/Makefile.am
+++ b/winsup/Makefile.am
@@ -14,10 +14,26 @@ cygdoc_DATA = \
        CYGWIN_LICENSE \
        COPYING
 
-SUBDIRS = cygwin cygserver utils testsuite
+SUBDIRS = cygwin testsuite
+
+if BUILD_CYGSERVER
+SUBDIRS += cygserver
+endif
+
+if BUILD_UTILS
+SUBDIRS += utils
+endif
 
 if BUILD_DOC
 SUBDIRS += doc
 endif
 
-cygserver utils testsuite: cygwin
+testsuite: cygwin
+
+if BUILD_CYGSERVER
+cygserver: cygwin
+endif
+
+if BUILD_UTILS
+utils: cygwin
+endif
diff --git a/winsup/configure.ac b/winsup/configure.ac
index 18adf3d97..e7ac814b1 100644
--- a/winsup/configure.ac
+++ b/winsup/configure.ac
@@ -83,6 +83,18 @@ AC_ARG_ENABLE(doc,
              enable_doc=yes)
 AM_CONDITIONAL(BUILD_DOC, [test $enable_doc != "no"])
 
+# Disabling build of cygserver and utils is needed for zero-bootstrap build of
+# stage 1 Cygwin toolchain where the linker is not able to produce executables
+# yet.
+AC_ARG_ENABLE(cygserver,
+             [AS_HELP_STRING([--disable-cygserver], [do not build 
cygserver])],,
+             enable_cygserver=yes)
+AM_CONDITIONAL(BUILD_CYGSERVER, [test $enable_cygserver != "no"])
+AC_ARG_ENABLE(utils,
+             [AS_HELP_STRING([--disable-utils], [do not build utils])],,
+             enable_utils=yes)
+AM_CONDITIONAL(BUILD_UTILS, [test $enable_utils != "no"])
+
 AC_CHECK_PROGS([DOCBOOK2XTEXI], [docbook2x-texi db2x_docbook2texi])
 if test -z "$DOCBOOK2XTEXI" ; then
     if test "x$enable_doc" != "xno"; then
diff --git a/winsup/cygserver/Makefile.am b/winsup/cygserver/Makefile.am
index ec7a62240..efb578e53 100644
--- a/winsup/cygserver/Makefile.am
+++ b/winsup/cygserver/Makefile.am
@@ -12,7 +12,9 @@ cygserver_flags=$(cxxflags_common) -Wimplicit-fallthrough=5 
-Werror -DSYSCONFDIR
 AM_CXXFLAGS = $(CFLAGS)
 
 noinst_LIBRARIES = libcygserver.a
+if BUILD_CYGSERVER
 sbin_PROGRAMS = cygserver
+endif
 bin_SCRIPTS = cygserver-config
 
 cygserver_SOURCES = \
diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml
index 39610b916..ae9bdb8dc 100644
--- a/winsup/doc/faq-programming.xml
+++ b/winsup/doc/faq-programming.xml
@@ -698,8 +698,23 @@ Building these programs can be disabled with the 
<literal>--without-cross-bootst
 option to <literal>configure</literal>.
 </para>
 
+<para>
+Build of <literal>cygserver</literal> can be skipped with
+<literal>--disable-cygserver</literal> and build of other Cygwin utilities with
+<literal>--disable-utils</literal>.
+</para>
+
+<para>
+In combination, <literal>--disable-cygserver</literal>,
+<literal>--disable-dumper</literal>, <literal>--disable-utils</literal>
+and  <literal>--without-cross-bootstrap</literal> allow building of just
+<literal>cygwin1.dll</literal> and <literal>crt0.o</literal> for a stage2
+compiler, when being built with stage1 compiler which does not support linking
+executables yet (because those files are missing).
+</para>
+
 <!-- If you want to run the tests <literal>busybox</literal> and
-     <literal>cygutils-extra<literal> are also required. -->
+     <literal>cygutils-extra</literal> are also required. -->
 
 <para>
 Building the documentation also requires the <literal>dblatex</literal>,

Reply via email to