lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cygwin.newlib-cygwin{,-nobin}: init at 3.6.4

+298 -37
+4 -1
pkgs/os-specific/cygwin/default.nix
··· 17 17 w32api = callPackage ./w32api { }; 18 18 w32api-headers = callPackage ./w32api { headersOnly = true; }; 19 19 20 - newlib-cygwin-headers = callPackage ./newlib-cygwin { }; 20 + newlib-cygwin = callPackage ./newlib-cygwin { }; 21 + # this is here to avoid symlinks being made to cygwin1.dll in /nix/store 22 + newlib-cygwin-nobin = callPackage ./newlib-cygwin/nobin.nix { }; 23 + newlib-cygwin-headers = callPackage ./newlib-cygwin { headersOnly = true; }; 21 24 }; 22 25 }
+138 -35
pkgs/os-specific/cygwin/newlib-cygwin/default.nix
··· 1 1 { 2 2 lib, 3 + stdenv, 3 4 stdenvNoCC, 5 + stdenvNoLibc, 6 + autoreconfHook, 7 + bison, 4 8 buildPackages, 5 - fetchurl, 9 + cocom-tool-set, 10 + flex, 11 + perl, 12 + w32api, 6 13 w32api-headers, 14 + 15 + headersOnly ? false, 7 16 }: 8 17 9 - stdenvNoCC.mkDerivation (finalAttrs: { 10 - pname = "newlib-cygwin-headers"; 11 - version = "3.6.4"; 18 + (if headersOnly then stdenvNoCC else stdenvNoLibc).mkDerivation ( 19 + finalAttrs: 20 + { 21 + pname = "newlib-cygwin${lib.optionalString headersOnly "-headers"}"; 22 + version = "3.6.4"; 23 + 24 + src = buildPackages.fetchgit { 25 + url = "https://cygwin.com/git/newlib-cygwin.git"; 26 + rev = "cygwin-${finalAttrs.version}"; 27 + hash = "sha256-+WYKwqcDAc7286GzbgKKAxNJCOf3AeNnF8XEVPoor+g="; 28 + }; 29 + 30 + outputs = [ 31 + "out" 32 + ] 33 + ++ lib.optionals (!headersOnly) [ 34 + "bin" 35 + "dev" 36 + "man" 37 + ]; 38 + 39 + patches = [ 40 + # Newer versions of gcc don't like struct winsize being used before being 41 + # declared. Backport of https://cygwin.com/cgit/newlib-cygwin/commit/?id=73600d68227e125af24b7de7c3fccbd4eb66ee03 42 + ./fix-winsize.patch 43 + ] 44 + # After cygwin hosted builds are working, we should upstream this 45 + ++ lib.optional ( 46 + !headersOnly && stdenvNoLibc.hostPlatform != stdenvNoLibc.buildPlatform 47 + ) ./fix-cross.patch; 48 + 49 + passthru.w32api = if headersOnly then w32api-headers else w32api; 50 + 51 + meta = { 52 + homepage = "https://cygwin.com/"; 53 + description = "A DLL which provides substantial POSIX API functionality on Windows."; 54 + license = with lib.licenses; [ 55 + # newlib 56 + gpl2 57 + # winsup 58 + gpl3 59 + ]; 60 + platforms = lib.platforms.cygwin; 61 + maintainers = [ lib.maintainers.corngood ]; 62 + }; 63 + } 64 + // ( 65 + if headersOnly then 66 + { 67 + dontConfigure = true; 68 + dontBuild = true; 69 + 70 + installPhase = '' 71 + mkdir -p $out/include/ 72 + cp -r newlib/libc/include/* $out/include/ 73 + cp -r winsup/cygwin/include/* $out/include/ 74 + ''; 75 + } 76 + else 77 + { 78 + postPatch = '' 79 + patchShebangs --build winsup/cygwin/scripts 80 + ''; 81 + 82 + autoreconfFlags = [ 83 + "winsup" 84 + ] 85 + # Only reconfigure root when fix-cross.patch is applied. Otherwise the 86 + # autoconf version check will fail. 87 + ++ lib.optional (stdenvNoLibc.hostPlatform != stdenvNoLibc.buildPlatform) "."; 88 + 89 + env = 90 + let 91 + libflag = "-Wl,-L${lib.getLib w32api}${w32api.libdir or "/lib/w32api"}"; 92 + in 93 + { 94 + CFLAGS_FOR_TARGET = toString [ 95 + libflag 96 + ]; 12 97 13 - src = buildPackages.fetchgit { 14 - url = "https://cygwin.com/git/newlib-cygwin.git"; 15 - rev = "cygwin-${finalAttrs.version}"; 16 - hash = "sha256-+WYKwqcDAc7286GzbgKKAxNJCOf3AeNnF8XEVPoor+g="; 17 - }; 98 + CXXFLAGS_FOR_TARGET = toString [ 99 + "-Wno-error=register" 100 + libflag 101 + ]; 102 + }; 18 103 19 - patches = [ 20 - # newer versions of gcc don't like struct winsize being used before being 21 - # declared. 22 - ./fix-winsize.patch 23 - ]; 104 + strictDeps = true; 24 105 25 - dontConfigure = true; 26 - dontBuild = true; 106 + depsBuildBuild = [ buildPackages.stdenv.cc ]; 27 107 28 - installPhase = '' 29 - mkdir -p $out/include/ 30 - cp -r newlib/libc/include/* $out/include/ 31 - cp -r winsup/cygwin/include/* $out/include/ 32 - ''; 108 + nativeBuildInputs = [ 109 + autoreconfHook 110 + bison 111 + cocom-tool-set 112 + flex 113 + perl 114 + ]; 33 115 34 - passthru.w32api = w32api-headers; 116 + buildInputs = [ w32api ]; 35 117 36 - meta = { 37 - homepage = "https://cygwin.com/"; 38 - description = "A DLL which provides substantial POSIX API functionality on Windows."; 39 - license = with lib.licenses; [ 40 - # newlib 41 - gpl2 42 - # winsup 43 - gpl3 44 - ]; 45 - platforms = lib.platforms.cygwin; 46 - maintainers = [ lib.maintainers.corngood ]; 47 - }; 48 - }) 118 + makeFlags = [ 119 + "tooldir=${placeholder "out"}" 120 + ]; 121 + 122 + enableParallelBuilding = true; 123 + 124 + # this is explicitly -j1 in cygwin.cygport 125 + # without it the install order is non-deterministic 126 + enableParallelInstalling = false; 127 + 128 + hardeningDisable = [ 129 + # conflicts with internal definition of 'bzero' 130 + "fortify" 131 + "stackprotector" 132 + ]; 133 + 134 + configurePlatforms = [ 135 + "build" 136 + "target" 137 + ]; 138 + 139 + configureFlags = [ 140 + "--disable-shared" 141 + "--disable-doc" 142 + "--enable-static" 143 + "--disable-dumper" 144 + "--with-cross-bootstrap" 145 + ] 146 + ++ lib.optional (stdenvNoLibc.hostPlatform != stdenvNoLibc.buildPlatform) [ 147 + "ac_cv_prog_CC=gcc" 148 + ]; 149 + } 150 + ) 151 + )
+55
pkgs/os-specific/cygwin/newlib-cygwin/fix-cross.patch
··· 1 + Disable strict autoconf version check so we can autoreconf in nixpkgs. 2 + 3 + diff --git a/config/override.m4 b/config/override.m4 4 + index 8b954d3cb..60c4cfd12 100644 5 + --- a/config/override.m4 6 + +++ b/config/override.m4 7 + @@ -44,7 +44,6 @@ AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK], 8 + [m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])]) 9 + ]) 10 + m4_define([AC_INIT], m4_defn([AC_INIT])[ 11 + -_GCC_AUTOCONF_VERSION_CHECK 12 + ]) 13 + 14 + 15 + 16 + This is needed for target linking to find e.g. crt0.o. 17 + diff --git a/configure.ac b/configure.ac 18 + index 05ddf6987..f5bbd5c72 100644 19 + --- a/configure.ac 20 + +++ b/configure.ac 21 + @@ -3166,7 +3166,7 @@ case " $target_configdirs " in 22 + *" --with-newlib "*) 23 + case "$target" in 24 + *-cygwin*) 25 + - FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include' 26 + + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include' 27 + ;; 28 + esac 29 + 30 + 31 + Autoconf clears EXEEXT= in cross, which breaks installation of utils/cygserver. 32 + 33 + AC_CHECK_LIB is disabled in cross after AC_NO_EXECUTABLES. 34 + diff --git a/winsup/configure.ac b/winsup/configure.ac 35 + index e7ac814b1..14b56e130 100644 36 + --- a/winsup/configure.ac 37 + +++ b/winsup/configure.ac 38 + @@ -40,6 +40,8 @@ AM_PROG_AS 39 + AC_LANG(C) 40 + AC_LANG(C++) 41 + 42 + +EXEEXT=.exe 43 + + 44 + AC_ARG_WITH([cross-bootstrap],[AS_HELP_STRING([--with-cross-bootstrap],[do not build programs using the MinGW toolchain or check for MinGW libraries (useful for bootstrapping a cross-compiler)])],[],[with_cross_bootstrap=no]) 45 + 46 + AC_CYGWIN_INCLUDES 47 + @@ -135,8 +137,6 @@ AM_CONDITIONAL(BUILD_DUMPER, [test "x$build_dumper" = "xyes"]) 48 + # libbfd.a doesn't have a pkgconfig file, so we guess what it's dependencies 49 + # are, based on what's present in the build environment 50 + BFD_LIBS="-lintl -liconv -liberty -lz" 51 + -AC_CHECK_LIB([sframe], [sframe_decode], [BFD_LIBS="${BFD_LIBS} -lsframe"]) 52 + -AC_CHECK_LIB([zstd], [ZSTD_isError], [BFD_LIBS="${BFD_LIBS} -lzstd"]) 53 + AC_SUBST([BFD_LIBS]) 54 + 55 + AC_CONFIG_FILES([
+9
pkgs/os-specific/cygwin/newlib-cygwin/nobin.nix
··· 1 + { 2 + emptyDirectory, 3 + newlib-cygwin, 4 + }: 5 + 6 + newlib-cygwin 7 + // { 8 + bin = emptyDirectory; 9 + }
+88
pkgs/os-specific/cygwin/newlib-cygwin/remove-definitions-that-conflict-with-mingw.patch
··· 1 + From cc95494ed527e64fcd1ade7ed7ae44f9e0a6fa8a Mon Sep 17 00:00:00 2001 2 + From: David McFarland <corngood@gmail.com> 3 + Date: Tue, 9 Sep 2025 15:04:45 -0300 4 + Subject: [PATCH] remove definitions that conflict with mingw 5 + 6 + --- 7 + winsup/cygwin/fhandler/socket_inet.cc | 2 ++ 8 + winsup/cygwin/fhandler/socket_local.cc | 2 ++ 9 + winsup/cygwin/local_includes/ntdll.h | 20 -------------------- 10 + winsup/cygwin/net.cc | 2 ++ 11 + 4 files changed, 6 insertions(+), 20 deletions(-) 12 + 13 + diff --git a/winsup/cygwin/fhandler/socket_inet.cc b/winsup/cygwin/fhandler/socket_inet.cc 14 + index 63cc498f1..03681c07b 100644 15 + --- a/winsup/cygwin/fhandler/socket_inet.cc 16 + +++ b/winsup/cygwin/fhandler/socket_inet.cc 17 + @@ -20,7 +20,9 @@ 18 + #undef u_long 19 + #define u_long __ms_u_long 20 + #include <w32api/ws2tcpip.h> 21 + +#define cmsghdr __ms_cmsghdr 22 + #include <w32api/mswsock.h> 23 + +#undef cmsghdr 24 + #include <w32api/mstcpip.h> 25 + #include <netinet/tcp.h> 26 + #include <netinet/udp.h> 27 + diff --git a/winsup/cygwin/fhandler/socket_local.cc b/winsup/cygwin/fhandler/socket_local.cc 28 + index e4a88169b..b832d8a84 100644 29 + --- a/winsup/cygwin/fhandler/socket_local.cc 30 + +++ b/winsup/cygwin/fhandler/socket_local.cc 31 + @@ -21,7 +21,9 @@ 32 + #define u_long __ms_u_long 33 + #include "ntsecapi.h" 34 + #include <w32api/ws2tcpip.h> 35 + +#define cmsghdr __ms_cmsghdr 36 + #include <w32api/mswsock.h> 37 + +#undef cmsghdr 38 + #include <unistd.h> 39 + #include <asm/byteorder.h> 40 + #include <sys/socket.h> 41 + diff --git a/winsup/cygwin/local_includes/ntdll.h b/winsup/cygwin/local_includes/ntdll.h 42 + index 4497fe53f..bf86a8293 100644 43 + --- a/winsup/cygwin/local_includes/ntdll.h 44 + +++ b/winsup/cygwin/local_includes/ntdll.h 45 + @@ -489,26 +489,6 @@ typedef struct _FILE_DISPOSITION_INFORMATION_EX // 64 46 + ULONG Flags; 47 + } FILE_DISPOSITION_INFORMATION_EX, *PFILE_DISPOSITION_INFORMATION_EX; 48 + 49 + -typedef struct _FILE_STAT_INFORMATION // 68 50 + -{ 51 + - LARGE_INTEGER FileId; 52 + - LARGE_INTEGER CreationTime; 53 + - LARGE_INTEGER LastAccessTime; 54 + - LARGE_INTEGER LastWriteTime; 55 + - LARGE_INTEGER ChangeTime; 56 + - LARGE_INTEGER AllocationSize; 57 + - LARGE_INTEGER EndOfFile; 58 + - ULONG FileAttributes; 59 + - ULONG ReparseTag; 60 + - ULONG NumberOfLinks; 61 + - ACCESS_MASK EffectiveAccess; 62 + -} FILE_STAT_INFORMATION, *PFILE_STAT_INFORMATION; 63 + - 64 + -typedef struct _FILE_CASE_SENSITIVE_INFORMATION // 71 65 + -{ 66 + - ULONG Flags; 67 + -} FILE_CASE_SENSITIVE_INFORMATION, *PFILE_CASE_SENSITIVE_INFORMATION; 68 + - 69 + enum { 70 + FILE_LINK_REPLACE_IF_EXISTS = 0x01, 71 + FILE_LINK_POSIX_SEMANTICS = 0x02, 72 + diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc 73 + index 737e494f8..6a1a0d079 100644 74 + --- a/winsup/cygwin/net.cc 75 + +++ b/winsup/cygwin/net.cc 76 + @@ -18,7 +18,9 @@ details. */ 77 + #undef u_long 78 + #define u_long __ms_u_long 79 + #include <w32api/ws2tcpip.h> 80 + +#define cmsghdr __ms_cmsghdr 81 + #include <w32api/mswsock.h> 82 + +#undef cmsghdr 83 + #include <w32api/iphlpapi.h> 84 + #define gethostname cygwin_gethostname 85 + #include <unistd.h> 86 + -- 87 + 2.50.1 88 +
+1
pkgs/os-specific/windows/default.nix
··· 7 7 newScope, 8 8 overrideCC, 9 9 stdenvNoLibc, 10 + emptyDirectory, 10 11 }: 11 12 12 13 lib.makeScope newScope (
+3 -1
pkgs/top-level/all-packages.nix
··· 4867 4867 isl = if !stdenv.hostPlatform.isDarwin then isl_0_20 else null; 4868 4868 4869 4869 withoutTargetLibc = true; 4870 - langCC = false; 4870 + langCC = stdenv.targetPlatform.isCygwin; # can't compile libcygwin1.a without C++ 4871 4871 libcCross = libc1; 4872 4872 targetPackages.stdenv.cc.bintools = binutilsNoLibc; 4873 4873 enableShared = ··· 7632 7632 if stdenv.hostPlatform.isMinGW then windows.mingw_w64 else windows.sdk 7633 7633 else if libc == "ucrt" then 7634 7634 if stdenv.hostPlatform.isMinGW then windows.mingw_w64 else windows.sdk 7635 + else if libc == "cygwin" then 7636 + cygwin.newlib-cygwin-nobin 7635 7637 else if libc == "libSystem" then 7636 7638 if stdenv.hostPlatform.useiOSPrebuilt then darwin.iosSdkPkgs.libraries else darwin.libSystem 7637 7639 else if libc == "fblibc" then