1 # Copyright 1999-2023 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
39 media-libs/tiff-compat:4
47 x11-libs/libXcomposite
68 # Install scalable icons
69 mkdir
-p "${S}"/usr
/share
/icons
/hicolor
/scalable
/apps || die
70 mv "${S}"/opt
/apps
/${MY_PGK_NAME}/entries
/icons
/hicolor
/scalable
/apps
/*.svg \
71 "${S}"/usr
/share
/icons
/hicolor
/scalable
/apps || die
73 # Set RPATH for preserve-libs handling
74 pushd "${S}"/opt
/apps
/${MY_PGK_NAME}/files || die
77 # Use \x7fELF header to separate ELF executables and libraries
78 [[ -f ${x} && $
(od -t x1
-N 4 "${x}") == *"7f 45 4c 46"* ]] ||
continue
79 local RPATH_ROOT
="/opt/apps/${MY_PGK_NAME}/files"
80 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/"
81 patchelf
--set-rpath "${RPATH_S}" "${x}" || \
82 die
"patchelf failed on ${x}"
83 # patchelf --replace-needed libMagickCore-6.Q16.so.7 libMagickCore-7.Q16.so "${x}" || \
84 # die "patchelf failed on ${x}"
85 patchelf
--replace-needed libjbig.so
.0 libjbig.so
"${x}" || \
86 die
"patchelf failed on ${x}"
91 sed -E -i 's/^Exec=.*$/Exec=zw3d %F/g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
92 sed -E -i 's/^Icon=.*$/Icon=ZW3Dprofessional/g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
93 sed -E -i 's/Application;//g' "${S}/usr/share/applications/${MY_PGK_NAME}.desktop" || die
96 mkdir
-p "${S}"/usr
/bin
/ || die
98 cat >> "${S}"/opt
/apps
/${MY_PGK_NAME}/zw3d
<<- EOF || die
100 sh /opt/apps/${MY_PGK_NAME}/files/zw3drun.sh \$*
103 ln -s /opt
/apps
/${MY_PGK_NAME}/zw3d
"${S}"/usr
/bin
/zw3d || die
105 # Use system libraries
106 # rm -rf "${S}"/opt/apps/${MY_PGK_NAME}/files/lib3rd/libMagickCore* || die
107 # rm -rf "${S}"/opt/apps/${MY_PGK_NAME}/files/lib3rd/libjpeg* || die
109 # Fix coredump while draw 2D sketch due to not find fonts
110 # media-fonts/noto-cjk is required
111 # and should use /usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc
112 local MY_FONT_PATH_OLD
="/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"
113 local MY_FONT_PATH_NEW
="//////usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"
114 bbe
-e "s|${MY_FONT_PATH_OLD}|${MY_FONT_PATH_NEW}|" "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so" \
115 > "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so.tmp" && \
116 mv "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so.tmp" "${S}/opt/apps/${MY_PGK_NAME}/files/lib/libdisp.so" || die
118 # Install package and fix permissions
120 doins
-r opt
/apps
/${MY_PGK_NAME}
124 fperms
0755 /opt
/apps
/${MY_PGK_NAME}/zw3d
127 for x
in $
(find "opt/apps/${MY_PGK_NAME}") ; do
128 # Fix shell script permissions
129 [[ "${x: -3}" == ".sh" ]] && fperms
0755 "/${x}"
130 # Use \x7fELF header to separate ELF executables and libraries
131 [[ -f ${x} && $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] && fperms 0755 "/${x}"