net-proxy/yass: add 1.11.1-r1
[gentoo-zh.git] / net-im / dingtalk / dingtalk-7.1.0.31120.ebuild
blob643daf43eaffe77b22a64b16fd3bf05396419b8a
1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 MY_PGK_NAME="com.alibabainc.dingtalk"
7 inherit desktop unpacker xdg
9 DESCRIPTION="Communication platform that supports video and audio conferencing"
10 HOMEPAGE="https://gov.dingtalk.com"
11 SRC_URI="https://dtapp-pub.dingtalk.com/dingtalk-desktop/xc_dingtalk_update/linux_deb/Release/com.alibabainc.${PN}_${PV}_amd64.deb"
13 LICENSE="all-rights-reserved"
14 SLOT="0"
15 KEYWORDS="-* ~amd64"
17 RESTRICT="strip mirror bindist"
19 RDEPEND="
20 dev-libs/wayland
21 dev-libs/libthai
22 dev-qt/qtgui
23 media-libs/tiff-compat:4
24 media-libs/libpulse
25 media-video/rtmpdump
26 net-misc/curl
27 net-nds/openldap
28 sys-libs/glibc
29 sys-libs/zlib
30 sys-process/procps
31 x11-libs/gtk+:2
32 x11-libs/gtk+:3
33 x11-libs/libXScrnSaver
34 virtual/libcrypt
37 DEPEND="${RDEPEND}"
39 BDEPEND="dev-util/patchelf"
41 S=${WORKDIR}
43 QA_PREBUILT="*"
45 src_install() {
46 # Install scalable icon
47 doicon -s scalable "${FILESDIR}"/dingtalk.svg
48 # Remove the libraries that break compatibility in modern systems
49 # Dingtalk will use the system libs instead
50 MY_VERSION=$(cat "${S}"/opt/apps/"${MY_PGK_NAME}"/files/version)
51 # Use system stdc++
52 rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libstdc++* || die
53 # Use system glibc
54 rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libm.so* || die
55 # Use system zlib
56 rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libz* || die
57 # Use system libcurl, fix preserved depend problem
58 rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libcurl.so* || die
59 # use system freetype, fix undefined symbol: FT_Get_Color_Glyph_Layer
60 rm -rf "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libfreetype.so* || die
62 # Set RPATH for preserve-libs handling
63 pushd "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}" || die
64 local x
65 for x in $(find) ; do
66 # Use \x7fELF header to separate ELF executables and libraries
67 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] || continue
68 local RPATH_ROOT="/opt/apps/${MY_PGK_NAME}/files/${MY_VERSION}"
69 patchelf --set-rpath "${RPATH_ROOT}/:${RPATH_ROOT}/swiftshader/:${RPATH_ROOT}/platforminputcontexts/:${RPATH_ROOT}/imageformats/" "${x}" || \
70 die "patchelf failed on ${x}"
71 done
72 popd || die
73 # fix ldd pattern error
74 sed -i 's/libc_version=.*/libc_version=`ldd --version | grep ldd | rev | cut -d" " -f1 | rev`/g' "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh || die
75 # Fix fcitx5
76 sed -i "s/export XMODIFIERS/#export XMODIFIERS/g" "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh || die
77 sed -i "s/export QT_IM_MODULE/#export QT_IM_MODULE/g" "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh || die
79 cat >> "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.head <<- EOF || die
80 #!/bin/sh
81 if [ -z "\${QT_IM_MODULE}" ]
82 then
83 if [ -n "\$(pidof fcitx5)" ]
84 then
85 export XMODIFIERS="@im=fcitx"
86 export QT_IM_MODULE=fcitx
87 elif [ -n "\$(pidof ibus-daemon)" ]
88 then
89 export XMODIFIERS="@im=ibus"
90 export QT_IM_MODULE=ibus
91 elif [ -n "\$(pidof fcitx)" ]
92 then
93 export XMODIFIERS="@im=fcitx"
94 export QT_IM_MODULE=fcitx
97 EOF
99 cat "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.head "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh > "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.new || die
100 cat "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.new > "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh || die
101 rm "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.head "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.new || die
103 # Add dingtalk command
104 mkdir -p "${S}"/usr/bin/ || die
105 ln -s /opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh "${S}"/usr/bin/dingtalk || die
107 # Fix file path and desktop files
108 sed -E -i 's/^Icon=.*$/Icon=dingtalk/g' "${S}"/opt/apps/"${MY_PGK_NAME}"/entries/applications/*.desktop || die
110 mkdir -p usr/share/applications || die
111 mv "${S}"/opt/apps/"${MY_PGK_NAME}"/entries/applications/"${MY_PGK_NAME}".desktop usr/share/applications/ || die
113 # Install package and fix permissions
114 insinto /opt/apps
115 doins -r opt/apps/${MY_PGK_NAME}
116 insinto /usr
117 doins -r usr/*
119 pushd "${S}" || die
120 for x in $(find "opt/apps/${MY_PGK_NAME}") ; do
121 # Fix shell script permissions
122 [[ "${x: -3}" == ".sh" ]] && fperms 0755 "/${x}"
123 # Use \x7fELF header to separate ELF executables and libraries
124 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] && fperms 0755 "/${x}"
125 done
126 popd || die