Merge branch 'master' into clangen/upstream-pdcurses

This commit is contained in:
casey langen 2020-03-08 15:37:54 -07:00
commit 7e1c6b9cd0
6 changed files with 43 additions and 5 deletions

View File

@ -48,7 +48,7 @@ link_directories ("${musikcube_SOURCE_DIR}/bin/plugins")
set(COMMON_LINK_LIBS ${BOOST_LINK_LIBS} curl pthread crypto) set(COMMON_LINK_LIBS ${BOOST_LINK_LIBS} curl pthread crypto)
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set (musikcube_LINK_LIBS ${COMMON_LINK_LIBS}) set (musikcube_LINK_LIBS ${COMMON_LINK_LIBS})
else() else()
set (musikcube_LINK_LIBS ${COMMON_LINK_LIBS} dl) set (musikcube_LINK_LIBS ${COMMON_LINK_LIBS} dl)
@ -79,7 +79,7 @@ endif()
# "/usr/local" doesn't seem to be included by default on macOS 10.12+ # "/usr/local" doesn't seem to be included by default on macOS 10.12+
# "/opt/local" is the default installation location for MacPorts # "/opt/local" is the default installation location for MacPorts
if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
link_directories ("/usr/local/lib") link_directories ("/usr/local/lib")
link_directories ("/usr/local/opt/openssl/lib") link_directories ("/usr/local/opt/openssl/lib")
include_directories("/usr/local/include") include_directories("/usr/local/include")
@ -88,7 +88,7 @@ endif ()
if (EXISTS "/etc/arch-release" OR EXISTS "/etc/manjaro-release" OR NO_NCURSESW) if (EXISTS "/etc/arch-release" OR EXISTS "/etc/manjaro-release" OR NO_NCURSESW)
add_definitions (-DNO_NCURSESW) add_definitions (-DNO_NCURSESW)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD" )
add_definitions (-DNO_NCURSESW) add_definitions (-DNO_NCURSESW)
endif() endif()
@ -193,6 +193,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_subdirectory(src/plugins/sndioout) add_subdirectory(src/plugins/sndioout)
add_dependencies(musikcube sndioout) add_dependencies(musikcube sndioout)
endif() endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_subdirectory(src/plugins/sndioout)
add_dependencies(musikcube sndioout)
if (${ENABLE_PULSEAUDIO} MATCHES "true")
add_subdirectory(src/plugins/pulseout) # disabled by default
add_dependencies(musikcube pulseout)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_subdirectory(src/plugins/sndioout) add_subdirectory(src/plugins/sndioout)
add_dependencies(musikcube sndioout) add_dependencies(musikcube sndioout)

View File

@ -126,6 +126,8 @@ namespace musik { namespace core { namespace sdk {
static const std::string PLATFORM = "macos"; static const std::string PLATFORM = "macos";
#elif defined __FreeBSD__ #elif defined __FreeBSD__
static const std::string PLATFORM = "freebsd"; static const std::string PLATFORM = "freebsd";
#elif defined __OpenBSD__
static const std::string PLATFORM = "openbsd";
#else #else
static const std::string PLATFORM = "linux"; static const std::string PLATFORM = "linux";
#endif #endif

View File

@ -56,6 +56,15 @@
#include <limits.h> #include <limits.h>
#endif #endif
// given the #ifdef/#else above, the following is not required.
// Nor it is the #if FreeBSD below.
#ifdef __OpenBSD__
#include <sys/types.h>
#include <sys/sysctl.h>
#include <unistd.h>
#include <limits.h>
#endif
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <sys/types.h> #include <sys/types.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -125,6 +134,22 @@ namespace musik { namespace core {
mib[3] = -1; mib[3] = -1;
size_t bufsize = sizeof(pathbuf); size_t bufsize = sizeof(pathbuf);
sysctl(mib, 4, pathbuf, &bufsize, nullptr, 0); sysctl(mib, 4, pathbuf, &bufsize, nullptr, 0);
#elif defined __OpenBSD__
int mib[4];
char **argv;
size_t len = ARG_MAX;
mib[0] = CTL_KERN;
mib[1] = KERN_PROC_ARGS;
mib[2] = getpid();
mib[3] = KERN_PROC_ARGV;
argv = new char*[len];
if (sysctl(mib, 4, argv, &len, nullptr, 0) < 0) abort();
boost::filesystem::path command = boost::filesystem::system_complete(argv[0]);
realpath(command.c_str(), pathbuf);
delete[] argv;
#else #else
std::string pathToProc = u8fmt("/proc/%d/exe", (int) getpid()); std::string pathToProc = u8fmt("/proc/%d/exe", (int) getpid());
readlink(pathToProc.c_str(), pathbuf, PATH_MAX); readlink(pathToProc.c_str(), pathbuf, PATH_MAX);

View File

@ -66,6 +66,8 @@ static const std::string PLATFORM = "win32";
static const std::string PLATFORM = "macos"; static const std::string PLATFORM = "macos";
#elif defined __FreeBSD__ #elif defined __FreeBSD__
static const std::string PLATFORM = "freebsd"; static const std::string PLATFORM = "freebsd";
#elif defined __OpenBSD__
static const std::string PLATFORM = "openbsd";
#else #else
static const std::string PLATFORM = "linux"; static const std::string PLATFORM = "linux";
#endif #endif
@ -268,4 +270,4 @@ void UpdateCheck::ShowNoUpgradeFoundOverlay() {
.AddButton("KEY_ENTER", "ENTER", _TSTR("button_close")); .AddButton("KEY_ENTER", "ENTER", _TSTR("button_close"));
App::Overlays().Push(dialog); App::Overlays().Push(dialog);
} }

View File

@ -49,6 +49,8 @@ namespace musik {
static const std::string PLATFORM = "macos"; static const std::string PLATFORM = "macos";
#elif defined __FreeBSD__ #elif defined __FreeBSD__
static const std::string PLATFORM = "freebsd"; static const std::string PLATFORM = "freebsd";
#elif defined __OpenBSD__
static const std::string PLATFORM = "openbsd";
#else #else
static const std::string PLATFORM = "linux"; static const std::string PLATFORM = "linux";
#endif #endif

View File

@ -794,7 +794,7 @@ void Window::Clear() {
} }
else if (this->frame && this->content) { else if (this->frame && this->content) {
wbkgd_internal(this->frame, frameColor); wbkgd_internal(this->frame, frameColor);
wbkgd_internal(this->frame, contentColor); wbkgd_internal(this->content, contentColor);
} }
} }