modified configure and makefile for handling mimedb update
authorArun Persaud <arun@nubati.net>
Thu, 16 Feb 2012 04:59:09 +0000 (20:59 -0800)
committerArun Persaud <arun@nubati.net>
Thu, 16 Feb 2012 06:36:58 +0000 (22:36 -0800)
the default configure will install them using the xdg commands (if they exist on the system)

Makefile.am
configure.ac

index 3f0e37d..50cf922 100644 (file)
@@ -68,7 +68,11 @@ dist_svgicon_DATA = xboard.svg
 ### desktop files for KDE and gnome
 
 Applicationsdir = $(datadir)/applications
-Applications_DATA = xboard.desktop
+Applications_DATA = xboard.desktop xboard-fen-viewer.desktop  xboard-pgn-viewer.desktop  xboard-tourney.desktop
+
+### mime file
+mimedir = $(datadir)/mime/packages
+mime_DATA = xboard.xml
 
 ### directory and files for bitmaps
 
@@ -171,27 +175,35 @@ distclean-local:
 xboard.man: xboard.texi copyright.texi gpl.texinfo version.texi
        $(srcdir)/texi2man $(srcdir)/xboard.texi > xboard.man || (rm -f xboard.man ; false)
 
+### install mime-type files and corresponding icons and menu entries if enabled during configure
+
 install-data-hook: install-mime-database
 uninstall-hook: uninstall-mime-database
+
 install-mime-database:
+if ENABLE_UPDATE_MIMEDB        
        -if test -z "$(DESTDIR)" -a -n "$(XDG_MIME)" -a -n "$(XDG_DESKTOP_MENU)" -a -n "$(XDG_ICON_RESOURCE)" ; then \
-               xdg-mime install --mode system --novendor xboard.xml ;\
-               xdg-desktop-menu install --mode system --novendor xboard-pgn-viewer.desktop;\
-               xdg-desktop-menu install --mode system --novendor xboard-fen-viewer.desktop;\
-               xdg-desktop-menu install --mode system --novendor xboard-tourney.desktop;\
-               xdg-icon-resource install --context mimetypes --size 32 pixmaps/board32.xpm application-x-chess-pgn;\
-               xdg-icon-resource install --context mimetypes --size 32 pixmaps/cross32.xpm application-x-xboard-trn;\
-               xdg-icon-resource install --context mimetypes --size 48 pixmaps/board48.xpm application-x-chess-pgn;\
-               xdg-icon-resource install --context mimetypes --size 48 pixmaps/cross48.xpm application-x-xboard-trn;\
+               $(XDG_MIME) install --mode system --novendor xboard.xml ;\
+               $(XDG_DESKTOP_MENU) install --mode system --novendor xboard-pgn-viewer.desktop;\
+               $(XDG_DESKTOP_MENU) install --mode system --novendor xboard-fen-viewer.desktop;\
+               $(XDG_DESKTOP_MENU) install --mode system --novendor xboard-tourney.desktop;\
+               $(XDG_ICON_RESOURCE) install --context mimetypes --size 32 pixmaps/board32.xpm application-x-chess-pgn;\
+               $(XDG_ICON_RESOURCE) install --context mimetypes --size 32 pixmaps/cross32.xpm application-x-xboard-trn;\
+               $(XDG_ICON_RESOURCE) install --context mimetypes --size 48 pixmaps/board48.xpm application-x-chess-pgn;\
+               $(XDG_ICON_RESOURCE) install --context mimetypes --size 48 pixmaps/cross48.xpm application-x-xboard-trn;\
        fi
+endif
+
 uninstall-mime-database:
+if ENABLE_UPDATE_MIMEDB        
        -if test -z "$(DESTDIR)" -a -n "$(XDG_MIME)" -a -n "$(XDG_DESKTOP_MENU)" -a -n "$(XDG_ICON_RESOURCE)" ; then \
-               xdg-mime uninstall --mode system --novendor xboard.xml;\
-               xdg-desktop-menu uninstall --mode system --novendor xboard-pgn-viewer.desktop;\
-               xdg-desktop-menu uninstall --mode system --novendor xboard-fen-viewer.desktop;\
-               xdg-desktop-menu uninstall --mode system --novendor xboard-tourney.desktop;\
-               xdg-icon-resource uninstall --context mimetypes --size 32 board32.xpm application-x-chess-pgn;\
-               xdg-icon-resource uninstall --context mimetypes --size 32 cross32.xpm application-x-xboard-trn;\
-               xdg-icon-resource uninstall --context mimetypes --size 48 board48.xpm application-x-chess-pgn;\
-               xdg-icon-resource uninstall --context mimetypes --size 48 cross48.xpm application-x-xboard-trn;\
+               $(XDG-MIME) uninstall --mode system --novendor xboard.xml;\
+               $(XDG_DESKTOP_MENU) uninstall --mode system --novendor xboard-pgn-viewer.desktop;\
+               $(XDG_DESKTOP_MENU) uninstall --mode system --novendor xboard-fen-viewer.desktop;\
+               $(XDG_DESKTOP_MENU) uninstall --mode system --novendor xboard-tourney.desktop;\
+               $(XDG_ICON_RESOURCE) uninstall --context mimetypes --size 32 board32.xpm application-x-chess-pgn;\
+               $(XDG_ICON_RESOURCE) uninstall --context mimetypes --size 32 cross32.xpm application-x-xboard-trn;\
+               $(XDG_ICON_RESOURCE) uninstall --context mimetypes --size 48 board48.xpm application-x-chess-pgn;\
+               $(XDG_ICON_RESOURCE) uninstall --context mimetypes --size 48 cross48.xpm application-x-xboard-trn;\
        fi
+endif
index 37bae05..21b46aa 100644 (file)
@@ -416,15 +416,24 @@ X_LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXmu -lX11 -lXt "
 AC_SUBST(X_CFLAGS)
 AC_SUBST(X_LIBS)
 
-dnl | can we install desktop icons and mime associations?
-AC_PATH_PROG([XDG_MIME],[xdg-mime])
-AC_SUBST(XDG_MIME)
-AC_PATH_PROG([XDG_DESKTOP_MENU],[xdg-desktop-menu])
-AC_SUBST(XDG_DESKTOP_MENU)
-AC_PATH_PROG([XDG_ICON_RESOURCE],[xdg-icon-resource])
-AC_SUBST(XDG_ICON_RESOURCE)
-
+dnl | should we install desktop icons and mime associations?
+AC_ARG_ENABLE( [update-mimedb],
+               [AS_HELP_STRING([--disable-update-mimedb],[disable the update-mime-database after install [default=no]])],
+               [enable_mimedb="no"],
+               [enable_mimedb="yes"])
+
+AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x"$enable_mimedb" = "xyes")
+
+if test x"$enable_mimedb" = "xyes"; then
+   AC_PATH_PROG([XDG_MIME],[xdg-mime])
+   AC_SUBST(XDG_MIME)
+   AC_PATH_PROG([XDG_DESKTOP_MENU],[xdg-desktop-menu])
+   AC_SUBST(XDG_DESKTOP_MENU)
+   AC_PATH_PROG([XDG_ICON_RESOURCE],[xdg-icon-resource])
+   AC_SUBST(XDG_ICON_RESOURCE)
+fi
 
+dnl |  output Makefile
 AC_CONFIG_FILES([Makefile cmail po/Makefile.in])
 AC_CONFIG_COMMANDS([test-stamp-h],[test -z "$CONFIG_HEADERS" || date > stamp-h])
 AC_CONFIG_COMMANDS([chmod-cmail],[chmod 755 cmail])
@@ -443,6 +452,8 @@ echo "                                    (bitmaps will go in \$datadir/games/xb
 echo "        infodir:         $infodir   (info files will go here)"
 echo "        sysconfdir:      $sysconfdir   (xboard.conf will go here)"
 echo ""
+echo "        update mimedb:   $enable_mimedb"
+echo ""
 echo "        NLS support:     $USE_NLS"
 echo ""
 echo "        Xaw3d:           $with_Xaw3d"