app-editors/appflowy-bin: add 0.7.4, drop 0.7.3
[gentoo-zh.git] / net-im / wechat-universal-bwrap / wechat-universal-bwrap-1.0.0.241-r1.ebuild
blob633b5f9f81c34adb42adebfec9996905ef507f2d
1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit desktop toolchain-funcs unpacker xdg
8 DESCRIPTION="WeChat (Universal) from UOS, inside bwrap sandbox"
9 HOMEPAGE="https://weixin.qq.com https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap"
11 UOS_APPSTORE_URI="https://home-store-packages.uniontech.com/appstore/pool/appstore"
12 AUR_REPO_REF="a50592f4f9ac4387f2c2e56c59b62ace629e316f"
13 SRC_URI="
14 amd64? ( ${UOS_APPSTORE_URI}/c/com.tencent.wechat/com.tencent.wechat_${PV}_amd64.deb )
15 arm64? ( ${UOS_APPSTORE_URI}/c/com.tencent.wechat/com.tencent.wechat_${PV}_arm64.deb )
16 loong? ( ${UOS_APPSTORE_URI}/c/com.tencent.wechat/com.tencent.wechat_${PV}_loongarch64.deb )
17 https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap/archive/${AUR_REPO_REF}.tar.gz -> wechat-universal-bwrap-${AUR_REPO_REF}.tar.gz
20 S="${WORKDIR}"
21 LICENSE="all-rights-reserved GPL-2"
22 SLOT="0"
23 KEYWORDS="-* ~amd64 ~arm64 ~loong"
24 RESTRICT="bindist strip mirror"
26 # the sonames are gathered with the following trick
28 # objdump -p /path/weixin | grep NEEDED | awk '{print $2}' | xargs equery b | sort | uniq
29 BLOB_RDEPEND="
30 app-accessibility/at-spi2-core:2
31 dev-libs/expat
32 dev-libs/glib:2
33 dev-libs/nspr
34 dev-libs/nss
35 dev-libs/openssl-compat:1.1.1
36 dev-libs/wayland
37 media-libs/alsa-lib
38 media-libs/fontconfig
39 media-libs/freetype
40 media-libs/libglvnd
41 media-libs/mesa
42 media-libs/tiff-compat:4
43 sys-apps/dbus
44 sys-libs/zlib
45 x11-libs/cairo
46 x11-libs/libdrm
47 x11-libs/libX11
48 x11-libs/libxcb
49 x11-libs/libXcomposite
50 x11-libs/libXdamage
51 x11-libs/libXext
52 x11-libs/libXfixes
53 x11-libs/libxkbcommon
54 x11-libs/libXrandr
55 x11-libs/libXrender
56 x11-libs/pango
57 x11-libs/xcb-util-image
58 x11-libs/xcb-util-keysyms
59 x11-libs/xcb-util-renderutil
60 x11-libs/xcb-util-wm
63 RDEPEND="
64 ${BLOB_RDEPEND}
65 sys-apps/bubblewrap
66 sys-apps/lsb-release
67 x11-misc/flatpak-xdg-utils
68 x11-misc/xdg-user-dirs
69 loong? ( virtual/loong-ow-compat )
71 BDEPEND="dev-util/patchelf"
73 QA_PREBUILT="*"
75 src_prepare() {
76 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev/null
77 eapply "${FILESDIR}/adjust-launcher-fs-layout.patch"
78 popd > /dev/null
80 default
82 pushd "${S}/opt/apps/com.tencent.wechat/files" > /dev/null
83 ebegin "Unbundling libuosdevicea.so"
84 rm libuosdevicea.so || die
85 eend $?
86 popd > /dev/null
89 call_cc() {
90 local cc="$(tc-getCC)"
91 echo "$cc" "$@"
92 "$cc" "$@" || die
95 call_patchelf() {
96 echo patchelf "$@"
97 patchelf "$@" || die
100 src_compile() {
101 einfo "Fixing blob RUNPATHs"
102 pushd "${S}/opt/apps/com.tencent.wechat/files" > /dev/null
103 # originally $ORIGIN:$ORIGIN
104 call_patchelf --set-rpath '$ORIGIN' RadiumWMPF/runtime/WeChatAppEx
105 # originally $ORIGIN:/home/ubuntu/.wconan2/ilink/5ae3ed15_1692179323/libs/Release/clang-llvm-12.0.0/libs:
106 call_patchelf --remove-rpath RadiumWMPF/runtime/libilink2.so
107 # originally /home/ubuntu/.wconan2/ilink_network/cfed668b_1692178974/ilink-network/libs/Release/clang-llvm-12.0.0/libs:
108 call_patchelf --remove-rpath RadiumWMPF/runtime/libilink_network.so
109 # originally ./ (!!!)
110 call_patchelf --remove-rpath libvoipChannel.so
111 call_patchelf --remove-rpath libvoipCodec.so
112 popd > /dev/null
114 einfo "Building stub libuosdevicea.so"
115 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev/null
116 call_cc -fPIC -shared ${CFLAGS} ${LDFLAGS} -o libuosdevicea.so libuosdevicea.c || die
117 popd > /dev/null
120 src_install() {
121 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev/null
122 domenu wechat-universal.desktop
123 newbin wechat-universal.sh wechat-universal
125 exeinto /usr/share/wechat-universal/usr/bin
126 newexe fake_dde-file-manager dde-file-manager
128 insinto /opt/wechat-universal
129 doins libuosdevicea.so
130 insinto /usr/share/wechat-universal/usr/lib/license
131 doins libuosdevicea.so
132 popd > /dev/null
134 # needed on the host side for bwrap to be able to do the bind-mount
135 keepdir /usr/lib/license
137 insinto /usr/share/wechat-universal/etc
138 newins "${FILESDIR}/stub-uos-release" lsb-release
140 insinto /opt/wechat-universal
141 doins -r "${S}/opt/apps/com.tencent.wechat/files/"*
142 fperms 0755 /opt/wechat-universal/{crashpad_handler,wechat}
143 fperms 0755 /opt/wechat-universal/RadiumWMPF/runtime/WeChatAppEx{,_crashpad_handler}
145 pushd "${S}/opt/apps/com.tencent.wechat/entries/icons/hicolor" > /dev/null
146 for size in 16 32 48 64 128 256; do
147 newicon -s ${size} "${size}x${size}/apps/com.tencent.wechat.png" wechat-universal.png
148 done
149 popd > /dev/null
152 pkg_postinst() {
153 elog "This WeChat will run in a sys-apps/bubblewrap sandbox, and will only"
154 elog "be able to access \$XDG_DOCUMENTS_DIR/WeChat_Data by default."
155 elog
156 elog "You can bind additional directories into the sandbox by creating a"
157 elog "~/.config/wechat-universal/binds.list file, with every line an"
158 elog "absolute or relative-to-HOME path."