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://home-store-packages.uniontech.com/appstore/pool/appstore/c/${MY_PGK_NAME}/${MY_PGK_NAME}_${PV}_amd64.deb -> ${P}.deb"
13 LICENSE
="all-rights-reserved"
17 RESTRICT
="strip mirror bindist"
30 dev-qt/qtprintsupport:5
37 media-libs/opencollada
38 || ( media-libs/tiff:0/0 media-libs/tiff-compat:4 )
46 x11-libs/libXcomposite
67 # Install scalable icons
68 mkdir
-p "${S}"/usr
/share
/icons
/hicolor
/scalable
/apps || die
69 mv "${S}"/opt/apps/${MY_PGK_NAME}/entries/icons/hicolor/scalable/apps/*.svg "${S}"/usr
/share
/icons
/hicolor
/scalable
/apps || die
71 # Set RPATH for preserve-libs handling
72 pushd "${S}"/opt
/apps
/${MY_PGK_NAME}/files || die
75 # Use \x7fELF header to separate ELF executables and libraries
76 [[ -f ${x} && $
(od -t x1
-N 4 "${x}") == *"7f 45 4c 46"* ]] ||
continue
77 local RPATH_ROOT
="/opt/apps/${MY_PGK_NAME}/files"
78 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/:/usr/lib64/"
79 patchelf
--set-rpath "${RPATH_S}" "${x}" || \
80 die
"patchelf failed on ${x}"
81 # patchelf --replace-needed libMagickCore-6.Q16.so.7 libMagickCore-7.Q16.so "${x}" || \
82 # die "patchelf failed on ${x}"
83 patchelf
--replace-needed libjbig.so
.0 libjbig.so
"${x}" || \
84 die
"patchelf failed on ${x}"
89 sed -E -i 's/^Exec=.*$/Exec=zw3d %F/g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
90 sed -E -i 's/^Icon=.*$/Icon=ZW3Dprofessional/g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
91 sed -E -i 's/Application;//g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
94 mkdir
-p "${S}"/usr
/bin
/ || die
96 cat >> "${S}"/opt
/apps
/${MY_PGK_NAME}/zw3d
<<- EOF || die
98 sh /opt/apps/${MY_PGK_NAME}/files/zw3drun.sh \$*
101 ln -s /opt
/apps
/${MY_PGK_NAME}/zw3d
"${S}"/usr
/bin
/zw3d || die
103 # Use system libraries
104 # rm -rf "${S}"/opt/apps/${MY_PGK_NAME}/files/lib3rd/libMagickCore* || die
105 # rm -rf "${S}"/opt/apps/${MY_PGK_NAME}/files/lib3rd/libjpeg* || die
107 # Fix coredump while draw 2D sketch due to not find fonts
108 # media-fonts/noto-cjk is required
109 # and should use /usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc
110 local MY_FONT_PATH_OLD
="/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"
111 local MY_FONT_PATH_NEW
="//////usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"
112 bbe
-e "s|${MY_FONT_PATH_OLD}|${MY_FONT_PATH_NEW}|" "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so" > "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so.tmp" && \
113 mv "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so.tmp" "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so" || die
115 # Install package and fix permissions
117 doins
-r opt
/apps
/${MY_PGK_NAME}
121 fperms
0755 /opt
/apps
/${MY_PGK_NAME}/zw3d
124 for x
in $
(find "opt/apps/${MY_PGK_NAME}") ; do
125 # Fix shell script permissions
126 [[ "${x: -3}" == ".sh" ]] && fperms
0755 "/${x}"
127 # Use \x7fELF header to separate ELF executables and libraries
128 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] && fperms 0755 "/${x}"