dev-python/conda-libmamba-solver: bump version to 24.11.1
[gentoo-zh.git] / net-im / tencent-qq / tencent-qq-3.2.15_p241224.ebuild
blob8910a09090aa31e7dbf2a727eb0f39ce08749461
1 # Copyright 2019-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit unpacker xdg
8 MY_PV=${PV/_p/_}
9 _I="Linux"
10 _ArchExt="_01"
11 _QQDownSite="https://dldir1.qq.com/qqfile/qq/QQNT"
12 _QQFileName="QQ"
13 _QQFileSuffix=".deb"
15 _LiteLoader_PV="1.2.3"
16 DESCRIPTION="The new version of the official linux-qq"
17 HOMEPAGE="https://im.qq.com/linuxqq/index.shtml"
19 SRC_URI="
20         amd64? ( ${_QQDownSite}/$_I/${_QQFileName}_${MY_PV}_amd64${_ArchExt}${_QQFileSuffix} )
21         arm64? ( ${_QQDownSite}/$_I/${_QQFileName}_${MY_PV}_arm64${_ArchExt}${_QQFileSuffix} )
22         loong? ( ${_QQDownSite}/$_I/${_QQFileName}_${MY_PV}_loongarch64${_ArchExt}${_QQFileSuffix} )
23         liteloader? (
24                 https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/releases/download/${_LiteLoader_PV}/LiteLoaderQQNT.zip \
25                 -> LiteLoaderQQNT-${_LiteLoader_PV}.zip
26         )
28 S=${WORKDIR}
29 LICENSE="Tencent"
30 SLOT="0"
31 KEYWORDS="-* ~amd64 ~arm64"
33 IUSE="+bwrap system-vips gnome appindicator liteloader"
35 RESTRICT="strip mirror"
37 RDEPEND="
38         x11-libs/gtk+:3
39         x11-libs/libnotify
40         dev-libs/nss
41         appindicator? ( dev-libs/libayatana-appindicator )
42         x11-libs/libXScrnSaver
43         x11-libs/libXcomposite
44         x11-libs/libXdamage
45         x11-libs/libXtst
46         x11-misc/xdg-utils
47         app-accessibility/at-spi2-core:2
48         app-crypt/libsecret
49         virtual/krb5
50         sys-apps/keyutils
51         system-vips? (
52                 dev-libs/glib
53                 >=media-libs/vips-8.15.2[-pdf]
54         )
55         bwrap? (
56                 sys-apps/bubblewrap
57                 x11-misc/snapd-xdg-open
58                 x11-misc/flatpak-xdg-utils
59         )
60         gnome? ( dev-libs/gjs )
61         media-libs/openslide
62         loong? (
63                         virtual/loong-ow-compat
64         )
66 BDEPEND="liteloader? ( app-arch/unzip )"
68 src_unpack() {
69         :
70         if use liteloader; then
71                 unpack LiteLoaderQQNT-${_LiteLoader_PV}.zip
72         fi
75 src_install() {
76         dodir /
77         cd "${D}" || die
78         if [ "${ARCH}" = "loong" ]; then
79                 unpacker "${DISTDIR}/${_QQFileName}_${MY_PV}_loongarch64${_ArchExt}${_QQFileSuffix}"
80         else
81                 unpacker "${DISTDIR}/${_QQFileName}_${MY_PV}_${ARCH}${_ArchExt}${_QQFileSuffix}"
82         fi
84         if use system-vips; then
85                 rm -r "${D}"/opt/QQ/resources/app/sharp-lib || die
86         fi
88         if use bwrap; then
89                 exeinto /opt/QQ
90                 doexe "${FILESDIR}"/start.sh
91                 sed -i 's!/opt/QQ/qq!/opt/QQ/start.sh!' "${D}"/usr/share/applications/qq.desktop || die
92                 insinto /opt/QQ/workarounds
93                 doins "${FILESDIR}"/{config.json,xdg-open.sh,vercmp.sh}
94                 fperms +x /opt/QQ/workarounds/{xdg-open.sh,vercmp.sh}
96                 local _base_pkgver=${PV/_p/-} || die
97                 local _update_pkgver=${_base_pkgver} || die
98                 local cur_ver=${_update_pkgver:-${base_ver}} || die
99                 local build_ver=${cur_ver#*-} || die
101                 sed -i "s|__BASE_VER__|${base_ver}|g;s|__CURRENT_VER__|${cur_ver}|g;s|__BUILD_VER__|${build_ver}|g" \
102                         "${D}"/opt/QQ/workarounds/config.json \
103                         "${D}"/opt/QQ/start.sh || die
105         else
106                 sed -i 's!/opt/QQ/qq!/usr/bin/qq!' "${D}"/usr/share/applications/qq.desktop || die
107         fi
109         if use bwrap; then
110                 dosym -r /opt/QQ/start.sh /usr/bin/qq
111         elif use system-vips; then
112                 newbin "$FILESDIR/qq.sh" qq
113         else
114                 dosym -r /opt/QQ/qq /usr/bin/qq
115         fi
117         # https://bugs.gentoo.org/898912
118         if use appindicator; then
119                 dosym ../../usr/lib64/libayatana-appindicator3.so /opt/QQ/libappindicator3.so
120         fi
122         sed -i 's!/usr/share/icons/hicolor/512x512/apps/qq.png!qq!' "${D}"/usr/share/applications/qq.desktop || die
123         gzip -d "${D}"/usr/share/doc/linuxqq/changelog.gz || die
124         dodoc "${D}"/usr/share/doc/linuxqq/changelog
125         rm -rf "${D}"/usr/share/doc/linuxqq/ || die
127         if use liteloader; then
128                 insinto /opt/LiteLoader
129                 doins -r "${WORKDIR}"/*
130                 dosym -r /opt/LiteLoader/src/preload.js /opt/QQ/resources/app/application/preload.js
131                 sed -i "1 i require(\"/opt/LiteLoader\");" "${D}"/opt/QQ/resources/app/app_launcher/index.js || die
132         fi
135 pkg_postinst() {
136         xdg_pkg_postinst
137         if use bwrap; then
138                 elog "-EN-----------------------------------------------------------------"
139                 elog "If you want to download files in QQ"
140                 elog "Please set the QQ download path to ~/Download"
141                 elog "If you have enabled LiteLoaderQQNT support, relevant plugins can be "
142                 elog "downloaded from https://liteloaderqqnt.github.io/, "
143                 elog "For instance, after downloading the 「轻量工具箱」 and unzipping it, "
144                 elog "download it to the directory ~/.config/QQ/LiteLoaderQQNT/plugins/lite_tools_v4/, "
145                 elog "and the changes will take effect after a restart."
146                 elog "--------------------------------------------------------------------"
147                 elog "-ZH-----------------------------------------------------------------"
148                 elog "如果要在 QQ 中下载文件,请先在「设置」->「存储管理」中把下载文件夹"
149                 elog "更改为系统的“下载”/“Downloads”文件夹。"
150                 elog "如果您启用了 LiteLoaderQQNT 支持,"
151                 elog "可以从 https://liteloaderqqnt.github.io/ 下载相关插件,"
152                 elog "例如:「轻量工具箱」下载后"
153                 elog "解压到 ~/.config/QQ/LiteLoaderQQNT/plugins/“lite_tools_v4”/ 目录下,重启后生效。"
154                 elog "--------------------------------------------------------------------"
155         fi