Haiku packaging: .hpkg script and HaikuPorts recipe template
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run

- 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
This commit is contained in:
yann64andClaude Opus 5.5 committed 2026-11-29 06:50:47 +01:00
1 parent b757b35709
commit d190a8b5f8
7 files changed
+180 -6

No files matched your search

+18 -2
View File
@@ -9,7 +9,7 @@ target_link_libraries(OpenPU PRIVATE openpu_core openpu_warnings be tracker shar
$<$<BOOL:${INTL_LIBRARY}>:${INTL_LIBRARY}>)
target_compile_definitions(OpenPU PRIVATE
GETTEXT_PACKAGE="openpu"
OPENPU_LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
OPENPU_LOCALEDIR="${CMAKE_INSTALL_PREFIX}/data/locale")
# BeAPI headers trigger -Wshadow/-Wconversion noise we cannot fix.
target_compile_options(OpenPU PRIVATE -Wno-shadow -Wno-conversion)
@@ -35,4 +35,20 @@ if(HAIKU_RC AND HAIKU_XRES)
COMMAND ${HAIKU_MIMESET} -f $<TARGET_FILE:OpenPU>)
endif()
install(TARGETS OpenPU RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# Haiku package layout: the application in apps/, a link in the Deskbar's Applications menu.
install(TARGETS OpenPU RUNTIME DESTINATION apps)
if(HAIKU_RC AND HAIKU_XRES)
# `cmake --install --strip` rewrites the ELF file and drops the appended resources (icon,
# signature, version): attach them again to the installed copy.
install(CODE "
set(app \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/apps/OpenPU\")
execute_process(COMMAND ${HAIKU_XRES} -o \"\${app}\" ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc
COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND ${HAIKU_MIMESET} -f \"\${app}\")
")
endif()
install(CODE "
set(menu \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/data/deskbar/menu/Applications\")
file(MAKE_DIRECTORY \"\${menu}\")
file(CREATE_LINK ../../../../apps/OpenPU \"\${menu}/OpenPU\" SYMBOLIC)
")
+15 -2
View File
@@ -6,6 +6,8 @@
#include <Application.h>
#include <LocaleRoster.h>
#include <Message.h>
#include <Path.h>
#include <PathFinder.h>
#include "i18n.hpp"
@@ -30,6 +32,18 @@ std::string preferredLanguage()
return language;
}
/// Translations directory: OPENPU_LOCALEDIR (build tree), else data/locale of the installation
/// location holding the application (system or user packages), else the configured one.
std::string localeDir()
{
if (const char* dir = std::getenv("OPENPU_LOCALEDIR")) // NOLINT(concurrency-mt-unsafe): no thread yet
return dir;
BPath path;
if (BPathFinder().FindPath(B_FIND_PATH_DATA_DIRECTORY, "locale", B_FIND_PATH_EXISTING_ONLY, path) == B_OK)
return path.Path();
return OPENPU_LOCALEDIR;
}
class App : public BApplication {
public:
explicit App(std::string language) : BApplication(kSignature), language_(std::move(language)) {}
@@ -60,8 +74,7 @@ int main()
(void)setenv("LANGUAGE", language.c_str(), 1); // NOLINT(concurrency-mt-unsafe): no thread yet
(void)setenv("LC_MESSAGES", "en_US.UTF-8", 0); // NOLINT(concurrency-mt-unsafe)
(void)std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe)
const char* localeDir = std::getenv("OPENPU_LOCALEDIR"); // NOLINT(concurrency-mt-unsafe): build tree
bindtextdomain(GETTEXT_PACKAGE, localeDir != nullptr ? localeDir : OPENPU_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, localeDir().c_str());
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);