Linux packaging: Debian package, AppImage script, release workflow
- CPack DEB configuration (cmake/Packaging.cmake): dependencies from dpkg-shlibdeps, udisks2 recommended, strip. - AppStream metadata, installed with the desktop file and the icons; tools/release.sh adds each release to it. - tools/appimage.sh: AppImage of the GTK interface and openpu-cli with linuxdeploy and its GTK plugin (x86_64 and aarch64). - Release workflow: .deb, AppImage and openpu-cli tarball for x86_64 and arm64, attached to the release of a vX.Y.Z tag, or kept as artifacts on a manual run. tools/release.sh edits the release when the workflow created it first. - The GTK interface finds its translations next to the executable (../share/locale), for relocatable installs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
1 parent
bbc3bb3896
commit
ce7316af29
11 files changed
+261
-8
No files matched your search
+24
-3
@@ -5,9 +5,32 @@
|
||||
|
||||
#include <clocale>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/application.h>
|
||||
|
||||
namespace {
|
||||
|
||||
/// Translations directory: OPENPU_LOCALEDIR (build tree), else <prefix>/share/locale next to the
|
||||
/// executable when it exists (relocatable installs such as the AppImage), else the configured one.
|
||||
std::string localeDir()
|
||||
{
|
||||
if (const char* dir = std::getenv("OPENPU_LOCALEDIR")) // NOLINT(concurrency-mt-unsafe): no thread yet
|
||||
return dir;
|
||||
std::error_code ec;
|
||||
const auto exe = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
if (!ec) {
|
||||
const auto dir = exe.parent_path().parent_path() / "share" / "locale";
|
||||
if (std::filesystem::is_directory(dir, ec))
|
||||
return dir.string();
|
||||
}
|
||||
return OPENPU_LOCALEDIR;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// A language chosen in the settings overrides the session language (gettext reads LANGUAGE).
|
||||
@@ -19,9 +42,7 @@ int main(int argc, char* argv[])
|
||||
// dismissed: the window reports unreadable settings itself
|
||||
}
|
||||
(void)std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe): no thread yet
|
||||
// OPENPU_LOCALEDIR lets a build-tree binary find its translations.
|
||||
const char* localeDir = std::getenv("OPENPU_LOCALEDIR"); // NOLINT(concurrency-mt-unsafe)
|
||||
bindtextdomain(GETTEXT_PACKAGE, localeDir != nullptr ? localeDir : OPENPU_LOCALEDIR);
|
||||
bindtextdomain(GETTEXT_PACKAGE, localeDir().c_str());
|
||||
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain(GETTEXT_PACKAGE);
|
||||
|
||||
|
||||
Reference in new issue
Block a user