summaryrefslogtreecommitdiff
blob: 7d5d43322d793292421824a7400416d1907df272 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop wrapper xdg

MY_PN=${PN/-professional/}
DESCRIPTION="Intelligent Python IDE with unique code assistance and analysis"
HOMEPAGE="https://www.jetbrains.com/pycharm/"
SRC_URI="
	amd64? ( https://download.jetbrains.com/python/${P}.tar.gz )
	arm64? ( https://download.jetbrains.com/python/${P}-aarch64.tar.gz )
"
S="${WORKDIR}/${MY_PN}-${PV}"

LICENSE="PyCharm"
#https://www.jetbrains.com/legal/third-party-software/?product=pcp
#license/javahelp_license.txt: CDDL-1.1
#license/javolution_license.txt: BSD-2
#license/saxon-conditions.html: MPL-1.0
#license/yourkit-license-redist.txt: BSD
#license/third-party-libraries.json:
## cat third-party-libraries.json | jq '.[].license' | sort | uniq
# "commercial, available on request" http://www.yworks.com/products/yfiles-for-java-2.x/sla
# "Custom" https://checkmarx.com/legal/jetbrains-checkmarx-end-user-terms-and-conditions/
# color.js is MIT
# codehaus is MIT
# roman.py is ZPL not "Python 2.1.1 license"
# Eclipse Distribution License 1.0 is BSD
LICENSE+=" 0BSD Apache-2.0 BSD BSD-2 CC0-1.0 CC-BY-2.5 CC-BY-3.0 CC-BY-4.0 CDDL-1.1 CPL-1.0 EPL-1.0 GPL-2"
LICENSE+=" GPL-2-with-classpath-exception ISC JSON LGPL-2.1 LGPL-3 LGPL-3+ libpng MIT MPL-1.1 MPL-2.0 OFL"
LICENSE+=" OFL-1.1 public-domain PYTHON unicode Unlicense W3C ZLIB ZPL"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+bundled-jdk"

RDEPEND="
	dev-libs/glib:2
	dev-python/pip
	media-fonts/dejavu
	bundled-jdk? (
		app-accessibility/at-spi2-core:2
		dev-libs/expat
		dev-libs/nspr
		dev-libs/nss
		media-libs/alsa-lib
		media-libs/freetype:2=
		media-libs/mesa
		net-print/cups
		sys-apps/dbus
		sys-libs/zlib
		x11-libs/cairo
		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/libdrm
		x11-libs/libxcb
		x11-libs/libxkbcommon
		x11-libs/pango
	)
	!bundled-jdk? (
		>=virtual/jre-17
	)
"
BDEPEND="dev-util/patchelf"

RESTRICT="mirror test"

DESTDIR="/opt/${PN}"
QA_PREBUILT="${DESTDIR#/}/.*"

src_prepare() {
	default
	local remove_me=(
		help/ReferenceCardForMac.pdf
		plugins/remote-dev-server/selfcontained
		plugins/python/helpers/pydev/pydevd_attach_to_process/attach_linux_x86.so
		plugins/python/helpers/pydev/pydevd_attach_to_process/attach_linux_amd64.so
		plugins/python/helpers/pydev/pydevd_attach_to_process/attach_linux_aarch64.so
		plugins/tailwindcss  # Relies on masked package sys-libs/musl
	)

	if use amd64; then
		remove_me+=(
			lib/async-profiler/aarch64
			plugins/cwm-plugin/quiche-native/linux-aarch64
		)
	fi

	if use arm64; then
		remove_me+=(
			lib/async-profiler/amd64
		)
	fi

	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 || die

	if ! use bundled-jdk; then
		rm -rf jbr || die
	fi

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

src_install() {
	insinto ${DESTDIR}
	doins -r *

	fperms 755 ${DESTDIR}/bin/{format.sh,fsnotifier,inspect.sh,jetbrains_client.sh,ltedit.sh,pycharm.sh,remote-dev-server.sh,repair,restarter}

	if use bundled-jdk; then
		fperms 755 "${DESTDIR}"/jbr/bin/{java,javac,javadoc,jcmd,jdb,jfr,jhsdb,jinfo,jmap,jps,jrunscript,jstack,jstat,keytool,rmiregistry,serialver}
		fperms 755 "${DESTDIR}"/jbr/lib/{chrome-sandbox,jcef_helper,jexec,jspawnhelper}
	fi

	make_wrapper ${PN} ${DESTDIR}/bin/pycharm.sh
	newicon bin/${MY_PN}.png ${PN}.png
	make_desktop_entry ${PN} ${PN} ${PN}

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