Adapt install routines to install locales

This commit is contained in:
Mario Hüttel 2019-10-20 14:04:39 +02:00
parent 31a47339f8
commit 8005e8bcc7
3 changed files with 18 additions and 8 deletions

View File

@ -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 -)
}

View File

@ -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)

View File

@ -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")