diff --git a/patches/5.2.0~beta2/0001-Add-missing-defined-in-preprocessor-test.patch b/patches/5.2.0~beta2/0001-Add-missing-defined-in-preprocessor-test.patch new file mode 100644 index 00000000..13a9a80d --- /dev/null +++ b/patches/5.2.0~beta2/0001-Add-missing-defined-in-preprocessor-test.patch @@ -0,0 +1,27 @@ +From 8300488c8891138da0bb490f1e74aaa9acfe11bd Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Tue, 27 Feb 2024 16:14:38 +0100 +Subject: [PATCH 01/14] Add missing `defined` in preprocessor test + +When `HAS_CLOCK_GETTIME_NSEC_NP` is not defined, +`#elif HAS_CLOCK_GETTIME_NSEC_NP` triggers a warning +--- + runtime/unix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/runtime/unix.c b/runtime/unix.c +index b5fd4de17b..b397fd2c9c 100644 +--- a/runtime/unix.c ++++ b/runtime/unix.c +@@ -47,7 +47,7 @@ + #endif + #ifdef HAS_POSIX_MONOTONIC_CLOCK + #include +-#elif HAS_CLOCK_GETTIME_NSEC_NP ++#elif defined(HAS_CLOCK_GETTIME_NSEC_NP) + #include + #endif + #ifdef HAS_DIRENT +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0002-Include-config.h-before-HAS_GETTIMEOFDAY-is-tested.patch b/patches/5.2.0~beta2/0002-Include-config.h-before-HAS_GETTIMEOFDAY-is-tested.patch new file mode 100644 index 00000000..6ea34521 --- /dev/null +++ b/patches/5.2.0~beta2/0002-Include-config.h-before-HAS_GETTIMEOFDAY-is-tested.patch @@ -0,0 +1,34 @@ +From 3a811f54eb8b087ccbcebf40898053c37afec2a5 Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Tue, 27 Feb 2024 16:22:58 +0100 +Subject: [PATCH 02/14] Include `config.h` before `HAS_GETTIMEOFDAY` is tested + +Also remove a duplicate `errno.h` +--- + runtime/unix.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/runtime/unix.c b/runtime/unix.c +index b397fd2c9c..abdc8cd630 100644 +--- a/runtime/unix.c ++++ b/runtime/unix.c +@@ -21,6 +21,7 @@ + /* Helps finding RTLD_DEFAULT in glibc */ + /* also secure_getenv */ + ++#include "caml/config.h" + #include + #include + #include +@@ -32,8 +33,6 @@ + #endif + #include + #include +-#include +-#include "caml/config.h" + #if defined(SUPPORT_DYNAMIC_LINKING) && !defined(BUILDING_LIBCAMLRUNS) + #define WITH_DYNAMIC_LINKING + #ifdef __CYGWIN__ +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0003-Fix-a-pattern-in-configure.patch b/patches/5.2.0~beta2/0003-Fix-a-pattern-in-configure.patch new file mode 100644 index 00000000..0ca5a155 --- /dev/null +++ b/patches/5.2.0~beta2/0003-Fix-a-pattern-in-configure.patch @@ -0,0 +1,38 @@ +From ae8385418d41ee5948bdd988e1c03615c6f73961 Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Mon, 26 Feb 2024 17:48:50 +0100 +Subject: [PATCH 03/14] Fix a pattern in configure + +In a sh `case` pattern matching, each `|`-separated alternative must +match the complete expression +--- + configure | Bin 647384 -> 647386 bytes + configure.ac | 2 +- + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index c307be8f419008a6282200bfe39e231a24da8dbb..8da296aaa838196901735466a6d3636fcb77439e 100755 +GIT binary patch +delta 42 +vcmca{Q2o|H^@bM47N!>F7M2#)Eo|1VOjF7M2#)Eo|1V%!x(0(>Ly56PbR?i_M{ZiYprsvjZ{5_9?EM +GZnFU{U=!^C + +diff --git a/configure.ac b/configure.ac +index f6fbf61157..c04ee82f96 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1007,7 +1007,7 @@ AS_CASE([$ocaml_cc_vendor,$host], + [*,x86_64-*-darwin*], + [oc_ldflags='-Wl,-no_compact_unwind'; + AC_DEFINE([HAS_ARCH_CODE32], [1])], +- [*,aarch64-*-darwin*|arm64-*-darwin*], ++ [*,aarch64-*-darwin*|*,arm64-*-darwin*], + AC_DEFINE([HAS_ARCH_CODE32], [1]), + [*,*-*-cygwin*], + [common_cppflags="$common_cppflags -U_WIN32" +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0004-Detect-and-use-CC-.-_FOR_BUILD-to-build-sak.patch b/patches/5.2.0~beta2/0004-Detect-and-use-CC-.-_FOR_BUILD-to-build-sak.patch new file mode 100644 index 00000000..317bc2e6 --- /dev/null +++ b/patches/5.2.0~beta2/0004-Detect-and-use-CC-.-_FOR_BUILD-to-build-sak.patch @@ -0,0 +1,310 @@ +From 48b442a8dc4e763dfa74f181883f12be6ab49337 Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Wed, 21 Feb 2024 18:47:12 +0100 +Subject: [PATCH 04/14] Detect and use {CC,...}_FOR_BUILD to build sak + +--- + Makefile | 9 +- + Makefile.config.in | 4 + + aclocal.m4 | 1 + + build-aux/ax_prog_cc_for_build.m4 | 155 ++++++++++++++++++++++++++++++ + configure | Bin 647386 -> 682453 bytes + configure.ac | 10 +- + 6 files changed, 172 insertions(+), 7 deletions(-) + create mode 100644 build-aux/ax_prog_cc_for_build.m4 + +diff --git a/Makefile b/Makefile +index 71d41cd2d6..df191af79c 100644 +--- a/Makefile ++++ b/Makefile +@@ -1284,11 +1284,10 @@ runtime/caml/jumptbl.h : runtime/caml/instruct.h + sed -n -e '/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \ + -e '/^}/q' > $@ + +-# These are provided as a temporary shim to allow cross-compilation systems +-# to supply a host C compiler and different flags and a linking macro. +-SAK_CC ?= $(CC) +-SAK_CFLAGS ?= $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) +-SAK_LINK ?= $(MKEXE_VIA_CC) ++SAK_CC ?= $(CC_FOR_BUILD) ++SAK_CFLAGS ?=\ ++ $(OC_CFLAGS) $(CFLAGS_FOR_BUILD) $(OC_CPPFLAGS) $(CPPFLAGS_FOR_BUILD) ++SAK_LINK ?= $(SAK_CC) $(SAK_CFLAGS) $(OC_EXE_LDFLAGS) $(OUTPUTEXE)$(1) $(2) + + $(SAK): runtime/sak.$(O) + $(V_MKEXE)$(call SAK_LINK,$@,$^) +diff --git a/Makefile.config.in b/Makefile.config.in +index 559738f6ed..4243bebad9 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -65,11 +65,13 @@ LIBTOOL = $(TOP_BUILDDIR)/libtool + ### Which C compiler to use + TOOLPREF=@ac_tool_prefix@ + CC=@CC@ ++CC_FOR_BUILD=@CC_FOR_BUILD@ + + CC_HAS_DEBUG_PREFIX_MAP=@cc_has_debug_prefix_map@ + AS_HAS_DEBUG_PREFIX_MAP=@as_has_debug_prefix_map@ + + LDFLAGS?=@LDFLAGS@ ++LDFLAGS_FOR_BUILD=@LDFLAGS_FOR_BUILD@ + + ### How to invoke the C preprocessor through the C compiler + CPP=@CPP@ +@@ -160,7 +162,9 @@ UNIX_OR_WIN32=@unix_or_win32@ + INSTALL_SOURCE_ARTIFACTS=@install_source_artifacts@ + + CFLAGS=@CFLAGS@ ++CFLAGS_FOR_BUILD=@CFLAGS_FOR_BUILD@ + CPPFLAGS=@CPPFLAGS@ ++CPPFLAGS_FOR_BUILD=@CPPFLAGS_FOR_BUILD@ + OCAMLC_CFLAGS=@ocamlc_cflags@ + + OCAMLC_CPPFLAGS=@ocamlc_cppflags@ +diff --git a/aclocal.m4 b/aclocal.m4 +index cb73385dda..d2e58a45f6 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -30,6 +30,7 @@ m4_include([build-aux/ax_check_compile_flag.m4]) + + # Macros from the autoconf macro archive + m4_include([build-aux/ax_func_which_gethostbyname_r.m4]) ++m4_include([build-aux/ax_prog_cc_for_build.m4]) + m4_include([build-aux/ax_pthread.m4]) + + # OCaml version +diff --git a/build-aux/ax_prog_cc_for_build.m4 b/build-aux/ax_prog_cc_for_build.m4 +new file mode 100644 +index 0000000000..1db8d73f96 +--- /dev/null ++++ b/build-aux/ax_prog_cc_for_build.m4 +@@ -0,0 +1,155 @@ ++# =========================================================================== ++# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html ++# =========================================================================== ++# ++# SYNOPSIS ++# ++# AX_PROG_CC_FOR_BUILD ++# ++# DESCRIPTION ++# ++# This macro searches for a C compiler that generates native executables, ++# that is a C compiler that surely is not a cross-compiler. This can be ++# useful if you have to generate source code at compile-time like for ++# example GCC does. ++# ++# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything ++# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). ++# The value of these variables can be overridden by the user by specifying ++# a compiler with an environment variable (like you do for standard CC). ++# ++# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object ++# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if ++# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are ++# substituted in the Makefile. ++# ++# LICENSE ++# ++# Copyright (c) 2008 Paolo Bonzini ++# ++# Copying and distribution of this file, with or without modification, are ++# permitted in any medium without royalty provided the copyright notice ++# and this notice are preserved. This file is offered as-is, without any ++# warranty. ++ ++#serial 21 ++ ++AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) ++AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl ++AC_REQUIRE([AC_PROG_CC])dnl ++AC_REQUIRE([AC_PROG_CPP])dnl ++AC_REQUIRE([AC_CANONICAL_BUILD])dnl ++ ++dnl Use the standard macros, but make them use other variable names ++dnl ++pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl ++pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl ++pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl ++pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl ++pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl ++pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl ++pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl ++pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl ++pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl ++pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl ++pushdef([ac_cv_objext], ac_cv_build_objext)dnl ++pushdef([ac_exeext], ac_build_exeext)dnl ++pushdef([ac_objext], ac_build_objext)dnl ++pushdef([CC], CC_FOR_BUILD)dnl ++pushdef([CPP], CPP_FOR_BUILD)dnl ++pushdef([GCC], GCC_FOR_BUILD)dnl ++pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl ++pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl ++pushdef([EXEEXT], BUILD_EXEEXT)dnl ++pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl ++pushdef([OBJEXT], BUILD_OBJEXT)dnl ++pushdef([host], build)dnl ++pushdef([host_alias], build_alias)dnl ++pushdef([host_cpu], build_cpu)dnl ++pushdef([host_vendor], build_vendor)dnl ++pushdef([host_os], build_os)dnl ++pushdef([ac_cv_host], ac_cv_build)dnl ++pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl ++pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl ++pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl ++pushdef([ac_cv_host_os], ac_cv_build_os)dnl ++pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl ++pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl ++pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl ++pushdef([cross_compiling], cross_compiling_build)dnl ++ ++cross_compiling_build=no ++ ++ac_build_tool_prefix= ++AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"], ++ [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"]) ++ ++AC_LANG_PUSH([C]) ++ ++dnl The pushdef([ac_cv_c_compiler_gnu], ...) currently does not cover ++dnl the use of this variable in _AC_LANG_COMPILER_GNU called by ++dnl AC_PROG_CC. Unset this cache variable temporarily as a workaround. ++was_set_c_compiler_gnu=${[ac_cv_c_compiler_gnu]+y} ++AS_IF([test ${was_set_c_compiler_gnu}], ++ [saved_c_compiler_gnu=$[ac_cv_c_compiler_gnu] ++ AS_UNSET([[ac_cv_c_compiler_gnu]])]) ++ ++AC_PROG_CC ++ ++dnl Restore ac_cv_c_compiler_gnu ++AS_IF([test ${was_set_c_compiler_gnu}], ++ [[ac_cv_c_compiler_gnu]=$[saved_c_compiler_gnu]]) ++ ++_AC_COMPILER_EXEEXT ++_AC_COMPILER_OBJEXT ++AC_PROG_CPP ++ ++dnl Restore the old definitions ++dnl ++popdef([cross_compiling])dnl ++popdef([am_cv_prog_cc_c_o])dnl ++popdef([am_cv_CC_dependencies_compiler_type])dnl ++popdef([ac_tool_prefix])dnl ++popdef([ac_cv_host_os])dnl ++popdef([ac_cv_host_vendor])dnl ++popdef([ac_cv_host_cpu])dnl ++popdef([ac_cv_host_alias])dnl ++popdef([ac_cv_host])dnl ++popdef([host_os])dnl ++popdef([host_vendor])dnl ++popdef([host_cpu])dnl ++popdef([host_alias])dnl ++popdef([host])dnl ++popdef([OBJEXT])dnl ++popdef([LDFLAGS])dnl ++popdef([EXEEXT])dnl ++popdef([CPPFLAGS])dnl ++popdef([CFLAGS])dnl ++popdef([GCC])dnl ++popdef([CPP])dnl ++popdef([CC])dnl ++popdef([ac_objext])dnl ++popdef([ac_exeext])dnl ++popdef([ac_cv_objext])dnl ++popdef([ac_cv_exeext])dnl ++popdef([ac_cv_c_compiler_gnu])dnl ++popdef([ac_cv_prog_cc_g])dnl ++popdef([ac_cv_prog_cc_cross])dnl ++popdef([ac_cv_prog_cc_works])dnl ++popdef([ac_cv_prog_cc_c89])dnl ++popdef([ac_cv_prog_gcc])dnl ++popdef([ac_cv_prog_CPP])dnl ++ ++dnl restore global variables ac_ext, ac_cpp, ac_compile, ++dnl ac_link, ac_compiler_gnu (dependant on the current ++dnl language after popping): ++AC_LANG_POP([C]) ++ ++dnl Finally, set Makefile variables ++dnl ++AC_SUBST(BUILD_EXEEXT)dnl ++AC_SUBST(BUILD_OBJEXT)dnl ++AC_SUBST([CFLAGS_FOR_BUILD])dnl ++AC_SUBST([CPPFLAGS_FOR_BUILD])dnl ++AC_SUBST([LDFLAGS_FOR_BUILD])dnl ++]) +diff --git a/configure b/configure +index 8da296aaa838196901735466a6d3636fcb77439e..d6492a8ce6f87d238842d7ac018b81ec667646a8 100755 +GIT binary patch +delta 6794 +zcmds5drVu`8Q1xYui+9PtmaWhlFN;;c^NQCXfkTj1ZdKX@kpC0Yty>Kn8)VY0hh5l2t +zi5BY_ZB(H@p4RJflr%Jyy5!hG(uQJ-vAHQo&DZ8&D*xM0F7P5j2gP2O{>Xl{8-eJkvZ#q_SEDao& +zZiZo9fMUzLQ*rw#N0J+tlYxD+w)H+vk2|dR!=Wx62S);>z+fOS7`;A;ieri6v9A_3 +zRvUmPcHHml4h>Kz9qNeqB7vw+T<|)E(UYEP-&8&{lJJXTczNOx(@T+#gMm&T7Nw^a +zOL`~|D={%?-a2Ib^bpBUq8N@x3I;Ba6LoRvlv|G>|3R8z;cl@|3CUuL +z!^JtNVU;;}=JdxxZEnS1i8-F`o|Um@SYOQ%HH?SCLSqEXxSTI{@b +z9SD5lm^B4ge@IefQ!1YPiM1e8)Q=RB(K3FUs^V1!6PP3wdlfxB7F9B8AofKp11vaB +z4#95rd3=&ojq(x=Uy6Du+%%5@!AO993B(3U%Xr?XZwdE5MN2KuX!?<6FXl~?95aq{ +z5&mRV@N4f$tFdpI)UlOcOp{ZhD|sBhXhdhvkRRWkh<<67`UqTjahCk`#*IUo +zuBDpiJ))6JGlIOT5th$m^fEcZtGs%d{Ei==o+G>X@zpuvzCB>j^v)I&q~Lv0z{kS5 +z5M<%r_sL;4Ir%rR<2R?_`@HvWtiI*(5osj6QCF#sSG>aFtt)VcBakH`aN;jkwU*az +zCd<;2Bo;mGOMfTph!{vWsoACeqCBqs;Kaq}ymSj?8G_;~jM +zDdhJdhG!#wcY)Ni$h@#Xercj~VwSPn|i7?!x2;|)`d6oRg +zRB{U<@D?1i5Ar#Ela5(@`xBDK)qGWPIx+i@bQI?@AO(ND12VN2{!KQXsg!1 +zMZ&^$>{-c$wsr97dhW;=3Pj@P{0@G*n5BS_2jvPB@DAy_M()cHj(B`tfoh)QtO6xW +z_hkiMa2hX#*qzbu_jT(pHhLLIe$L>xir`dM5-s)}mF#yVlX_KpxF!m)j}^7#33RBB!NNx>?^3l8YX6qzyGCFSAUUk8ctJX#D} +zc!l3929+)SwiulJlG_RSRUG!JyIXO$)~FN(cGX%2jZ7!3OBPZg2>Cn-k2&EPUc$T+ +zwkD0&V!aF2ux&r$f}QO1qzl&aq>JO$Ms(J|YJ9Yn$hf8i%K7DCH$1>NkClLzeNrfM +zuw?^ev+-gH)bm_br3u8^O5taW>f=(FVxNC3OT^Ja85BBs>xBqZ*r^?J8RnFOn@QMK +z4##+vQ{^HAbi5WTD-sawsz^X^ykaE?EN&R&g>u%v>0Z%#N9BsvKV6xyzO*V~{ijt4 +z>y_&3w|-}J!un{nXgv*pyD-lK75wgFlMj0mx<)*((=EonfAbbSXX%|pe~#04pLiF+ +zcyzqT%jHnHRx&QL@k$GkE~2O$ +zikOIBZGx?LREK7};YG0#LpwC_x7u~IUt-Oc0JG-St@*NVa}$?+?tXB50h0qFM3|G)~9nbxEQhI^*Zg{(MTeJ)h9?LL_cTX6nG%f0w= +z8pyaV4_4tPxzNt64)6a4Z3K>=nIF=RQnz+B4?@7;>L`G-B+bBr(v5pQ$j5&jA=~jl +zA*^pr%u{}&L#vF)MvFV%B;rX-lnj+|lvq>z4(yLI2fR9Cy|T|NO!~ErHKjZCP6^-t +zH(!6kv{!F!#&gyk>#y)!cy88OkYQkLwB_1xYys}U+;^?_akmbIw%^6pjN)!mlcu!p +zcdZjC^@6lETJ3p-vc4aBVd3Wlm!mRo&0F(-W#HlwQkNl!i1h`m7jiK +j-G4{bXuAQESXuGdpUE7^@^c|cqJJCxr)nW7EjaT(P9=Dw + +delta 62 +zcmcb5S@YIG^$oN9nkD?(CHxtIm +Date: Thu, 22 Feb 2024 13:37:28 +0100 +Subject: [PATCH 05/14] Use `target` instead of `host` to detect the C + toolchain + +When building a cross-compiler, the runtime will run on the target, not +the host so: +- set `cross_compiling` by comparing `build` to `target` (rather than to + `host`), as this variable will be used later +- use `target` to set up the tool prefix, +- as the libtool configuration will configure a `build` to `host` + toolchain, temporarily assign `host*` values to `target*` values +--- + configure | Bin 682453 -> 683009 bytes + configure.ac | 18 ++++++++++++++++++ + 2 files changed, 18 insertions(+) + +diff --git a/configure b/configure +index d6492a8ce6f87d238842d7ac018b81ec667646a8..68b1661dcb62e3e13f98b3f680715ff3238357c9 100755 +GIT binary patch +delta 1917 +zcmZ`(eN2^A7~ee~@8w>Bs~|FwkCzW?2I{Xr|O11Q*AahkHFLh&8G!iLBVnb8nmG5 +z_KPC>8a1C<*Q|Rzb0t)FY`CiMg{x`-JG=C9R3dvN`^_}HhLSzCL1cyDcZ!VaL;57d1UzXk!#gxM??o&G0OhAcY +z&R4BAetsEZo6QXTsXgfRXs~ZJqK!);X3pbh4xp4|neX;Vv{`|+91QJ+n9wP-oBzPj +zata9r(22ojUFhJ&#)l}E01thHu2Hr&*BZmW??bDRX~uto4o3mw)D?uu3bVD0 +zb>Wrp*;Uo;GBnlH#QTO&IyCjbe7TtKxCN4=-b8xLJUM*qN90{R4`$(;;UiP%y#)r( +z>3vinQj}D$hQme`*KFrn{W|7@B|){P64Fb +zAgFyCPMfdZl$pI7`{mG2*5IDVlJod=9lsUX=j0PXT(OXEs14UIVdeB +zNe=yqv*2m)^eEBgLKB4szs@3#Gmdalk(>& +z{+t|#f=t+}SWQ2P=Z=1oYlYJ5zarhTf9KaEi`~6OV%UWgv>aYM7if(tg^rWQrO@jW +znT^mQI +zAv`bsKbWsbpf;)C;Y8XVXSRMho34a5_-HPzQldeO-%xcQyH`XL`Hp-#Bmcf_rSzWU +zmu{kEGUY2zQjfI9x6t+Gf5aXwr`tiyk#c$g7;MdUn#M|f)WPeYpz6oT{K810iGSCT>u|BeU*x%h+`Ee +Lil4q}EA09g^E$y- + +delta 1319 +zcmYLJe@xV67~l7O-uJva@XosfP7~zY$!G}C7~@A+FtV8F+_9RX1c3&GW?pt@YjYaf +zPf@WSwnv;4<%ZfHwwn1W*18{&=^~_xbU8KJW8B +z&v(bgg7Xsv-6yP(-TL|->zRtIu1GZ28i~5sciORzXv}^hlxIxXH)3Uj0eWb}stsV| +zg4%^&{A&4e+uv5MK7G;Jl}Sczj9&Nuer@~{IgTXjEyY+{VwE514T?IVdbvgPrW4BF +zAeQ)&Nj>_nts*Deos73TBac0@7B@R#K8{^dv(VEoa?+D(Qmz=*erpABpkKIf?*UOy +zRFelpOeGN-biaPR&AAqpH~BhHm2WrolIbn77UyI9UPnncuF2V`=0)w*=;r +zU^J)_Tf^Yc1$B^M>Ao=JrgWTXh6v!Qgww0Ft2M(uP=6kW1XwcC3_0%A|$(jxwg}wl3s(K$XT!ilX7*;M!M*Hx+D^QiR;q@yp +zNMKW~T%%`xgnGc1pPWA3GzF`<_xdVqlU(GUX{i1$ty%vt4d(F4D*d-uI44|<5OctHM~OK8Ece1)jdphbB1hcbX| +z!!oQ5y5yjc{Lkd;JgR5U%H?Fr9+MB)+@8HtvY2HIUzG_~dGvSLLJNfM8OiHeI3vGz +z^HmqPR2!p4zskZ3F6GrHT8RP%11r=osxzg?(q +z1y6Dl%n!oe*j^lsgz(Eum4TlxSLxbwn_9$O*7ap7Z8qhsxl8?)n!BbtRmL~izf`p| +zy0J`E6GF3aS?Fp|UhG(*N-4L0g*wh*4Gn6VwHlPGyY5xTQlz0(>J&@QkB@pPtvPiufs(^{SmrYc{P#Vr-pzE-w8AL^` + +diff --git a/configure.ac b/configure.ac +index 404216bc4a..a6645c6637 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -288,6 +288,14 @@ AC_CANONICAL_BUILD + AC_CANONICAL_HOST + AC_CANONICAL_TARGET + ++# Override cross_compiling and ac_tool_prefix variables since the C toolchain is ++# used to generate target code when building a cross compiler ++AS_IF([test x"$build" = x"$target"], ++ [cross_compiling=no], ++ [cross_compiling=yes]) ++AS_IF([test -n "$target_alias"], ++ [ac_tool_prefix=$target_alias-]) ++ + # Ensure that AC_CONFIG_LINKS will either create symlinks which are compatible + # with native Windows (i.e. NTFS symlinks, not WSL or Cygwin-emulated ones) or + # use its fallback mechanisms. Native Windows versions of ocamlc/ocamlopt cannot +@@ -594,12 +602,22 @@ AC_CHECK_TOOLS([LD],[ld link]) + # Also, it has been observed that, on some platforms (e.g. msvc) LT_INIT + # alters the CFLAGS variable, so we save its value before calling the macro + # and restore it after the call ++pushdef([host], target)dnl ++pushdef([host_alias], target_alias)dnl ++pushdef([host_cpu], target_cpu)dnl ++pushdef([host_vendor], target_vendor)dnl ++pushdef([host_os], target_os)dnl + old_host_os=$host_os + AS_IF([test x"$host_os" = "xwindows"],[host_os=mingw]) + saved_CFLAGS="$CFLAGS" + LT_INIT + CFLAGS="$saved_CFLAGS" + host_os=$old_host_os ++popdef([host_os])dnl ++popdef([host_vendor])dnl ++popdef([host_cpu])dnl ++popdef([host_alias])dnl ++popdef([host])dnl + + AS_CASE([$host], + [sparc-sun-solaris*], +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0006-SQUASH-Use-target-instead-of-host-when-relevant-in-c.patch b/patches/5.2.0~beta2/0006-SQUASH-Use-target-instead-of-host-when-relevant-in-c.patch new file mode 100644 index 00000000..216c1103 --- /dev/null +++ b/patches/5.2.0~beta2/0006-SQUASH-Use-target-instead-of-host-when-relevant-in-c.patch @@ -0,0 +1,83 @@ +From c96635766faf5c424a4bc1372bdd5fb4c2e88306 Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Wed, 21 Feb 2024 19:05:44 +0100 +Subject: [PATCH 06/14] SQUASH? Use `target` instead of `host` when relevant in + configuration + +--- + configure | Bin 683009 -> 682374 bytes + configure.ac | 10 +++++----- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/configure b/configure +index 68b1661dcb62e3e13f98b3f680715ff3238357c9..d95617e269d68bf4d86876852247ab541de1f81a 100755 +GIT binary patch +delta 399 +zcmZp?q1kp>vtbKk=Z@*?b}))hpR|`znYSddC_S|#J~1aVu~>Kdhf*e6bfLYB3${Pq +z$+(9RO=4p))3oWXdl+9&kAKU^HQi<}BQI-8eqJiq^goGAl1!Ot)A_QPRCyAU{}zIO*B$9ACQvsvU76hIO%C0q&$sX4`|Kng6bq}1MUm=TDXfS4JG +zS%8>zd&6NiJ04cBySE=a&$f$cy3ATO{_P!?*y5U|Po2)rzx{IvyPfcK#+!_C{3zbb +zNtteVlhG7I@Zn;n8PmCQ**Ul8WwKvm#E>sMz}UC_Nj5tVq~Yw)+)xZvFuPd_0jo + +delta 367 +zcmZp>tl4-&vtbKk=Z@(Mb2(I}%bsTCpWd*Skz;#7K9d6D_FX#}_b^U>l+PqKJ@*`I +z-*m}6jIXENVd7!(aha}A!lX1^cP}FkS7LH}a!I_8i>=D^iCSzT+kplwW|{uu0h6GZ +zkBgFmtwM#hLPY3d@EaT~_hZyHs~cYFUiwhc_vU+rh(-R^ghEv{+$j6bZr+jj@E+X+t>4qy&u +z%1N1iF^kz1L<_!PoH0EogPn6bcLw`4#_27&%mN_skLMZtw%28`^Ds_NFk_PjE1AAJ +zo1JU=oosg5=}RuK%5Im)VQ*)d{{JeYpo)uUkgIbD(0Aw_flJ`<&%y$B+4gG%>_E)1 +K{aOL%h93Yg?t?7= + +diff --git a/configure.ac b/configure.ac +index a6645c6637..9ade5eff47 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -597,7 +597,7 @@ AS_IF([test x"$enable_ocamldoc" = "xno"], + # Initialization of libtool + # Allow the MSVC linker to be found even if ld isn't installed. + # User-specified LD still takes precedence. +-AC_CHECK_TOOLS([LD],[ld link]) ++AC_CHECK_TARGET_TOOLS([LD],[ld link]) + # libtool expects host_os=mingw for native Windows + # Also, it has been observed that, on some platforms (e.g. msvc) LT_INIT + # alters the CFLAGS variable, so we save its value before calling the macro +@@ -1027,7 +1027,7 @@ AS_CASE([$flexdll_source_dir,$supports_shared_libraries,$flexlink,$host], + + mkexe_cmd_exp="$CC" + +-AS_CASE([$ocaml_cc_vendor,$host], ++AS_CASE([$ocaml_cc_vendor,$target], + [*,x86_64-*-darwin*], + [oc_ldflags='-Wl,-no_compact_unwind'; + AC_DEFINE([HAS_ARCH_CODE32], [1])], +@@ -1045,7 +1045,7 @@ AS_CASE([$ocaml_cc_vendor,$host], + ) + ostype="Cygwin"], + [*,*-*-mingw32*], +- [AS_CASE([$host], ++ [AS_CASE([$target], + [i686-*-*], [oc_dll_ldflags="-static-libgcc"]) + ostype="Win32" + toolchain="mingw" +@@ -1342,7 +1342,7 @@ system=unknown + # preserving $arch = 'none' <=> $system = 'unknown' + has_native_backend=no + native_ldflags="" +-AS_CASE([$host], ++AS_CASE([$target], + [[i[3456]86-*-linux*]], + [arch=i386; system=linux], + [[i[3456]86-*-freebsd*]], +@@ -1479,7 +1479,7 @@ AS_IF([$natdynlink], + + AC_DEFINE_UNQUOTED([OCAML_OS_TYPE], ["$ostype"]) + +-AC_CHECK_TOOL([DIRECT_LD],[ld]) ++AC_CHECK_TARGET_TOOL([DIRECT_LD],[ld]) + AS_IF([test -z "$PARTIALLD"], + [AS_CASE(["$host,$ocaml_cc_vendor"], + [x86_64-*-darwin*,gcc-*], [PACKLD_FLAGS=' -arch x86_64'], +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0007-WIP-Use-the-STRIP-command-automatically-detected-by-.patch b/patches/5.2.0~beta2/0007-WIP-Use-the-STRIP-command-automatically-detected-by-.patch new file mode 100644 index 00000000..22401afd --- /dev/null +++ b/patches/5.2.0~beta2/0007-WIP-Use-the-STRIP-command-automatically-detected-by-.patch @@ -0,0 +1,73 @@ +From 1e10b8a83db726a419f13bd8d1aba6f60e3abc4a Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Fri, 23 Feb 2024 12:00:32 +0100 +Subject: [PATCH 07/14] WIP Use the STRIP command automatically detected by + libtool + +libtool configuration will try and detect the `strip` for the code +generated by the configured C compiler, so that it works also for a +cross-compiler + +WIP: ensure it works also on MSVC, hopefully libtool-detected strip will +not break the compiled code +--- + Makefile.config.in | 1 + + configure | Bin 682374 -> 682375 bytes + configure.ac | 1 + + stdlib/Makefile | 5 +---- + 4 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index 4243bebad9..b91634efb6 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -185,6 +185,7 @@ OCAMLOPT_CFLAGS=@ocamlc_cflags@ + OCAMLOPT_CPPFLAGS=@ocamlc_cppflags@ + NATIVECCLIBS=@cclibs@ + SYSTHREAD_SUPPORT=@systhread_support@ ++STRIP=@STRIP@ + PACKLD=@PACKLD@$(EMPTY) + CCOMPTYPE=@ccomptype@ + TOOLCHAIN=@toolchain@ +diff --git a/configure b/configure +index d95617e269d68bf4d86876852247ab541de1f81a..97aad962d1af69e461c0a66ec81924799ef71a05 100755 +GIT binary patch +delta 67 +zcmZp>tl559b3=pw<~IM;jI6;SL7oB427%iR0vT=9+jA-yftU%1nSq!Eh*^P{4T#x+ +Mm}7fR1*g +Date: Mon, 26 Feb 2024 11:51:11 +0100 +Subject: [PATCH 08/14] Allow `ocaml` as a target OS to configure freestanding + cross-compilers + +Allow the use of *-*-ocaml or *-*-*-ocaml target triplets to stand for +freestanding cross-compilers by temporarily rewriting the target OS to +`none` when generating the canonical target + +This allows to use *-*-ocaml and *-*-*-ocaml prefixes for cross-compiler +specific toolchains, so that all the specific tools (for instance +aarch64-solo5-ocaml-gcc, etc.) are automatically discovered +--- + configure | Bin 682375 -> 682884 bytes + configure.ac | 17 +++++++++++++++++ + 2 files changed, 17 insertions(+) + +diff --git a/configure b/configure +index 97aad962d1af69e461c0a66ec81924799ef71a05..baa5801900b179c59b2c52069572e9a9323ec5f2 100755 +GIT binary patch +delta 550 +zcmb7Ay-EW?5awe1I~#kO$>t!QaE%s%A%zHvl|>%l7|%&u*t-q8i!oT7g>Xg66uyX% +zI*l)2VdY!+08UQPiy|n?x6FJqeDlo|PvPBjc>CaO7I_m6mC{2HI>A&4Kno5{pB$WZ +zp{EV>43Tx1UC68tiB1Pnk%99OI7$cFppj|>hK5Eu?(m!7E~z5nG>A-RB!HtnWn|EC +zoqG~wK9>oqk9OY>s`!0+j7p;Ih@hGZKS4{dz=6!5x$Oh&MDtf}5yAlz0GPxUuP8n} +z?sfwHN^+jGqE;DO${k!U3YLZHR5r021$$As#ivA25r=mB%ftU199h2fpB(%?e$v?3 +rx)-mt{pm^J-P9Z3%>THmC}v}iQDZDI>WpQ^3S*VAHl2;vA79=8l()39 + +delta 60 +zcmZpPHHW=8YvN}Y_=EbaSy8G)Dyh?#*H#AgL!HXvpPVvg +Date: Mon, 26 Feb 2024 12:06:45 +0100 +Subject: [PATCH 09/14] Define OS type to None + +--- + configure | Bin 682884 -> 682934 bytes + configure.ac | 4 +++- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index baa5801900b179c59b2c52069572e9a9323ec5f2..65d75f72f15b39190c7e93fad5cba4523812c252 100755 +GIT binary patch +delta 84 +zcmZp@7Pdpz)pfLVwRH3H^HOWHz|7Q~G))C7E(IXSFD|Jp +gNVQe+1IkW+=*TYDe)T#V5VHd@$M&n&IoD4H0OGSB^8f$< + +delta 43 +wcmdmXU9;u7W@7PdpzCu?&HwzJ+~17da{=Ge}9gLC6#0Cjl~tpET3 + +diff --git a/configure.ac b/configure.ac +index 46bb92878f..c2d8945071 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1091,7 +1091,9 @@ AS_CASE([$ocaml_cc_vendor,$target], + [oc_ldflags='-brtl -bexpfull' + AC_DEFINE([HAS_ARCH_CODE32], [1])], + [gcc-*,powerpc-*-linux*], +- [oc_ldflags="-mbss-plt"]) ++ [oc_ldflags="-mbss-plt"], ++ [*,*-*-none|*,*-*-elf], ++ [ostype="None"]) + + ## Program to use to install files + AC_PROG_INSTALL +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0010-Add-freestanding-targets-to-supported-configurations.patch b/patches/5.2.0~beta2/0010-Add-freestanding-targets-to-supported-configurations.patch new file mode 100644 index 00000000..244861c8 --- /dev/null +++ b/patches/5.2.0~beta2/0010-Add-freestanding-targets-to-supported-configurations.patch @@ -0,0 +1,41 @@ +From 29a4805526c1dca8ac1f7fa81a3ae0c7de57b700 Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Mon, 26 Feb 2024 19:35:26 +0100 +Subject: [PATCH 10/14] Add freestanding targets to supported configurations + +--- + configure | Bin 682934 -> 683089 bytes + configure.ac | 6 +++++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 65d75f72f15b39190c7e93fad5cba4523812c252..f7b58c3463a962d8aa82b0e5665851e8f1d7b715 100755 +GIT binary patch +delta 98 +zcmdmXUGw4%&4w1n7N!>F7M2#)7Pc+yJCdi%N3nDAR#=$Do0;fp>E`9F7M2#)7Pc+yJCdhwwB;0@o^Xy$puH@G9f&!Am~(qs3fFCR +E01VR;KmY&$ + +diff --git a/configure.ac b/configure.ac +index c2d8945071..9fd979e3de 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1459,7 +1459,11 @@ AS_CASE([$target], + [x86_64-*-cygwin*], + [has_native_backend=yes; arch=amd64; system=cygwin], + [riscv64-*-linux*], +- [has_native_backend=yes; arch=riscv; model=riscv64; system=linux] ++ [has_native_backend=yes; arch=riscv; model=riscv64; system=linux], ++ [x86_64-*-none], ++ [has_native_backend=yes; arch=amd64; system=none], ++ [aarch64-*-none], ++ [has_native_backend=yes; arch=arm64; system=none] + ) + + AS_CASE([$arch], +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0011-Check-that-the-configured-and-the-installed-OCaml-ar.patch b/patches/5.2.0~beta2/0011-Check-that-the-configured-and-the-installed-OCaml-ar.patch new file mode 100644 index 00000000..656f691d --- /dev/null +++ b/patches/5.2.0~beta2/0011-Check-that-the-configured-and-the-installed-OCaml-ar.patch @@ -0,0 +1,47 @@ +From 61c99c4957a51e8f5b899498b7ce13f90dd3ce5f Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Tue, 19 Mar 2024 19:14:29 +0100 +Subject: [PATCH 11/14] Check that the configured and the installed OCaml are + compatible + +--- + configure | Bin 683089 -> 683680 bytes + configure.ac | 7 +++++++ + 2 files changed, 7 insertions(+) + +diff --git a/configure b/configure +index f7b58c3463a962d8aa82b0e5665851e8f1d7b715..31ffdd081633102a35cefed74fad3c9be11e2993 100755 +GIT binary patch +delta 458 +zcmcb3Lvz7h&4w1n7N!>F7M2#)Eo|{zrpgN8sR~7@g{7HAsS1e-dHH#|$wm3a#k$G) +zxdoXysYMF;X$mD7sS3r3xv2_esYS(^`FYbFBROoeL84Frn4-+Q;*!LioYWKrf9J&9 +z90iym(;ZJSO4XB~K~GOlK}o?*&CFV%mP-K$5_5`D6H_YV;WorWt+q|bPX=0*te{(# +zSDKpuR-6fRa%ypjLWPp4o{^qGT~caEqLGrkf-O))1*b{V3-_@(N`Rc4Sdy8Pld7PB +zq+4@(;S6>$aa@vui`XQl7hGo-@W{-=VS++gu>x+(HI)>URD3-BT>bo&6im6&GN%_# +YU^i~>F7M2#)Eo|{z)35un>$TtEVFO}zAm#vK&h2-2xQ-+O0L~E- +ASO5S3 + +diff --git a/configure.ac b/configure.ac +index 9fd979e3de..2762f1a29f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -826,6 +826,13 @@ AS_IF( + CPPFLAGS_FOR_BUILD='$(CPPFLAGS)' + LDFLAGS_FOR_BUILD='$(LDFLAGS)'], + [cross_compiler=true ++ # We require a non-cross-compiler of the same version ++ AC_MSG_CHECKING([the version of the installed OCaml compiler]) ++ already_installed_version=`ocamlc -vnum` ++ AS_IF([test x"AC_PACKAGE_VERSION" = x"$already_installed_version"], ++ [AC_MSG_RESULT([compatible (AC_PACKAGE_VERSION)])], ++ [AC_MSG_ERROR(m4_normalize([incompatible (AC_PACKAGE_VERSION vs ++ $already_installed_version)]))]) + AC_MSG_NOTICE([detecting the C toolchain for build]) + AX_PROG_CC_FOR_BUILD]) + +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0012-Use-the-target-pkg-config-to-detect-zstd.patch b/patches/5.2.0~beta2/0012-Use-the-target-pkg-config-to-detect-zstd.patch new file mode 100644 index 00000000..d600ff4d --- /dev/null +++ b/patches/5.2.0~beta2/0012-Use-the-target-pkg-config-to-detect-zstd.patch @@ -0,0 +1,43 @@ +From a7597aaed7aca82429a5c634f6885b395e4d24b1 Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Wed, 20 Mar 2024 17:41:26 +0100 +Subject: [PATCH 12/14] Use the target pkg-config to detect zstd + +Make sure that we don't detect zstd on build when we are building a +cross-compiler, as the native zstd has no reason to be compatible with +the cross toolchain +--- + configure | Bin 683680 -> 683439 bytes + configure.ac | 2 +- + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index 31ffdd081633102a35cefed74fad3c9be11e2993..ae18072313fec6078189f5168eca4394378c165e 100755 +GIT binary patch +delta 145 +zcmZ2*S9ASs&4w1n7N!>F7M2#)7Pc1lEgZXxrVHn=YftAZ=CGg6y_=DDdu%aBGRyQO +z1?(cz1EQH&rr$2-5SebipHXZ2r*aON=}(?8%5T@M;8@H&-R=N~AVdv!C5Hful7gDr +v^u|gKIkvRKoZ?ia?We0b>=>sf*KsJaqyhz|>(_EfwYSu9Y;URKl=%PvE5|VO + +delta 173 +zcmZ2~TXVr(&4w1n7N!>F7M2#)7Pc1lEgZXxrXPII7|dCaovxdlpO=<7ec@SFv*~^x +z7zLPtV$-GfaLnF*p_t<+^K=I>Hu32J(M&AU*OqgLOn*_%AwPYJ7@O>NwF-{K%+o8& +zIJmc~)NmLuPJi%&kx#v#BtF2~J>J>h&&|_aNx@d3!djsuBQ=jp0SFK>+b3RURcD+Y +SR?8vZKDm}-`{Y_qnGXPc^gNOP + +diff --git a/configure.ac b/configure.ac +index 2762f1a29f..cf614d7068 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2262,7 +2262,7 @@ AC_CHECK_HEADER([spawn.h], + [AC_CHECK_FUNC([posix_spawn], + [AC_CHECK_FUNC([posix_spawnp], [AC_DEFINE([HAS_POSIX_SPAWN])])])]) + +-AC_PATH_TOOL([PKG_CONFIG], [pkg-config], [false]) ++AC_PATH_TARGET_TOOL([PKG_CONFIG], [pkg-config], [false]) + + ## ZSTD compression library + +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0013-WIP-Add-a-Makefile.cross-for-recipes-to-build-a-cros.patch b/patches/5.2.0~beta2/0013-WIP-Add-a-Makefile.cross-for-recipes-to-build-a-cros.patch new file mode 100644 index 00000000..9482ff71 --- /dev/null +++ b/patches/5.2.0~beta2/0013-WIP-Add-a-Makefile.cross-for-recipes-to-build-a-cros.patch @@ -0,0 +1,122 @@ +From 6241bba59e65434578d11c2258ebe76efd08f372 Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Fri, 23 Feb 2024 16:56:07 +0100 +Subject: [PATCH 13/14] WIP Add a Makefile.cross for recipes to build a + cross-compiler + +Define cross.opt and cross-install targets + +FIXME: Problems of inconsistencies between compilation options (only +about zstd?) between the native toolchain and the cross toolchain may +break the build? +--- + Makefile | 2 ++ + Makefile.cross | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 85 insertions(+) + create mode 100644 Makefile.cross + +diff --git a/Makefile b/Makefile +index df191af79c..cb6b3f4484 100644 +--- a/Makefile ++++ b/Makefile +@@ -2732,6 +2732,8 @@ endif + + include .depend + ++include Makefile.cross ++ + Makefile.config Makefile.build_config: config.status + config.status: + @echo "Please refer to the installation instructions:" +diff --git a/Makefile.cross b/Makefile.cross +new file mode 100644 +index 0000000000..b993783d2f +--- /dev/null ++++ b/Makefile.cross +@@ -0,0 +1,83 @@ ++#************************************************************************** ++#* * ++#* OCaml * ++#* * ++#* Samuel Hym, Tarides * ++#* * ++#* Copyright 2024 Tarides * ++#* * ++#* All rights reserved. This file is distributed under the terms of * ++#* the GNU Lesser General Public License version 2.1, with the * ++#* special exception on linking described in the file LICENSE. * ++#* * ++#************************************************************************** ++ ++# Recipes to build a cross-compiler (_not_ cross-compiling the compiler), aka ++# generating code that will run on `target`, assuming that a non-cross OCaml ++# compiler (so targetting our build machine) of the same version is available in ++# $PATH ++ ++# We assume no zstd for the cross-compiler (ie no requirement on zstd for the ++# target) ++# Still the cross-compiler will run on host, not target. And as a consequence of ++# the rules linking it, the cross-compilers will be linked with the _build_ ++# version of libcomprmarsh, so we still must discover the flags to link with ++# libzstd if it was set up in the non-cross compiler, so we rely on the ++# pkg-config command to get the linking flags for zstd ++PKG_CONFIG := pkg-config ++# This is used only once, so it doesn't have to be much lazier ++NATIVE_ZSTD_LIBS=ZSTD_LIBS="$(shell $(PKG_CONFIG) --libs libzstd)" ++# As the libcomprmarsh built by the C cross compiler will not be linked in, we ++# can build an empty one ++NO_ZSTD=libcomprmarsh_OBJECTS= ++ ++CROSS_OVERRIDES=OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun \ ++ BOOT_OCAMLLEX=ocamllex OCAMLYACC=ocamlyacc ++CROSS_COMPILER_OVERRIDES=$(CROSS_OVERRIDES) CAMLC=ocamlc CAMLOPT=ocamlopt \ ++ BEST_OCAMLC=ocamlc BEST_OCAMLOPT=ocamlopt BEST_OCAMLLEX=ocamllex ++ ++INSTALL_OVERRIDES=build_ocamldoc=false WITH_DEBUGGER= ++ ++# Freestanding target custom options ++ifeq "$(SYSTEM)" "none" ++RUNTIME_BUILD_OVERRIDES=runtime_PROGRAMS= ++INSTALL_OVERRIDES += runtime_PROGRAMS=`which ocamlrun` \ ++ runtime_BYTECODE_STATIC_LIBRARIES=runtime/ld.conf ++else ++RUNTIME_BUILD_OVERRIDES= ++endif ++ ++cross.opt: ++ $(MAKE) runtime-all $(NO_ZSTD) $(RUNTIME_BUILD_OVERRIDES) ++ $(MAKE) ocamlc ocamlopt $(TOOLS_BYTECODE_TARGETS) expunge \ ++ $(CROSS_COMPILER_OVERRIDES) ++ $(MAKE) library $(CROSS_OVERRIDES) ++ifneq "$(SYSTEM)" "none" ++ $(MAKE) ocamlyacc $(CROSS_OVERRIDES) ++ $(MAKE) ocamllex $(CROSS_COMPILER_OVERRIDES) ++endif ++ $(MAKE) ocaml $(CROSS_COMPILER_OVERRIDES) ++ $(MAKE) -C otherlibs all $(CROSS_OVERRIDES) ++ # Opt ++ $(MAKE) runtimeopt $(NO_ZSTD) ++ $(MAKE) ocamlc.opt ocamlopt.opt $(TOOLS_NATIVE_TARGETS) \ ++ $(NO_ZSTD) $(CROSS_COMPILER_OVERRIDES) $(NATIVE_ZSTD_LIBS) ++ $(MAKE) libraryopt $(NO_ZSTD) $(CROSS_OVERRIDES) ++ $(MAKE) otherlibrariesopt ocamltoolsopt $(NO_ZSTD) $(CROSS_OVERRIDES) ++ $(MAKE) tools-allopt.opt $(NO_ZSTD) $(CROSS_COMPILER_OVERRIDES) ++ ++.PHONY: cross-install ++cross-install: ++ # dummy files ++ touch \ ++ $(addprefix toplevel/, \ ++ $(foreach ext,cmi cmt cmti cmx, native/nat__dummy__.$(ext)) \ ++ all__dummy__.cmx topstart.o native/tophooks.cmi) ++ $(LN) `which ocamlyacc` yacc/ocamlyacc.opt$(EXE) ++ $(LN) `which ocamllex` lex/ocamllex.opt$(EXE) ++ifeq "$(SYSTEM)" "none" ++ $(LN) `which ocamlyacc` yacc/ocamlyacc$(EXE) ++ $(LN) `which ocamllex` lex/ocamllex$(EXE) ++endif ++ # Real installation ++ $(MAKE) install $(INSTALL_OVERRIDES) OCAMLRUN=ocamlrun +-- +2.43.0 + diff --git a/patches/5.2.0~beta2/0014-Set-Max_domains-to-1.patch b/patches/5.2.0~beta2/0014-Set-Max_domains-to-1.patch new file mode 100644 index 00000000..523cb873 --- /dev/null +++ b/patches/5.2.0~beta2/0014-Set-Max_domains-to-1.patch @@ -0,0 +1,31 @@ +From d6f2e4a2fcb24e0a39f05862b9bd1c202064180f Mon Sep 17 00:00:00 2001 +From: Samuel Hym +Date: Fri, 12 Apr 2024 19:21:52 +0200 +Subject: [PATCH 14/14] Set Max_domains to 1 + +Solo5 is single-core with no scheduler, so avoid the useless memory +waste +--- + runtime/caml/domain.h | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/runtime/caml/domain.h b/runtime/caml/domain.h +index 4b9be80b41..986486478c 100644 +--- a/runtime/caml/domain.h ++++ b/runtime/caml/domain.h +@@ -31,11 +31,7 @@ extern "C" { + + /* The runtime currently has a hard limit on the number of domains. + This hard limit may go away in the future. */ +-#ifdef ARCH_SIXTYFOUR +-#define Max_domains 128 +-#else +-#define Max_domains 16 +-#endif ++#define Max_domains 1 + + /* is the minor heap full or an external interrupt has been triggered */ + Caml_inline int caml_check_gc_interrupt(caml_domain_state * dom_st) +-- +2.43.0 +