1 # Copyright 1999-2022 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit desktop multilib unpacker xdg
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"
16 RESTRICT
="strip mirror bindist"
26 BDEPEND
="dev-util/patchelf"
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
)
44 rm opt
/apps
/com.alibabainc.dingtalk
/files
/${version}/libstdc
++* || die
46 rm opt
/apps
/com.alibabainc.dingtalk
/files
/${version}/libm.so
* || die
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
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}"
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
67 if [ -n "\$(pidof fcitx5)" ]
69 export XMODIFIERS="@im=fcitx5"
70 export QT_IM_MODULE=fcitx5
71 elif [ -n "\$(pidof ibus-daemon)" ]
73 export XMODIFIERS="@im=ibus"
74 export QT_IM_MODULE=ibus
76 export XMODIFIERS="@im=fcitx"
77 export QT_IM_MODULE=fcitx
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