summaryrefslogtreecommitdiff
path: root/dev-util/rust-rover/rust-rover-2025.3.3.ebuild
blob: 35b79f1bc82cf99103279475a1e72d260adf99a9 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8

inherit desktop wrapper xdg-utils

DESCRIPTION="A feature-rich Rust IDE with timely support by JetBrarins"
HOMEPAGE="https://www.jetbrains.com/rust/"
SRC_URI="https://download.jetbrains.com/rustrover/RustRover-${PV}.tar.gz"

# to keep it tidy.
S="${WORKDIR}/RustRover-${PV}"

LICENSE="|| ( JetBrains-business JetBrains-classroom JetBrains-educational JetBrains-individual )
		Apache-2.0
		BSD
		CC0-1.0
		CDDL
		CDDL-1.1
		EPL-1.0
		GPL-2
		GPL-2-with-classpath-exception
		ISC
		LGPL-2.1
		LGPL-3
		MIT
		MPL-1.1
		OFL-1.1
		ZLIB
"
SLOT="0"
KEYWORDS="-* ~amd64"
IUSE="+bundled-jdk nvidia"
RESTRICT="bindist mirror"
QA_PREBUILT="opt/RustRover/*"

BDEPEND="dev-util/patchelf"

RDEPEND="!bundled-jdk? ( >=virtual/jre-1.8 )
	>=app-accessibility/at-spi2-core-2.46.0:2
	dev-debug/gdb
	llvm-core/lldb
	dev-libs/expat
	dev-libs/glib:2
	dev-libs/nspr
	dev-libs/nss
	dev-libs/wayland
	media-libs/alsa-lib
	media-libs/freetype:2
	media-libs/mesa
	net-print/cups
	sys-apps/dbus
	virtual/zlib:=
	x11-libs/cairo
	x11-libs/libdrm
	x11-libs/libX11
	x11-libs/libXcomposite
	x11-libs/libXcursor
	x11-libs/libXdamage
	x11-libs/libXext
	x11-libs/libXfixes
	x11-libs/libXi
	x11-libs/libXrandr
	x11-libs/libXrender
	x11-libs/libXtst
	x11-libs/libXxf86vm
	x11-libs/libxcb
	x11-libs/libxkbcommon
	x11-libs/pango
"

src_prepare() {
	default

	local remove_me=(
		Install-Linux-tar.txt
		bin/gdb
		bin/lldb
		plugins/remote-dev-server/selfcontained
		plugins/gateway-plugin/lib/remote-dev-workers/remote-dev-worker-linux-arm64
		plugins/platform-ijent-impl/ijent-aarch64-unknown-linux-musl-release
		lib/async-profiler/aarch64
	)

	rm -rv "${remove_me[@]}" || die

	sed -i \
		-e "\$a\\\\" \
		-e "\$a#-----------------------------------------------------------------------" \
		-e "\$a# Disable automatic updates as these are handled through Gentoo's" \
		-e "\$a# package manager. See bug #704494" \
		-e "\$a#-----------------------------------------------------------------------" \
		-e "\$aide.no.platform.update=Gentoo" bin/idea.properties

	for file in "jbr/lib/"/{libjcef.so,jcef_helper}
	do
		if [[ -f "${file}" ]]; then
			patchelf --set-rpath '$ORIGIN' ${file} || die
		fi
	done

	if use nvidia; then
		grep -q '^-Dide.browser.jcef.out-of-process.enabled=' \
			bin/rustrover64.vmoptions \
		|| echo "-Dide.browser.jcef.out-of-process.enabled=false" \
			>> bin/rustrover64.vmoptions || die
	fi

}

src_install() {
	local DIR="/opt/RustRover"
	local JRE_DIR="jbr"

	insinto ${DIR}
	doins -r *

	# bin files
	for _f in format.sh fsnotifier inspect.sh jetbrains_client.sh ltedit.sh \
	rustrover rustrover.sh restarter native-helper/intellij-rust-native-helper; do
		fperms 755 "${DIR}/bin/$_f"
	done

	# JRE bin files
	for _f in java javac javadoc jcmd jdb jfr jhsdb jinfo jmap \
	jps jrunscript jstack jstat keytool rmiregistry serialver; do
		fperms 755 "${DIR}/${JRE_DIR}/bin/$_f"
	done

	# lib files
	for _f in chrome-sandbox jcef_helper jexec jspawnhelper; do
		fperms 755 "${DIR}/${JRE_DIR}/lib/$_f"
	done

	if ! use bundled-jdk; then
		rm -r "${D}/${DIR}/${JRE_DIR}" || die
	fi

	make_wrapper "rustrover" "${DIR}/bin/rustrover"
	newicon "bin/rustrover.svg" "rustrover.svg"
	make_desktop_entry "rustrover" "RustRover" "rustrover" "Development;IDE;"

	# recommended by: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
	dodir /etc/sysctl.d/
	echo "fs.inotify.max_user_watches = 524288" > "${D}/etc/sysctl.d/30-idea-inotify-watches.conf" || die
}

pkg_postinst() {
	xdg_icon_cache_update
}

pkg_postrm() {
	xdg_icon_cache_update
}