1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit desktop toolchain-funcs rpm 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 RPM_URI
="https://mirrors.opencloudos.tech/opencloudos/9.2/extras"
12 AUR_REPO_REF
="5e8ad25218b82b9bbacb0bd43dce2feb85998889"
14 amd64? ( ${RPM_URI}/x86_64/os/Packages/wechat-beta_${PV}_amd64.rpm )
15 arm64? ( ${RPM_URI}/aarch64/os/Packages/wechat-beta_${PV}_arm64.rpm ) https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap/archive/${AUR_REPO_REF}.tar.gz -> wechat-universal-bwrap-${AUR_REPO_REF}.tar.gz
19 LICENSE
="all-rights-reserved GPL-2"
21 KEYWORDS
="-* ~amd64 ~arm64"
22 RESTRICT
="bindist strip mirror"
24 # the sonames are gathered with the following trick
26 # objdump -p /path/weixin | grep NEEDED | awk '{print $2}' | xargs equery b | sort | uniq
28 app-accessibility/at-spi2-core:2
33 dev-libs/openssl-compat:1.1.1
40 media-libs/tiff-compat:4
47 x11-libs/libXcomposite
55 x11-libs/xcb-util-image
56 x11-libs/xcb-util-keysyms
57 x11-libs/xcb-util-renderutil
65 x11-misc/flatpak-xdg-utils
66 x11-misc/xdg-user-dirs
67 loong? ( virtual/loong-ow-compat )
69 BDEPEND
="dev-util/patchelf"
74 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev
/null
75 eapply
"${FILESDIR}/adjust-launcher-fs-layout-1.patch"
82 local cc
="$(tc-getCC)"
93 einfo
"Fixing blob RUNPATHs"
94 pushd "${S}/opt/wechat-beta" > /dev
/null
95 # originally $ORIGIN:$ORIGIN
96 call_patchelf
--set-rpath '$ORIGIN' RadiumWMPF
/runtime
/WeChatAppEx
97 # originally $ORIGIN:/home/ubuntu/.wconan2/ilink/5ae3ed15_1692179323/libs/Release/clang-llvm-12.0.0/libs:
98 call_patchelf
--remove-rpath RadiumWMPF
/runtime
/libilink2.so
99 # originally /home/ubuntu/.wconan2/ilink_network/cfed668b_1692178974/ilink-network/libs/Release/clang-llvm-12.0.0/libs:
100 call_patchelf
--remove-rpath RadiumWMPF
/runtime
/libilink_network.so
101 # originally ./ (!!!)
102 call_patchelf
--remove-rpath libvoipChannel.so
103 call_patchelf
--remove-rpath libvoipCodec.so
104 call_patchelf
--remove-needed libbz2.so
.1.0 wechat
105 call_patchelf
--add-needed libbz2.so
.1 wechat
108 einfo
"Building stub libuosdevicea.so"
109 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev
/null
110 call_cc
-fPIC -shared ${CFLAGS} ${LDFLAGS} -o libuosdevicea.so libuosdevicea.c || die
115 LIB_DIR
=/usr
/lib
/wechat-universal
116 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev
/null
117 domenu wechat-universal.desktop
118 exeinto
/usr
/lib
/wechat-universal
119 newexe wechat-universal.sh start.sh
120 newexe wechat-universal.sh stop.sh
122 exeinto
${LIB_DIR}/usr
/bin
123 newexe fake_dde-file-manager dde-file-manager
125 insinto
/opt
/wechat-universal
126 doins libuosdevicea.so
127 insinto
${LIB_DIR}/usr
/lib
/license
128 doins libuosdevicea.so
131 # needed on the host side for bwrap to be able to do the bind-mount
132 keepdir
/usr
/lib
/license
134 insinto
${LIB_DIR}/etc
135 newins
"${FILESDIR}/stub-uos-release" lsb-release
137 insinto
/opt
/wechat-universal
138 doins
-r "${S}/opt/wechat-beta/"*
139 fperms
0755 /opt
/wechat-universal
/{crashpad_handler
,wechat
}
140 fperms
0755 /opt
/wechat-universal
/RadiumWMPF
/runtime
/WeChatAppEx
{,_crashpad_handler
}
142 newicon
"${S}/opt/wechat-beta/icons/wechat.png" wechat-universal.png
146 elog
"This WeChat will run in a sys-apps/bubblewrap sandbox, and will only"
147 elog
"be able to access \$XDG_DOCUMENTS_DIR/WeChat_Data by default."
149 elog
"You can bind additional directories into the sandbox by creating a"
150 elog
"~/.config/wechat-universal/binds.list file, with every line an"
151 elog
"absolute or relative-to-HOME path."