1 |
1 |
# Copyright 1999-2022 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit desktop xdg-utils
|
|
6 |
inherit desktop wrapper xdg
|
7 |
7 |
|
8 |
8 |
# get the major version from PV
|
9 |
|
MV=${PV:0:1}
|
10 |
|
MY_PV=${PV#*_p}
|
|
9 |
MY_PV=$(ver_cut 3)
|
|
10 |
MY_PN=${PN/-/_}
|
11 |
11 |
|
12 |
12 |
DESCRIPTION="Sophisticated text editor for code, markup and prose"
|
13 |
13 |
HOMEPAGE="https://www.sublimetext.com"
|
14 |
14 |
SRC_URI="
|
15 |
|
amd64? ( https://download.sublimetext.com/sublime_text_${MV}_build_${MY_PV}_x64.tar.bz2 )
|
16 |
|
x86? ( https://download.sublimetext.com/sublime_text_${MV}_build_${MY_PV}_x32.tar.bz2 )"
|
|
15 |
amd64? ( https://download.sublimetext.com/sublime_text_build_${MY_PV}_x64.tar.xz )"
|
|
16 |
S="${WORKDIR}/${MY_PN}"
|
17 |
17 |
|
18 |
18 |
LICENSE="Sublime"
|
19 |
19 |
SLOT="0"
|
20 |
|
KEYWORDS="~amd64 ~x86"
|
|
20 |
KEYWORDS="~amd64"
|
21 |
21 |
IUSE="dbus"
|
22 |
22 |
RESTRICT="bindist mirror strip"
|
23 |
23 |
|
... | ... | |
28 |
28 |
x11-libs/libX11
|
29 |
29 |
dbus? ( sys-apps/dbus )"
|
30 |
30 |
|
|
31 |
PATCHES=(
|
|
32 |
"${FILESDIR}"/${PN}-4_p4107-remove-deprecated-key-onlyshowin-from-launcher.patch
|
|
33 |
"${FILESDIR}"/${PN}-4_p4107-set-explicit-startupwmclass-in-launcher.patch
|
|
34 |
)
|
|
35 |
|
31 |
36 |
QA_PREBUILT="*"
|
32 |
|
S="${WORKDIR}/sublime_text_${MV}"
|
33 |
37 |
|
34 |
38 |
# Sublime bundles the kitchen sink, which includes python and other assorted
|
35 |
39 |
# modules. Do not try to unbundle these because you are guaranteed to fail.
|
36 |
40 |
|
37 |
41 |
src_install() {
|
38 |
|
insinto /opt/${PN}${MV}
|
39 |
|
doins -r Packages Icon
|
40 |
|
doins changelog.txt sublime_plugin.py sublime.py python3.3.zip
|
41 |
|
|
42 |
|
exeinto /opt/${PN}${MV}
|
43 |
|
doexe crash_reporter plugin_host sublime_text
|
44 |
|
dosym ../../opt/${PN}${MV}/sublime_text /usr/bin/subl
|
|
42 |
insinto /opt/${MY_PN}
|
|
43 |
doins -r Packages Lib Icon # /Icon is used at runtime by the application
|
|
44 |
doins changelog.txt libcrypto.so.1.1 libssl.so.1.1 sublime_text.desktop
|
|
45 |
|
|
46 |
# sublime_merge looks for /opt/sublime_text/sublime_text
|
|
47 |
exeinto /opt/${MY_PN}
|
|
48 |
doexe crash_reporter plugin_host-3.3 plugin_host-3.8 sublime_text
|
|
49 |
|
|
50 |
# sublime-text sets its WM_CLASS based on its argv[0]. A wrapper script is
|
|
51 |
# used instead of a symlink to preserve a consistent WM_CLASS regardless of
|
|
52 |
# how the application is launched. This causes the WM_CLASS to be
|
|
53 |
# "sublime_text" which matches the .desktop entry.
|
|
54 |
make_wrapper subl "/opt/${MY_PN}/sublime_text --fwdargv0 \"\$0\""
|
|
55 |
domenu sublime_text.desktop
|
45 |
56 |
|
46 |
57 |
local size
|
47 |
58 |
for size in 16 32 48 128 256; do
|
48 |
|
dosym ../../../../../../opt/${PN}${MV}/Icon/${size}x${size}/sublime-text.png \
|
49 |
|
/usr/share/icons/hicolor/${size}x${size}/apps/subl.png
|
|
59 |
doicon --size ${size} Icon/${size}x${size}/${PN}.png
|
50 |
60 |
done
|
51 |
|
|
52 |
|
make_desktop_entry "subl %F" "Sublime Text ${MV}" subl \
|
53 |
|
"TextEditor;IDE;Development" "StartupNotify=true"
|
54 |
|
|
55 |
|
# needed to get WM_CLASS lookup right
|
56 |
|
mv "${ED}"/usr/share/applications/subl{-sublime-text,}.desktop || die
|
57 |
|
}
|
58 |
|
|
59 |
|
pkg_postrm() {
|
60 |
|
xdg_icon_cache_update
|
61 |
61 |
}
|
62 |
62 |
|
63 |
63 |
pkg_postinst() {
|
64 |
|
xdg_icon_cache_update
|
|
64 |
xdg_pkg_postinst
|
|
65 |
|
|
66 |
elog 'Sublime Text 4'"'"'s window class changes from WM_CLASS="subl" to'
|
|
67 |
elog 'WM_CLASS="sublime_text" matching other distributions.'
|
65 |
68 |
}
|