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) with bwrap sandbox"
9 HOMEPAGE
="https://weixin.qq.com https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap"
11 APP_NAME
="com.tencent.wechat"
12 URL_ROOT
="https://home-store-packages.uniontech.com/appstore/pool/appstore/c/${APP_NAME}"
13 DEB_STEM
="${APP_NAME}_${PV}"
14 AUR_REPO_REF
="e0982191c6940f1bdcae87786cf8e5badfaf65c9"
16 amd64? ( ${URL_ROOT}/${DEB_STEM}_amd64.deb )
17 arm64? ( ${URL_ROOT}/${DEB_STEM}_arm64.deb )
18 loong? ( ${URL_ROOT}/${DEB_STEM}_loongarch64.deb ) https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap/archive/${AUR_REPO_REF}.tar.gz -> wechat-universal-bwrap-${AUR_REPO_REF}.tar.gz
22 LICENSE
="all-rights-reserved GPL-2"
24 KEYWORDS
="-* ~amd64 ~arm64 ~loong"
25 RESTRICT
="bindist strip mirror"
27 # the sonames are gathered with the following trick
29 # objdump -p /path/weixin | grep NEEDED | awk '{print $2}' | xargs equery b | sort | uniq
31 app-accessibility/at-spi2-core:2
36 dev-libs/openssl-compat:1.1.1
43 media-libs/tiff-compat:4
50 x11-libs/libXcomposite
58 x11-libs/xcb-util-image
59 x11-libs/xcb-util-keysyms
60 x11-libs/xcb-util-renderutil
68 x11-misc/flatpak-xdg-utils
69 x11-misc/xdg-user-dirs
70 loong? ( virtual/loong-ow-compat )
72 BDEPEND
="dev-util/patchelf"
77 elog
"Start patch wechat-universal.sh about launcher fs layout"
78 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev
/null
79 eapply
"${FILESDIR}/adjust-launcher-fs-layout-1.patch"
86 local cc
="$(tc-getCC)"
97 einfo
"Fixing blob RUNPATHs"
98 pushd "${S}/opt/apps/${APP_NAME}/files" > /dev
/null
99 # originally $ORIGIN:$ORIGIN
100 call_patchelf
--set-rpath '$ORIGIN' RadiumWMPF
/runtime
/WeChatAppEx
101 # originally $ORIGIN:/home/ubuntu/.wconan2/ilink/fcafc08e_1712581517/libs/Release/clang-llvm-12.0.0/libs
102 call_patchelf
--remove-rpath RadiumWMPF
/runtime
/libilink2.so
103 # originally /home/ubuntu/.wconan2/ilink_network/7fd99102_1712579641/ilink-network/libs/Release/clang-llvm-12.0.0/libs:
104 call_patchelf
--remove-rpath RadiumWMPF
/runtime
/libilink_network.so
105 # originally ./ (!!!)
106 call_patchelf
--remove-rpath libvoipChannel.so
107 call_patchelf
--remove-rpath libvoipCodec.so
108 call_patchelf
--remove-rpath libconfService.so
110 call_patchelf
--remove-rpath libilink2.so
111 call_patchelf
--remove-rpath libilink_network.so
112 # look like without meaning, same lib on my system
113 call_patchelf
--remove-needed libbz2.so
.1.0 wechat
114 call_patchelf
--add-needed libbz2.so
.1 wechat
117 einfo
"Building stub libuosdevicea.so"
118 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev
/null
119 call_cc
-fPIC -shared ${CFLAGS} ${LDFLAGS} -o libuosdevicea.so libuosdevicea.c || die
124 LIB_DIR
=/usr
/lib
/wechat-universal
125 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev
/null
126 domenu wechat-universal.desktop
127 exeinto
/usr
/lib
/wechat-universal
128 newexe wechat-universal.sh start.sh
129 newexe wechat-universal.sh stop.sh
131 exeinto
${LIB_DIR}/usr
/bin
132 newexe fake_dde-file-manager dde-file-manager
134 insinto
/opt
/wechat-universal
135 doins libuosdevicea.so
136 insinto
${LIB_DIR}/usr
/lib
/license
137 doins libuosdevicea.so
140 # needed on the host side for bwrap to be able to do the bind-mount
141 keepdir
/usr
/lib
/license
143 insinto
${LIB_DIR}/etc
144 newins
"${FILESDIR}/stub-uos-release" lsb-release
146 insinto
/opt
/wechat-universal
147 doins
-r "${S}/opt/apps/${APP_NAME}/files/"*
148 fperms
0755 /opt
/wechat-universal
/{crashpad_handler
,wechat
,wxocr
,wxplayer
}
149 fperms
0755 /opt
/wechat-universal
/RadiumWMPF
/runtime
/WeChatAppEx
{,_crashpad_handler
}
151 einfo
"Installing icons..."
152 for i
in 16 32 64 128 256; do
153 png_file
="${S}/opt/apps/${APP_NAME}/entries/icons/hicolor/${i}x${i}/apps/${APP_NAME}.png"
154 if [ -e "${png_file}" ]; then
155 newicon
-s "${i}" -c apps
"${png_file}" "wechat-universal.png"
161 if [[ "$LANG" == "zh_CN.UTF-8" ]]; then
162 elog
'>> 注意!升级至4.0版本后,环境变量已统一至WECHAT_ 前缀'
163 elog
'>> 执行 `wechat-universal --help` 来查看相关帮助信息'
165 elog
'>> Warning! After updating to v4.0, all environment variables are unified to be prefixed with WECHAT_'
166 elog
'>> Run `wechat-universal --help` to check for the help message'