blob: 4332fe3ff2518200e6355069d3f13191903e583f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
BV="${PV}-1"
BV_AMD64="${BV}-linux-x86_64"
LLVM_COMPAT=( {20..22} )
inherit llvm-r2 multiprocessing shell-completion toolchain-funcs
DESCRIPTION="The Crystal Programming Language"
HOMEPAGE="https://crystal-lang.org/
https://github.com/crystal-lang/crystal/"
SRC_URI="
https://github.com/crystal-lang/${PN}/archive/${PV}.tar.gz
-> ${P}.gh.tar.gz
amd64? (
https://github.com/crystal-lang/${PN}/releases/download/${BV/-*}/${PN}-${BV_AMD64}.tar.gz
)
"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64"
IUSE="doc debug llvm-libunwind"
RESTRICT="test" # Upstream test suite not reliable.
DEPEND="
dev-libs/boehm-gc:=[threads]
dev-libs/gmp:=
dev-libs/libatomic_ops:=
dev-libs/libevent:=
dev-libs/libpcre2:=[unicode]
dev-libs/libxml2:=
dev-libs/libyaml
dev-libs/pcl:=
$(llvm_gen_dep '
llvm-core/llvm:${LLVM_SLOT}=
')
llvm-libunwind? (
llvm-runtimes/libunwind:=
)
!llvm-libunwind? (
sys-libs/libunwind:=
)
"
RDEPEND="
${DEPEND}
"
PATCHES=(
"${FILESDIR}/${PN}-0.27.0-gentoo-tests-long-unix.patch"
"${FILESDIR}/${PN}-0.27.0-gentoo-tests-long-unix-2.patch"
"${FILESDIR}/${PN}-1.15.0-remove-enviroment-clearing-tests.patch"
)
# Do not complain about CFLAGS etc. Crystal rebuilds itself.
QA_FLAGS_IGNORED='.*'
src_prepare() {
default
# Link against system boehm-gc instead of upstream prebuilt static library
# bug #929123, #929989 and #931100
# https://github.com/crystal-lang/crystal/issues/12035#issuecomment-2522606612
rm "${WORKDIR}/crystal-${BV}"/lib/crystal/libgc.a || die
}
src_configure() {
local bootstrap_path="${WORKDIR}/${PN}-${BV}/bin"
if [[ ! -d "${bootstrap_path}" ]] ; then
eerror "Binary tarball does not contain expected directory:"
die "'${bootstrap_path}' path does not exist."
fi
# crystal uses 'LLVM_TARGETS' to override default list of targets
unset LLVM_TARGETS
MY_EMAKE_COMMON_ARGS=(
PATH="${bootstrap_path}:${PATH}"
CRYSTAL_CONFIG_VERSION="${PV}"
CRYSTAL_CONFIG_PATH="lib:${EPREFIX}/usr/$(get_libdir)/crystal"
$(usex debug "" release=1)
interpreter="true"
threads="$(makeopts_jobs)"
check_lld="" # disable opportunistic lld
progress="true"
stats="true"
verbose="true"
AR="$(tc-getAR)"
CC="$(tc-getCC)"
CXX="$(tc-getCXX)"
LLVM_CONFIG="$(get_llvm_prefix -d)/bin/llvm-config"
)
}
src_compile() {
emake "${MY_EMAKE_COMMON_ARGS[@]}"
if use doc ; then
emake docs "${MY_EMAKE_COMMON_ARGS[@]}"
fi
}
src_test() {
nonfatal emake std_spec "${MY_EMAKE_COMMON_ARGS[@]}"
}
src_install() {
insinto "/usr/$(get_libdir)/crystal"
doins -r src/.
exeinto /usr/bin
doexe .build/crystal
newbashcomp etc/completion.bash "${PN}"
newfishcomp etc/completion.fish crystal.fish
newzshcomp etc/completion.zsh _crystal
dodoc -r samples
doman "man/${PN}.1"
if use doc ; then
docinto api
dodoc -r docs/.
fi
}
|