From b87c8d1152f1be044691e2afa8e6eae9b049529b Mon Sep 17 00:00:00 2001 From: casey langen Date: Thu, 15 Jul 2021 20:45:43 -0700 Subject: [PATCH] OpenBSD build fixes. --- src/musikcube/CMakeLists.txt | 12 ++++++++++-- src/musikcube/cursespp/App.cpp | 16 ++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/musikcube/CMakeLists.txt b/src/musikcube/CMakeLists.txt index 33c0f1182..532043365 100644 --- a/src/musikcube/CMakeLists.txt +++ b/src/musikcube/CMakeLists.txt @@ -103,10 +103,18 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") else() find_package(PkgConfig) if (${NCURSES_DISABLE_LIB_SUFFIXES} MATCHES "true") - pkg_check_modules(NCURSES REQUIRED ncurses panel) + # pkg_check_modules fails on some systems, including OpenBSD. + # pkg_check_modules(NCURSES REQUIRED ncurses panel) + ensure_library_exists(ncurses) + ensure_library_exists(panel) + set(NCURSES_LIBRARIES, ncurses panel) message(STATUS "[ncurses] using library names without 'w' prefix") else() - pkg_check_modules(NCURSES REQUIRED ncursesw panelw) + # pkg_check_modules fails on some systems, including OpenBSD. + # pkg_check_modules(NCURSES REQUIRED ncursesw panelw) + ensure_library_exists(ncursesw) + ensure_library_exists(panelw) + set(NCURSES_LIBRARIES, ncursesw panelw) message(STATUS "[ncurses] using library names with 'w' prefix") endif() target_link_libraries(musikcube ${musikcube_LINK_LIBS} ${NCURSES_LIBRARIES} musikcore) diff --git a/src/musikcube/cursespp/App.cpp b/src/musikcube/cursespp/App.cpp index eb8f8c180..c68e484e6 100755 --- a/src/musikcube/cursespp/App.cpp +++ b/src/musikcube/cursespp/App.cpp @@ -243,6 +243,16 @@ App::App(const std::string& title) { throw std::runtime_error("app instance already running!"); } +#ifndef WIN32 + if (!isLangUtf8()) { + std::cout << "\n\nThis application requires a UTF-8 compatible LANG environment " + "variable to be set in the controlling terminal. Setting to C.UTF-8. Depending on " + "your environment, you may see corrupted output. If that'st he case, try to set " + "LANG=C.UTF-8 before starting musikcube.\n\n\n\n"; + setenv("LANG", "C.UTF-8", 1); + } +#endif + instance = this; /* only one instance. */ this->quit = false; this->minWidth = this->minHeight = 0; @@ -493,12 +503,6 @@ void App::Run(ILayoutPtr layout) { if (App::Running(this->uniqueId, this->appTitle)) { return; } -#else - if (!isLangUtf8()) { - std::cout << "\n\nThis application requires a UTF-8 compatible LANG environment " - "variable to be set in the controlling terminal. Exiting.\n\n\n"; - return; - } #endif int64_t ch;