app-editors/appflowy-bin: add 0.7.4, drop 0.7.3
[gentoo-zh.git] / net-im / wechat-universal-bwrap / wechat-universal-bwrap-4.0.0.23.ebuild
blob10bebb3fcb27da60fe9a44d0f41ce0f014f6bc47
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) 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="8ee52cb9ff6e00a0a6910e1863cac9bf4c2d386f"
15 SRC_URI="
16 amd64? ( ${URL_ROOT}/${DEB_STEM}_amd64.deb )
17 arm64? ( ${URL_ROOT}/${DEB_STEM}_arm64.deb )
18 loong? ( ${URL_ROOT}/${DEB_STEM}_loongarch64.deb )
19 https://github.com/7Ji-PKGBUILDs/wechat-universal-bwrap/archive/${AUR_REPO_REF}.tar.gz -> wechat-universal-bwrap-${AUR_REPO_REF}.tar.gz
22 S="${WORKDIR}"
23 LICENSE="all-rights-reserved GPL-2"
24 SLOT="0"
25 KEYWORDS="-* ~amd64 ~arm64 ~loong"
26 RESTRICT="bindist strip mirror"
28 # the sonames are gathered with the following trick
30 # objdump -p /path/weixin | grep NEEDED | awk '{print $2}' | xargs equery b | sort | uniq
31 BLOB_RDEPEND="
32 app-accessibility/at-spi2-core:2
33 dev-libs/expat
34 dev-libs/glib:2
35 dev-libs/nspr
36 dev-libs/nss
37 dev-libs/openssl-compat:1.1.1
38 dev-libs/wayland
39 media-libs/alsa-lib
40 media-libs/fontconfig
41 media-libs/freetype
42 media-libs/libglvnd
43 media-libs/mesa
44 media-libs/tiff-compat:4
45 sys-apps/dbus
46 sys-libs/zlib
47 x11-libs/cairo
48 x11-libs/libdrm
49 x11-libs/libX11
50 x11-libs/libxcb
51 x11-libs/libXcomposite
52 x11-libs/libXdamage
53 x11-libs/libXext
54 x11-libs/libXfixes
55 x11-libs/libxkbcommon
56 x11-libs/libXrandr
57 x11-libs/libXrender
58 x11-libs/pango
59 x11-libs/xcb-util-image
60 x11-libs/xcb-util-keysyms
61 x11-libs/xcb-util-renderutil
62 x11-libs/xcb-util-wm
65 RDEPEND="
66 ${BLOB_RDEPEND}
67 sys-apps/bubblewrap
68 sys-apps/lsb-release
69 x11-misc/flatpak-xdg-utils
70 x11-misc/xdg-user-dirs
71 loong? ( virtual/loong-ow-compat )
73 BDEPEND="dev-util/patchelf"
75 QA_PREBUILT="*"
77 src_prepare() {
78 elog "Start patch wechat-universal.sh about launcher fs layout"
79 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev/null
80 eapply "${FILESDIR}/adjust-launcher-fs-layout-2.patch"
81 popd > /dev/null
83 default
86 call_cc() {
87 local cc="$(tc-getCC)"
88 echo "$cc" "$@"
89 "$cc" "$@" || die
92 call_patchelf() {
93 echo patchelf "$@"
94 patchelf "$@" || die
97 src_compile() {
98 einfo "Fixing blob RUNPATHs"
99 pushd "${S}/opt/apps/${APP_NAME}/files" > /dev/null
100 # originally $ORIGIN:$ORIGIN
101 call_patchelf --set-rpath '$ORIGIN' RadiumWMPF/runtime/WeChatAppEx
102 # orginally /data/devops-xwechat/workspace/translib_linux_test/linux/3rd_x86_64/lib
103 call_patchelf --set-rpath '$ORIGIN' libwxtrans.so
104 # originally $ORIGIN:/home/ubuntu/.wconan2/ilink/fcafc08e_1712581517/libs/Release/clang-llvm-12.0.0/libs
105 call_patchelf --set-rpath '$ORIGIN' RadiumWMPF/runtime/libilink2.so
106 # originally /home/ubuntu/.wconan2/ilink_network/7fd99102_1712579641/ilink-network/libs/Release/clang-llvm-12.0.0/libs:
107 call_patchelf --set-rpath '$ORIGIN' RadiumWMPF/runtime/libilink_network.so
108 # originally ./ (!!!)
109 call_patchelf --remove-rpath libvoipChannel.so
110 call_patchelf --remove-rpath libvoipCodec.so
111 call_patchelf --remove-rpath libconfService.so
113 call_patchelf --remove-rpath libilink2.so
114 call_patchelf --remove-rpath libilink_network.so
115 # look like without meaning, same lib on my system
116 call_patchelf --remove-needed libbz2.so.1.0 wechat
117 call_patchelf --add-needed libbz2.so.1 wechat
119 einfo 'Stripping executable permission of non-ELF files...'
120 local _file
121 for _file in $(find -type f -perm /111); do
122 readelf -h "${_file}" &>/dev/null && continue || true
123 stat --printf ' %A => ' "${_file}"
124 chmod u-x,g-x,o-x "${_file}"
125 stat --format '%A %n' "${_file}"
126 done
128 popd > /dev/null
130 einfo "Building stub libuosdevicea.so"
131 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev/null
132 call_cc -fPIC -shared ${CFLAGS} ${LDFLAGS} -o libuosdevicea.so libuosdevicea.c || die
133 popd > /dev/null
136 src_install() {
137 LIB_DIR=/usr/lib/wechat-universal
138 pushd "${S}/wechat-universal-bwrap-${AUR_REPO_REF}" > /dev/null
139 domenu wechat-universal.desktop
140 exeinto /usr/lib/wechat-universal
141 newexe wechat-universal.sh start.sh
142 newexe wechat-universal.sh stop.sh
144 exeinto ${LIB_DIR}/usr/bin
145 newexe fake_dde-file-manager dde-file-manager
147 insinto /opt/wechat-universal
148 doins libuosdevicea.so
149 insinto ${LIB_DIR}/usr/lib/license
150 doins libuosdevicea.so
151 popd > /dev/null
153 # needed on the host side for bwrap to be able to do the bind-mount
154 keepdir /usr/lib/license
156 insinto ${LIB_DIR}/etc
157 newins "${FILESDIR}/stub-uos-release" lsb-release
159 insinto /opt/wechat-universal
160 doins -r "${S}/opt/apps/${APP_NAME}/files/"*
161 fperms 0755 /opt/wechat-universal/{crashpad_handler,wechat,wxocr,wxplayer}
162 fperms 0755 /opt/wechat-universal/RadiumWMPF/runtime/WeChatAppEx{,_crashpad_handler}
164 einfo "Installing icons..."
165 for i in 16 32 64 128 256; do
166 png_file="${S}/opt/apps/${APP_NAME}/entries/icons/hicolor/${i}x${i}/apps/${APP_NAME}.png"
167 if [ -e "${png_file}" ]; then
168 newicon -s "${i}" -c apps "${png_file}" "wechat-universal.png"
170 done
173 pkg_postinst() {
174 if [[ "$LANG" == "zh_CN.UTF-8" ]]; then
175 elog '>> 注意!升级至4.0版本后,环境变量已统一至WECHAT_ 前缀'
176 elog '>> 执行 `wechat-universal --help` 来查看相关帮助信息'
177 else
178 elog '>> Warning! After updating to v4.0, all environment variables are unified to be prefixed with WECHAT_'
179 elog '>> Run `wechat-universal --help` to check for the help message'