net-im/dingtalk: drop old
[gentoo-zh.git] / net-im / dingtalk / dingtalk-1.2.0.140.ebuild
blob52b36eb0e9b8417747b9d06d29d290008810d895
1 # Copyright 1999-2022 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=7
6 inherit desktop multilib unpacker xdg
8 DESCRIPTION="dingtalk"
9 HOMEPAGE="https://gov.dingtalk.com"
10 SRC_URI="https://dtapp-pub.dingtalk.com/dingtalk-desktop/xc_dingtalk_update/linux_deb/Release/com.alibabainc.${PN}_${PV}_amd64.deb"
12 LICENSE="all-rights-reserved"
13 KEYWORDS="-* ~amd64"
14 SLOT="0"
16 RESTRICT="strip mirror bindist"
18 RDEPEND="
19 dev-libs/libthai
20 net-nds/openldap
21 sys-libs/glibc
22 sys-libs/zlib
23 sys-process/procps
26 BDEPEND="dev-util/patchelf"
28 DEPEND="${RDEPEND}"
30 S=${WORKDIR}
32 src_unpack() {
36 src_install() {
37 dodir /
38 cd "${ED}" || die
39 unpacker
40 # Remove the libraries that break compatibility in modern systems
41 # Dingtalk will use the system libs instead
42 version=$(cat opt/apps/com.alibabainc.dingtalk/files/version)
43 # Use system stdc++
44 rm opt/apps/com.alibabainc.dingtalk/files/${version}/libstdc++* || die
45 # Use system glibc
46 rm opt/apps/com.alibabainc.dingtalk/files/${version}/libm.so* || die
47 # Use system zlib
48 rm opt/apps/com.alibabainc.dingtalk/files/${version}/libz* || die
50 # Set RPATH for preserve-libs handling
51 pushd "opt/apps/com.alibabainc.dingtalk/files/${version}/" || die
52 local x
53 for x in $(find) ; do
54 # Use \x7fELF header to separate ELF executables and libraries
55 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] || continue
56 local rpath_root="/opt/apps/com.alibabainc.dingtalk/files/${version}"
57 patchelf --set-rpath "${rpath_root}/:${rpath_root}/swiftshader/:${rpath_root}/platforminputcontexts/:${rpath_root}/imageformats/" "${x}" || \
58 die "patchelf failed on ${x}"
59 done
60 popd || die
61 # Fix fcitx5
62 sed -i "s/export XMODIFIERS/#export XMODIFIERS/g" opt/apps/com.alibabainc.dingtalk/files/Elevator.sh || die
63 sed -i "s/export QT_IM_MODULE/#export QT_IM_MODULE/g" opt/apps/com.alibabainc.dingtalk/files/Elevator.sh || die
65 cat >> opt/apps/com.alibabainc.dingtalk/files/Elevator.sh.head <<- EOF || die
66 #!/bin/sh
67 if [ -n "\$(pidof fcitx5)" ]
68 then
69 export XMODIFIERS="@im=fcitx5"
70 export QT_IM_MODULE=fcitx5
71 elif [ -n "\$(pidof ibus-daemon)" ]
72 then
73 export XMODIFIERS="@im=ibus"
74 export QT_IM_MODULE=ibus
75 else
76 export XMODIFIERS="@im=fcitx"
77 export QT_IM_MODULE=fcitx
79 EOF
81 cat opt/apps/com.alibabainc.dingtalk/files/Elevator.sh.head opt/apps/com.alibabainc.dingtalk/files/Elevator.sh > opt/apps/com.alibabainc.dingtalk/files/Elevator.sh.new || die
82 cat opt/apps/com.alibabainc.dingtalk/files/Elevator.sh.new > opt/apps/com.alibabainc.dingtalk/files/Elevator.sh || die
83 rm opt/apps/com.alibabainc.dingtalk/files/Elevator.sh.head opt/apps/com.alibabainc.dingtalk/files/Elevator.sh.new || die
85 mkdir -p usr/share/applications || die
86 cp opt/apps/com.alibabainc.dingtalk/entries/applications/com.alibabainc.dingtalk.desktop usr/share/applications/ || die