summaryrefslogtreecommitdiff
path: root/dev-util/webstorm/webstorm-2026.2.0.1.ebuild
blob: 505d82f01b0f00ccc598ee9234a597200e6e12e8 (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
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop wrapper toolchain-funcs

DESCRIPTION="An integrated development environment for JavaScript and related technologies"
HOMEPAGE="https://www.jetbrains.com/webstorm/"
SRC_URI="
	amd64? ( https://download-cdn.jetbrains.com/${PN}/WebStorm-${PV}.tar.gz )
	arm64? ( https://download-cdn.jetbrains.com/${PN}/WebStorm-${PV}-aarch64.tar.gz )
"

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/2025"
KEYWORDS="~amd64 ~arm64"
IUSE="wayland"

RESTRICT="bindist mirror"
QA_PREBUILT="opt/${P}/*"

BDEPEND="dev-util/debugedit
	dev-util/patchelf
"
RDEPEND="
		dev-libs/wayland
		sys-libs/pam
		sys-process/audit
		virtual/zlib:=
"

src_unpack() {
		# WebStorm unarchived directory is in format WebStorm-xxx.yyy.zzz, not ${P}
		if use amd64 ; then
			cp "${DISTDIR}"/WebStorm-${PV}.tar.gz "${WORKDIR}"/ || die
		elif use arm64 ; then
			cp "${DISTDIR}"/WebStorm-${PV}-aarch64.tar.gz "${WORKDIR}"/ || die
		fi
		mkdir -p "${P}" || die
		tar --strip-components=1 -xzf "WebStorm-${PV}".tar.gz -C "${P}" || die
}

src_prepare() {
		tc-export OBJCOPY
		default

	if ! use arm64; then
		local remove_me=(
			lib/async-profiler/aarch64
		)
	elif ! use amd64; then
		local remove_me=(
			lib/async-profiler/amd64
		)
	fi

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

	# excepting files that should be kept for remote plugins
	if ! use arm64 ; then
		local skip_remote_files=(
			"plugins/platform-ijent-bundledBinaries/ijent-aarch64-unknown-linux-musl-release"
			"plugins/gateway-plugin/lib/remote-dev-workers/remote-dev-worker-linux-arm64"
		)
	elif ! use amd64; then
		local skip_remote_files=(
			"plugins/platform-ijent-bundledBinaries/ijent-x86_64-unknown-linux-musl-release"
			"plugins/gateway-plugin/lib/remote-dev-workers/remote-dev-worker-linux-amd64"
		)
	fi

	# removing debug symbols and relocating debug files as per #876295
	# we're escaping all the files that contain $() in their name
	# as they should not be executed
	find . -type f ! -name '*$(*)*' -print0 | while IFS= read -r -d '' file; do
		for skip in "${skip_remote_files[@]}"; do
			[[ ${file} == ./"${skip}" ]] && continue 2
		done
		if file "${file}" | grep -qE "ELF (32|64)-bit"; then
			${OBJCOPY} --remove-section .note.gnu.build-id "${file}" || die
			debugedit -b "${EPREFIX}/opt/${PN}" -d "/usr/lib/debug" -i "${file}" || die
		fi
	done

		patchelf --set-rpath '$ORIGIN' "plugins/jcef-plugin/jcef/libjcef.so" || die
		patchelf --set-rpath '$ORIGIN' "plugins/jcef-plugin/jcef/jcef_helper" || die

		# As per https://blog.jetbrains.com/platform/2024/07/wayland-support-preview-in-2024-2/ for full wayland support
		if use wayland; then
				echo "-Dawt.toolkit.name=WLToolkit" >> bin/webstorm64.vmoptions || die
		fi
}

src_install() {
		local dir="/opt/${P}"

		# foreign-arch binaries kept for remote plugins; the host strip
		# cannot parse them
		if ! use arm64 ; then
			dostrip -x "${dir}"/plugins/platform-ijent-bundledBinaries/ijent-aarch64-unknown-linux-musl-release
			dostrip -x "${dir}"/plugins/gateway-plugin/lib/remote-dev-workers/remote-dev-worker-linux-arm64
		elif ! use amd64 ; then
			dostrip -x "${dir}"/plugins/platform-ijent-bundledBinaries/ijent-x86_64-unknown-linux-musl-release
			dostrip -x "${dir}"/plugins/gateway-plugin/lib/remote-dev-workers/remote-dev-worker-linux-amd64
		fi

		insinto "${dir}"
		doins -r *
		fperms 755 "${dir}"/bin/{"${PN}",fsnotifier,format.sh,inspect.sh,jetbrains_client.sh,ltedit.sh,remote-dev-server,remote-dev-server.sh,restarter}
		fperms 755 "${dir}"/jbr/bin/{java,javac,javadoc,jcmd,jdb,jfr,jhsdb,jinfo,jmap,jps,jrunscript,jstack,jstat,jwebserver,keytool,rmiregistry,serialver}
		fperms 755 "${dir}"/jbr/lib/{jexec,jspawnhelper}
		fperms 755 "${dir}"/plugins/jcef-plugin/jcef/{chrome-sandbox,jcef_helper}

		make_wrapper "${PN}" "${dir}"/bin/"${PN}"
		newicon bin/"${PN}".svg "${PN}".svg
		make_desktop_entry "${PN}" "WebStorm ${PV}" "${PN}" "Development;IDE;"

		# recommended by: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
		insinto /usr/lib/sysctl.d
		newins - 30-"${PN}"-inotify-watches.conf <<<"fs.inotify.max_user_watches = 524288"
}