Version 5.1.0
Other changes: - Add LicenseRef-Fedora-Public-Domain to the runtime License field - New ocaml-rpm-macros subpackage - Depend on libzstd-devel for compressed marshaling - Disable LTO
This commit is contained in:
parent
4a09b96d7b
commit
a433439c10
25
0001-Don-t-add-rpaths-to-libraries.patch
Normal file
25
0001-Don-t-add-rpaths-to-libraries.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 03435cc789bfb783c1d5566e8abd387eea1b9155 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 24 Jun 2014 10:00:15 +0100
|
||||
Subject: [PATCH 1/4] Don't add rpaths to libraries.
|
||||
|
||||
---
|
||||
configure.ac | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 7c7d9a814c..d5040c279c 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1106,8 +1106,6 @@ AS_IF([test x"$enable_shared" != "xno"],
|
||||
[[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]],
|
||||
[mkdll_flags="${mkdll_flags} -Wl,--no-execute-only"])
|
||||
oc_ldflags="$oc_ldflags -Wl,-E"
|
||||
- rpath="-Wl,-rpath,"
|
||||
- mksharedlibrpath="-Wl,-rpath,"
|
||||
natdynlinkopts="-Wl,-E"
|
||||
supports_shared_libraries=true],
|
||||
[mkdll='shared-libs-not-available'])
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,86 +0,0 @@
|
||||
From 8741f4d88801e478e0ab7f871dc7dbcf9d7cc8f4 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Angeletti <florian.angeletti@inria.fr>
|
||||
Date: Thu, 15 Dec 2022 14:28:32 +0100
|
||||
Subject: [PATCH 01/17] increment version number after tagging 5.0.0
|
||||
|
||||
---
|
||||
VERSION | 2 +-
|
||||
build-aux/ocaml_version.m4 | 6 +++---
|
||||
configure | Bin 617024 -> 617302 bytes
|
||||
ocaml-variants.opam | 6 +++---
|
||||
4 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/VERSION b/VERSION
|
||||
index fc40ac52d7..314f8ec760 100644
|
||||
--- a/VERSION
|
||||
+++ b/VERSION
|
||||
@@ -1,4 +1,4 @@
|
||||
-5.0.0
|
||||
+5.0.1+dev0-2022-12-15
|
||||
|
||||
# Starting with OCaml 4.14, although the version string that appears above is
|
||||
# still correct and this file can thus still be used to figure it out,
|
||||
diff --git a/build-aux/ocaml_version.m4 b/build-aux/ocaml_version.m4
|
||||
index ba48c00277..78049eaab0 100644
|
||||
--- a/build-aux/ocaml_version.m4
|
||||
+++ b/build-aux/ocaml_version.m4
|
||||
@@ -25,7 +25,7 @@
|
||||
# The following macro, OCAML__DEVELOPMENT_VERSION, should be either
|
||||
# [true] of [false].
|
||||
|
||||
-m4_define([OCAML__DEVELOPMENT_VERSION], [false])
|
||||
+m4_define([OCAML__DEVELOPMENT_VERSION], [true])
|
||||
|
||||
# The three following components (major, minor and patch level) MUST be
|
||||
# integers. They MUST NOT be left-padded with zeros and all of them,
|
||||
@@ -33,10 +33,10 @@ m4_define([OCAML__DEVELOPMENT_VERSION], [false])
|
||||
|
||||
m4_define([OCAML__VERSION_MAJOR], [5])
|
||||
m4_define([OCAML__VERSION_MINOR], [0])
|
||||
-m4_define([OCAML__VERSION_PATCHLEVEL], [0])
|
||||
+m4_define([OCAML__VERSION_PATCHLEVEL], [1])
|
||||
# Note that the OCAML__VERSION_EXTRA string defined below is always empty
|
||||
# for officially-released versions of OCaml.
|
||||
-m4_define([OCAML__VERSION_EXTRA], [])
|
||||
+m4_define([OCAML__VERSION_EXTRA], [dev0-2022-12-15])
|
||||
|
||||
# The OCAML__VERSION_EXTRA_PREFIX macro defined below should be a
|
||||
# single character:
|
||||
diff --git a/configure b/configure
|
||||
index 19764d19a9b8fb1a9f01868f8f7863733a4c4ecd..f54df41388272a49e583ca20f325508c5b814eff 100755
|
||||
GIT binary patch
|
||||
delta 558
|
||||
zcmX?bMfKV>)eSNnf`-~DsbvPbMg~Skx`sexx>=UvgA=CkWIk^hOwrBS-boQyg!>lT
|
||||
z^I#D^w|=RVFoum>>61UO%Wj^0>LnI?x7YGA-j2jHYkHy%qwMsubVfN$x$RTa8SPkv
|
||||
zFfE!a6)I(ITT)b-%EjgH?C9$gALQ!e>KN=A?-~&j<Y=oNoS&Pjpb?N$TCAg>gcdML
|
||||
zn(EW}a~M6D47nz63=t8qMU&s2pTqc^h0$<&pc<q4^twVuX?`>n(`ObkI${VGs4{AT
|
||||
zl=Ds(C}Lzq($6>DyNHn&(|gk&sxgYT=M^ymF%u9o12N0?ydu`PGG?IP+Aq9d1!A`C
|
||||
q7hbSOxPU~a14U%Fd+Kt$%*A3FFo1ow*U#pd&5kL#U3xKx>Tv-4Xq`R)
|
||||
|
||||
delta 271
|
||||
zcmcb1P4&PP)eSNnj0T%^IX*Zs8cf#nmH~32y^|t<)Vam>JU~ir!%`_`1FrPRAJ}C#
|
||||
ze?IjRsBZgPUdG#zj0V#$>M+Vq|CY`u2NYAyV6<alGT@r*6)L4*o0gbUoXW-J@9gO7
|
||||
z6CdR2<LVgf8t)nr669#>m!Fq9{ZtO4CrI(b5D`Y(?UuQW&sl)xDHbt0O)n~9be#S`
|
||||
zl~Hqge<33;n}VqU5P+mi`GP}&JpJ4iVw6nv4D<}z1B)4fm<foPftY1`U@>cP84Jkj
|
||||
x_Tw*EftYRk@t5ooE?}YQKq1-f_IeyIbAdJiec-dbbq>dDcA(P@mvE>a2LKy+Taf?&
|
||||
|
||||
diff --git a/ocaml-variants.opam b/ocaml-variants.opam
|
||||
index 5928f357f2..a0876e02c9 100644
|
||||
--- a/ocaml-variants.opam
|
||||
+++ b/ocaml-variants.opam
|
||||
@@ -1,9 +1,9 @@
|
||||
opam-version: "2.0"
|
||||
-version: "5.0.0"
|
||||
+version: "5.0.1+trunk"
|
||||
license: "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception"
|
||||
-synopsis: "Official release of OCaml 5.0.0"
|
||||
+synopsis: "OCaml development version"
|
||||
depends: [
|
||||
- "ocaml" {= "5.0.0" & post}
|
||||
+ "ocaml" {= "5.0.1" & post}
|
||||
"base-unix" {post}
|
||||
"base-bigarray" {post}
|
||||
"base-threads" {post}
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 925bf9a6d828d7548751f9a21892cad6209fc950 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Scherer <gabriel.scherer@gmail.com>
|
||||
Date: Fri, 16 Dec 2022 09:41:13 +0100
|
||||
Subject: [PATCH 02/17] Merge pull request #11814 from
|
||||
gasche/clarify-DLS.new_key-doc
|
||||
|
||||
clarify the doc of Domain.DLS.new_key
|
||||
|
||||
(cherry picked from commit be210179503c4a82b72dd4762560e13c408d37b7)
|
||||
---
|
||||
stdlib/domain.mli | 37 ++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 30 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/stdlib/domain.mli b/stdlib/domain.mli
|
||||
index 7763043aa5..2d79b3b0c3 100644
|
||||
--- a/stdlib/domain.mli
|
||||
+++ b/stdlib/domain.mli
|
||||
@@ -96,15 +96,38 @@ module DLS : sig
|
||||
|
||||
val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key
|
||||
(** [new_key f] returns a new key bound to initialiser [f] for accessing
|
||||
- domain-local variables.
|
||||
+, domain-local variables.
|
||||
|
||||
- If [split_from_parent] is provided, spawning a domain will derive the
|
||||
- child value (for this key) from the parent value.
|
||||
+ If [split_from_parent] is not provided, the value for a new
|
||||
+ domain will be computed on-demand by the new domain: the first
|
||||
+ [get] call will call the initializer [f] and store that value.
|
||||
|
||||
- Note that the [split_from_parent] call is computed in the parent
|
||||
- domain, and is always computed regardless of whether the child domain
|
||||
- will use it. If the splitting function is expensive or requires
|
||||
- client-side computation, consider using ['a Lazy.t key].
|
||||
+ If [split_from_parent] is provided, spawning a domain will
|
||||
+ derive the child value (for this key) from the parent
|
||||
+ value. This computation happens in the parent domain and it
|
||||
+ always happens, regardless of whether the child domain will
|
||||
+ use it.
|
||||
+ If the splitting function is expensive or requires
|
||||
+ child-side computation, consider using ['a Lazy.t key]:
|
||||
+
|
||||
+ {[
|
||||
+ let init () = ...
|
||||
+
|
||||
+ let split_from_parent parent_value =
|
||||
+ ... parent-side computation ...;
|
||||
+ lazy (
|
||||
+ ... child-side computation ...
|
||||
+ )
|
||||
+
|
||||
+ let key = Domain.DLS.new_key ~split_from_parent init
|
||||
+
|
||||
+ let get () = Lazy.force (Domain.DLS.get key)
|
||||
+ ]}
|
||||
+
|
||||
+ In this case a part of the computation happens on the child
|
||||
+ domain; in particular, it can access [parent_value]
|
||||
+ concurrently with the parent domain, which may require
|
||||
+ explicit synchronization to avoid data races.
|
||||
*)
|
||||
|
||||
val get : 'a key -> 'a
|
||||
--
|
||||
2.41.0
|
||||
|
45
0002-configure-Allow-user-defined-C-compiler-flags.patch
Normal file
45
0002-configure-Allow-user-defined-C-compiler-flags.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From d9bcdb9d0a27e10350b1ca90df43b401656324f1 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 29 May 2012 20:44:18 +0100
|
||||
Subject: [PATCH 2/4] configure: Allow user defined C compiler flags.
|
||||
|
||||
---
|
||||
configure.ac | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d5040c279c..4cbba04557 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -759,6 +759,10 @@ AS_CASE([$host],
|
||||
internal_cflags="$cc_warnings"],
|
||||
[common_cflags="-O"])])
|
||||
|
||||
+# Allow CFLAGS and LDFLAGS to be added.
|
||||
+common_cflags="$common_cflags $CFLAGS"
|
||||
+cclibs="$cclibs $LDFLAGS"
|
||||
+
|
||||
# Enable SSE2 on x86 mingw to avoid using 80-bit registers.
|
||||
AS_CASE([$host],
|
||||
[i686-*-mingw32*],
|
||||
@@ -2325,7 +2329,7 @@ AC_CONFIG_COMMANDS_PRE([
|
||||
[mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"])
|
||||
mkdll_ldflags=""
|
||||
AS_IF([test -n "${LDFLAGS}"],
|
||||
- [for flag in ${LDFLAGS}; do
|
||||
+ [for flag in "${LDFLAGS}"; do
|
||||
mkdll_ldflags="${mkdll_ldflags} ${mkexe_ldflags_prefix}${flag}"
|
||||
done
|
||||
mkdll_ldflags_exp="$mkdll_ldflags"])
|
||||
@@ -2351,7 +2355,7 @@ ${mkdll_ldflags}"
|
||||
],[
|
||||
mkdll_ldflags='$(OC_DLL_LDFLAGS) $(LDFLAGS)'
|
||||
mkdll_ldflags_exp="${oc_dll_ldflags}"
|
||||
- AS_IF([test -n ${LDFLAGS}],
|
||||
+ AS_IF([test -n "${LDFLAGS}"],
|
||||
[mkdll_ldflags_exp="$mkdll_ldflags_exp $LDFLAGS"])
|
||||
mkexe_ldflags="\$(OC_LDFLAGS) \$(LDFLAGS)"
|
||||
mkexe_ldflags_exp="${oc_ldflags} ${LDFLAGS}"
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 83ef99f67fda11b268098a271f56b990e295bbc2 Mon Sep 17 00:00:00 2001
|
||||
From: Xavier Leroy <xavier.leroy@college-de-france.fr>
|
||||
Date: Tue, 20 Dec 2022 10:48:41 +0100
|
||||
Subject: [PATCH 03/17] Add KC Sivaramakrishnan as author
|
||||
|
||||
For the two new chapters "Parallel programming" and "Memory model".
|
||||
|
||||
Follow-up to #11280.
|
||||
|
||||
(cherry picked from commit e6340ced8ca1d46f11eaea8e0474d1eb2142fe1c)
|
||||
---
|
||||
manual/src/allfiles.etex | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/manual/src/allfiles.etex b/manual/src/allfiles.etex
|
||||
index 6600943f54..3e07555b85 100644
|
||||
--- a/manual/src/allfiles.etex
|
||||
+++ b/manual/src/allfiles.etex
|
||||
@@ -12,7 +12,8 @@
|
||||
release \ocamlversion \\[1cm]
|
||||
\Large Documentation and user's manual \\[1cm]
|
||||
\large Xavier Leroy, \\
|
||||
- Damien Doligez, Alain Frisch, Jacques Garrigue, Didier Rémy and Jérôme Vouillon \\[1cm]
|
||||
+ Damien Doligez, Alain Frisch, Jacques Garrigue, \\
|
||||
+ Didier Rémy, KC Sivaramakrishnan and Jérôme Vouillon \\[1cm]
|
||||
\today \\
|
||||
~
|
||||
\vfill
|
||||
--
|
||||
2.41.0
|
||||
|
34
0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch
Normal file
34
0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 352789925e44f012fbddc5dfae63abd15a447577 Mon Sep 17 00:00:00 2001
|
||||
From: Miod Vallat <miod@tarides.com>
|
||||
Date: Mon, 4 Sep 2023 13:50:30 -0600
|
||||
Subject: [PATCH 3/4] Fix x86_64 delivery of effect-related exceptions
|
||||
|
||||
---
|
||||
runtime/amd64.S | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/runtime/amd64.S b/runtime/amd64.S
|
||||
index 7e6f95c680..24dfa7111b 100644
|
||||
--- a/runtime/amd64.S
|
||||
+++ b/runtime/amd64.S
|
||||
@@ -902,6 +902,7 @@ LBL(112):
|
||||
movq Caml_state(current_stack), %rsi
|
||||
SWITCH_OCAML_STACKS
|
||||
/* No parent stack. Raise Effect.Unhandled. */
|
||||
+ ENTER_FUNCTION
|
||||
movq %rax, C_ARG_1
|
||||
LEA_VAR(caml_raise_unhandled_effect, %rax)
|
||||
jmp LBL(caml_c_call)
|
||||
@@ -946,7 +947,8 @@ CFI_STARTPROC
|
||||
UPDATE_BASE_POINTER(%rcx)
|
||||
SWITCH_OCAML_STACKS
|
||||
jmp *(%rbx)
|
||||
-2: LEA_VAR(caml_raise_continuation_already_resumed, %rax)
|
||||
+2: ENTER_FUNCTION
|
||||
+ LEA_VAR(caml_raise_continuation_already_resumed, %rax)
|
||||
jmp LBL(caml_c_call)
|
||||
CFI_ENDPROC
|
||||
ENDFUNCTION(G(caml_resume))
|
||||
--
|
||||
2.41.0
|
||||
|
696
0004-Update-framepointers-tests-to-avoid-false-positive-w.patch
Normal file
696
0004-Update-framepointers-tests-to-avoid-false-positive-w.patch
Normal file
@ -0,0 +1,696 @@
|
||||
From 210f9b439b264fb6ab16802f468992086a4af58c Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Buoro <fabrice@tarides.com>
|
||||
Date: Fri, 10 Mar 2023 09:36:22 -0700
|
||||
Subject: [PATCH 4/4] Update framepointers tests to avoid false positive with
|
||||
inlined C functions
|
||||
|
||||
---
|
||||
testsuite/tests/frame-pointers/c_call.ml | 14 +-
|
||||
.../tests/frame-pointers/c_call.reference | 9 -
|
||||
testsuite/tests/frame-pointers/c_call.run | 4 -
|
||||
testsuite/tests/frame-pointers/c_call_.c | 14 +-
|
||||
testsuite/tests/frame-pointers/effects.ml | 12 +-
|
||||
.../tests/frame-pointers/effects.reference | 15 --
|
||||
testsuite/tests/frame-pointers/effects.run | 4 -
|
||||
.../tests/frame-pointers/exception_handler.ml | 4 +-
|
||||
.../exception_handler.reference | 12 --
|
||||
.../frame-pointers/exception_handler.run | 4 -
|
||||
.../tests/frame-pointers/filter-locations.sh | 23 ---
|
||||
testsuite/tests/frame-pointers/fp_backtrace.c | 186 +++++++++++-------
|
||||
testsuite/tests/frame-pointers/reperform.ml | 4 +-
|
||||
.../tests/frame-pointers/reperform.reference | 3 -
|
||||
testsuite/tests/frame-pointers/reperform.run | 4 -
|
||||
.../tests/frame-pointers/stack_realloc.ml | 4 +-
|
||||
.../frame-pointers/stack_realloc.reference | 3 -
|
||||
.../tests/frame-pointers/stack_realloc.run | 4 -
|
||||
.../tests/frame-pointers/stack_realloc2.ml | 4 +-
|
||||
.../frame-pointers/stack_realloc2.reference | 3 -
|
||||
.../tests/frame-pointers/stack_realloc2.run | 4 -
|
||||
21 files changed, 144 insertions(+), 190 deletions(-)
|
||||
delete mode 100644 testsuite/tests/frame-pointers/c_call.run
|
||||
delete mode 100644 testsuite/tests/frame-pointers/effects.run
|
||||
delete mode 100644 testsuite/tests/frame-pointers/exception_handler.run
|
||||
delete mode 100755 testsuite/tests/frame-pointers/filter-locations.sh
|
||||
delete mode 100644 testsuite/tests/frame-pointers/reperform.run
|
||||
delete mode 100644 testsuite/tests/frame-pointers/stack_realloc.run
|
||||
delete mode 100644 testsuite/tests/frame-pointers/stack_realloc2.run
|
||||
|
||||
diff --git a/testsuite/tests/frame-pointers/c_call.ml b/testsuite/tests/frame-pointers/c_call.ml
|
||||
index 7d48b4947d..f552b0df8f 100644
|
||||
--- a/testsuite/tests/frame-pointers/c_call.ml
|
||||
+++ b/testsuite/tests/frame-pointers/c_call.ml
|
||||
@@ -7,20 +7,20 @@ all_modules = "${readonly_files} c_call.
|
||||
|
||||
*)
|
||||
|
||||
-external fp_backtrace : unit -> unit = "fp_backtrace"
|
||||
-external fp_backtrace_no_alloc : unit -> unit = "fp_backtrace" [@@noalloc]
|
||||
-external fp_backtrace_many_args : int -> int -> int -> int -> int -> int -> int
|
||||
- -> int -> int -> int -> int -> unit =
|
||||
+external fp_backtrace : string -> unit = "fp_backtrace"
|
||||
+external fp_backtrace_no_alloc : string -> unit = "fp_backtrace" [@@noalloc]
|
||||
+external fp_backtrace_many_args : string -> int -> int -> int -> int -> int
|
||||
+ -> int -> int -> int -> int -> int -> int -> unit =
|
||||
"fp_backtrace_many_args_argv" "fp_backtrace_many_args"
|
||||
|
||||
let[@inline never] f () =
|
||||
(* Check backtrace through caml_c_call_stack_args *)
|
||||
- fp_backtrace_many_args 1 2 3 4 5 6 7 8 9 10 11;
|
||||
+ fp_backtrace_many_args Sys.argv.(0) 1 2 3 4 5 6 7 8 9 10 11;
|
||||
(* Check backtrace through caml_c_call.
|
||||
* Also check that caml_c_call_stack_args correctly restores rbp register *)
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
(* Check caml_c_call correctly restores rbp register *)
|
||||
- fp_backtrace_no_alloc ();
|
||||
+ fp_backtrace_no_alloc Sys.argv.(0);
|
||||
42
|
||||
|
||||
let () = ignore (f ())
|
||||
diff --git a/testsuite/tests/frame-pointers/c_call.reference b/testsuite/tests/frame-pointers/c_call.reference
|
||||
index 92fb40a238..23095e7431 100644
|
||||
--- a/testsuite/tests/frame-pointers/c_call.reference
|
||||
+++ b/testsuite/tests/frame-pointers/c_call.reference
|
||||
@@ -3,19 +3,10 @@ caml_c_call_stack_args
|
||||
camlC_call.f
|
||||
camlC_call.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
caml_c_call
|
||||
camlC_call.f
|
||||
camlC_call.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
camlC_call.f
|
||||
camlC_call.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
diff --git a/testsuite/tests/frame-pointers/c_call.run b/testsuite/tests/frame-pointers/c_call.run
|
||||
deleted file mode 100644
|
||||
index e96b5ea13a..0000000000
|
||||
--- a/testsuite/tests/frame-pointers/c_call.run
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-
|
||||
-${program} 2>&1 \
|
||||
- | ${test_source_directory}/filter-locations.sh ${program} >${output}
|
||||
diff --git a/testsuite/tests/frame-pointers/c_call_.c b/testsuite/tests/frame-pointers/c_call_.c
|
||||
index 634c4dd937..a75100b213 100644
|
||||
--- a/testsuite/tests/frame-pointers/c_call_.c
|
||||
+++ b/testsuite/tests/frame-pointers/c_call_.c
|
||||
@@ -16,10 +16,10 @@
|
||||
#include <assert.h>
|
||||
#include "caml/mlvalues.h"
|
||||
|
||||
-void fp_backtrace(void);
|
||||
+void fp_backtrace(value);
|
||||
|
||||
-value fp_backtrace_many_args(value a, value b, value c, value d, value e,
|
||||
- value f, value g, value h, value i, value j, value k)
|
||||
+value fp_backtrace_many_args(value argv0, value a, value b, value c,
|
||||
+ value d, value e, value f, value g, value h, value i, value j, value k)
|
||||
{
|
||||
assert(Int_val(a) == 1);
|
||||
assert(Int_val(b) == 2);
|
||||
@@ -33,15 +33,15 @@ value fp_backtrace_many_args(value a, value b, value c, value d, value e,
|
||||
assert(Int_val(j) == 10);
|
||||
assert(Int_val(k) == 11);
|
||||
|
||||
- fp_backtrace();
|
||||
+ fp_backtrace(argv0);
|
||||
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
-value fp_bactrace_many_args_argv(value *argv, int argc)
|
||||
+value fp_bactrace_many_args_argv(value argv0, value *argv, int argc)
|
||||
{
|
||||
assert(argc == 11);
|
||||
|
||||
- return fp_backtrace_many_args(argv[0], argv[1], argv[2], argv[3], argv[4],
|
||||
- argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
|
||||
+ return fp_backtrace_many_args(argv0, argv[0], argv[1], argv[2], argv[3],
|
||||
+ argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
|
||||
}
|
||||
diff --git a/testsuite/tests/frame-pointers/effects.ml b/testsuite/tests/frame-pointers/effects.ml
|
||||
index 2aa7012606..ac304683fe 100644
|
||||
--- a/testsuite/tests/frame-pointers/effects.ml
|
||||
+++ b/testsuite/tests/frame-pointers/effects.ml
|
||||
@@ -11,26 +11,26 @@ open Printf
|
||||
open Effect
|
||||
open Effect.Deep
|
||||
|
||||
-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc]
|
||||
+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc]
|
||||
|
||||
type _ t += E : int -> int t
|
||||
|
||||
let[@inline never] f () =
|
||||
printf "# computation f\n%!";
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
printf "# perform effect (E 0)\n%!";
|
||||
let v = perform (E 0) in
|
||||
printf "# perform returns %d\n%!" v;
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
v + 1
|
||||
|
||||
let h (type a) (eff : a t) : ((a, 'b) continuation -> 'b) option =
|
||||
let[@inline never] h_effect_e v k =
|
||||
printf "# caught effect (E %d). continuing...\n%!" v;
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
let v = continue k (v + 1) in
|
||||
printf "# continue returns %d\n%!" v;
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
v + 1
|
||||
in
|
||||
match eff with
|
||||
@@ -41,7 +41,7 @@ let h (type a) (eff : a t) : ((a, 'b) continuation -> 'b) option =
|
||||
let v =
|
||||
let[@inline never] v_retc v =
|
||||
printf "# done %d\n%!" v;
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
v + 1
|
||||
in
|
||||
match_with f ()
|
||||
diff --git a/testsuite/tests/frame-pointers/effects.reference b/testsuite/tests/frame-pointers/effects.reference
|
||||
index c8bd0a391a..8ae3fc26df 100644
|
||||
--- a/testsuite/tests/frame-pointers/effects.reference
|
||||
+++ b/testsuite/tests/frame-pointers/effects.reference
|
||||
@@ -3,39 +3,24 @@ camlEffects.f
|
||||
caml_runstack
|
||||
camlEffects.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
# perform effect (E 0)
|
||||
# caught effect (E 0). continuing...
|
||||
camlEffects.h_effect_e
|
||||
camlEffects.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
# perform returns 1
|
||||
camlEffects.f
|
||||
caml_runstack
|
||||
camlEffects.h_effect_e
|
||||
camlEffects.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
# done 2
|
||||
camlEffects.v_retc
|
||||
camlEffects.h_effect_e
|
||||
camlEffects.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
# continue returns 3
|
||||
camlEffects.h_effect_e
|
||||
camlEffects.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
# result=4
|
||||
diff --git a/testsuite/tests/frame-pointers/effects.run b/testsuite/tests/frame-pointers/effects.run
|
||||
deleted file mode 100644
|
||||
index e96b5ea13a..0000000000
|
||||
--- a/testsuite/tests/frame-pointers/effects.run
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-
|
||||
-${program} 2>&1 \
|
||||
- | ${test_source_directory}/filter-locations.sh ${program} >${output}
|
||||
diff --git a/testsuite/tests/frame-pointers/exception_handler.ml b/testsuite/tests/frame-pointers/exception_handler.ml
|
||||
index 6bf5bf470d..19773f78de 100644
|
||||
--- a/testsuite/tests/frame-pointers/exception_handler.ml
|
||||
+++ b/testsuite/tests/frame-pointers/exception_handler.ml
|
||||
@@ -8,7 +8,7 @@
|
||||
*)
|
||||
|
||||
(* https://github.com/ocaml/ocaml/pull/11031 *)
|
||||
-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc]
|
||||
+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc]
|
||||
|
||||
exception Exn1
|
||||
exception Exn2
|
||||
@@ -38,7 +38,7 @@ let[@inline never] handler () =
|
||||
let _ = Sys.opaque_identity x0 in
|
||||
let _ = Sys.opaque_identity x1 in
|
||||
let _ = Sys.opaque_identity x2 in
|
||||
- fp_backtrace ()
|
||||
+ fp_backtrace Sys.argv.(0)
|
||||
|
||||
let[@inline never] nested i =
|
||||
begin
|
||||
diff --git a/testsuite/tests/frame-pointers/exception_handler.reference b/testsuite/tests/frame-pointers/exception_handler.reference
|
||||
index 513ca488b9..e012fb6d4f 100644
|
||||
--- a/testsuite/tests/frame-pointers/exception_handler.reference
|
||||
+++ b/testsuite/tests/frame-pointers/exception_handler.reference
|
||||
@@ -2,27 +2,15 @@ camlException_handler.handler
|
||||
camlException_handler.bare
|
||||
camlException_handler.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
camlException_handler.handler
|
||||
camlException_handler.bare
|
||||
camlException_handler.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
camlException_handler.handler
|
||||
camlException_handler.nested
|
||||
camlException_handler.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
camlException_handler.handler
|
||||
camlException_handler.nested
|
||||
camlException_handler.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
diff --git a/testsuite/tests/frame-pointers/exception_handler.run b/testsuite/tests/frame-pointers/exception_handler.run
|
||||
deleted file mode 100644
|
||||
index e96b5ea13a..0000000000
|
||||
--- a/testsuite/tests/frame-pointers/exception_handler.run
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-
|
||||
-${program} 2>&1 \
|
||||
- | ${test_source_directory}/filter-locations.sh ${program} >${output}
|
||||
diff --git a/testsuite/tests/frame-pointers/filter-locations.sh b/testsuite/tests/frame-pointers/filter-locations.sh
|
||||
deleted file mode 100755
|
||||
index 31c7fc3189..0000000000
|
||||
--- a/testsuite/tests/frame-pointers/filter-locations.sh
|
||||
+++ /dev/null
|
||||
@@ -1,23 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-
|
||||
-set -eu
|
||||
-
|
||||
-program="${1}"
|
||||
-# https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed/29626460#29626460
|
||||
-program_escaped=$(echo ${program} | sed 's/[^^\\]/[&]/g; s/\^/\\^/g; s/\\/\\\\/g')
|
||||
-regex_backtrace='^.*(\(.*\)+0x[[:xdigit:]]*)[0x[[:xdigit:]]*]$'
|
||||
-regex_trim_fun='^\(caml.*\)_[[:digit:]]*$'
|
||||
-
|
||||
-# - Ignore backtrace not coming from the program binary
|
||||
-# - Discard the number suffix from OCaml function name
|
||||
-# - Remove strange '[0x.....]' entries inserted by some implementation
|
||||
-# of backtrace_symbols_fd
|
||||
-# - Keep the other lines
|
||||
-sed -e \
|
||||
- "/${regex_backtrace}/ {
|
||||
- /^${program_escaped}/ ! d
|
||||
- s/${regex_backtrace}/\1/
|
||||
- s/${regex_trim_fun}/\1/
|
||||
- s;caml_\(main\|startup\);caml_main/caml_startup;
|
||||
- }" \
|
||||
- -e '/^\[0x/d'
|
||||
diff --git a/testsuite/tests/frame-pointers/fp_backtrace.c b/testsuite/tests/frame-pointers/fp_backtrace.c
|
||||
index a521218a38..cef7ccd9f2 100644
|
||||
--- a/testsuite/tests/frame-pointers/fp_backtrace.c
|
||||
+++ b/testsuite/tests/frame-pointers/fp_backtrace.c
|
||||
@@ -1,10 +1,17 @@
|
||||
#include <execinfo.h>
|
||||
-#include <unistd.h>
|
||||
-#include <setjmp.h>
|
||||
-#include <signal.h>
|
||||
+#include <regex.h>
|
||||
+#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
|
||||
-#define ARRSIZE(a) (sizeof(a) / sizeof(*(a)))
|
||||
+#include "caml/mlvalues.h"
|
||||
+
|
||||
+#define ARR_SIZE(a) (sizeof(a) / sizeof(*(a)))
|
||||
+
|
||||
+#define RE_FUNC_NAME "^.*\\((.+)\\+0x[[:xdigit:]]+\\) \\[0x[[:xdigit:]]+\\]$"
|
||||
+#define RE_TRIM_FUNC "(caml.*)_[[:digit:]]+"
|
||||
+#define CAML_ENTRY "caml_program"
|
||||
|
||||
typedef struct frame_info
|
||||
{
|
||||
@@ -12,99 +19,138 @@ typedef struct frame_info
|
||||
void* retaddr; /* rip */
|
||||
} frame_info;
|
||||
|
||||
-jmp_buf resume_buf;
|
||||
|
||||
+/*
|
||||
+ * A backtrace symbol looks like:
|
||||
+ * ./path/to/binary(camlModule_fn_123+0xAABBCC) [0xAABBCCDDEE]
|
||||
+ */
|
||||
+static const char* backtrace_symbol(const struct frame_info* fi)
|
||||
+{
|
||||
+ char** symbols = backtrace_symbols(&fi->retaddr, 1);
|
||||
+ if (!symbols) {
|
||||
+ perror("backtrace_symbols");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ const char* symbol = strdup(symbols[0]);
|
||||
+ free(symbols);
|
||||
+ return symbol;
|
||||
+}
|
||||
|
||||
-static void signal_handler(int signum)
|
||||
+static bool is_from_executable(const char* symbol, const char* execname)
|
||||
{
|
||||
- /* Should be safe to be called from a signal handler.
|
||||
- * See 21.2.1 "Performing a nonlocal goto from a signal handler" from
|
||||
- * The Linux Programming Interface, Michael Kerrisk */
|
||||
- siglongjmp(resume_buf, 1);
|
||||
+ return strncmp(symbol, execname, strlen(execname)) == 0;
|
||||
}
|
||||
|
||||
-static int install_signal_handlers(const int signals[], struct sigaction
|
||||
- handlers[], int count)
|
||||
+static regmatch_t func_name_from_symbol(const char* symbol)
|
||||
{
|
||||
- for (int i = 0; i < count; i++) {
|
||||
- struct sigaction action = { 0 };
|
||||
- action.sa_handler = signal_handler;
|
||||
- sigemptyset(&action.sa_mask);
|
||||
- action.sa_flags = 0;
|
||||
-
|
||||
- if (sigaction(signals[i], &action, &handlers[i]) != 0) {
|
||||
- perror("sigaction");
|
||||
- return -1;
|
||||
- }
|
||||
+ regex_t regex;
|
||||
+ regmatch_t match[2] = { {-1, -1}, {-1, -1}};
|
||||
+ char errbuf[128];
|
||||
+ int err;
|
||||
+
|
||||
+ err = regcomp(®ex, RE_FUNC_NAME, REG_EXTENDED);
|
||||
+ if (err) {
|
||||
+ regerror(err, ®ex, errbuf, ARR_SIZE(errbuf));
|
||||
+ fprintf(stderr, "regcomp: %s\n", errbuf);
|
||||
+ return match[0];
|
||||
}
|
||||
- return 0;
|
||||
+
|
||||
+ err = regexec(®ex, symbol, ARR_SIZE(match), match, 0);
|
||||
+ if (err == REG_NOMATCH)
|
||||
+ return match[0];
|
||||
+
|
||||
+ return match[1];
|
||||
}
|
||||
|
||||
-static int restore_signal_handlers(const int signals[], struct sigaction
|
||||
- handlers[], int count)
|
||||
+static bool is_caml_entry(const char* symbol, const regmatch_t* funcname)
|
||||
{
|
||||
- for (int i = 0; i < count; i++) {
|
||||
- if (sigaction(signals[i], &handlers[i], NULL) != 0) {
|
||||
- perror("sigaction");
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
- return 0;
|
||||
+ //regoff_t len = funcname->rm_eo - funcname->rm_so;
|
||||
+ //return strnstr(symbol + funcname->rm_so, CAML_ENTRY, len) == 0;
|
||||
+ return strstr(symbol + funcname->rm_so, CAML_ENTRY) != NULL;
|
||||
}
|
||||
|
||||
-static int safe_read(const struct frame_info* fi, struct frame_info** prev,
|
||||
- void** retaddr)
|
||||
+static regmatch_t trim_func_name(const char* symbol, const regmatch_t* funcname)
|
||||
{
|
||||
- /* Signals to ignore while attempting to read frame_info members */
|
||||
- const int signals[] = { SIGSEGV, SIGBUS };
|
||||
- /* Store original signal handers */
|
||||
- struct sigaction handlers[ARRSIZE(signals)] = { 0 };
|
||||
- int ret = 0;
|
||||
-
|
||||
- if (install_signal_handlers(signals, handlers, ARRSIZE(signals)) != 0)
|
||||
- return -1;
|
||||
-
|
||||
- if (!sigsetjmp(resume_buf, 1)) {
|
||||
- *prev = fi->prev;
|
||||
- *retaddr = fi->retaddr;
|
||||
- } else {
|
||||
- ret = -1;
|
||||
+ regex_t regex;
|
||||
+ regmatch_t match[2] = { {-1, -1}, {-1, -1}};
|
||||
+ char errbuf[128];
|
||||
+ int err;
|
||||
+
|
||||
+ err = regcomp(®ex, RE_TRIM_FUNC, REG_EXTENDED);
|
||||
+ if (err) {
|
||||
+ regerror(err, ®ex, errbuf, ARR_SIZE(errbuf));
|
||||
+ fprintf(stderr, "regcomp: %s\n", errbuf);
|
||||
+ return match[0];
|
||||
}
|
||||
|
||||
- if (restore_signal_handlers(signals, handlers, ARRSIZE(signals)) != 0)
|
||||
- return -1;
|
||||
+ match[0] = *funcname;
|
||||
+ err = regexec(®ex, symbol, ARR_SIZE(match), match, REG_STARTEND);
|
||||
+ if (err == REG_NOMATCH) {
|
||||
+ /* match[0] has already been overwritten to hold the function full name for
|
||||
+ regexec */
|
||||
+ return match[1];
|
||||
+ }
|
||||
|
||||
- return ret;
|
||||
+ return match[1];
|
||||
}
|
||||
|
||||
-static void print_location(void* addr)
|
||||
+static void print_symbol(const char* symbol, const regmatch_t* match)
|
||||
{
|
||||
- if (!addr)
|
||||
- return;
|
||||
+ regoff_t off = match->rm_so;
|
||||
+ regoff_t len = match->rm_eo - match->rm_so;
|
||||
|
||||
- /* This requires the binary to be linked with '-rdynamic' */
|
||||
- backtrace_symbols_fd(&addr, 1, STDOUT_FILENO);
|
||||
+ fprintf(stdout, "%.*s\n", len, symbol + off);
|
||||
+ fflush(stdout);
|
||||
}
|
||||
|
||||
-void fp_backtrace(void)
|
||||
+void fp_backtrace(value argv0)
|
||||
{
|
||||
- struct frame_info *fi;
|
||||
- struct frame_info* next;
|
||||
- void* retaddr;
|
||||
+ const char* execname = String_val(argv0);
|
||||
+ struct frame_info* next = NULL;
|
||||
+ const char* symbol = NULL;
|
||||
|
||||
- fi = __builtin_frame_address(0);
|
||||
- retaddr = __builtin_extract_return_addr(__builtin_return_address(0));
|
||||
-
|
||||
- for (; fi; fi = next) {
|
||||
- if (safe_read(fi, &next, &retaddr) != 0)
|
||||
- return;
|
||||
-
|
||||
- print_location(retaddr);
|
||||
+ for (struct frame_info* fi = __builtin_frame_address(0); fi; fi = next) {
|
||||
+ next = fi->prev;
|
||||
|
||||
/* Detect the simplest kind of infinite loop */
|
||||
if (fi == next) {
|
||||
- printf("fp_backtrace: loop detected\n");
|
||||
- return;
|
||||
+ fprintf(stderr, "fp_backtrace: loop detected\n");
|
||||
+ break;
|
||||
}
|
||||
+
|
||||
+ symbol = backtrace_symbol(fi);
|
||||
+ if (!symbol)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Skip entries not from the test */
|
||||
+ if (!is_from_executable(symbol, execname))
|
||||
+ goto skip;
|
||||
+
|
||||
+ /* Exctract the full function name */
|
||||
+ regmatch_t funcname = func_name_from_symbol(symbol);
|
||||
+ if (funcname.rm_so == -1)
|
||||
+ goto skip;
|
||||
+
|
||||
+ /* Trim numeric suffix from caml functions */
|
||||
+ regmatch_t functrimmed = trim_func_name(symbol, &funcname);
|
||||
+
|
||||
+ /* Use the trimmed caml name if available, otherwise use the full function
|
||||
+ name */
|
||||
+ const regmatch_t* match = (functrimmed.rm_so != -1) ?
|
||||
+ &functrimmed : &funcname;
|
||||
+
|
||||
+ print_symbol(symbol, match);
|
||||
+
|
||||
+ /* Stop the backtrace at caml_program */
|
||||
+ if (is_caml_entry(symbol, &funcname))
|
||||
+ break;
|
||||
+
|
||||
+skip:
|
||||
+ free((void*)symbol);
|
||||
+ symbol = NULL;
|
||||
}
|
||||
+
|
||||
+ if (symbol)
|
||||
+ free((void*)symbol);
|
||||
}
|
||||
diff --git a/testsuite/tests/frame-pointers/reperform.ml b/testsuite/tests/frame-pointers/reperform.ml
|
||||
index ec5393907c..7a3b09162b 100644
|
||||
--- a/testsuite/tests/frame-pointers/reperform.ml
|
||||
+++ b/testsuite/tests/frame-pointers/reperform.ml
|
||||
@@ -11,7 +11,7 @@
|
||||
open Effect
|
||||
open Effect.Deep
|
||||
|
||||
-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc]
|
||||
+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc]
|
||||
|
||||
type _ Effect.t += E : unit t
|
||||
| F : unit t
|
||||
@@ -22,7 +22,7 @@ let rec foo n =
|
||||
if n = 5 then begin
|
||||
perform E;
|
||||
print_endline "# resumed...";
|
||||
- fp_backtrace ()
|
||||
+ fp_backtrace Sys.argv.(0)
|
||||
end;
|
||||
foo (n + 1) + n
|
||||
end
|
||||
diff --git a/testsuite/tests/frame-pointers/reperform.reference b/testsuite/tests/frame-pointers/reperform.reference
|
||||
index 9ac6681d4b..e215f77169 100644
|
||||
--- a/testsuite/tests/frame-pointers/reperform.reference
|
||||
+++ b/testsuite/tests/frame-pointers/reperform.reference
|
||||
@@ -15,6 +15,3 @@ camlReperform.bar
|
||||
caml_runstack
|
||||
camlReperform.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
diff --git a/testsuite/tests/frame-pointers/reperform.run b/testsuite/tests/frame-pointers/reperform.run
|
||||
deleted file mode 100644
|
||||
index e96b5ea13a..0000000000
|
||||
--- a/testsuite/tests/frame-pointers/reperform.run
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-
|
||||
-${program} 2>&1 \
|
||||
- | ${test_source_directory}/filter-locations.sh ${program} >${output}
|
||||
diff --git a/testsuite/tests/frame-pointers/stack_realloc.ml b/testsuite/tests/frame-pointers/stack_realloc.ml
|
||||
index fc4e9e9d3b..cacc43c216 100644
|
||||
--- a/testsuite/tests/frame-pointers/stack_realloc.ml
|
||||
+++ b/testsuite/tests/frame-pointers/stack_realloc.ml
|
||||
@@ -13,7 +13,7 @@ open Effect.Deep
|
||||
|
||||
type _ t += E : int -> int t
|
||||
|
||||
-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc]
|
||||
+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc]
|
||||
external c_fun : unit -> int = "c_fun"
|
||||
|
||||
let[@inline never][@local never] f x = x
|
||||
@@ -42,7 +42,7 @@ let[@inline never] consume_stack () =
|
||||
|
||||
let[@inline never] callback () =
|
||||
consume_stack ();
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
0
|
||||
|
||||
let _ = Callback.register "callback" callback
|
||||
diff --git a/testsuite/tests/frame-pointers/stack_realloc.reference b/testsuite/tests/frame-pointers/stack_realloc.reference
|
||||
index 016a03550a..e61d4104e0 100644
|
||||
--- a/testsuite/tests/frame-pointers/stack_realloc.reference
|
||||
+++ b/testsuite/tests/frame-pointers/stack_realloc.reference
|
||||
@@ -7,6 +7,3 @@ camlStack_realloc.f_comp
|
||||
caml_runstack
|
||||
camlStack_realloc.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
diff --git a/testsuite/tests/frame-pointers/stack_realloc.run b/testsuite/tests/frame-pointers/stack_realloc.run
|
||||
deleted file mode 100644
|
||||
index e96b5ea13a..0000000000
|
||||
--- a/testsuite/tests/frame-pointers/stack_realloc.run
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-
|
||||
-${program} 2>&1 \
|
||||
- | ${test_source_directory}/filter-locations.sh ${program} >${output}
|
||||
diff --git a/testsuite/tests/frame-pointers/stack_realloc2.ml b/testsuite/tests/frame-pointers/stack_realloc2.ml
|
||||
index a4aea249ea..b2a602fa4a 100644
|
||||
--- a/testsuite/tests/frame-pointers/stack_realloc2.ml
|
||||
+++ b/testsuite/tests/frame-pointers/stack_realloc2.ml
|
||||
@@ -13,7 +13,7 @@ open Effect.Deep
|
||||
|
||||
type _ t += E : int -> int t
|
||||
|
||||
-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc]
|
||||
+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc]
|
||||
external c_fun : unit -> int = "c_fun"
|
||||
|
||||
let[@inline never][@local never] f x = x
|
||||
@@ -41,7 +41,7 @@ let[@inline never] consume_stack () =
|
||||
ignore (gobbler count)
|
||||
|
||||
let[@inline never] callback () =
|
||||
- fp_backtrace ();
|
||||
+ fp_backtrace Sys.argv.(0);
|
||||
0
|
||||
|
||||
let _ = Callback.register "callback" callback
|
||||
diff --git a/testsuite/tests/frame-pointers/stack_realloc2.reference b/testsuite/tests/frame-pointers/stack_realloc2.reference
|
||||
index ae492abd88..0051f3bad0 100644
|
||||
--- a/testsuite/tests/frame-pointers/stack_realloc2.reference
|
||||
+++ b/testsuite/tests/frame-pointers/stack_realloc2.reference
|
||||
@@ -7,6 +7,3 @@ camlStack_realloc2.f_comp
|
||||
caml_runstack
|
||||
camlStack_realloc2.entry
|
||||
caml_program
|
||||
-caml_start_program
|
||||
-caml_main/caml_startup
|
||||
-main
|
||||
diff --git a/testsuite/tests/frame-pointers/stack_realloc2.run b/testsuite/tests/frame-pointers/stack_realloc2.run
|
||||
deleted file mode 100644
|
||||
index e96b5ea13a..0000000000
|
||||
--- a/testsuite/tests/frame-pointers/stack_realloc2.run
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-
|
||||
-${program} 2>&1 \
|
||||
- | ${test_source_directory}/filter-locations.sh ${program} >${output}
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,39 +0,0 @@
|
||||
From ea8b79eda165722d04b369f1811a5aa80ab5acc6 Mon Sep 17 00:00:00 2001
|
||||
From: SSHz <szhang590@bloomberg.net>
|
||||
Date: Sun, 27 Nov 2022 14:46:16 +0000
|
||||
Subject: [PATCH 04/17] removed set but unused variables in yacc/reader.c
|
||||
(#11758)
|
||||
|
||||
(cherry picked from commit 0114f62d3ed056254ac25192f724e92a2ff6c448)
|
||||
---
|
||||
yacc/reader.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/yacc/reader.c b/yacc/reader.c
|
||||
index 7377967994..7a0b888961 100644
|
||||
--- a/yacc/reader.c
|
||||
+++ b/yacc/reader.c
|
||||
@@ -1049,12 +1049,10 @@ void read_declarations(void)
|
||||
void output_token_type(void)
|
||||
{
|
||||
bucket * bp;
|
||||
- int n;
|
||||
|
||||
fprintf(interface_file, "type token =\n");
|
||||
if (!rflag) ++outline;
|
||||
fprintf(output_file, "type token =\n");
|
||||
- n = 0;
|
||||
for (bp = first_symbol; bp; bp = bp->next) {
|
||||
if (bp->class == TERM && bp->true_token) {
|
||||
fprintf(interface_file, " | %s", bp->name);
|
||||
@@ -1068,7 +1066,6 @@ void output_token_type(void)
|
||||
fprintf(interface_file, "\n");
|
||||
if (!rflag) ++outline;
|
||||
fprintf(output_file, "\n");
|
||||
- n++;
|
||||
}
|
||||
}
|
||||
fprintf(interface_file, "\n");
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 848e28fc6f3f3c9802b23c00f2d77f568c761667 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Scherer <gabriel.scherer@gmail.com>
|
||||
Date: Tue, 3 Jan 2023 17:41:12 +0100
|
||||
Subject: [PATCH 05/17] Merge pull request #11860 from
|
||||
Octachron/index_for_stdlib
|
||||
|
||||
documentation: sort modules alphabetically
|
||||
|
||||
fixes #11857
|
||||
|
||||
(cherry picked from commit 14004c6d4bedadb7215ded2c77230270e52307ff)
|
||||
---
|
||||
api_docgen/Makefile.docfiles | 24 +++++++++++++++---------
|
||||
1 file changed, 15 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/api_docgen/Makefile.docfiles b/api_docgen/Makefile.docfiles
|
||||
index 0c2412b192..f12830b1ec 100644
|
||||
--- a/api_docgen/Makefile.docfiles
|
||||
+++ b/api_docgen/Makefile.docfiles
|
||||
@@ -26,10 +26,6 @@ define capitalize
|
||||
$(foreach m,$(1),$(call capitalize_one,$m))
|
||||
endef
|
||||
|
||||
-define sort
|
||||
-$(shell $(OCAMLDEP) -sort $(1))
|
||||
-endef
|
||||
-
|
||||
runtime_events_MLIS := runtime_events.mli
|
||||
str_MLIS := str.mli
|
||||
unix_MLIS := unix.mli unixLabels.mli
|
||||
@@ -62,10 +58,8 @@ endif
|
||||
libref_TEXT=Ocaml_operators Format_tutorial
|
||||
libref_C=$(call capitalize,$(libref))
|
||||
|
||||
-PARSING_MLIS := $(call sort, \
|
||||
- $(notdir $(wildcard $(ROOTDIR)/parsing/*.mli))\
|
||||
-)
|
||||
-UTILS_MLIS := $(call sort,$(notdir $(wildcard $(ROOTDIR)/utils/*.mli)))
|
||||
+PARSING_MLIS := $(notdir $(wildcard $(ROOTDIR)/parsing/*.mli))
|
||||
+UTILS_MLIS := $(notdir $(wildcard $(ROOTDIR)/utils/*.mli))
|
||||
DRIVER_MLIS := pparse.mli
|
||||
|
||||
compilerlibref_MLIS= \
|
||||
@@ -76,8 +70,20 @@ compilerlibref=$(compilerlibref_MLIS:%.mli=%)
|
||||
compilerlibref_TEXT=Compiler_libs
|
||||
compilerlibref_C=$(call capitalize,$(compilerlibref))
|
||||
|
||||
-ALL_LIBREF= $(libref_TEXT:%=libref/%) $(libref:%=libref/%)
|
||||
+ALL_LIBREF= \
|
||||
+ $(sort $(libref_TEXT:%=libref/%)) \
|
||||
+ $(sort $(filter-out libref/camlinternal%, $(libref:%=libref/%))) \
|
||||
+ $(sort $(filter libref/camlinternal%, $(libref:%=libref/%)))
|
||||
+
|
||||
ALL_COMPILERLIBREF= \
|
||||
$(compilerlibref_TEXT:%=compilerlibref/%) \
|
||||
$(compilerlibref:%=compilerlibref/%)
|
||||
+# Note that the output of $(wildcard ...) is sorted alphabetically.
|
||||
+# The compilerlibs index will be thus be sorted first by category:
|
||||
+# - text documentation
|
||||
+# - parsing modules
|
||||
+# - utils modules
|
||||
+# - driver modules
|
||||
+# And then alphabetically inside each category.
|
||||
+
|
||||
ALL_DOC= $(ALL_LIBREF) $(ALL_COMPILERLIBREF)
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,42 +0,0 @@
|
||||
From a3cd42bc03ed0fc706bb7364fdb14b29b1925600 Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Wed, 4 Jan 2023 16:33:28 +0000
|
||||
Subject: [PATCH 06/17] Allow installing in folder with space in name (#11590)
|
||||
|
||||
- fix(build): Repair make install (in man/Makefile)
|
||||
---
|
||||
Changes | 8 ++++++++
|
||||
man/Makefile | 4 ++--
|
||||
2 files changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Changes b/Changes
|
||||
index 776f6e7a45..438c0f3ec2 100644
|
||||
--- a/Changes
|
||||
+++ b/Changes
|
||||
@@ -1,3 +1,11 @@
|
||||
+OCaml 5.0 maintenance version
|
||||
+-----------------------------
|
||||
+
|
||||
+### Build system:
|
||||
+
|
||||
+- #11590: Allow installing to a destination path containing spaces.
|
||||
+ (Élie Brami, review by Sébastien Hinderer and David Allsopp)
|
||||
+
|
||||
OCaml 5.0 (16 December 2022)
|
||||
----------------------------
|
||||
|
||||
diff --git a/man/Makefile b/man/Makefile
|
||||
index 36d3126563..10cc8bbe41 100644
|
||||
--- a/man/Makefile
|
||||
+++ b/man/Makefile
|
||||
@@ -22,5 +22,5 @@ MANPAGES = $(addsuffix .1,\
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
- $(MKDIR) $(INSTALL_PROGRAMS_MAN_DIR)
|
||||
- $(INSTALL_DATA) $(MANPAGES) $(INSTALL_PROGRAMS_MAN_DIR)
|
||||
+ $(MKDIR) '$(INSTALL_PROGRAMS_MAN_DIR)'
|
||||
+ $(INSTALL_DATA) $(MANPAGES) '$(INSTALL_PROGRAMS_MAN_DIR)'
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,45 +0,0 @@
|
||||
From 44f4015f9a649e164b332e6ab1302139191d4a4f Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Wed, 3 Mar 2021 12:24:36 +0000
|
||||
Subject: [PATCH 07/17] Detect unused Makefile variables in workflow
|
||||
|
||||
---
|
||||
tools/ci/actions/runner.sh | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/ci/actions/runner.sh b/tools/ci/actions/runner.sh
|
||||
index ede27f710a..26123b40d1 100755
|
||||
--- a/tools/ci/actions/runner.sh
|
||||
+++ b/tools/ci/actions/runner.sh
|
||||
@@ -21,6 +21,8 @@ PREFIX=~/local
|
||||
MAKE="make $MAKE_ARG"
|
||||
SHELL=dash
|
||||
|
||||
+MAKE_WARN="$MAKE --warn-undefined-variables"
|
||||
+
|
||||
export PATH=$PREFIX/bin:$PATH
|
||||
|
||||
Configure () {
|
||||
@@ -60,9 +62,18 @@ EOF
|
||||
}
|
||||
|
||||
Build () {
|
||||
- $MAKE world.opt
|
||||
+ if [ "$(uname)" = 'Darwin' ]; then
|
||||
+ script -q build.log $MAKE_WARN
|
||||
+ else
|
||||
+ script --return --command "$MAKE_WARN" build.log
|
||||
+ fi
|
||||
echo Ensuring that all names are prefixed in the runtime
|
||||
./tools/check-symbol-names runtime/*.a otherlibs/*/lib*.a
|
||||
+ if grep -Fq ' warning: undefined variable ' build.log; then
|
||||
+ echo Undefined Makefile variables detected
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ rm build.log
|
||||
}
|
||||
|
||||
Test () {
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,33 +0,0 @@
|
||||
From 2eccdd3cd78624b0f2664d6152afbcae167f6f8b Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Mon, 20 Feb 2023 20:27:58 +0000
|
||||
Subject: [PATCH 08/17] Fix incorrect variable from runtime/Makefile merge
|
||||
|
||||
Wrong CPPFLAGS used when assembling with ASPP.
|
||||
---
|
||||
Makefile | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index bb2c245eab..3ea3296c7f 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -952,6 +952,15 @@ ASPP_ERROR = \
|
||||
runtime/%.o: runtime/%.S
|
||||
$(ASPP) $(OC_ASPPFLAGS) -o $@ $< || $(ASPP_ERROR)
|
||||
|
||||
+# $(OC_DEBUG_CPPFLAGS) and $(OC_INSTR_CPPFLAGS) are still used in the two
|
||||
+# recipes just below instead of the correct $(ocamlrund_CPPFLAGS) and
|
||||
+# $(ocamlruni_CPPFLAGS). This has been fixed on trunk, but in the
|
||||
+# 5.0 maintenance branch here we just define default values for those OC_*
|
||||
+# variables to avoid an undefined-variable warning, preserving exactly the
|
||||
+# (somewhat strange) behaviour of the 5.0.0 release.
|
||||
+OC_DEBUG_CPPFLAGS ?=
|
||||
+OC_INSTR_CPPFLAGS ?=
|
||||
+
|
||||
runtime/%.d.o: runtime/%.S
|
||||
$(ASPP) $(OC_ASPPFLAGS) $(OC_DEBUG_CPPFLAGS) -o $@ $< || $(ASPP_ERROR)
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 5f3f8bf734bdc02adc69cf92f066547bd71e8a25 Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Mon, 20 Feb 2023 20:31:31 +0000
|
||||
Subject: [PATCH 09/17] Provide a default for $(OCAMLDEPFLAGS)
|
||||
|
||||
---
|
||||
Makefile.common | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile.common b/Makefile.common
|
||||
index 536e2a28ca..e2a9176a5c 100644
|
||||
--- a/Makefile.common
|
||||
+++ b/Makefile.common
|
||||
@@ -169,6 +169,7 @@ endef # PROGRAM_SYNONYM
|
||||
# should take place *before* Makefile.common is included.
|
||||
|
||||
OCAMLDEP ?= $(BEST_OCAMLDEP)
|
||||
+OCAMLDEPFLAGS ?=
|
||||
OC_OCAMLDEPFLAGS = -slash
|
||||
OC_OCAMLDEPDIRS =
|
||||
OCAMLDEP_CMD = $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) \
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 7f4569e22c2a19d51324c44a2954b10427df2cd8 Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Tue, 21 Feb 2023 14:44:21 +0000
|
||||
Subject: [PATCH 10/17] Report all post-build failures
|
||||
|
||||
Rather than just reporting un-prefixed symbol names, also report
|
||||
undefined variables.
|
||||
---
|
||||
tools/ci/actions/runner.sh | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/ci/actions/runner.sh b/tools/ci/actions/runner.sh
|
||||
index 26123b40d1..6e5a30f73a 100755
|
||||
--- a/tools/ci/actions/runner.sh
|
||||
+++ b/tools/ci/actions/runner.sh
|
||||
@@ -67,13 +67,19 @@ Build () {
|
||||
else
|
||||
script --return --command "$MAKE_WARN" build.log
|
||||
fi
|
||||
- echo Ensuring that all names are prefixed in the runtime
|
||||
- ./tools/check-symbol-names runtime/*.a otherlibs/*/lib*.a
|
||||
+ failed=0
|
||||
if grep -Fq ' warning: undefined variable ' build.log; then
|
||||
echo Undefined Makefile variables detected
|
||||
- exit 1
|
||||
+ failed=1
|
||||
fi
|
||||
rm build.log
|
||||
+ echo Ensuring that all names are prefixed in the runtime
|
||||
+ if ! ./tools/check-symbol-names runtime/*.a otherlibs/*/lib*.a ; then
|
||||
+ failed=1
|
||||
+ fi
|
||||
+ if ((failed)); then
|
||||
+ exit 1
|
||||
+ fi
|
||||
}
|
||||
|
||||
Test () {
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 0f6dc503bf3814e5547ffb4e9d6ea0a75ffd1ec0 Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Wed, 22 Feb 2023 10:47:00 +0000
|
||||
Subject: [PATCH 11/17] Finish off removal of FORCE_INSTRUMENTED_RUNTIME
|
||||
|
||||
---
|
||||
utils/Makefile | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/utils/Makefile b/utils/Makefile
|
||||
index 0fcbc59ce5..efd8574fa5 100644
|
||||
--- a/utils/Makefile
|
||||
+++ b/utils/Makefile
|
||||
@@ -90,7 +90,6 @@ config_main.ml: config.mlp $(ROOTDIR)/Makefile.config Makefile config.common.ml
|
||||
$(call SUBST,FUNCTION_SECTIONS) \
|
||||
$(call SUBST,CC_HAS_DEBUG_PREFIX_MAP) \
|
||||
$(call SUBST,AS_HAS_DEBUG_PREFIX_MAP) \
|
||||
- $(call SUBST,FORCE_INSTRUMENTED_RUNTIME) \
|
||||
$< > $@
|
||||
cat config.common.ml >> $@
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,27 +0,0 @@
|
||||
From ffb2022797986324213891a59c02af46269b5c17 Mon Sep 17 00:00:00 2001
|
||||
From: Damien Doligez <damien.doligez@inria.fr>
|
||||
Date: Mon, 17 Apr 2023 11:36:32 +0200
|
||||
Subject: [PATCH 12/17] suppress spurious alert when compiling stdlib
|
||||
documentation
|
||||
|
||||
(cherry picked from commit 5c0fb8e23865fdbf151bdbe15d91176903c284d3)
|
||||
---
|
||||
api_docgen/ocamldoc/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/api_docgen/ocamldoc/Makefile b/api_docgen/ocamldoc/Makefile
|
||||
index 1b3d5f57f7..b6419ae50d 100644
|
||||
--- a/api_docgen/ocamldoc/Makefile
|
||||
+++ b/api_docgen/ocamldoc/Makefile
|
||||
@@ -44,7 +44,7 @@ $(libref:%=build/libref/%.odoc): build/libref/%.odoc: %.mli | build/libref
|
||||
$(OCAMLDOC_RUN) -nostdlib -hide Stdlib -lib Stdlib \
|
||||
-pp \
|
||||
"$(AWK) -v ocamldoc=true -f ../../stdlib/expand_module_aliases.awk" \
|
||||
- $(DOC_STDLIB_INCLUDES) -hide-warnings $< -dump $@
|
||||
+ $(DOC_STDLIB_INCLUDES) -hide-warnings -alert -all $< -dump $@
|
||||
|
||||
$(compilerlibref:%=build/compilerlibref/%.odoc):\
|
||||
build/compilerlibref/%.odoc: %.mli | build/compilerlibref
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,70 +0,0 @@
|
||||
From 4cc4eb8b0d71c64c5252d6764f4c4b0aa6020995 Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Sat, 3 Jun 2023 18:02:24 +0100
|
||||
Subject: [PATCH 13/17] Merge pull request #12285 from
|
||||
smorimoto/update-deprecated-actions
|
||||
|
||||
Update deprecated GitHub Actions
|
||||
|
||||
(cherry picked from commit eadb05a504e0738f246a7dc846a442793005a27a)
|
||||
---
|
||||
.github/workflows/build.yml | 8 ++++----
|
||||
.github/workflows/hygiene.yml | 2 +-
|
||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
|
||||
index ae0fcace20..933c14a926 100644
|
||||
--- a/.github/workflows/build.yml
|
||||
+++ b/.github/workflows/build.yml
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
manual_changed: ${{ steps.manual.outputs.manual_changed }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
- uses: actions/checkout@v2
|
||||
+ uses: actions/checkout@v3
|
||||
- name: Check for manual changes
|
||||
id: manual
|
||||
run: >-
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
git config --local --unset http.https://github.com/.extraheader
|
||||
tar --zstd -cf /tmp/sources.tar.zstd .
|
||||
- name: Upload Artifact
|
||||
- uses: actions/upload-artifact@v2
|
||||
+ uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: compiler
|
||||
path: /tmp/sources.tar.zstd
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Artifact
|
||||
- uses: actions/download-artifact@v2
|
||||
+ uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: compiler
|
||||
- name: Unpack Artifact
|
||||
@@ -137,7 +137,7 @@ jobs:
|
||||
- debug-s4096
|
||||
steps:
|
||||
- name: Download artifact
|
||||
- uses: actions/download-artifact@v2
|
||||
+ uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: compiler
|
||||
- name: Unpack Artifact
|
||||
diff --git a/.github/workflows/hygiene.yml b/.github/workflows/hygiene.yml
|
||||
index e89efd2f47..3b2e10795f 100644
|
||||
--- a/.github/workflows/hygiene.yml
|
||||
+++ b/.github/workflows/hygiene.yml
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
# context variable.
|
||||
if: failure()
|
||||
|
||||
- - uses: actions/checkout@v2
|
||||
+ - uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 50
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,40 +0,0 @@
|
||||
From af3a67cd06e07825c63b70a038cf90481039b1ed Mon Sep 17 00:00:00 2001
|
||||
From: David Allsopp <david.allsopp@metastack.com>
|
||||
Date: Fri, 9 Jun 2023 21:47:51 +0100
|
||||
Subject: [PATCH 14/17] Merge pull request #12286 from
|
||||
smorimoto/replace-set-output
|
||||
|
||||
Replace the set-output command with the GITHUB_OUTPUT environment file
|
||||
|
||||
(cherry picked from commit 50054a632a5ac3bb4199276617d358e3fa4a108b)
|
||||
---
|
||||
tools/ci/actions/check-manual-modified.sh | 2 +-
|
||||
tools/ci/actions/runner.sh | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/ci/actions/check-manual-modified.sh b/tools/ci/actions/check-manual-modified.sh
|
||||
index dc8b6bd809..c5826c1fd0 100755
|
||||
--- a/tools/ci/actions/check-manual-modified.sh
|
||||
+++ b/tools/ci/actions/check-manual-modified.sh
|
||||
@@ -32,4 +32,4 @@ else
|
||||
fi
|
||||
|
||||
echo "Manual altered: $result"
|
||||
-echo "::set-output name=manual_changed::$result"
|
||||
+echo "manual_changed=$result" >>"$GITHUB_OUTPUT"
|
||||
diff --git a/tools/ci/actions/runner.sh b/tools/ci/actions/runner.sh
|
||||
index 6e5a30f73a..295e58a83e 100755
|
||||
--- a/tools/ci/actions/runner.sh
|
||||
+++ b/tools/ci/actions/runner.sh
|
||||
@@ -159,7 +159,7 @@ ReportBuildStatus () {
|
||||
else
|
||||
STATUS='success'
|
||||
fi
|
||||
- echo "::set-output name=build-status::$STATUS"
|
||||
+ echo "build-status=$STATUS" >>"$GITHUB_OUTPUT"
|
||||
exit $CODE
|
||||
}
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 0e07dfdb530734ef4db351ecc24c6363e36916ec Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 24 Jun 2014 10:00:15 +0100
|
||||
Subject: [PATCH 15/17] Don't add rpaths to libraries.
|
||||
|
||||
---
|
||||
utils/config.mlp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/utils/config.mlp b/utils/config.mlp
|
||||
index 7e1848f433..811d9134dd 100644
|
||||
--- a/utils/config.mlp
|
||||
+++ b/utils/config.mlp
|
||||
@@ -42,8 +42,8 @@ let native_c_compiler =
|
||||
c_compiler ^ " " ^ ocamlopt_cflags ^ " " ^ ocamlopt_cppflags
|
||||
let native_c_libraries = "%%NATIVECCLIBS%%"
|
||||
let native_pack_linker = "%%PACKLD%%"
|
||||
-let default_rpath = "%%RPATH%%"
|
||||
-let mksharedlibrpath = "%%MKSHAREDLIBRPATH%%"
|
||||
+let default_rpath = ""
|
||||
+let mksharedlibrpath = ""
|
||||
let ar = "%%ARCMD%%"
|
||||
let supports_shared_libraries = %%SUPPORTS_SHARED_LIBRARIES%%
|
||||
let mkdll, mkexe, mkmaindll =
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 9d3722c87ab15dfbc4e1a934e09ddc8253712d9c Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 29 May 2012 20:44:18 +0100
|
||||
Subject: [PATCH 16/17] configure: Allow user defined C compiler flags.
|
||||
|
||||
---
|
||||
configure.ac | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index a7974b0426..8068de3cfc 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -670,6 +670,10 @@ AS_CASE([$host],
|
||||
internal_cflags="$cc_warnings"],
|
||||
[common_cflags="-O"])])
|
||||
|
||||
+# Allow CFLAGS and LDFLAGS to be added.
|
||||
+common_cflags="$common_cflags $CFLAGS"
|
||||
+cclibs="$cclibs $LDFLAGS"
|
||||
+
|
||||
# Enable SSE2 on x86 mingw to avoid using 80-bit registers.
|
||||
AS_CASE([$host],
|
||||
[i686-*-mingw32],
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 74b0eee42f616cb05c640c0ceac0cc391e4a7ef1 Mon Sep 17 00:00:00 2001
|
||||
From: Jerry James <loganjerry@gmail.com>
|
||||
Date: Fri, 7 Jul 2023 07:07:09 -0600
|
||||
Subject: [PATCH 17/17] Fix skiplist test failure (#12346)
|
||||
|
||||
Fix -Wmaybe-uninitialized warning in skiplist test
|
||||
Fix -Wunused-variable warning in skiplist test
|
||||
|
||||
Co-authored-by: Xavier Leroy <xavier.leroy@college-de-france.fr>
|
||||
(cherry picked from commit 3027e3308d685af03caf4f605b4bec55b04ed28e)
|
||||
(cherry picked from commit 9aa7761060a7c40d11237599382b892dbcb79cb5)
|
||||
---
|
||||
testsuite/tests/lf_skiplist/stubs.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/testsuite/tests/lf_skiplist/stubs.c b/testsuite/tests/lf_skiplist/stubs.c
|
||||
index 991483e408..acc0eaf9cf 100644
|
||||
--- a/testsuite/tests/lf_skiplist/stubs.c
|
||||
+++ b/testsuite/tests/lf_skiplist/stubs.c
|
||||
@@ -64,7 +64,7 @@ static int get_len(struct lf_skipcell *p, struct lf_skipcell *end) {
|
||||
static uintnat count_marks(struct lf_skiplist *sk) {
|
||||
uintnat r = 0;
|
||||
struct lf_skipcell *p = sk->head;
|
||||
- uintptr_t succ;
|
||||
+ uintptr_t succ = 0;
|
||||
|
||||
while (p) {
|
||||
for (int k = p->top_level; k >= 0; k--) {
|
||||
@@ -135,7 +135,6 @@ inline static uintnat calc_right(uintnat id,uintnat turn,uintnat ndoms) { return
|
||||
CAMLprim value insert_skiplist(value turn_val,value ndoms_val,value domain_id_val) {
|
||||
CAMLparam3(turn_val,ndoms_val,domain_id_val);
|
||||
uintnat domain_id = Long_val(domain_id_val);
|
||||
- uintnat ndoms = Long_val(ndoms_val);
|
||||
uintnat turn = Long_val(turn_val);
|
||||
uintnat k = calc_key(domain_id,turn) ;
|
||||
uintnat v = calc_value(domain_id) ;
|
||||
--
|
||||
2.41.0
|
||||
|
69
macros.ocaml-rpm
Normal file
69
macros.ocaml-rpm
Normal file
@ -0,0 +1,69 @@
|
||||
# Make %files lists from an installed tree of files.
|
||||
# Options:
|
||||
# -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs,
|
||||
# is placed in its own package. This option requires the existence of opam
|
||||
# *.install files in the build tree.
|
||||
# -n: suppress creation of a devel subpackage.
|
||||
%ocaml_files(sn) %{python3} /usr/lib/rpm/redhat/ocaml_files.py %{-s} %{-n} %{buildroot} %{ocamldir}
|
||||
|
||||
# Internal macro holding the common parts of ocaml_install and dune_install
|
||||
%ocaml_install_common(sn) %{expand:
|
||||
rm -rf %{buildroot}%{_prefix}/doc
|
||||
mlis=$(find %{buildroot}%{_libdir}/ocaml -name '*.mli')
|
||||
rm -f ${mlis//.mli/.ml}
|
||||
%ocaml_files %{-s} %{-n}}
|
||||
|
||||
# Install files listed in opam *.install files.
|
||||
# Options:
|
||||
# -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs,
|
||||
# is placed in its own package.
|
||||
# -n: suppress creation of a devel subpackage.
|
||||
%ocaml_install(sn) %{expand:
|
||||
%{python3} /usr/lib/rpm/redhat/ocaml_files.py -i %{-s} %{-n} %{buildroot} %{ocamldir}
|
||||
%ocaml_install_common %{-s} %{-n}}
|
||||
|
||||
# Add smp_mflags to arguments if no -j release option is given.
|
||||
# Add --release to arguments if no -p or --release option is given.
|
||||
# Add --verbose to arguments if it is not given.
|
||||
%dune_add_flags(-) %{lua:
|
||||
has_j = false
|
||||
has_p = false
|
||||
has_v = false
|
||||
for _, flag in pairs(arg) do
|
||||
if flag:find("^-j") then
|
||||
has_j = true
|
||||
elseif flag:find("^-p") or flag:find("^--release)") then
|
||||
has_p = true
|
||||
elseif flag:find("^--verbose") then
|
||||
has_v = true
|
||||
end
|
||||
end
|
||||
if not has_j then
|
||||
table.insert(arg, 1, rpm.expand("%{?_smp_mflags}"))
|
||||
end
|
||||
if not has_p then
|
||||
table.insert(arg, 1, "--release")
|
||||
end
|
||||
if not has_v then
|
||||
table.insert(arg, 1, "--verbose")
|
||||
end
|
||||
print(table.concat(arg, " "))
|
||||
}
|
||||
|
||||
# Build with dune
|
||||
%dune_build(-) dune build %{dune_add_flags %*}
|
||||
|
||||
# Run tests with dune
|
||||
%dune_check(-) dune runtest %{dune_add_flags %*}
|
||||
|
||||
# Install with dune
|
||||
# Options:
|
||||
# -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs,
|
||||
# is placed in its own package.
|
||||
# -n: suppress creation of a devel subpackage.
|
||||
%dune_install(sn) %{expand:
|
||||
dune install --destdir=%{buildroot} %{dune_add_flags %*}
|
||||
if [ -d _build/default/_doc/_html ]; then
|
||||
find _build/default/_doc/_html -name .dune-keep -delete
|
||||
fi
|
||||
%ocaml_install_common %{-s} %{-n}}
|
127
ocaml.spec
127
ocaml.spec
@ -1,6 +1,12 @@
|
||||
# Don't add -Wl,-dT,<build dir>
|
||||
%undefine _package_note_flags
|
||||
|
||||
# OCaml 5.1 broke building with LTO. A file prims.c is generated with primitive
|
||||
# function declarations, all with "void" for their parameter list. This does
|
||||
# not match the real definitions, leading to lots of -Wlto-type-mismatch
|
||||
# warnings. These change the output of the tests, leading to many failed tests.
|
||||
%global _lto_cflags %{nil}
|
||||
|
||||
# OCaml has a bytecode backend that works on anything with a C
|
||||
# compiler, and a native code backend available on a subset of
|
||||
# architectures. A further subset of architectures support native
|
||||
@ -23,7 +29,7 @@ ExcludeArch: %{ix86}
|
||||
|
||||
# These are all the architectures that the tests run on. The tests
|
||||
# take a long time to run, so don't run them on slow machines.
|
||||
%global test_arches aarch64 %{power64} riscv64 x86_64
|
||||
%global test_arches aarch64 %{power64} riscv64 s390x x86_64
|
||||
# These are the architectures for which the tests must pass otherwise
|
||||
# the build will fail.
|
||||
#global test_arches_required aarch64 ppc64le x86_64
|
||||
@ -36,8 +42,8 @@ ExcludeArch: %{ix86}
|
||||
%global rcver %{nil}
|
||||
|
||||
Name: ocaml
|
||||
Version: 5.0.0
|
||||
Release: 4%{?dist}
|
||||
Version: 5.1.0
|
||||
Release: 1%{?dist}
|
||||
|
||||
Summary: OCaml compiler and programming environment
|
||||
|
||||
@ -46,6 +52,8 @@ License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception
|
||||
URL: https://www.ocaml.org
|
||||
|
||||
Source0: https://github.com/ocaml/ocaml/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: macros.ocaml-rpm
|
||||
Source2: ocaml_files.py
|
||||
|
||||
# IMPORTANT NOTE:
|
||||
#
|
||||
@ -56,44 +64,33 @@ Source0: https://github.com/ocaml/ocaml/archive/%{version}/%{name}-%{vers
|
||||
#
|
||||
# https://pagure.io/fedora-ocaml
|
||||
#
|
||||
# Current branch: fedora-39-5.0.0
|
||||
# Current branch: fedora-40-5.1.0
|
||||
#
|
||||
# ALTERNATIVELY add a patch to the end of the list (leaving the
|
||||
# existing patches unchanged) adding a comment to note that it should
|
||||
# be incorporated into the git repo at a later time.
|
||||
|
||||
# Patches added after 5.0.0 was released.
|
||||
Patch: 0001-increment-version-number-after-tagging-5.0.0.patch
|
||||
Patch: 0002-Merge-pull-request-11814-from-gasche-clarify-DLS.new.patch
|
||||
Patch: 0003-Add-KC-Sivaramakrishnan-as-author.patch
|
||||
Patch: 0004-removed-set-but-unused-variables-in-yacc-reader.c-11.patch
|
||||
Patch: 0005-Merge-pull-request-11860-from-Octachron-index_for_st.patch
|
||||
Patch: 0006-Allow-installing-in-folder-with-space-in-name-11590.patch
|
||||
Patch: 0007-Detect-unused-Makefile-variables-in-workflow.patch
|
||||
Patch: 0008-Fix-incorrect-variable-from-runtime-Makefile-merge.patch
|
||||
Patch: 0009-Provide-a-default-for-OCAMLDEPFLAGS.patch
|
||||
Patch: 0010-Report-all-post-build-failures.patch
|
||||
Patch: 0011-Finish-off-removal-of-FORCE_INSTRUMENTED_RUNTIME.patch
|
||||
Patch: 0012-suppress-spurious-alert-when-compiling-stdlib-docume.patch
|
||||
Patch: 0013-Merge-pull-request-12285-from-smorimoto-update-depre.patch
|
||||
Patch: 0014-Merge-pull-request-12286-from-smorimoto-replace-set-.patch
|
||||
# Patches added after 5.1.0 was released.
|
||||
|
||||
# Fedora-specific patches
|
||||
Patch: 0015-Don-t-add-rpaths-to-libraries.patch
|
||||
Patch: 0016-configure-Allow-user-defined-C-compiler-flags.patch
|
||||
|
||||
# Fix skiplist test failure
|
||||
# https://github.com/ocaml/ocaml/pull/12346
|
||||
Patch: 0017-Fix-skiplist-test-failure-12346.patch
|
||||
Patch: 0001-Don-t-add-rpaths-to-libraries.patch
|
||||
Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch
|
||||
# https://github.com/ocaml/ocaml/pull/12530
|
||||
Patch: 0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch
|
||||
# https://github.com/ocaml/ocaml/pull/11594
|
||||
Patch: 0004-Update-framepointers-tests-to-avoid-false-positive-w.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: git
|
||||
BuildRequires: gcc
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: gawk
|
||||
BuildRequires: hardlink
|
||||
BuildRequires: parallel
|
||||
BuildRequires: perl-interpreter
|
||||
BuildRequires: util-linux
|
||||
BuildRequires: /usr/bin/annocheck
|
||||
BuildRequires: pkgconfig(libzstd)
|
||||
|
||||
# Documentation requirements
|
||||
BuildRequires: asciidoc
|
||||
@ -101,17 +98,19 @@ BuildRequires: python3-pygments
|
||||
|
||||
# ocamlopt runs gcc to link binaries. Because Fedora includes
|
||||
# hardening flags automatically, redhat-rpm-config is also required.
|
||||
# Compressed marshaling requires libzstd-devel.
|
||||
Requires: gcc
|
||||
Requires: redhat-rpm-config
|
||||
Requires: libzstd-devel%{?_isa}
|
||||
|
||||
# Because we pass -c flag to ocaml-find-requires (to avoid circular
|
||||
# dependencies) we also have to explicitly depend on the right version
|
||||
# of ocaml-runtime.
|
||||
Requires: ocaml-runtime%{?_isa} = %{version}-%{release}
|
||||
|
||||
# Force ocaml-srpm-macros to be at the latest version, since OCaml 5.0
|
||||
# Force ocaml-srpm-macros to be at the latest version, since OCaml 5.1
|
||||
# has a different set of native code generators than previous versions.
|
||||
Requires: ocaml-srpm-macros >= 8
|
||||
Requires: ocaml-srpm-macros >= 9
|
||||
|
||||
# Bundles an MD5 implementation in runtime/caml/md5.h and runtime/md5.c
|
||||
Provides: bundled(md5-plumb)
|
||||
@ -137,6 +136,10 @@ and a comprehensive library.
|
||||
|
||||
|
||||
%package runtime
|
||||
# LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception: the project as a whole
|
||||
# LicenseRef-Fedora-Public-Domain: the MD5 implementation in runtime/caml/md5.h
|
||||
# and runtime/md5.c
|
||||
License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception AND LicenseRef-Fedora-Public-Domain
|
||||
Summary: OCaml runtime environment
|
||||
Requires: util-linux
|
||||
Provides: ocaml(runtime) = %{version}
|
||||
@ -197,6 +200,20 @@ Note that this exposes internal details of the OCaml compiler which
|
||||
may not be portable between versions.
|
||||
|
||||
|
||||
%package rpm-macros
|
||||
# LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception: the project as a whole
|
||||
# BSD-3-Clause: ocaml_files.py
|
||||
License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception AND BSD-3-Clause
|
||||
Summary: RPM macros for building OCaml packages
|
||||
BuildArch: noarch
|
||||
Requires: ocaml = %{version}-%{release}
|
||||
Requires: python3
|
||||
|
||||
|
||||
%description rpm-macros
|
||||
This package contains macros that are useful for building OCaml RPMs.
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -S git -n %{name}-%{version}%{rcver}
|
||||
# Patches touch configure.ac, so rebuild it:
|
||||
@ -214,6 +231,9 @@ make=make
|
||||
# Set ocamlmklib default flags to include Fedora linker flags
|
||||
sed -i '/ld_opts/s|\[\]|["%{build_ldflags}"]|' tools/ocamlmklib.ml
|
||||
|
||||
# Expose a dependency on the math library
|
||||
sed -i '/^EXTRACAMLFLAGS=/aLINKOPTS=-cclib -lm' otherlibs/unix/Makefile
|
||||
|
||||
# Don't use %%configure macro because it sets --build, --host which
|
||||
# breaks some incorrect assumptions made by OCaml's configure.ac
|
||||
#
|
||||
@ -295,58 +315,54 @@ echo %{version} > $RPM_BUILD_ROOT%{_libdir}/ocaml/fedora-ocaml-release
|
||||
# Remove the installed documentation. We will install it using %%doc
|
||||
rm -rf $RPM_BUILD_ROOT%{_docdir}/ocaml
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{rpmmacrodir}
|
||||
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{rpmmacrodir}/macros.ocaml-rpm
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/redhat
|
||||
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_rpmconfigdir}/redhat
|
||||
|
||||
# Link, rather than copy, identical binaries
|
||||
hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs
|
||||
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%{_bindir}/ocaml
|
||||
|
||||
%{_bindir}/ocamlcmt
|
||||
%{_bindir}/ocamlcp
|
||||
%{_bindir}/ocamldebug
|
||||
%{_bindir}/ocamlmklib
|
||||
%{_bindir}/ocamlmktop
|
||||
%{_bindir}/ocamlprof
|
||||
%{_bindir}/ocamlyacc
|
||||
|
||||
# symlink to either .byte or .opt version
|
||||
%{_bindir}/ocamlc
|
||||
%{_bindir}/ocamlcp
|
||||
%{_bindir}/ocamldep
|
||||
%{_bindir}/ocamllex
|
||||
%{_bindir}/ocamlmklib
|
||||
%{_bindir}/ocamlmktop
|
||||
%{_bindir}/ocamlobjinfo
|
||||
%{_bindir}/ocamloptp
|
||||
%{_bindir}/ocamlprof
|
||||
|
||||
# bytecode versions
|
||||
%{_bindir}/ocamlc.byte
|
||||
%{_bindir}/ocamlcp.byte
|
||||
%{_bindir}/ocamldep.byte
|
||||
%{_bindir}/ocamllex.byte
|
||||
%{_bindir}/ocamlmklib.byte
|
||||
%{_bindir}/ocamlmktop.byte
|
||||
%{_bindir}/ocamlobjinfo.byte
|
||||
%{_bindir}/ocamloptp.byte
|
||||
%{_bindir}/ocamlprof.byte
|
||||
|
||||
%if %{native_compiler}
|
||||
# native code versions
|
||||
%{_bindir}/ocamlc.opt
|
||||
%{_bindir}/ocamlcp.opt
|
||||
%{_bindir}/ocamldep.opt
|
||||
%{_bindir}/ocamllex.opt
|
||||
%{_bindir}/ocamlmklib.opt
|
||||
%{_bindir}/ocamlmktop.opt
|
||||
%{_bindir}/ocamlobjinfo.opt
|
||||
%{_bindir}/ocamloptp.opt
|
||||
%{_bindir}/ocamlprof.opt
|
||||
%endif
|
||||
|
||||
%if %{native_compiler}
|
||||
%{_bindir}/ocamlopt
|
||||
%{_bindir}/ocamlopt.byte
|
||||
%{_bindir}/ocamlopt.opt
|
||||
%endif
|
||||
|
||||
%if %{native_compiler}
|
||||
%{_bindir}/ocamlnat
|
||||
%{_bindir}/ocamlopt
|
||||
%{_bindir}/ocamlopt.byte
|
||||
%{_bindir}/ocamlopt.opt
|
||||
%{_bindir}/ocamloptp
|
||||
%endif
|
||||
|
||||
%{_libdir}/ocaml/camlheader
|
||||
@ -398,9 +414,6 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/ocaml
|
||||
%{_libdir}/ocaml/dynlink/META
|
||||
%{_libdir}/ocaml/dynlink/*.cmi
|
||||
%{_libdir}/ocaml/dynlink/*.cma
|
||||
%dir %{_libdir}/ocaml/ocamlmktop
|
||||
%{_libdir}/ocaml/ocamlmktop/*.cmo
|
||||
%{_libdir}/ocaml/ocamlmktop/*.cmi
|
||||
%dir %{_libdir}/ocaml/profiling
|
||||
%{_libdir}/ocaml/profiling/*.cmo
|
||||
%{_libdir}/ocaml/profiling/*.cmi
|
||||
@ -448,7 +461,19 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/ocaml
|
||||
%{_libdir}/ocaml/compiler-libs
|
||||
|
||||
|
||||
%files rpm-macros
|
||||
%{rpmmacrodir}/macros.ocaml-rpm
|
||||
%{_rpmconfigdir}/redhat/ocaml_files.py
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Oct 4 2023 Jerry James <loganjerry@gmail.com> - 5.1.0-1
|
||||
- Version 5.1.0
|
||||
- Add LicenseRef-Fedora-Public-Domain to the runtime License field
|
||||
- New ocaml-rpm-macros subpackage
|
||||
- Depend on libzstd-devel for compressed marshaling
|
||||
- Disable LTO
|
||||
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
|
451
ocaml_files.py
Normal file
451
ocaml_files.py
Normal file
@ -0,0 +1,451 @@
|
||||
# Copyright 2022-3, Jerry James
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name of Red Hat nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import string
|
||||
import sys
|
||||
from collections.abc import Iterable, Iterator
|
||||
from enum import Enum, auto
|
||||
from typing import Callable, final
|
||||
|
||||
# Version of this script
|
||||
version=2
|
||||
|
||||
#
|
||||
# BUILDROOT CATEGORIZATION
|
||||
#
|
||||
|
||||
# Directories to ignore when generating %dir entries
|
||||
root_dirs: set[str] = {
|
||||
'/',
|
||||
'/etc',
|
||||
'/usr',
|
||||
'/usr/bin',
|
||||
'/usr/lib',
|
||||
'/usr/lib/ocaml',
|
||||
'/usr/lib/ocaml/caml',
|
||||
'/usr/lib/ocaml/stublibs',
|
||||
'/usr/lib/ocaml/threads',
|
||||
'/usr/lib64',
|
||||
'/usr/lib64/ocaml',
|
||||
'/usr/lib64/ocaml/caml',
|
||||
'/usr/lib64/ocaml/stublibs',
|
||||
'/usr/lib64/ocaml/threads',
|
||||
'/usr/libexec',
|
||||
'/usr/sbin',
|
||||
'/usr/share',
|
||||
'/usr/share/doc'
|
||||
}
|
||||
|
||||
def find_buildroot_toplevel(buildroot: str) -> list[str]:
|
||||
"""Find toplevel files and directories in the buildroot.
|
||||
|
||||
:param str buildroot: path to the buildroot
|
||||
:return: a list of toplevel files and directories in the buildroot
|
||||
"""
|
||||
bfiles: list[str] = []
|
||||
for path, dirs, files in os.walk(buildroot):
|
||||
for i in range(len(dirs) - 1, -1, -1):
|
||||
d = os.path.join(path, dirs[i])[len(buildroot):]
|
||||
if d not in root_dirs and not d.startswith('/usr/share/man'):
|
||||
bfiles.append(d)
|
||||
del dirs[i]
|
||||
for f in files:
|
||||
realfile = os.path.join(path, f)[len(buildroot):]
|
||||
if realfile.startswith('/usr/share/man'):
|
||||
bfiles.append(realfile + '*')
|
||||
else:
|
||||
bfiles.append(realfile)
|
||||
return bfiles
|
||||
|
||||
# File suffixes that go into a devel subpackage
|
||||
dev_suffixes: set[str] = {
|
||||
'a', 'cmo', 'cmt', 'cmti', 'cmx', 'cmxa', 'h', 'idl', 'ml', 'mli', 'o'
|
||||
}
|
||||
|
||||
def is_devel_file(filname: str) -> bool:
|
||||
"""Determine whether a file belongs to a devel subpackage.
|
||||
|
||||
:param str filname: the filename to check
|
||||
:return: True if the file belongs to a devel subpackage, else False
|
||||
"""
|
||||
return (filname == 'dune-package' or filname == 'opam' or
|
||||
(os.path.splitext(filname)[1][1:] in dev_suffixes
|
||||
and not filname.endswith('_top_init.ml')))
|
||||
|
||||
def find_buildroot_all(buildroot: str, devel: bool, add_star: bool) -> list[set[str]]:
|
||||
"""Find all files and directories in the buildroot and optionally
|
||||
categorize them as 'main' or 'devel'.
|
||||
|
||||
:param Namespace args: parsed command line arguments
|
||||
:param bool devel: True to split into 'main' and 'devel', False otherwise
|
||||
:param bool add_star: True to add a star to man page filenames
|
||||
:return: a list of files and directories, in this order: main files,
|
||||
main directories, devel files, and devel directories
|
||||
"""
|
||||
bfiles: list[set[str]] = [set(), set(), set()]
|
||||
bdirs: set[str] = set()
|
||||
for path, dirs, files in os.walk(buildroot):
|
||||
for d in dirs:
|
||||
realdir = os.path.join(path, d)[len(buildroot):]
|
||||
if realdir not in root_dirs and not realdir.startswith('/usr/share/man'):
|
||||
bdirs.add(realdir)
|
||||
for f in files:
|
||||
realfile = os.path.join(path, f)[len(buildroot):]
|
||||
if devel and is_devel_file(os.path.basename(realfile)):
|
||||
bfiles[2].add(realfile)
|
||||
else:
|
||||
if add_star and realfile.startswith('/usr/share/man'):
|
||||
bfiles[0].add(realfile + '*')
|
||||
else:
|
||||
bfiles[0].add(realfile)
|
||||
parentdir = os.path.dirname(realfile)
|
||||
if parentdir in bdirs:
|
||||
bfiles[1].add(parentdir)
|
||||
bdirs.remove(parentdir)
|
||||
# Catch intermediate directories, as in ocaml-mtime
|
||||
parentdir = os.path.dirname(parentdir)
|
||||
if parentdir in bdirs:
|
||||
bfiles[1].add(parentdir)
|
||||
bdirs.remove(parentdir)
|
||||
bfiles.append(bdirs)
|
||||
return bfiles
|
||||
|
||||
#
|
||||
# INSTALL FILE LEXER AND PARSER
|
||||
#
|
||||
|
||||
class TokenType(Enum):
|
||||
"""The types of tokens that can appear in an opam *.install file."""
|
||||
ERROR = auto()
|
||||
COLON = auto()
|
||||
LBRACE = auto()
|
||||
RBRACE = auto()
|
||||
LBRACK = auto()
|
||||
RBRACK = auto()
|
||||
STRING = auto()
|
||||
FIELD = auto()
|
||||
|
||||
@final
|
||||
class InstallFileLexer(Iterator[tuple[TokenType, str]]):
|
||||
"""Convert an opam *.install file into a sequence of tokens."""
|
||||
__slots__ = ['index', 'text']
|
||||
|
||||
def __init__(self, filname: str) -> None:
|
||||
"""Create an opam *.install file lexer.
|
||||
|
||||
:param str filname: the name of the file to read from
|
||||
"""
|
||||
self.index = 0
|
||||
with open(filname, 'r') as f:
|
||||
# Limit reads to 4 MB in case this file is bogus.
|
||||
# Most install files are under 4K.
|
||||
self.text = f.read(4194304)
|
||||
|
||||
def skip_whitespace(self) -> None:
|
||||
"""Skip over whitespace in the input."""
|
||||
while self.index < len(self.text) and \
|
||||
(self.text[self.index] == '#' or
|
||||
self.text[self.index] in string.whitespace):
|
||||
if self.text[self.index] == '#':
|
||||
while (self.index < len(self.text) and
|
||||
self.text[self.index] != '\n' and
|
||||
self.text[self.index] != '\r'):
|
||||
self.index += 1
|
||||
else:
|
||||
self.index += 1
|
||||
|
||||
def __next__(self) -> tuple[TokenType, str]:
|
||||
"""Get the next token from the opam *.install file.
|
||||
|
||||
:return: a pair containing the type and text of the next token
|
||||
"""
|
||||
self.skip_whitespace()
|
||||
if self.index < len(self.text):
|
||||
ch = self.text[self.index]
|
||||
if ch == ':':
|
||||
self.index += 1
|
||||
return (TokenType.COLON, ch)
|
||||
if ch == '{':
|
||||
self.index += 1
|
||||
return (TokenType.LBRACE, ch)
|
||||
if ch == '}':
|
||||
self.index += 1
|
||||
return (TokenType.RBRACE, ch)
|
||||
if ch == '[':
|
||||
self.index += 1
|
||||
return (TokenType.LBRACK, ch)
|
||||
if ch == ']':
|
||||
self.index += 1
|
||||
return (TokenType.RBRACK, ch)
|
||||
if ch == '"':
|
||||
start = self.index + 1
|
||||
end = start
|
||||
while end < len(self.text) and self.text[end] != '"':
|
||||
end += 2 if self.text[end] == '\\' else 1
|
||||
self.index = end + 1
|
||||
return (TokenType.STRING, self.text[start:end])
|
||||
if ch in string.ascii_letters:
|
||||
start = self.index
|
||||
end = start + 1
|
||||
while (end < len(self.text) and
|
||||
(self.text[end] == '_' or
|
||||
self.text[end] in string.ascii_letters)):
|
||||
end += 1
|
||||
self.index = end
|
||||
return (TokenType.FIELD, self.text[start:end])
|
||||
return (TokenType.ERROR, ch)
|
||||
else:
|
||||
raise StopIteration
|
||||
|
||||
@final
|
||||
class InstallFileParser(Iterable[tuple[str, bool, str, str]]):
|
||||
"""Parse opam *.install files."""
|
||||
|
||||
__slots__ = ['pkgname', 'lexer', 'libdir']
|
||||
|
||||
def __init__(self, filname: str, libdir: str) -> None:
|
||||
"""Initialize an OCaml .install file parser.
|
||||
|
||||
:param str filname: name of the .install file to parse
|
||||
:param str libdir: the OCaml library directory
|
||||
"""
|
||||
self.pkgname = os.path.splitext(os.path.basename(filname))[0]
|
||||
self.lexer = InstallFileLexer(filname)
|
||||
self.libdir = libdir
|
||||
|
||||
def __iter__(self) -> Iterator[tuple[str, bool, str, str]]:
|
||||
"""Parse a .install file.
|
||||
If there are any parse errors, we assume this file is not really an
|
||||
opam .install file and abandon the parse.
|
||||
"""
|
||||
# Map opam installer names to directories
|
||||
opammap: dict[str, str] = {
|
||||
'lib': os.path.join(self.libdir, self.pkgname),
|
||||
'lib_root': self.libdir,
|
||||
'libexec': os.path.join(self.libdir, self.pkgname),
|
||||
'libexec_root': self.libdir,
|
||||
'bin': '/usr/bin',
|
||||
'sbin': '/usr/sbin',
|
||||
'toplevel': os.path.join(self.libdir, 'toplevel'),
|
||||
'share': os.path.join('/usr/share', self.pkgname),
|
||||
'share_root': '/usr/share',
|
||||
'etc': os.path.join('/etc', self.pkgname),
|
||||
'doc': os.path.join('/usr/doc', self.pkgname),
|
||||
'stublibs': os.path.join(self.libdir, 'stublibs'),
|
||||
'man': '/usr/share/man'
|
||||
}
|
||||
|
||||
# Parse the file
|
||||
try:
|
||||
toktyp, token = next(self.lexer)
|
||||
while toktyp == TokenType.FIELD:
|
||||
libname = token
|
||||
toktyp, token = next(self.lexer)
|
||||
if toktyp != TokenType.COLON:
|
||||
return
|
||||
|
||||
toktyp, token = next(self.lexer)
|
||||
if toktyp != TokenType.LBRACK:
|
||||
return
|
||||
|
||||
directory = opammap.get(libname)
|
||||
if not directory:
|
||||
return
|
||||
|
||||
toktyp, token = next(self.lexer)
|
||||
while toktyp == TokenType.STRING:
|
||||
source = token
|
||||
optional = source[0] == '?'
|
||||
if optional:
|
||||
source = source[1:]
|
||||
nexttp, nexttk = next(self.lexer)
|
||||
if nexttp == TokenType.LBRACE:
|
||||
nexttp, nexttk = next(self.lexer)
|
||||
if nexttp == TokenType.STRING:
|
||||
filname = os.path.join(directory, nexttk)
|
||||
bracetp, bractk = next(self.lexer)
|
||||
if bracetp != TokenType.RBRACE:
|
||||
return
|
||||
nexttp, nexttk = next(self.lexer)
|
||||
else:
|
||||
return
|
||||
elif libname == 'man':
|
||||
index = token.rfind('.')
|
||||
if index < 0:
|
||||
return
|
||||
mandir = os.path.join(directory, 'man' + token[index+1:])
|
||||
filname = os.path.join(mandir, os.path.basename(token))
|
||||
else:
|
||||
filname = os.path.join(directory, os.path.basename(token))
|
||||
toktyp, token = nexttp, nexttk
|
||||
yield (self.pkgname, optional, source, filname)
|
||||
|
||||
if toktyp != TokenType.RBRACK:
|
||||
return
|
||||
toktyp, token = next(self.lexer)
|
||||
except StopIteration:
|
||||
return
|
||||
|
||||
def install_files(buildroot: str, libdir: str) -> None:
|
||||
"""Install the files listed in opam .install files in the buildroot.
|
||||
|
||||
For some projects, there are install files in both the project root
|
||||
directory and somewhere under "_build", so be careful not to parse the same
|
||||
install file twice.
|
||||
|
||||
:param str buildroot: path to the buildroot
|
||||
:param str libdir: the OCaml library directory
|
||||
"""
|
||||
install_files = set()
|
||||
for path, dirs, files in os.walk('.'):
|
||||
for f in files:
|
||||
if f.endswith('.install') and f not in install_files:
|
||||
install_files.add(f)
|
||||
parser = InstallFileParser(os.path.join(path, f), libdir)
|
||||
for _, optional, source, filname in parser:
|
||||
if not optional or os.path.exists(source):
|
||||
installpath = os.path.join(buildroot, filname[1:])
|
||||
os.makedirs(os.path.dirname(installpath), exist_ok=True)
|
||||
shutil.copy2(source, installpath)
|
||||
|
||||
def get_package_map(buildroot: str, libdir: str, devel: bool) -> dict[str, set[str]]:
|
||||
"""Create a map from package names to installed files from the opam .install
|
||||
files in the buildroot.
|
||||
|
||||
For some projects, there are install files in both the project root
|
||||
directory and somewhere under "_build", so be careful not to parse the same
|
||||
install file twice."""
|
||||
|
||||
pmap: dict[str, set[str]] = dict()
|
||||
install_files = set()
|
||||
|
||||
def add_pkg(pkgname: str, filname: str) -> None:
|
||||
"""Add a mapping from a package name to a filename.
|
||||
|
||||
:param str pkgname: the package that acts as the map key
|
||||
:param str filname: the filename to add to the package set
|
||||
"""
|
||||
if pkgname not in pmap:
|
||||
pmap[pkgname] = set()
|
||||
pmap[pkgname].add(filname)
|
||||
|
||||
installed = find_buildroot_all(buildroot, devel, False)
|
||||
for path, dirs, files in os.walk('.'):
|
||||
for f in files:
|
||||
if f.endswith('.install') and f not in install_files:
|
||||
install_files.add(f)
|
||||
parser = InstallFileParser(os.path.join(path, f), libdir)
|
||||
for pkgname, _, _, filname in parser:
|
||||
if filname in installed[0]:
|
||||
if filname.startswith('/usr/share/man'):
|
||||
add_pkg(pkgname, filname + '*')
|
||||
else:
|
||||
add_pkg(pkgname, filname)
|
||||
dirname = os.path.dirname(filname)
|
||||
if dirname in installed[1]:
|
||||
add_pkg(pkgname, '%dir ' + dirname)
|
||||
installed[1].remove(dirname)
|
||||
elif filname in installed[2]:
|
||||
if filname.startswith('/usr/share/man'):
|
||||
add_pkg(pkgname + '-devel', filname + '*')
|
||||
else:
|
||||
add_pkg(pkgname + '-devel', filname)
|
||||
dirname = os.path.dirname(filname)
|
||||
if dirname in installed[3]:
|
||||
add_pkg(pkgname + '-devel', '%dir ' + dirname)
|
||||
installed[3].remove(dirname)
|
||||
return pmap
|
||||
|
||||
#
|
||||
# MAIN INTERFACE
|
||||
#
|
||||
|
||||
def ocaml_files(no_devel: bool, separate: bool, install: bool, buildroot: str,
|
||||
libdir: str) -> None:
|
||||
"""Generate %files lists from an installed buildroot.
|
||||
|
||||
:param bool no_devel: False to split files into a main package and a devel
|
||||
package
|
||||
:param bool separate: True to place each OCaml module in an RPM package
|
||||
:param bool install: True to install files, False to generate %files
|
||||
:param str buildroot: the installed buildroot
|
||||
:param str libdir: the OCaml library directory
|
||||
"""
|
||||
if install:
|
||||
install_files(buildroot, libdir)
|
||||
elif separate:
|
||||
pkgmap = get_package_map(buildroot, libdir, not no_devel)
|
||||
for pkg in pkgmap:
|
||||
with open('.ofiles-' + pkg, 'w') as f:
|
||||
for entry in pkgmap[pkg]:
|
||||
f.write(entry + '\n')
|
||||
elif no_devel:
|
||||
with open('.ofiles', 'w') as f:
|
||||
for entry in find_buildroot_toplevel(buildroot):
|
||||
f.write(entry + '\n')
|
||||
else:
|
||||
files = find_buildroot_all(buildroot, True, True)
|
||||
with open('.ofiles', 'w') as f:
|
||||
for entry in files[0]:
|
||||
f.write(entry + '\n')
|
||||
for entry in files[1]:
|
||||
f.write('%dir ' + entry + '\n')
|
||||
with open('.ofiles-devel', 'w') as f:
|
||||
for entry in files[2]:
|
||||
f.write(entry + '\n')
|
||||
for entry in files[3]:
|
||||
f.write('%dir ' + entry + '\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Support for building OCaml RPM packages')
|
||||
parser.add_argument('-i', '--install',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='install files instead of generating %files')
|
||||
parser.add_argument('-n', '--no-devel',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='suppress creation of a devel subpackage')
|
||||
parser.add_argument('-s', '--separate',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='separate packaging. Each OCaml module is in a distinct RPM package. All modules are in a single RPM package by default.')
|
||||
parser.add_argument('-v', '--version',
|
||||
action='version',
|
||||
version=f'%(prog)s {str(version)}')
|
||||
parser.add_argument('buildroot', help='RPM build root')
|
||||
parser.add_argument('libdir', help='OCaml library directory')
|
||||
args = parser.parse_args()
|
||||
ocaml_files(args.no_devel,
|
||||
args.separate,
|
||||
args.install,
|
||||
args.buildroot,
|
||||
args.libdir)
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (ocaml-5.0.0.tar.gz) = c0cd445bdc2de5d45aae9aea78aab116807cc6782efbcb624a5843e2c0821ccb1e307cc23724f9636918495305cadc75abf04395cd9ede28597774ab60948167
|
||||
SHA512 (ocaml-5.1.0.tar.gz) = 814ea71de656eadc59a658ad3b6c4d786815c348ab883b1cdb22d5d0f99d11768f5646f03725f6b44c3b8f4ffeb71e89dadaea157711a7afbe86f23846fc5b52
|
||||
|
Loading…
Reference in New Issue
Block a user