net-im/tencent-qq: bump version to 3.2.15_p241224
[gentoo-zh.git] / net-im / wechat-universal-bwrap / wechat-universal-bwrap-1.0.0.242.ebuild
blob0eb82dce09a3b3069691b6e751e55d8dd2f5057a
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 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"
13 SRC_URI="
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
18 S="${WORKDIR}"
19 LICENSE="all-rights-reserved GPL-2"
20 SLOT="0"
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
27 BLOB_RDEPEND="
28 app-accessibility/at-spi2-core:2
29 dev-libs/expat
30 dev-libs/glib:2
31 dev-libs/nspr
32 dev-libs/nss
33 dev-libs/openssl-compat:1.1.1
34 dev-libs/wayland
35 media-libs/alsa-lib
36 media-libs/fontconfig
37 media-libs/freetype
38 media-libs/libglvnd
39 media-libs/mesa
40 media-libs/tiff-compat:4
41 sys-apps/dbus
42 sys-libs/zlib
43 x11-libs/cairo
44 x11-libs/libdrm
45 x11-libs/libX11
46 x11-libs/libxcb
47 x11-libs/libXcomposite
48 x11-libs/libXdamage
49 x11-libs/libXext
50 x11-libs/libXfixes
51 x11-libs/libxkbcommon
52 x11-libs/libXrandr
53 x11-libs/libXrender
54 x11-libs/pango
55 x11-libs/xcb-util-image
56 x11-libs/xcb-util-keysyms
57 x11-libs/xcb-util-renderutil
58 x11-libs/xcb-util-wm
61 RDEPEND="
62 ${BLOB_RDEPEND}
63 sys-apps/bubblewrap
64 sys-apps/lsb-release
65 x11-misc/flatpak-xdg-utils
66 x11-misc/xdg-user-dirs
67 loong? ( virtual/loong-ow-compat )
69 BDEPEND="dev-util/patchelf"
71 QA_PREBUILT="*"
73 src_prepare() {
74 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev/null
75 eapply "${FILESDIR}/adjust-launcher-fs-layout-1.patch"
76 popd > /dev/null
78 default
81 call_cc() {
82 local cc="$(tc-getCC)"
83 echo "$cc" "$@"
84 "$cc" "$@" || die
87 call_patchelf() {
88 echo patchelf "$@"
89 patchelf "$@" || die
92 src_compile() {
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
106 popd > /dev/null
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
111 popd > /dev/null
114 src_install() {
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
129 popd > /dev/null
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
145 pkg_postinst() {
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."
148 elog
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."