Commit dd3fe43a authored by Charles Lindsay's avatar Charles Lindsay

Validate desktop file when building; fix #6571

parent 09667210
......@@ -31,6 +31,7 @@ set(GLADE_FILES ui/account_list.glade ui/account_cannot_remove.glade ui/account_
option(DEBUG "Build for debugging." OFF)
option(ICON_UPDATE "Run gtk-update-icon-cache after the install." ON)
option(DESKTOP_UPDATE "Run update-desktop-database after the install." ON)
option(DESKTOP_VALIDATE "Check generated desktop file for errors during build." ON)
if (DEBUG)
message(STATUS "Debug build")
......@@ -44,6 +45,10 @@ if (DESKTOP_UPDATE)
message(STATUS "Desktop database will be updated")
endif ()
if (DESKTOP_VALIDATE)
message(STATUS "Generated desktop file will be checked for errors")
endif ()
find_package(PkgConfig)
pkg_check_modules(LIBUNITY QUIET unity>=5.12.0)
pkg_check_modules(LIBMESSAGINGMENU QUIET messaging-menu>=12.10.2)
......
# FindDesktopFileValidate.cmake
#
# Charles Lindsay <chaz@yorba.org>
# Copyright 2013 Yorba Foundation
find_program (DESKTOP_FILE_VALIDATE_EXECUTABLE desktop-file-validate)
if (DESKTOP_FILE_VALIDATE_EXECUTABLE)
set (DESKTOP_FILE_VALIDATE_FOUND TRUE)
else (DESKTOP_FILE_VALIDATE_EXECUTABLE)
set (DESKTOP_FILE_VALIDATE_FOUND FALSE)
endif (DESKTOP_FILE_VALIDATE_EXECUTABLE)
if (DESKTOP_FILE_VALIDATE_FOUND)
macro (VALIDATE_DESKTOP_FILE desktop_id)
add_custom_command (TARGET ${desktop_id}.desktop POST_BUILD
COMMAND ${DESKTOP_FILE_VALIDATE_EXECUTABLE} ${desktop_id}.desktop
)
endmacro (VALIDATE_DESKTOP_FILE desktop_id)
endif (DESKTOP_FILE_VALIDATE_FOUND)
......@@ -26,6 +26,8 @@ configure_help() {
Disable compiling the GSettings schema.
--disable-desktop-update
Disable desktop database update.
--disable-desktop-validate
Disable checking for errors in generated desktop file.
--disable-icon-update
Disable icon cache update.
......@@ -84,6 +86,10 @@ do
--disable-desktop-update)
CMDLINE="${CMDLINE} -DDESKTOP_UPDATE=OFF"
;;
--disable-desktop-validate)
CMDLINE="${CMDLINE} -DDESKTOP_VALIDATE=OFF"
;;
VALAC) [ ! $value ] && abort $1
VALAC=$value
......
......@@ -18,7 +18,8 @@ Build-Depends: debhelper (>= 8),
libmessaging-menu-dev (>= 12.10.2),
libunity-dev (>= 5.12.0),
intltool,
libgirepository1.0-dev (>= 1.32.0)
libgirepository1.0-dev (>= 1.32.0),
desktop-file-utils
Standards-Version: 3.8.3
Homepage: http://www.yorba.org
......
......@@ -3,8 +3,17 @@
#
include (FindIntltool)
include (FindDesktopFileValidate)
if (INTLTOOL_MERGE_FOUND)
INTLTOOL_MERGE_DESKTOP (geary po)
if (DESKTOP_VALIDATE)
if (DESKTOP_FILE_VALIDATE_FOUND)
VALIDATE_DESKTOP_FILE (geary)
else (DESKTOP_FILE_VALIDATE_FOUND)
message (FATAL_ERROR "desktop-file-validate must be installed to validate generated .desktop file")
endif (DESKTOP_FILE_VALIDATE_FOUND)
endif (DESKTOP_VALIDATE)
else (INTLTOOL_MERGE_FOUND)
message (FATAL_ERROR "intltool must be installed to generate .desktop file")
endif (INTLTOOL_MERGE_FOUND)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment