| 1 |
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
|
EAPI=8
|
|
4 |
EAPI=9
|
| 5 |
5 |
|
| 6 |
6 |
inherit multiprocessing elisp-common
|
| 7 |
7 |
|
| ... | ... | |
| 11 |
11 |
|
| 12 |
12 |
LICENSE="MIT"
|
| 13 |
13 |
SLOT="0/${PV}"
|
| 14 |
|
KEYWORDS="amd64 arm arm64 ~ppc ppc64 ~riscv x86"
|
| 15 |
|
IUSE="emacs"
|
| 16 |
|
RESTRICT="strip test"
|
|
14 |
KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64"
|
|
15 |
IUSE="emacs test"
|
|
16 |
RESTRICT="strip !test? ( test )"
|
| 17 |
17 |
|
| 18 |
18 |
RDEPEND="
|
| 19 |
19 |
dev-lang/ocaml:=
|
| 20 |
20 |
emacs? ( >=app-editors/emacs-23.1:* )
|
| 21 |
21 |
"
|
| 22 |
22 |
DEPEND="${RDEPEND}"
|
|
23 |
BDEPEND="
|
|
24 |
test? (
|
|
25 |
app-misc/jq
|
|
26 |
dev-debug/strace
|
|
27 |
>=dev-lang/ocaml-5.4.0
|
|
28 |
dev-ml/csexp
|
|
29 |
dev-ml/lwt
|
|
30 |
dev-ml/pp
|
|
31 |
dev-ml/ppx_expect
|
|
32 |
dev-ml/re
|
|
33 |
dev-ml/spawn
|
|
34 |
dev-ml/uutf
|
|
35 |
dev-vcs/git
|
|
36 |
)
|
|
37 |
"
|
| 23 |
38 |
|
| 24 |
39 |
QA_FLAGS_IGNORED="usr/bin/dune"
|
| 25 |
40 |
|
| ... | ... | |
| 32 |
47 |
# This allows `dune --version` to output the correct version
|
| 33 |
48 |
# instead of "n/a"
|
| 34 |
49 |
sed -i "/^(name dune)/a (version ${PV})" dune-project || die
|
|
50 |
|
|
51 |
# the dune-project file for dune includes generating .opam files,
|
|
52 |
# but they differ from the committed versions in that they include a
|
|
53 |
# version entry. Supposedly "dune promote" should be able to update
|
|
54 |
# these files, but it always fails with an error that the generated
|
|
55 |
# opam files do not match the committed ones (because of this
|
|
56 |
# version field). These files are not in the install image, they
|
|
57 |
# only trip up testing.
|
|
58 |
find opam -name '*.opam' -exec sed -i "/^opam-version: \"2.0\"/a version: \"${PV}\"" {} + || die
|
|
59 |
|
|
60 |
# Remove tests from test/blackbox-tests that don't work for various
|
|
61 |
# reasons. The majority of these are taken from Debian's testing, but
|
|
62 |
# the list is expanded with additional tests that fail (for example,
|
|
63 |
# because unpackaged dependencies like js_of_ocaml)
|
|
64 |
#
|
|
65 |
# See: https://salsa.debian.org/ocaml-team/ocaml-dune/-/blob/master/debian/rules?ref_type=heads
|
|
66 |
|
|
67 |
# Tests that need melc
|
|
68 |
rm -r test/blackbox-tests/test-cases/melange || die
|
|
69 |
rm -r test/blackbox-tests/test-cases/merlin || die
|
|
70 |
|
|
71 |
# Tests that need files in /usr/doc
|
|
72 |
rm -r test/blackbox-tests/test-cases/cinaps || die
|
|
73 |
rm -r test/blackbox-tests/test-cases/inline-tests || die
|
|
74 |
rm -r test/blackbox-tests/test-cases/ppx || die
|
|
75 |
rm -r test/blackbox-tests/test-cases/utop || die
|
|
76 |
rm -r test/blackbox-tests/test-cases/jsoo || die
|
|
77 |
rm -r test/blackbox-tests/test-cases/ctypes || die
|
|
78 |
|
|
79 |
# Tests with other unsatisfied assumptions
|
|
80 |
rm -r test/blackbox-tests/test-cases/custom-cross-compilation || die
|
|
81 |
rm -r test/blackbox-tests/test-cases/subst || die
|
|
82 |
rm -r test/blackbox-tests/test-cases/pkg || die
|
|
83 |
rm test/blackbox-tests/test-cases/os-variables.t || die
|
|
84 |
rm -r test/blackbox-tests/test-cases/cram || die
|
|
85 |
rm -r test/blackbox-tests/test-cases/actions || die
|
|
86 |
#rm -r test/blackbox-tests/test-cases/foreign-stubs/github7146.t || die
|
|
87 |
rm -r test/expect-tests/vcs || die
|
|
88 |
|
|
89 |
# Many expect-tests fail, but common and test_scheduler are needed for the rest
|
|
90 |
mkdir test-libs || die
|
|
91 |
mv test/expect-tests/{common,test_scheduler} test-libs || die
|
|
92 |
rm -r test/expect-tests || die
|
|
93 |
|
|
94 |
# Flaky tests (to be investigated)
|
|
95 |
rm -r otherlibs/dune-site/test || die # failed on amd64
|
|
96 |
rm -r otherlibs/dune-rpc-lwt/examples/rpc_client/test || die # failed on riscv64
|
|
97 |
rm -r otherlibs/dune-rpc-lwt/test || die # failed on s390x
|
|
98 |
rm -r otherlibs/stdune/test || die # failed on i386
|
|
99 |
|
|
100 |
# requires dev-ml/opam
|
|
101 |
rm -r test/blackbox-tests/test-cases/stanzas || die
|
|
102 |
rm test/blackbox-tests/test-cases/empty-meta-version-gh9176.t || die
|
|
103 |
rm -r test/blackbox-tests/test-cases/workspaces || die
|
|
104 |
|
|
105 |
# requires js_of_ocaml
|
|
106 |
rm -r test/blackbox-tests/test-cases/separate-compilation-github3622 || die
|
|
107 |
|
|
108 |
# requires dev-ml/odoc
|
|
109 |
rm -r test/blackbox-tests/test-cases/odoc || die
|
|
110 |
rm -r test/blackbox-tests/test-cases/install-mld-pages || die
|
|
111 |
|
|
112 |
# requires dev-ml/menhir
|
|
113 |
rm -r test/blackbox-tests/test-cases/menhir || die
|
|
114 |
rm -r test/blackbox-tests/test-cases/formatting || die
|
|
115 |
|
|
116 |
# fails with a diff
|
|
117 |
rm -r test/blackbox-tests/test-cases/trace/action-traces || die
|
|
118 |
rm -r test/blackbox-tests/test-cases/trace/first-last-events.t || die
|
|
119 |
rm -r test/blackbox-tests/test-cases/tests-locks.t || die
|
|
120 |
rm -r test/blackbox-tests/test-cases/install-dir || die
|
|
121 |
|
|
122 |
# attempts to install outside of build dir
|
|
123 |
rm -r test/blackbox-tests/test-cases/install || die
|
|
124 |
|
|
125 |
# fails with newer versions of dune (> 3.17)
|
|
126 |
rm -r test/blackbox-tests/test-cases/hidden-deps-unsupported.t || die
|
|
127 |
|
|
128 |
# requires fdo
|
|
129 |
rm -r test/blackbox-tests/test-cases/fdo.t || die
|
| 35 |
130 |
}
|
| 36 |
131 |
|
| 37 |
132 |
src_configure() {
|
| 38 |
|
./configure \
|
| 39 |
|
--libdir="$(ocamlc -where)" \
|
| 40 |
|
--mandir=/usr/share/man \
|
| 41 |
|
--docdir=/usr/share/doc \
|
| 42 |
|
--etcdir=/etc \
|
| 43 |
|
--datadir=/usr/share \
|
| 44 |
|
--sbindir=/usr/sbin \
|
| 45 |
|
--bindir=/usr/bin \
|
| 46 |
|
|| die
|
|
133 |
local confargs=(
|
|
134 |
--libdir="$(ocamlc -where)"
|
|
135 |
--mandir="${EPREFIX}"/usr/share/man
|
|
136 |
--docdir="${EPREFIX}"/usr/share/doc
|
|
137 |
--etcdir="${EPREFIX}"/etc
|
|
138 |
--datadir="${EPREFIX}"/usr/share
|
|
139 |
--sbindir="${EPREFIX}"/usr/sbin
|
|
140 |
--bindir="${EPREFIX}"/usr/bin
|
|
141 |
)
|
|
142 |
edo ./configure "${confargs[@]}"
|
| 47 |
143 |
}
|
| 48 |
144 |
|
| 49 |
145 |
src_compile() {
|
| 50 |
|
ocaml boot/bootstrap.ml -j $(get_makeopts_jobs) --verbose || die
|
| 51 |
|
./_boot/dune.exe build @install -p "${PN}" --profile dune-bootstrap \
|
| 52 |
|
-j $(get_makeopts_jobs) --display short || die
|
|
146 |
edo ocaml boot/bootstrap.ml -j $(get_makeopts_jobs) --verbose
|
|
147 |
|
|
148 |
local buildargs=(
|
|
149 |
build dune.install
|
|
150 |
-p "${PN}"
|
|
151 |
--profile dune-bootstrap
|
|
152 |
-j "$(get_makeopts_jobs)"
|
|
153 |
--display short
|
|
154 |
)
|
|
155 |
edo ./_boot/dune.exe "${buildargs[@]}"
|
| 53 |
156 |
|
| 54 |
157 |
use emacs && elisp-compile editor-integration/emacs/*.el
|
| 55 |
158 |
}
|
| 56 |
159 |
|
|
160 |
src_test() {
|
|
161 |
# Dune's own approach to testing relies on opam switches and
|
|
162 |
# vendored copies of necessary dependencies. The majority of these
|
|
163 |
# dependencies require dune itself to build.
|
|
164 |
#
|
|
165 |
# We take an approach similar to Debian where we keep the majority
|
|
166 |
# of the tests and remove those that don't work for whatever reason.
|
|
167 |
edo ./_boot/dune.exe runtest --display short
|
|
168 |
}
|
|
169 |
|
| 57 |
170 |
src_install() {
|
| 58 |
171 |
# OCaml generates textrels on 32-bit arches
|
| 59 |
172 |
if use arm || use ppc || use x86 ; then
|