From 8005e8bcc7fa27badf06adbe0b103ac63d7559dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 20 Oct 2019 14:04:39 +0200 Subject: [PATCH] Adapt install routines to install locales --- AUR/PKGBUILD | 8 +++++--- CMakeLists.txt | 14 +++++++++++--- translations/CMakeLists.txt | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/AUR/PKGBUILD b/AUR/PKGBUILD index 9f440fb..61d29a7 100644 --- a/AUR/PKGBUILD +++ b/AUR/PKGBUILD @@ -20,13 +20,14 @@ pkgver () { } build () { - cd "$srcdir/$pkgname-git" - cmake -DCMAKE_BUILD_TYPE=Release . + mkdir "$srcdir/$pkgname-git/build" + cd "$srcdir/$pkgname-git/build" + cmake -DCMAKE_BUILD_TYPE=Release .. make } package () { - cd "$srcdir/$pkgname-git" + cd "$srcdir/$pkgname-git/build" make DESTDIR="${pkgdir}" install install -D -m664 "$srcdir/$pkgname-git/AUR/gds-render.desktop" \ "$pkgdir/usr/share/applications/gds-render.desktop" @@ -34,4 +35,5 @@ package () { "$pkgdir/usr/share/icons/hicolor/scalable/apps/gds-render.svg" install -D -m664 "$srcdir/$pkgname-git/icon/128x128/gds-render.png" \ "$pkgdir/usr/share/icons/hicolor/128x128/apps/gds-render.png" + tar cf - "$srcdir/$pkgname-git/build/translations/output/locale" | (cd "$pkgdir/usr/share/" && tar xf -) } diff --git a/CMakeLists.txt b/CMakeLists.txt index 7899a2e..ddf4103 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ project(gds-render) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/usr/" CACHE PATH "..." FORCE) +endif() + if(NOT WIN32) string(ASCII 27 Esc) set(ColorReset "${Esc}[m") @@ -30,8 +34,8 @@ add_compile_options(-Wall -Wold-style-declaration -Wuninitialized -Wmaybe-uninit IF(CMAKE_BUILD_TYPE STREQUAL "Debug") message("${Yellow}Debug mode for translations used!${ColorReset}") - add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/translations\") - message("${BoldMagenta}${CMAKE_CURRENT_BINARY_DIR}/translations used as data dir${ColorReset}") + add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/translations/output\") + message("${BoldMagenta}${CMAKE_CURRENT_BINARY_DIR}/translations/output used as data dir${ColorReset}") else(CMAKE_BUILD_TYPE STREQUAL "Debug") message("Global locale directory used. Make sure files in /usr/share/locale are available") add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\") @@ -67,8 +71,12 @@ set(SOURCE add_executable(${PROJECT_NAME} ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c) add_dependencies(${PROJECT_NAME} glib-resources) add_dependencies(${PROJECT_NAME} version) +add_dependencies(${PROJECT_NAME} translations) SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c PROPERTIES GENERATED 1) target_link_libraries(${PROJECT_NAME} ${GLIB_LDFLAGS} ${GTK3_LDFLAGS} ${CAIRO_LDFLAGS} m version ${CMAKE_DL_LIBS}) -install (TARGETS ${PROJECT_NAME} DESTINATION bin) +install (TARGETS ${PROJECT_NAME} + RUNTIME + DESTINATION bin + ) add_custom_target(documentation DEPENDS doxygen) diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index 3d85c59..a181f7b 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -1,4 +1,4 @@ -add_custom_target(translations - COMMAND ./generate-mo.sh "${PROJECT_BINARY_DIR}/translations" +add_custom_target(translations ALL + COMMAND ./generate-mo.sh "${PROJECT_BINARY_DIR}/translations/output" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating translation locales")