Merge pull request #1253 from HougeLangley/master
[gentoo-zh.git] / net-im / tencent-qq / tencent-qq-2.0.0.1089_beta2.ebuild
blobbbacd33efda51a25376d004649ea80793261edbf
1 # Copyright 1999-2021 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=7
5 MULTILIB_COMPAT=( abi_x86_64 abi_mips_n64 )
7 inherit desktop multilib-build rpm xdg-utils
9 MY_PV=$(ver_cut 5-6)
10 MY_P=$(ver_cut 1-3)-${MY_PV/beta/b}-$(ver_cut 4)
12 DESCRIPTION="Official Linux version of Tencent QQ"
13 HOMEPAGE="https://im.qq.com/linuxqq/download.html"
14 LICENSE="Tencent"
15 RESTRICT="bindist mirror"
17 SRC_URI="
18 amd64? ( http://down.qq.com/qqweb/LinuxQQ/linuxqq_${MY_P}_x86_64.rpm )
19 arm64? ( http://down.qq.com/qqweb/LinuxQQ/linuxqq_${MY_P}_aarch64.rpm )
20 mips? ( http://down.qq.com/qqweb/LinuxQQ/linuxqq_${MY_P}_mips64el.rpm )
23 SLOT="0"
24 KEYWORDS="-* ~amd64 ~mips" # arm64 not tested
25 IUSE="big-endian"
26 REQUIRED_USE="
27 arm64? ( !big-endian )
28 mips? ( !big-endian )
31 # the sonames are gathered with the following trick:
33 # readelf -a qq | rg '\(NEEDED\)' | rg -o '\[.*\]' | sed 's/^\[//; s/\]$//;'
35 # then combine this with something even more devilish to get the package names:
37 # ldd qq | \
38 # rg "$(cat previous-result | tr '\n' '|' | sed 's/^/(?:/; s/|$/)/; s/\./\\./g;')" | \
39 # rg -o '=> (.*) \(' | \
40 # sed 's/^=> //; s/($//;' | \
41 # xargs equery b | \
42 # sort | \
43 # uniq
45 # NOTE: sys-devel/gcc and sys-libs/glibc are omitted, not sure if this is right
46 RDEPEND="
47 dev-libs/glib:2[${MULTILIB_USEDEP}]
48 dev-libs/nspr:0[${MULTILIB_USEDEP}]
49 dev-libs/nss:0[${MULTILIB_USEDEP}]
50 x11-libs/cairo:0[${MULTILIB_USEDEP}]
51 x11-libs/gdk-pixbuf:2[${MULTILIB_USEDEP}]
52 x11-libs/gtk+:2[${MULTILIB_USEDEP}]
53 x11-libs/libX11:0[${MULTILIB_USEDEP}]
54 x11-libs/pango:0[${MULTILIB_USEDEP}]
56 DEPEND=""
57 BDEPEND=""
59 QA_PREBUILT="opt/tencent-qq/crashpad_handler
60 opt/tencent-qq/qq"
62 S="${WORKDIR}"
64 src_unpack() {
65 rpm_src_unpack
68 src_prepare() {
69 default
71 # the original package installed into /usr/local/share/tencent-qq, which is insane
72 # rewrite to /opt/tencent-qq
73 # also apply several fixes pointed out by QA notice
74 # fix some other properties as well, effectively rewriting the file
75 sed -i '
76 s@/usr/local/bin@/opt/tencent-qq@g;
77 s@/usr/local/share/tencent-qq@/opt/tencent-qq@g;
78 /^Version=/d;
79 s/Application;//g;
80 s/;Tencent Software//g;
81 s/^Name=腾讯QQ$/Name=Tencent QQ/;
82 s/^Comment=腾讯QQ$/Comment=Tencent QQ/;
83 s/^GenericName\[zh_CN\]=$/GenericName[zh_CN]=腾讯QQ/;
84 ' \
85 usr/share/applications/qq.desktop || die "sed failed for qq.desktop"
87 echo 'GenericName=Tencent QQ' >> usr/share/applications/qq.desktop
90 src_install() {
91 # this is not needed, the desktop entry file refers to the install root
92 # doicon usr/share/tencent-qq/qq.png
93 domenu usr/share/applications/qq.desktop
95 insinto /opt/tencent-qq
96 exeinto /opt/tencent-qq
97 doexe usr/local/bin/{crashpad_handler,qq}
98 doins usr/local/share/tencent-qq/{qq.png,res.db}
99 dosym ../../opt/tencent-qq/qq usr/bin/qq
102 pkg_postinst() {
103 xdg_desktop_database_update
104 xdg_icon_cache_update
107 pkg_postrm() {
108 xdg_desktop_database_update
109 xdg_icon_cache_update