The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

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

Fix the detection of Cygwin-like build environments

Both Cygwin and MSYS2 are now consistently detected on MSYS2. In
particular, this means that ./configure --prefix $PWD/install and
similar will cause the prefix to be correctly translated to a Windows
path, as already happens on Cygwin.

+102 -26
+7
Changes
··· 415 415 building OCaml with --disable-shared. 416 416 (David Allsopp, review by Jonah Beckford, Damien Doligez and Hugo Heuzard) 417 417 418 + - #14244: Normalise `--prefix` when compiling on MSYS2 in the same way as is 419 + already done on Cygwin. In particular, backslashes are converted to slashes 420 + and MSYS2-style paths (e.g. resulting from `--prefix $PWD/install`) are 421 + converted to Windows-style paths. 422 + (David Allsopp, review by Jonah Beckford, Antonin Décimo, Damien Doligez and 423 + Samuel Hym) 424 + 418 425 ### Bug fixes: 419 426 420 427 - #14036: Fix nontermination of cycle printing in recursive modules with
+49 -14
configure
··· 3786 3786 ac_tool_prefix=$target_alias- 3787 3787 fi 3788 3788 3789 + # $cygwin_build_env=true if the build is taking place in any kind of Cygwin-like 3790 + # environment (which may include cross-compiling _from_ Cygwin) 3791 + # All patterns end with * (cf. build-aux/config.sub) 3792 + # 3793 + # In Cygwin itself, the mingw-w64 compilers are cross-compilers 3794 + # (host=x86_64-pc-cygwin; target=*-w64-mingw32) and $build when running from 3795 + # within Cygwin is always *-pc-cygwin. 3796 + # 3797 + # In MSYS2, the mingw-w64 compilers are normal host compilers, which MSYS2 makes 3798 + # available through different Environments (similar to the Microsoft Visual 3799 + # Studio Tools Command Prompts; see https://www.msys2.org/docs/environments/). 3800 + # It is possible to use MSYS2's "Cygwin" gcc (the equivalent of compiling native 3801 + # Cygwin), in which case $build is *-*-cygwin (some older MSYS2 installations 3802 + # may report the legacy *-*-msys*) 3803 + # The mingw-w64 Environments manually set $build to *-w64-mingw32, but the 3804 + # _native_ value inferred by config.guess (which uses uname -s) will be 3805 + # *-pc-mingw32 (for the 32-bit _target_ environments, even though MSYS2 is a 3806 + # 64-bit build environment) and *-pc-mingw64 (for the 64-bit _target_ 3807 + # environments). 3808 + # 3809 + # This leads to the four patterns below, all of which imply that the build is 3810 + # taking place on a system where Cygwin's utilities (cygpath, etc.) can be 3811 + # expected to be found and its semantics (CYGWIN=winsymlinks:native, etc.) be 3812 + # expected to apply. 3813 + # 3814 + # Note that although build=x86_64-pc-mingw64 will be accepted here, it is highly 3815 + # likely that that's a misconfigured environment, and the script will 3816 + # subsequently fail if host has not been altered to x86_64-w64-mingw32. 3817 + case $build in #( 3818 + *-*-cygwin*|*-*-msys*|*-*-mingw32*|*-*-mingw64*) : 3819 + cygwin_build_env=true ;; #( 3820 + *) : 3821 + cygwin_build_env=false ;; 3822 + esac 3823 + 3789 3824 # Ensure that AC_CONFIG_LINKS will either create symlinks which are compatible 3790 3825 # with native Windows (i.e. NTFS symlinks, not WSL or Cygwin-emulated ones) or 3791 3826 # use its fallback mechanisms. Native Windows versions of ocamlc/ocamlopt cannot 3792 3827 # interpret either WSL or Cygwin-emulated symlinks. 3793 - case $host in #( 3794 - *-pc-windows|*-w64-mingw32*) : 3828 + case $cygwin_build_env,$host in #( 3829 + true,*-pc-windows|true,*-w64-mingw32*) : 3795 3830 ac_config_commands="$ac_config_commands native-symlinks" 3796 3831 ;; #( 3797 3832 *) : ··· 15117 15152 ocamlsrcdir=$(unset CDPATH; cd -- "$srcdir" && printf %sX "$PWD") || fail 15118 15153 ocamlsrcdir=${ocamlsrcdir%X} 15119 15154 15120 - case $host in #( 15121 - *-w64-mingw32*|*-pc-windows) : 15155 + case $cygwin_build_env,$host in #( 15156 + true,*-w64-mingw32*|true,*-pc-windows) : 15122 15157 15123 15158 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a workable solution for ln -sf" >&5 15124 15159 printf %s "checking for a workable solution for ln -sf... " >&6; } ··· 16066 16101 if test x"$build" != x"$host" 16067 16102 then : 16068 16103 16069 - case $build in #( 16070 - *-pc-msys|*-*-cygwin) : 16071 - flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" 16072 - if test -z "$flexlink_where" 16104 + if $cygwin_build_env 16105 + then : 16106 + flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" 16107 + if test -z "$flexlink_where" 16073 16108 then : 16074 16109 as_fn_error $? "$flexlink is not executable from a native Win32 process" "$LINENO" 5 16075 - fi ;; #( 16076 - *) : 16077 - ;; 16078 - esac 16110 + 16111 + fi 16112 + 16113 + fi 16079 16114 16080 16115 fi 16081 16116 ··· 24174 24209 ;; 24175 24210 esac 24176 24211 else $as_nop 24177 - case $build,$host in #( 24178 - *-*-cygwin,*-w64-mingw32*|*-*-cygwin,*-pc-windows) : 24212 + case $cygwin_build_env,$host in #( 24213 + true,*-w64-mingw32*|true,*-pc-windows) : 24179 24214 prefix="$(LC_ALL=C.UTF-8 cygpath -m "$prefix")" ;; #( 24180 24215 *) : 24181 24216 ;;
+46 -12
configure.ac
··· 330 330 AS_IF([test -n "$target_alias"], 331 331 [ac_tool_prefix=$target_alias-]) 332 332 333 + # $cygwin_build_env=true if the build is taking place in any kind of Cygwin-like 334 + # environment (which may include cross-compiling _from_ Cygwin) 335 + # All patterns end with * (cf. build-aux/config.sub) 336 + # 337 + # In Cygwin itself, the mingw-w64 compilers are cross-compilers 338 + # (host=x86_64-pc-cygwin; target=*-w64-mingw32) and $build when running from 339 + # within Cygwin is always *-pc-cygwin. 340 + # 341 + # In MSYS2, the mingw-w64 compilers are normal host compilers, which MSYS2 makes 342 + # available through different Environments (similar to the Microsoft Visual 343 + # Studio Tools Command Prompts; see https://www.msys2.org/docs/environments/). 344 + # It is possible to use MSYS2's "Cygwin" gcc (the equivalent of compiling native 345 + # Cygwin), in which case $build is *-*-cygwin (some older MSYS2 installations 346 + # may report the legacy *-*-msys*) 347 + # The mingw-w64 Environments manually set $build to *-w64-mingw32, but the 348 + # _native_ value inferred by config.guess (which uses uname -s) will be 349 + # *-pc-mingw32 (for the 32-bit _target_ environments, even though MSYS2 is a 350 + # 64-bit build environment) and *-pc-mingw64 (for the 64-bit _target_ 351 + # environments). 352 + # 353 + # This leads to the four patterns below, all of which imply that the build is 354 + # taking place on a system where Cygwin's utilities (cygpath, etc.) can be 355 + # expected to be found and its semantics (CYGWIN=winsymlinks:native, etc.) be 356 + # expected to apply. 357 + # 358 + # Note that although build=x86_64-pc-mingw64 will be accepted here, it is highly 359 + # likely that that's a misconfigured environment, and the script will 360 + # subsequently fail if host has not been altered to x86_64-w64-mingw32. 361 + AS_CASE([$build], 362 + [*-*-cygwin*|*-*-msys*|*-*-mingw32*|*-*-mingw64*], 363 + [cygwin_build_env=true], 364 + [cygwin_build_env=false]) 365 + 333 366 # Ensure that AC_CONFIG_LINKS will either create symlinks which are compatible 334 367 # with native Windows (i.e. NTFS symlinks, not WSL or Cygwin-emulated ones) or 335 368 # use its fallback mechanisms. Native Windows versions of ocamlc/ocamlopt cannot 336 369 # interpret either WSL or Cygwin-emulated symlinks. 337 - AS_CASE([$host], 338 - [*-pc-windows|*-w64-mingw32*], 370 + AS_CASE([$cygwin_build_env,$host], 371 + [true,*-pc-windows|true,*-w64-mingw32*], 339 372 [AC_CONFIG_COMMANDS([native-symlinks], [], 340 373 [export CYGWIN="\$CYGWIN\${CYGWIN:+ }winsymlinks:nativestrict" 341 374 export MSYS="\$MSYS\${MSYS:+ }winsymlinks:nativestrict"])]) ··· 836 869 ocamlsrcdir=$(unset CDPATH; cd -- "$srcdir" && printf %sX "$PWD") || fail 837 870 ocamlsrcdir=${ocamlsrcdir%X} 838 871 839 - AS_CASE([$host], 840 - [*-w64-mingw32*|*-pc-windows], 872 + AS_CASE([$cygwin_build_env,$host], 873 + [true,*-w64-mingw32*|true,*-pc-windows], 841 874 [OCAML_CHECK_LN_ON_WINDOWS 842 875 ocamlsrcdir="$(LC_ALL=C.UTF-8 cygpath -w -- "$ocamlsrcdir")"], 843 876 [ln='ln -sf']) ··· 1158 1191 # ensure it can be executed from a native Windows process. The check 1159 1192 # is only necessary when cross-compiling. 1160 1193 AS_IF([test x"$build" != x"$host"],[ 1161 - AS_CASE([$build], 1162 - [*-pc-msys|*-*-cygwin], 1163 - [flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" 1164 - AS_IF([test -z "$flexlink_where"], 1165 - [AC_MSG_ERROR(m4_normalize([$flexlink is not executable from a 1166 - native Win32 process]))])]) 1194 + AS_IF([$cygwin_build_env], 1195 + [flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" 1196 + AS_IF([test -z "$flexlink_where"], 1197 + [AC_MSG_ERROR(m4_normalize([$flexlink is not executable from a 1198 + native Win32 process])) 1199 + ]) 1200 + ]) 1167 1201 ]) 1168 1202 ]) 1169 1203 ··· 2924 2958 [x86_64-w64-mingw32*], [prefix='C:/ocamlmgw64'], 2925 2959 [i686-pc-windows], [prefix='C:/ocamlms'], 2926 2960 [x86_64-pc-windows], [prefix='C:/ocamlms64'])], 2927 - [AS_CASE([$build,$host], 2928 - [*-*-cygwin,*-w64-mingw32*|*-*-cygwin,*-pc-windows], 2961 + [AS_CASE([$cygwin_build_env,$host], 2962 + [true,*-w64-mingw32*|true,*-pc-windows], 2929 2963 [prefix="$(LC_ALL=C.UTF-8 cygpath -m "$prefix")"])]) 2930 2964 2931 2965 # Define a few macros that were defined in config/m-nt.h