Permalink
Browse files

cmake: Support for DEB packaging.

  • Loading branch information...
1 parent 2fc34f2 commit 0ec11ec20b74ad0cff4f925d7d85e7dfeaa65507 @dnohales committed Jan 24, 2012
Showing with 41 additions and 19 deletions.
  1. +37 −17 CMakeLists.txt
  2. +4 −2 cmake/GSettings.cmake
View
@@ -7,15 +7,21 @@ list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
#
-# Base bits
+# Application information
+#
+set(PACKAGE_NAME ${PROJECT_NAME})
+set(PACKAGE_VERSION_MAJOR "0")
+set(PACKAGE_VERSION_MINOR "1")
+set(PACKAGE_VERSION_PATCH "1")
+set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
+set(PACKAGE_STRING "Gablabel ${PACKAGE_VERSION}")
+set (GETTEXT_PACKAGE ${PROJECT_NAME})
+#
+# Directories
#
set (DATADIR_ROOT "${CMAKE_INSTALL_PREFIX}/share")
set (DATADIR "${DATADIR_ROOT}/gablabel")
set(LOCALEDIR "${DATADIR_ROOT}/locale")
-set(PACKAGE_NAME "gablabel")
-set(PACKAGE_VERSION "0.1")
-set(PACKAGE_STRING "Gablabel ${PACKAGE_VERSION}")
-set (GETTEXT_PACKAGE "gablabel")
add_custom_target (uninstall "${CMAKE_COMMAND}" -P
@@ -33,8 +39,8 @@ add_definitions(-include config.h)
# Data
#
file (GLOB _datafiles "${CMAKE_CURRENT_SOURCE_DIR}/data/gablabel/*")
-install (FILES ${_datafiles} DESTINATION ${DATADIR})
-#install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/gablabel.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
+install (FILES ${_datafiles} DESTINATION "share/gablabel")
+install(FILES ${CMAKE_SOURCE_DIR}/data/gablabel.desktop DESTINATION "share/applications")
#
@@ -43,7 +49,7 @@ install (FILES ${_datafiles} DESTINATION ${DATADIR})
find_package (Gettext REQUIRED)
add_custom_command (OUTPUT ${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot
- COMMAND xgettext -c --files-from ${CMAKE_SOURCE_DIR}/po/POTFILES.in --keyword=_ -o ${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot --no-wrap --no-location
+ COMMAND xgettext -c --files-from ${CMAKE_SOURCE_DIR}/po/potfiles --keyword=_ -o ${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot --no-wrap --no-location
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
@@ -107,13 +113,27 @@ add_schema("data/es.nohal.Gablabel.gschema.xml")
#
# Icons
#
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/16.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/16x16/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/22.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/22x22/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/24.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/24x24/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/32.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/32x32/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/36.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/36x36/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/64.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/64x64/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/96.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/96x96/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/256.png" DESTINATION "${DATADIR_ROOT}/icons/hicolor/256x256/apps" RENAME gablabel.png)
-install(FILES "${CMAKE_SOURCE_DIR}/data/icons/scalable.svg" DESTINATION "${DATADIR_ROOT}/icons/hicolor/scalable/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/16.png" DESTINATION "share/icons/hicolor/16x16/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/22.png" DESTINATION "share/icons/hicolor/22x22/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/24.png" DESTINATION "share/icons/hicolor/24x24/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/32.png" DESTINATION "share/icons/hicolor/32x32/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/36.png" DESTINATION "share/icons/hicolor/36x36/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/64.png" DESTINATION "share/icons/hicolor/64x64/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/96.png" DESTINATION "share/icons/hicolor/96x96/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/256.png" DESTINATION "share/icons/hicolor/256x256/apps" RENAME gablabel.png)
+install(FILES "${CMAKE_SOURCE_DIR}/data/icons/scalable.svg" DESTINATION "share/icons/hicolor/scalable/apps" RENAME gablabel.svg)
+#
+# Packaging
+#
+SET(CPACK_GENERATOR "DEB")
+SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Damián Nohales")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION_PATCH})
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gablabel is a simplified and improved interface for Google Translator that's allows you to translate text into many languages.")
+SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+SET(CPACK_DEBIAN_PACKAGE_SECTION "utils")
+SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/eagleoneraptor/gablabel")
+
+INCLUDE(CPack)
View
@@ -17,10 +17,12 @@ macro(add_schema SCHEMA_NAME)
set(PKG_CONFIG_EXECUTABLE pkg-config)
# Have an option to not install the schema into where GLib is
if (GSETTINGS_LOCALINSTALL)
- SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
+ SET (GSETTINGS_DIR "share/glib-2.0/schemas/")
+ SET (GSETTINGS_FULL_DIR "${CMAKE_INSTALL_PREFIX}/${GSETTINGS_DIR}")
else (GSETTINGS_LOCALINSTALL)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
+ SET (GSETTINGS_FULL_DIR ${GSETTINGS_DIR})
endif (GSETTINGS_LOCALINSTALL)
# Run the validator and error if it fails
@@ -37,6 +39,6 @@ macro(add_schema SCHEMA_NAME)
if (GSETTINGS_COMPILE)
install (CODE "message (STATUS \"Compiling GSettings schemas\")")
- install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
+ install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_FULL_DIR})")
endif ()
endmacro()

0 comments on commit 0ec11ec

Please sign in to comment.