media-fonts/sarasa-gothic: add 1.0.24, drop 1.0.23
[gentoo-zh.git] / net-im / dingtalk / dingtalk-7.1.0.31017.ebuild
blob8e4c834bea79390ad2c60e3a047c12a5748b82d7
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/libthai
21         dev-qt/qtgui
22         media-libs/tiff-compat:4
23         media-libs/libpulse
24         media-video/rtmpdump
25         net-misc/curl
26         net-nds/openldap
27         sys-libs/glibc
28         sys-libs/zlib
29         sys-process/procps
30         x11-libs/gtk+:2
31         x11-libs/gtk+:3
32         x11-libs/libXScrnSaver
33         virtual/libcrypt
36 DEPEND="${RDEPEND}"
38 BDEPEND="dev-util/patchelf"
40 S=${WORKDIR}
42 QA_PREBUILT="*"
44 src_install() {
45         # Install scalable icon
46         doicon -s scalable "${FILESDIR}"/dingtalk.svg
47         # Remove the libraries that break compatibility in modern systems
48         # Dingtalk will use the system libs instead
49         MY_VERSION=$(cat "${S}"/opt/apps/"${MY_PGK_NAME}"/files/version)
50         # Use system stdc++
51         rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libstdc++* || die
52         # Use system glibc
53         rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libm.so* || die
54         # Use system zlib
55         rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libz* || die
56         # Use system libcurl, fix preserved depend problem
57         rm -f "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libcurl.so* || die
58         # use system freetype, fix undefined symbol: FT_Get_Color_Glyph_Layer
59         rm -rf "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}"/libfreetype.so* || die
61         # Set RPATH for preserve-libs handling
62         pushd "${S}"/opt/apps/"${MY_PGK_NAME}"/files/"${MY_VERSION}" || die
63         local x
64         for x in $(find) ; do
65                 # Use \x7fELF header to separate ELF executables and libraries
66                 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] || continue
67                 local RPATH_ROOT="/opt/apps/${MY_PGK_NAME}/files/${MY_VERSION}"
68                 patchelf --set-rpath "${RPATH_ROOT}/:${RPATH_ROOT}/swiftshader/:${RPATH_ROOT}/platforminputcontexts/:${RPATH_ROOT}/imageformats/" "${x}" || \
69                         die "patchelf failed on ${x}"
70         done
71         popd || die
72         # fix ldd pattern error
73         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
74         # Fix fcitx5
75         sed -i "s/export XMODIFIERS/#export XMODIFIERS/g" "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh || die
76         sed -i "s/export QT_IM_MODULE/#export QT_IM_MODULE/g" "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh || die
78         cat >> "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.head <<- EOF || die
79 #!/bin/sh
80 if [ -z "\${QT_IM_MODULE}" ]
81 then
82         if [ -n "\$(pidof fcitx5)" ]
83         then
84                 export XMODIFIERS="@im=fcitx"
85                 export QT_IM_MODULE=fcitx
86         elif [ -n "\$(pidof ibus-daemon)" ]
87         then
88                 export XMODIFIERS="@im=ibus"
89                 export QT_IM_MODULE=ibus
90         elif [ -n "\$(pidof fcitx)" ]
91         then
92                 export XMODIFIERS="@im=fcitx"
93                 export QT_IM_MODULE=fcitx
94         fi
96         EOF
98         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
99         cat "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.new > "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh || die
100         rm "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.head "${S}"/opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh.new || die
102         # Add dingtalk command
103         mkdir -p "${S}"/usr/bin/ || die
104         ln -s  /opt/apps/"${MY_PGK_NAME}"/files/Elevator.sh "${S}"/usr/bin/dingtalk || die
106         # Fix file path and desktop files
107         sed -E -i 's/^Icon=.*$/Icon=dingtalk/g' "${S}"/opt/apps/"${MY_PGK_NAME}"/entries/applications/*.desktop || die
109         mkdir -p usr/share/applications || die
110         mv "${S}"/opt/apps/"${MY_PGK_NAME}"/entries/applications/"${MY_PGK_NAME}".desktop usr/share/applications/ || die
112         # Install package and fix permissions
113         insinto /opt/apps
114         doins -r opt/apps/${MY_PGK_NAME}
115         insinto /usr
116         doins -r usr/*
118         pushd "${S}" || die
119         for x in $(find "opt/apps/${MY_PGK_NAME}") ; do
120                 # Fix shell script permissions
121                 [[ "${x: -3}" == ".sh" ]] && fperms 0755 "/${x}"
122                 # Use \x7fELF header to separate ELF executables and libraries
123                 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] && fperms 0755 "/${x}"
124         done
125         popd || die