media-gfx/freecad: install the proper icons and file associations (bug 551872, thanks...
authorMichael Weber <xmw@gentoo.org>
Tue, 11 Aug 2015 09:01:49 +0000 (11:01 +0200)
committerMichael Weber <xmw@gentoo.org>
Tue, 11 Aug 2015 09:02:05 +0000 (11:02 +0200)
Package-Manager: portage-2.2.20

media-gfx/freecad/files/freecad.sharedmimeinfo [new file with mode: 0644]
media-gfx/freecad/freecad-0.14.3702-r1.ebuild
media-gfx/freecad/freecad-0.15.4671.ebuild
media-gfx/freecad/freecad-9999.ebuild

diff --git a/media-gfx/freecad/files/freecad.sharedmimeinfo b/media-gfx/freecad/files/freecad.sharedmimeinfo
new file mode 100644 (file)
index 0000000..6d5e93e
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+       <mime-type type="application/x-extension-fcstd">
+               <!-- <sub-class-of type="application/zip"/> -->
+               <comment>FreeCAD document files</comment>
+               <glob pattern="*.fcstd"/>
+       </mime-type>
+</mime-info>
index 30df418e8e48bc10cd2daa4c25f13948d928579d..c1158cb385b6f40494451a6b6d010239dd315d2a 100644 (file)
@@ -6,7 +6,7 @@ EAPI=5
 
 PYTHON_COMPAT=( python2_7 )
 
-inherit cmake-utils eutils fortran-2 multilib python-single-r1
+inherit cmake-utils eutils fortran-2 multilib python-single-r1 fdo-mime
 
 DESCRIPTION="QT based Computer Aided Design application"
 HOMEPAGE="http://www.freecadweb.org/"
@@ -123,14 +123,34 @@ src_install() {
                "${EROOT}"usr/$(get_libdir)/${P}/bin/FreeCADCmd \
                "" "${EROOT}"usr/$(get_libdir)/${P}/lib
 
-       newicon src/Main/icon.ico ${PN}.ico
-       make_desktop_entry FreeCAD
+       make_desktop_entry FreeCAD "FreeCAD" "" "" "MimeType=application/x-extension-fcstd;"
 
        dodoc README.Linux ChangeLog.txt
 
+       # install mimetype for FreeCAD files
+       insinto /usr/share/mime/packages
+       newins "${FILESDIR}"/${PN}.sharedmimeinfo "${PN}.xml"
+
+       # install icons to correct place rather than /usr/share/freecad
+       pushd "${ED}/usr/share/${P}"
+       for size in 16 32 48 64; do
+               newicon -s ${size} freecad-icon-${size}.png freecad.png
+       done
+       doicon -s scalable freecad.svg
+       newicon -s 64 -c mimetypes freecad-doc.png application-x-extension-fcstd.png
+       popd
+
        # disable compression of QT assistant help files
        >> "${ED}"usr/share/doc/${P}/freecad.qhc.ecompress.skip
        >> "${ED}"usr/share/doc/${P}/freecad.qch.ecompress.skip
 
        python_optimize "${ED}"usr/{$(get_libdir),share}/${P}/Mod/
 }
+
+pkg_postinst() {
+       fdo-mime_mime_database_update
+}
+
+pkg_postrm() {
+       fdo-mime_mime_database_update
+}
index 63375fb695b57e7525bd250f6587b3778ead1261..a0b49547df4fdfb68c93b38cd53e029bdb1f9580 100644 (file)
@@ -6,7 +6,7 @@ EAPI=5
 
 PYTHON_COMPAT=( python2_7 )
 
-inherit cmake-utils eutils fortran-2 multilib python-single-r1
+inherit cmake-utils eutils fortran-2 multilib python-single-r1 fdo-mime
 
 DESCRIPTION="QT based Computer Aided Design application"
 HOMEPAGE="http://www.freecadweb.org/"
@@ -111,10 +111,22 @@ src_install() {
                "${EROOT}"usr/$(get_libdir)/${P}/bin/FreeCADCmd \
                "" "${EROOT}"usr/$(get_libdir)/${P}/lib
 
-       newicon src/Main/icon.ico ${PN}.ico
-       make_desktop_entry FreeCAD
+       make_desktop_entry FreeCAD "FreeCAD" "" "" "MimeType=application/x-extension-fcstd;"
 
-       dodoc README.Linux ChangeLog.txt
+       dodoc README.linux ChangeLog.txt
+
+       # install mimetype for FreeCAD files
+       insinto /usr/share/mime/packages
+       newins "${FILESDIR}"/${PN}.sharedmimeinfo "${PN}.xml"
+
+       # install icons to correct place rather than /usr/share/freecad
+       pushd "${ED}/usr/share/${P}"
+       for size in 16 32 48 64; do
+               newicon -s ${size} freecad-icon-${size}.png freecad.png
+       done
+       doicon -s scalable freecad.svg
+       newicon -s 64 -c mimetypes freecad-doc.png application-x-extension-fcstd.png
+       popd
 
        # disable compression of QT assistant help files
        >> "${ED}"usr/share/doc/${P}/freecad.qhc.ecompress.skip
@@ -122,3 +134,11 @@ src_install() {
 
        python_optimize "${ED}"usr/{$(get_libdir),share}/${P}/Mod/
 }
+
+pkg_postinst() {
+       fdo-mime_mime_database_update
+}
+
+pkg_postrm() {
+       fdo-mime_mime_database_update
+}
index 6b494f999928d0e523b79717c0293c845a1492a7..5001cf3a2408d767b1a272e0a5b12af3c1a0b5b1 100644 (file)
@@ -6,7 +6,7 @@ EAPI=5
 
 PYTHON_COMPAT=( python2_7 )
 
-inherit cmake-utils eutils git-r3 fortran-2 multilib python-single-r1
+inherit cmake-utils eutils git-r3 fortran-2 multilib python-single-r1 fdo-mime
 
 DESCRIPTION="QT based Computer Aided Design application"
 HOMEPAGE="http://www.freecadweb.org/"
@@ -17,7 +17,6 @@ SLOT="0"
 KEYWORDS=""
 IUSE=""
 
-# sci-libs/opencascade ok: failed: 6.9.0
 COMMON_DEPEND="dev-cpp/eigen:3
        dev-libs/boost
        dev-libs/xerces-c[icu]
@@ -112,14 +111,34 @@ src_install() {
                "${EROOT}"usr/$(get_libdir)/${P}/bin/FreeCADCmd \
                "" "${EROOT}"usr/$(get_libdir)/${P}/lib
 
-       newicon src/Main/icon.ico ${PN}.ico
-       make_desktop_entry FreeCAD
+       make_desktop_entry FreeCAD "FreeCAD" "" "" "MimeType=application/x-extension-fcstd;"
 
        dodoc README.md ChangeLog.txt
 
+       # install mimetype for FreeCAD files
+       insinto /usr/share/mime/packages
+       newins "${FILESDIR}"/${PN}.sharedmimeinfo "${PN}.xml"
+
+       # install icons to correct place rather than /usr/share/freecad
+       pushd "${ED}/usr/share/${P}"
+       for size in 16 32 48 64; do
+               newicon -s ${size} freecad-icon-${size}.png freecad.png
+       done
+       doicon -s scalable freecad.svg
+       newicon -s 64 -c mimetypes freecad-doc.png application-x-extension-fcstd.png
+       popd
+
        # disable compression of QT assistant help files
        >> "${ED}"usr/share/doc/${P}/freecad.qhc.ecompress.skip
        >> "${ED}"usr/share/doc/${P}/freecad.qch.ecompress.skip
 
        python_optimize "${ED}"usr/{$(get_libdir),share}/${P}/Mod/
 }
+
+pkg_postinst() {
+       fdo-mime_mime_database_update
+}
+
+pkg_postrm() {
+       fdo-mime_mime_database_update
+}