media-gfx/zw3d: fix install path to solve maintenance issues
[gentoo-zh.git] / media-gfx / zw3d / zw3d-2022.26.00-r1.ebuild
blob9e849cc8a0a66a562ba61ff88a6993a6631f9b9d
1 # Copyright 1999-2022 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 MY_PGK_NAME="com.zwsoft.zw3dprofessional"
7 inherit unpacker xdg
9 DESCRIPTION="CAD/CAM software for 3D design and processing"
10 HOMEPAGE="https://www.zwsoft.cn/product/zw3d/linux"
11 SRC_URI="https://download.zwcad.com/zw3d/3d_linux/2022/ZW3D-2022-Professional-V1.0_amd64.deb"
13 LICENSE="all-rights-reserved"
14 SLOT="0"
15 KEYWORDS="-* ~amd64"
17 RESTRICT="strip mirror bindist"
19 RDEPEND="
20 app-arch/bzip2
21 app-arch/xz-utils
22 dev-libs/atk
23 dev-libs/glib:2
24 dev-libs/libpcre
25 dev-libs/libxml2
26 dev-qt/qtsvg:5
27 dev-qt/qtwayland:5
28 media-gfx/imagemagick
29 media-libs/libglvnd
30 media-libs/libpng
31 media-libs/tiff
32 sys-libs/zlib
33 x11-libs/cairo
34 x11-libs/gdk-pixbuf:2
35 x11-libs/gtk+:3
36 x11-libs/libX11
37 x11-libs/libxcb
38 x11-libs/libXcomposite
39 x11-libs/libXext
40 x11-libs/libxkbcommon
41 x11-libs/libXmu
42 x11-libs/libXrender
43 x11-libs/libXt
44 x11-libs/pango
47 DEPEND="${RDEPEND}"
49 BDEPEND="dev-util/patchelf"
51 S=${WORKDIR}
53 QA_PREBUILT="*"
55 src_install() {
56 # Install scalable icons
57 mkdir -p "${S}"/usr/share/icons/hicolor/scalable/apps || die
58 mv "${S}"/opt/apps/${MY_PGK_NAME}/entries/icons/hicolor/scalable/apps/*.svg "${S}"/usr/share/icons/hicolor/scalable/apps || die
60 # Set RPATH for preserve-libs handling
61 pushd "${S}"/opt/apps/${MY_PGK_NAME}/files || die
62 local x
63 for x in $(find) ; do
64 # Use \x7fELF header to separate ELF executables and libraries
65 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] || continue
66 local RPATH_ROOT="/opt/apps/${MY_PGK_NAME}/files"
67 local RPATH_S="${RPATH_ROOT}/:${RPATH_ROOT}/lib/:${RPATH_ROOT}/lib/xlator/:${RPATH_ROOT}/lib/xlator/InterOp/:${RPATH_ROOT}/libqt/:${RPATH_ROOT}/libqt/plugins/designer/:${RPATH_ROOT}/lib3rd/"
68 patchelf --set-rpath "${RPATH_S}" "${x}" || \
69 die "patchelf failed on ${x}"
70 patchelf --replace-needed libMagickCore-6.Q16.so.7 libMagickCore-7.Q16.so "${x}" || \
71 die "patchelf failed on ${x}"
72 done
73 popd || die
75 # Fix desktop files
76 sed -E -i 's/^Exec=.*$/Exec=zw3d %F/g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
77 sed -E -i 's/^Icon=.*$/Icon=ZW3Dprofessional/g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
78 sed -E -i 's/Application;//g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
80 # Add zw3d command
81 mkdir -p "${S}"/usr/bin/ || die
83 cat >> "${S}"/opt/apps/${MY_PGK_NAME}/zw3d <<- EOF || die
84 #!/bin/sh
85 sh /opt/apps/${MY_PGK_NAME}/files/zw3drun.sh \$*
86 EOF
88 ln -s /opt/apps/${MY_PGK_NAME}/zw3d "${S}"/usr/bin/zw3d || die
90 # Use system libraries
91 rm -rf "${S}"/opt/apps/${MY_PGK_NAME}/files/lib3rd/libMagickCore* || die
92 rm -rf "${S}"/opt/apps/${MY_PGK_NAME}/files/lib3rd/libjpeg* || die
94 # Install package and fix permissions
95 insinto /opt/apps
96 doins -r opt/apps/${MY_PGK_NAME}
97 insinto /usr
98 doins -r usr/*
100 fperms 0755 /opt/apps/${MY_PGK_NAME}/zw3d
102 pushd "${S}" || die
103 for x in $(find "opt/apps/${MY_PGK_NAME}") ; do
104 # Fix shell script permissions
105 [[ "${x: -3}" == ".sh" ]] && fperms 0755 "/${x}"
106 # Use \x7fELF header to separate ELF executables and libraries
107 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] && fperms 0755 "/${x}"
108 done
109 popd || die