1 # Copyright 2019-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
11 _QQDownSite="https://dldir1.qq.com/qqfile/qq/QQNT"
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"
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} )
24 https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/releases/download/${_LiteLoader_PV}/LiteLoaderQQNT.zip \
25 -> LiteLoaderQQNT-${_LiteLoader_PV}.zip
31 KEYWORDS="-* ~amd64 ~arm64"
33 IUSE="+bwrap system-vips gnome appindicator liteloader"
35 RESTRICT="strip mirror"
41 appindicator? ( dev-libs/libayatana-appindicator )
42 x11-libs/libXScrnSaver
43 x11-libs/libXcomposite
47 app-accessibility/at-spi2-core:2
53 >=media-libs/vips-8.15.2[-pdf]
57 x11-misc/snapd-xdg-open
58 x11-misc/flatpak-xdg-utils
60 gnome? ( dev-libs/gjs )
63 virtual/loong-ow-compat
66 BDEPEND="liteloader? ( app-arch/unzip )"
70 if use liteloader; then
71 unpack LiteLoaderQQNT-${_LiteLoader_PV}.zip
78 if [ "${ARCH}" = "loong" ]; then
79 unpacker "${DISTDIR}/${_QQFileName}_${MY_PV}_loongarch64${_ArchExt}${_QQFileSuffix}"
81 unpacker "${DISTDIR}/${_QQFileName}_${MY_PV}_${ARCH}${_ArchExt}${_QQFileSuffix}"
84 if use system-vips; then
85 rm -r "${D}"/opt/QQ/resources/app/sharp-lib || die
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
106 sed -i 's!/opt/QQ/qq!/usr/bin/qq!' "${D}"/usr/share/applications/qq.desktop || die
110 dosym -r /opt/QQ/start.sh /usr/bin/qq
111 elif use system-vips; then
112 newbin "$FILESDIR/qq.sh" qq
114 dosym -r /opt/QQ/qq /usr/bin/qq
117 # https://bugs.gentoo.org/898912
118 if use appindicator; then
119 dosym ../../usr/lib64/libayatana-appindicator3.so /opt/QQ/libappindicator3.so
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
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/ 下载相关插件,"
153 elog "解压到 ~/.config/QQ/LiteLoaderQQNT/plugins/“lite_tools_v4”/ 目录下,重启后生效。"
154 elog "--------------------------------------------------------------------"