Diff ocaml-4.09.0-r3 with a ocaml-4.05.0-r9

/usr/portage/dev-lang/ocaml/ocaml-4.05.0-r9.ebuild 2023-10-09 14:52:29.468368350 +0300
3 3

  
4 4
EAPI=7
5 5

  
6
inherit flag-o-matic
6
inherit flag-o-matic toolchain-funcs
7 7

  
8
DESCRIPTION="Programming language supporting functional, imperative & object-oriented styles"
9
HOMEPAGE="https://ocaml.org/"
10
SRC_URI="https://github.com/ocaml/ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz
8
PATCHLEVEL="9"
9
MY_P="${P/_/-}"
10
DESCRIPTION="Type-inferring functional programming language descended from the ML family"
11
HOMEPAGE="https://ocaml.org"
12
SRC_URI="https://github.com/ocaml/ocaml/archive/${PV/_/+}.tar.gz -> ${MY_P}.tar.gz
13
	mirror://gentoo/${PN}-patches-${PATCHLEVEL}.tar.bz2
11 14
	https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-patches-1.tar.bz2"
12 15

  
13
LICENSE="LGPL-2.1"
16
LICENSE="QPL-1.0 LGPL-2"
17
# Everytime ocaml is updated to a new version, everything ocaml must be rebuilt,
18
# so here we go with the subslot.
14 19
SLOT="0/$(ver_cut 1-2)"
15 20
KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos"
16
IUSE="emacs flambda latex +ocamlopt spacetime xemacs"
21
IUSE="emacs flambda latex ncurses +ocamlopt spacetime X xemacs"
17 22

  
18
RDEPEND="sys-libs/binutils-libs:=
19
	spacetime? ( sys-libs/libunwind:= )"
23
RDEPEND="
24
	sys-libs/binutils-libs:=
25
	ncurses? ( sys-libs/ncurses:0= )
26
	spacetime? ( sys-libs/libunwind:= )
27
	X? ( x11-libs/libX11 )
28
	!dev-ml/num"
20 29
BDEPEND="${RDEPEND}
21 30
	virtual/pkgconfig"
22 31
PDEPEND="emacs? ( app-emacs/ocaml-mode )
23 32
	xemacs? ( app-xemacs/ocaml )"
24 33

  
25
QA_FLAGS_IGNORED='usr/lib.*/ocaml/bigarray.cmxs'
34
QA_FLAGS_IGNORED='usr/lib.*/ocaml/raw_spacetime_lib.cmxs'
35

  
36
S="${WORKDIR}/${MY_P}"
26 37

  
27 38
PATCHES=(
39
	"${FILESDIR}"/${PN}-4.04.2-tinfo.patch #459512
28 40
	"${WORKDIR}"/${P}-patches-1/
29 41
)
30 42

  
43
pkg_setup() {
44
	# dev-lang/ocaml creates its own objects but calls gcc for linking, which will
45
	# results in relocations if gcc wants to create a PIE executable
46
	if gcc-specs-pie ; then
47
		append-ldflags -nopie
48
		ewarn "Ocaml generates its own native asm, you're using a PIE compiler"
49
		ewarn "We have appended -nopie to ocaml build options"
50
		ewarn "because linking an executable with pie while the objects are not pic will not work"
51
	fi
52
}
53

  
31 54
src_prepare() {
32
	default
55
	EPATCH_SUFFIX="patch" eapply "${WORKDIR}/patches"
33 56

  
34 57
	cp "${FILESDIR}"/ocaml.conf "${T}" || die
35 58

  
59
	default
60
}
61

  
62
src_configure() {
63
	export LC_ALL=C
64
	local myconf=""
65

  
66
	# Causes build failures because it builds some programs with -pg,
67
	# bug #270920
68
	filter-flags -fomit-frame-pointer
69
	# Bug #285993
70
	filter-mfpmath sse
71

  
36 72
	# Broken until 4.12
37 73
	# bug #818445
38 74
	filter-lto
39 75
	append-flags -fno-strict-aliasing
40 76

  
77
	# -ggdb3 & co makes it behave weirdly, breaks sexplib
78
	replace-flags -ggdb* -ggdb
79

  
41 80
	# OCaml generates textrels on 32-bit arches
42 81
	# We can't do anything about it, but disabling it means that tests
43 82
	# for OCaml-based packages won't fail on unexpected output
......
46 85
		append-ldflags "-Wl,-z,notext"
47 86
	fi
48 87

  
49
	# Upstream build ignores LDFLAGS in several places.
50
	sed -i -e 's/\(^MKDLL=.*\)/\1 $(LDFLAGS)/' \
51
		-e 's/\(^OC_CFLAGS=.*\)/\1 $(LDFLAGS)/' \
52
		-e 's/\(^OC_LDFLAGS=.*\)/\1 $(LDFLAGS)/' \
53
		Makefile.config.in || die "LDFLAGS fix failed"
54
	# ${P} overrides upstream build's own P due to a wrong assignment operator.
55
	sed -i -e 's/^P ?=/P =/' stdlib/StdlibModules || die "P fix failed"
56
}
88
	# It doesn't compile on alpha without this LDFLAGS
89
	use alpha && append-ldflags "-Wl,--no-relax"
57 90

  
58
src_configure() {
59
	local opt=(
60
		--bindir="${EPREFIX}/usr/bin"
61
		--libdir="${EPREFIX}/usr/$(get_libdir)/ocaml"
62
		--mandir="${EPREFIX}/usr/share/man"
63
		--prefix="${EPREFIX}/usr"
64
		$(use_enable flambda)
65
		$(use_enable spacetime)
66
	)
91
	use ncurses || myconf="${myconf} -no-curses"
92
	use X || myconf="${myconf} -no-graph"
93
	use flambda && myconf="${myconf} -flambda"
94
	use spacetime && myconf="${myconf} -spacetime"
95

  
96
	# ocaml uses a home-brewn configure script, preventing it to use econf.
97
	RAW_LDFLAGS="$(raw-ldflags)" ./configure \
98
		--prefix "${EPREFIX}"/usr \
99
		--bindir "${EPREFIX}"/usr/bin \
100
		--target-bindir "${EPREFIX}"/usr/bin \
101
		--libdir "${EPREFIX}"/usr/$(get_libdir)/ocaml \
102
		--mandir "${EPREFIX}"/usr/share/man \
103
		-target "${CHOST}" \
104
		-host "${CBUILD}" \
105
		-cc "$(tc-getCC)" \
106
		-as "$(tc-getAS)" \
107
		-aspp "$(tc-getCC) -c" \
108
		-partialld "$(tc-getLD) -r" \
109
		--with-pthread ${myconf} || die "configure failed!"
67 110

  
68
	econf "${opt[@]}"
111
	# http://caml.inria.fr/mantis/view.php?id=4698
112
	export CCLINKFLAGS="${LDFLAGS}"
69 113
}
70 114

  
71 115
src_compile() {
116
	emake world
117

  
118
	# Native code generation can be disabled now
72 119
	if use ocamlopt ; then
73
		emake world.opt
74
	else
75
		emake world
120
		# bug #279968
121
		emake opt
122
		emake -j1 opt.opt
76 123
	fi
77 124
}
78 125

  
79 126
src_test() {
80 127
	if use ocamlopt ; then
81
		# OCaml tests only work when run sequentially
82
		emake -j1 -C testsuite all
128
		emake -j1 tests
83 129
	else
84 130
		ewarn "${PN} was built without 'ocamlopt' USE flag; skipping tests."
85 131
	fi
86 132
}
87 133

  
88 134
src_install() {
89
	default
135
	emake BINDIR="${ED}"/usr/bin \
136
		LIBDIR="${ED}"/usr/$(get_libdir)/ocaml \
137
		MANDIR="${ED}"/usr/share/man \
138
		install
139

  
140
	# Symlink the headers to the right place
90 141
	dodir /usr/include
91 142
	# Create symlink for header files
92 143
	dosym "../$(get_libdir)/ocaml/caml" /usr/include/caml
Thank you!