1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
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"
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
21 LICENSE
="all-rights-reserved GPL-2"
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
30 app-accessibility/at-spi2-core:2
35 dev-libs/openssl-compat:1.1.1
42 media-libs/tiff-compat:4
49 x11-libs/libXcomposite
57 x11-libs/xcb-util-image
58 x11-libs/xcb-util-keysyms
59 x11-libs/xcb-util-renderutil
67 x11-misc/flatpak-xdg-utils
68 x11-misc/xdg-user-dirs
69 loong? ( virtual/loong-ow-compat )
71 BDEPEND
="dev-util/patchelf"
76 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev
/null
77 eapply
"${FILESDIR}/adjust-launcher-fs-layout.patch"
82 pushd "${S}/opt/apps/com.tencent.wechat/files" > /dev
/null
83 ebegin
"Unbundling libuosdevicea.so"
84 rm libuosdevicea.so || die
90 local cc
="$(tc-getCC)"
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
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
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
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
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.
"
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.
"