1 # Copyright 1999-2022 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 MY_PGK_NAME
="com.zwsoft.zw3dprofessional"
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"
17 RESTRICT
="strip mirror bindist"
38 x11-libs/libXcomposite
49 BDEPEND
="dev-util/patchelf"
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
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}"
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
81 mkdir
-p "${S}"/usr
/bin
/ || die
83 cat >> "${S}"/opt
/apps
/${MY_PGK_NAME}/zw3d
<<- EOF || die
85 sh /opt/apps/${MY_PGK_NAME}/files/zw3drun.sh \$*
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
96 doins
-r opt
/apps
/${MY_PGK_NAME}
100 fperms
0755 /opt
/apps
/${MY_PGK_NAME}/zw3d
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}"