From 8c392d6681ae61717350e17e07a9487ed3e15145 Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Sun, 28 Mar 2021 20:13:16 +0300 Subject: Porting to Haiku --- CMakeLists.txt | 10 ++++++++++ src/app.c | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75883966..9fe62ba4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,6 +324,9 @@ endif () if (UNIX) target_link_libraries (app PUBLIC m) endif () +if (HAIKU) + target_link_libraries (app PUBLIC m network bsd) +endif () # Deployment. if (MSYS) @@ -342,6 +345,13 @@ if (MSYS) if (INSTALL_THE_FOUNDATION) install (PROGRAMS $ DESTINATION .) endif () +elseif (HAIKU) + install (TARGETS app DESTINATION .) + if (NOT ENABLE_RESOURCE_EMBED) + target_compile_definitions (app PUBLIC + LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/resources.lgr") + install (FILES ${EMB_BIN} DESTINATION .) + endif () elseif (UNIX AND NOT APPLE) set_target_properties (app PROPERTIES INSTALL_RPATH_USE_LINK_PATH YES diff --git a/src/app.c b/src/app.c index fd6cd0bb..d4d5f5a6 100644 --- a/src/app.c +++ b/src/app.c @@ -89,6 +89,10 @@ static const char *defaultDataDir_App_ = "~/AppData/Roaming/fi.skyjake.Lagrange" #define EMB_BIN "../../share/lagrange/resources.lgr" static const char *defaultDataDir_App_ = "~/.config/lagrange"; #endif +#if defined (iPlatformHaiku) +#define EMB_BIN "./resources.lgr" +static const char *defaultDataDir_App_ = "~/config/settings"; +#endif #if defined (LAGRANGE_EMB_BIN) /* specified in build config */ # undef EMB_BIN # define EMB_BIN LAGRANGE_EMB_BIN @@ -2128,7 +2132,7 @@ void openInDefaultBrowser_App(const iString *url) { setArguments_Process(proc, #if defined (iPlatformAppleDesktop) iClob(newStringsCStr_StringList("/usr/bin/env", "open", cstr_String(url), NULL)) -#elif defined (iPlatformLinux) || defined (iPlatformOther) +#elif defined (iPlatformLinux) || defined (iPlatformOther) || defined (iPlatformHaiku) iClob(newStringsCStr_StringList("/usr/bin/env", "xdg-open", cstr_String(url), NULL)) #elif defined (iPlatformMsys) iClob(newStringsCStr_StringList( @@ -2165,7 +2169,7 @@ void revealPath_App(const iString *path) { iRelease(proc); } iRelease(f); -#elif defined (iPlatformLinux) +#elif defined (iPlatformLinux) || defined (iPlatformHaiku) iFileInfo *inf = iClob(new_FileInfo(path)); iRangecc target; if (isDirectory_FileInfo(inf)) { -- cgit v1.2.3