net-im/dingtalk: bump to 1.0.0.203 (#1147)
[gentoo-zh.git] / net-im / dingtalk / dingtalk-1.0.0.203.ebuild
blobd187cb99cd2148d46448947d4bfdd21a3093a3a2
1 # Copyright 1999-2021 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="com.alibabainc.${PN}_${PV}_amd64.deb"
12 LICENSE="all-rights-reserved"
13 KEYWORDS="-* ~amd64"
14 SLOT="0"
16 RESTRICT="strip mirror bindist fetch"
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 [ -z "\$(pidof fcitx5)" ]
68 then
69 export XMODIFIERS="@im=fcitx5"
70 export QT_IM_MODULE=fcitx5
71 elif [ -z "\$(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
89 pkg_nofetch() {
90 einfo "Please follow https://h5.dingtalk.com/circle/healthCheckin.html?corpId=dingdc75e6471f48e6171a5c74e782e240c4&c003e554-f=3edf7be3-a&cbdbhh=qwertyuiop and download"
91 einfo "${DISTFILE_BIN}"
92 einfo "and place it in your DISTDIR directory."