Skip to content
Snippets Groups Projects
Commit 61c2c853 authored by omni's avatar omni Committed by Leo
Browse files

community/ocaml: upgrade to 4.12.0 & add archs

- ./Changes: #2289 deprecated lib
- remove unused patches
- generalize arm*linux* targets to include musl
- disable DT_TEXTREL warnings on i386 to pass the one failing test
- VERSION file removed upstream, #9895, #9523
- target all archs but mips64

fixes #11621
parent ae3083a5
No related branches found
No related tags found
1 merge request!18213community/ocaml: upgrade to 4.12.0 & add archs
# Contributor: Borys Zhukov <mp5@mp5.im>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer:
# Maintainer: omni <omni+alpine@hack.org>
pkgname=ocaml
pkgver=4.08.1
pkgrel=5
pkgver=4.12.0
pkgrel=0
pkgdesc="Main implementation of the Caml programming language"
url="http://ocaml.org/"
arch="all !x86 !armhf !armv7 !mips !mips64"
url="https://ocaml.org/"
arch="all !mips64" # "native-code compiler is not supported" on mips64
license="LGPL-2.1-or-later-WITH-linking-exception"
depends="$pkgname-runtime=$pkgver-r$pkgrel gcc"
makedepends="gdbm-dev libc-dev ncurses-dev zlib-dev binutils-dev"
[ "$CARCH" = "x86_64" ] || options="textrels"
subpackages="
$pkgname-doc
$pkgname-dev
......@@ -18,17 +17,16 @@ subpackages="
$pkgname-compiler-libs:_compiler_libs
$pkgname-runtime
"
source="http://caml.inria.fr/pub/distrib/ocaml-${pkgver%.*}/$pkgname-$pkgver.tar.gz
compile-without-debug-info.patch
fix-mcontext-fields.patch
fix-segfault-in-ppc64le.patch
fix-check-parser-uptodate-or-warn.sh.patch
fix-fnocommon-duplicate-definition.patch
source="https://caml.inria.fr/pub/distrib/ocaml-${pkgver%.*}/ocaml-$pkgver.tar.gz
fix-configure-musl.patch
"
builddir="$srcdir/$pkgname-$pkgver"
# 32bit archs
case "$CARCH" in
armv7|armhf|mips|x86) options="$options textrels" ;;
esac
build() {
cd "$builddir"
./configure \
--prefix /usr \
--bindir /usr/bin \
......@@ -41,15 +39,12 @@ build() {
}
check() {
cd "$builddir"
# FIXME: there seem to be some spurious failures, ignore until fixed.
make -C testsuite all || true
make ocamlopt
make ocamltest
make tests
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
......@@ -101,10 +96,7 @@ runtime() {
'*.cmo' \
'*.cmi' \
'*.cma' \
'VERSION' \
'stublibs' \
'vmthreads/*.cmi' \
'vmthreads/*.cma' \
'threads/*.cmi' \
'threads/*.cma'
do
......@@ -119,9 +111,5 @@ _submv() {
rmdir -p "$pkgdir"/${path%/*} 2>/dev/null || true
}
sha512sums="8239c1879926e59c3d9611ad0d97618ce21b0528f1bd59db3df9c24287ad180ffa74f34e52e1fab39e71cbf8113a9a4ee5037cc33ae64ca6a9a109fe4ada0256 ocaml-4.08.1.tar.gz
49cbd6df3a70d00df33d34ab4508dd04d52cbc94efc6c8cac8668758e7346be3c7acedf5b8af38a0adb18c69b8d0859667b12cc11699002c048af962cf283ad2 compile-without-debug-info.patch
e853f609006bd2514bbf63cf9215150496ec62ceee3e55f6f719b19453c97251ad935245578528fab798e626dab5a6c4e2fd5fb652f99ddd5cfd261ac0c4c9bb fix-mcontext-fields.patch
e65b647427d9c94933d5be97857daf8cdc65e25c10066740dbcbab7a4e6f8ddb2277ee7d5796abf5916e5bdd59b057de736190432c480fc8ff2a4b2a94d46eca fix-segfault-in-ppc64le.patch
b3362906c23ecdb084db7dbf18cae22f0a54ba968f1ecf9c8d13c230ca221b3f77fa820a52e091ce7b71b1cb4a91faf1346692aa6fa411bb46fca784500def25 fix-check-parser-uptodate-or-warn.sh.patch
22b6aba45bba33707f1effc2c0690b2ffa1c3c00fb8fab896d99ab80da704a424b705d5a51cd01471c3caba8ad47a58aac72a6eec0adcf1ff594fbbabd4d194f fix-fnocommon-duplicate-definition.patch"
sha512sums="7c9e4ebe9c6e3f04eca9b837b70f3dcfda7d81d033f4fb6d0c507cd40c82115c0dde0907444f60c406a301fafe1a48d0bca01ee6af192fd08458d3b1bee7f717 ocaml-4.12.0.tar.gz
444092ae137e290d459656dc56b36397572508e2dc59684446fb65ef37e467fc8ccb06e9d1f344cdb595854ffed0b8060dc969bfa477a26c297fee4a67727dda fix-configure-musl.patch"
Significantly decrease size of bytecode-compiled binaries (and slightly
even natives).
--- a/Makefile
+++ b/Makefile
@@ -44,8 +44,8 @@
CAMLRUN ?= boot/ocamlrun
include stdlib/StdlibModules
-CAMLC=$(CAMLRUN) boot/ocamlc -g -nostdlib -I boot -use-prims runtime/primitives
-CAMLOPT=$(CAMLRUN) ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink
+CAMLC=$(CAMLRUN) boot/ocamlc -nostdlib -I boot -use-prims runtime/primitives
+CAMLOPT=$(CAMLRUN) ./ocamlopt -nostdlib -I stdlib -I otherlibs/dynlink
ARCHES=amd64 i386 arm arm64 power s390x
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I middle_end \
-I middle_end/base_types -I asmcomp -I asmcomp/debug \
--- a/tools/check-parser-uptodate-or-warn.sh 2019-06-14 08:21:51.000000000 -0300
+++ b/tools/check-parser-uptodate-or-warn.sh 2019-07-16 14:56:27.352376332 -0300
@@ -43,8 +43,8 @@
}
# The check itself
-SOURCE_MTIME=$(mtime parsing/parser.mly)
-GENERATED_MTIME=$(mtime boot/menhir/parser.ml)
+SOURCE_MTIME=$(mtime "$builddir"/parsing/parser.mly)
+GENERATED_MTIME=$(mtime "$builddir"/boot/menhir/parser.ml)
if test $SOURCE_MTIME -gt $(( $GENERATED_MTIME + 10 ))
then
echo
--- a/configure 2021-02-24 13:49:29.000000000 +0000
+++ b/configure 2021-02-25 17:08:37.549751090 +0000
@@ -13878,19 +13878,19 @@ else
fi; system=elf ;; #(
s390x*-*-linux*) :
arch=s390x; model=z10; system=elf ;; #(
- armv6*-*-linux-gnueabihf) :
+ armv6*-*-linux-*eabihf) :
arch=arm; model=armv6; system=linux_eabihf ;; #(
- armv7*-*-linux-gnueabihf) :
+ armv7*-*-linux-*eabihf) :
arch=arm; model=armv7; system=linux_eabihf ;; #(
- armv8*-*-linux-gnueabihf) :
+ armv8*-*-linux-*eabihf) :
arch=arm; model=armv8; system=linux_eabihf ;; #(
- armv8*-*-linux-gnueabi) :
+ armv8*-*-linux-*eabi) :
arch=arm; model=armv8; system=linux_eabi ;; #(
- armv7*-*-linux-gnueabi) :
+ armv7*-*-linux-*eabi) :
arch=arm; model=armv7; system=linux_eabi ;; #(
- armv6t2*-*-linux-gnueabi) :
+ armv6t2*-*-linux-*eabi) :
arch=arm; model=armv6t2; system=linux_eabi ;; #(
- armv6*-*-linux-gnueabi) :
+ armv6*-*-linux-*eabi) :
arch=arm; model=armv6; system=linux_eabi ;; #(
armv6*-*-freebsd*) :
arch=arm; model=armv6; system=freebsd ;; #(
@@ -13898,13 +13898,13 @@ fi; system=elf ;; #(
arch=arm; model=armv6; system=netbsd ;; #(
earmv7*-*-netbsd*) :
arch=arm; model=armv7; system=netbsd ;; #(
- armv5te*-*-linux-gnueabi) :
+ armv5te*-*-linux-*eabi) :
arch=arm; model=armv5te; system=linux_eabi ;; #(
- armv5*-*-linux-gnueabi) :
+ armv5*-*-linux-*eabi) :
arch=arm; model=armv5; system=linux_eabi ;; #(
- arm*-*-linux-gnueabihf) :
+ arm*-*-linux-*eabihf) :
arch=arm; system=linux_eabihf ;; #(
- arm*-*-linux-gnueabi) :
+ arm*-*-linux-*eabi) :
arch=arm; system=linux_eabi ;; #(
arm*-*-openbsd*) :
arch=arm; system=bsd ;; #(
@@ -14100,16 +14100,22 @@ fi
# e.g. Ubuntu >= 17.10 for i386, which uses the glibc dynamic loader.
case $arch in #(
- amd64|s390x|none) :
+ amd64|aarch64|s390x|none) :
# ocamlopt generates PIC code or doesn't generate code at all
- ;; #(
+ ;; #(
*) :
- case $host in #(
- *-linux-musl) :
- # Alpine and other musl-based Linux distributions
- common_cflags="-no-pie $common_cflags" ;; #(
- *) :
- ;;
+ case $host in #(
+ i?86-*-linux-musl*) :
+ # Alpine and other musl-based Linux distributions, 32bit x86,
+ # disable DT_TEXTREL, see https://github.com/ocaml/ocaml/issues/9800
+ common_cflags="-Wl,-z,notext -no-pie $common_cflags"
+ mksharedlib="$mksharedlib -Wl,-z,notext"
+ mkmaindll="$mkmaindll -Wl,-z,notext";; #(
+ *-linux-musl*) :
+ # Alpine and other musl-based Linux distributions
+ common_cflags="-no-pie $common_cflags" ;; #(
+ *) :
+ ;;
esac ;;
esac
Reason: gcc-10 defaults to -fno-common, which results in errors when
global variables are defined multiple times.
Upstream: no
diff --git a/runtime/backtrace.c b/runtime/backtrace.c
index a3c2c08..0a3ea33 100644
--- a/runtime/backtrace.c
+++ b/runtime/backtrace.c
@@ -28,7 +28,7 @@
#include "caml/fail.h"
/* The table of debug information fragments */
-struct ext_table caml_debug_info;
+extern struct ext_table caml_debug_info;
CAMLexport int32_t caml_backtrace_active = 0;
CAMLexport int32_t caml_backtrace_pos = 0;
diff --git a/runtime/startup_nat.c b/runtime/startup_nat.c
index 43b85e3..a5479de 100644
--- a/runtime/startup_nat.c
+++ b/runtime/startup_nat.c
@@ -44,7 +44,7 @@
#endif
extern int caml_parser_trace;
-CAMLexport header_t caml_atom_table[256];
+CAMLextern header_t caml_atom_table[256];
char * caml_code_area_start, * caml_code_area_end;
struct ext_table caml_code_fragments_table;
diff -Nru a/runtime/signals_osdep.h b/runtime/signals_osdep.h
--- a/runtime/signals_osdep.h 2019-06-14 08:21:51.000000000 -0300
+++ b/runtime/signals_osdep.h 2019-07-16 14:21:56.751434439 -0300
@@ -297,11 +297,19 @@
sigact.sa_flags = 0
typedef unsigned long context_reg;
- #define CONTEXT_PC (context->regs->nip)
- #define CONTEXT_EXCEPTION_POINTER (context->regs->gpr[29])
- #define CONTEXT_YOUNG_LIMIT (context->regs->gpr[30])
- #define CONTEXT_YOUNG_PTR (context->regs->gpr[31])
- #define CONTEXT_SP (context->regs->gpr[1])
+ #ifdef __powerpc64__
+ #define CONTEXT_PC (context->gp_regs[32])
+ #define CONTEXT_EXCEPTION_POINTER (context->gp_regs[29])
+ #define CONTEXT_YOUNG_LIMIT (context->gp_regs[30])
+ #define CONTEXT_YOUNG_PTR (context->gp_regs[31])
+ #define CONTEXT_SP (context->gp_regs[1])
+ #else
+ #define CONTEXT_PC (context->regs->nip)
+ #define CONTEXT_EXCEPTION_POINTER (context->regs->gpr[29])
+ #define CONTEXT_YOUNG_LIMIT (context->regs->gpr[30])
+ #define CONTEXT_YOUNG_PTR (context->regs->gpr[31])
+ #define CONTEXT_SP (context->regs->gpr[1])
+ #endif
/****************** PowerPC, NetBSD */
Compile ocaml natives with -no-pie flag as a workaround for some problem
with dynamic loader.
ocaml builds fine on ppc64le, but when I try to use ocamlc, I'm getting
a segfault.
Gdb backtrace shows:
#0 0x00003fffb7fad710 in do_relocs (dso=0x3fffb7ff26a0 <app>, rel=0x200ab4b8, rel_size=2495088,
stride=3) at ldso/dynlink.c:379
#1 0x00003fffb7fae1ec in reloc_all (p=0x3fffb7ff26a0 <app>) at ldso/dynlink.c:1195
#2 0x00003fffb7fafc94 in __dls3 (sp=<optimized out>) at ldso/dynlink.c:1638
0000003 0x00003fffb7faf3d4 in __dls2 (base=<optimized out>, sp=0x3ffffffffba0) at ldso/dynlink.c:1424
0000004 0x00003fffb7facd2c in _dlstart_c (sp=<optimized out>, dynv=<optimized out>)
at ldso/dlstart.c:147
0000005 0x00003fffb7fb1104 in _dlstart () from /lib/ld-musl-powerpc64le.so.1
Upstream-Issue: https://caml.inria.fr/mantis/view.php?id=7562.
--- a/configure
+++ b/configure
@@ -13334,6 +13334,9 @@
sharedlib_cflags="-fPIC"
mksharedlib="$CC -shared"
oc_ldflags="$oc_ldflags -Wl,-E"
+ case "$target" in
+ powerpc64le*) ldflags="$ldflags -no-pie"
+ esac
rpath="-Wl,-rpath,"
mksharedlibrpath="-Wl,-rpath,"
natdynlinkopts="-Wl,-E"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment