- tools/haiku-package.sh: release build staged into the package layout (apps/OpenPU, bin/openpu-cli, data/locale, Deskbar link), .PackageInfo with the library requirements, `package create`. Validated with `pkgman install` in the Haiku R1/beta6 VM. - packaging/haiku/openpu.recipe: HaikuPorts recipe template, to be named after the released version with the archive checksum. - The Haiku application is installed in apps/ and finds its translations through BPathFinder (data/locale of its installation location). - Fix: `cmake --install --strip` dropped the application's resources (icon, signature, version); they are attached again after install. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
36 lines
1.5 KiB
CMake
36 lines
1.5 KiB
CMake
# Translations (gettext). Source strings are English; add a language by adding <lang>.po and
|
|
# listing it in LINGUAS.
|
|
include(GNUInstallDirs)
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
|
|
set(OPENPU_INSTALL_LOCALEDIR data/locale) # Haiku package layout
|
|
else()
|
|
set(OPENPU_INSTALL_LOCALEDIR ${CMAKE_INSTALL_LOCALEDIR})
|
|
endif()
|
|
find_package(Gettext)
|
|
if(NOT GETTEXT_FOUND)
|
|
message(WARNING "gettext (msgfmt) not found: translations are not built")
|
|
return()
|
|
endif()
|
|
file(STRINGS LINGUAS OPENPU_LINGUAS REGEX "^[^#]")
|
|
foreach(lang IN LISTS OPENPU_LINGUAS)
|
|
set(mo ${CMAKE_BINARY_DIR}/locale/${lang}/LC_MESSAGES/openpu.mo)
|
|
add_custom_command(OUTPUT ${mo}
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/${lang}/LC_MESSAGES
|
|
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${mo} ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po
|
|
DEPENDS ${lang}.po)
|
|
list(APPEND OPENPU_MO_FILES ${mo})
|
|
install(FILES ${mo} DESTINATION ${OPENPU_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES)
|
|
endforeach()
|
|
add_custom_target(translations ALL DEPENDS ${OPENPU_MO_FILES})
|
|
|
|
# `cmake --build . --target pot` refreshes the template from the sources.
|
|
find_program(XGETTEXT xgettext)
|
|
if(XGETTEXT)
|
|
add_custom_target(pot
|
|
COMMAND ${XGETTEXT} --keyword=_ --keyword=N_ --from-code=UTF-8 --package-name=openpu
|
|
--add-comments=TRANSLATORS -o ${CMAKE_CURRENT_SOURCE_DIR}/openpu.pot
|
|
${PROJECT_SOURCE_DIR}/src/ui-gtk/main_window.cpp
|
|
${PROJECT_SOURCE_DIR}/src/ui-haiku/main_window.cpp
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
|
endif()
|