Bundle terminfo for standalone builds.

This commit is contained in:
casey langen 2022-02-13 18:02:38 -08:00
parent c1feaa1f20
commit e17a65b2fe
4 changed files with 18 additions and 0 deletions

View File

@ -57,6 +57,7 @@ mkdir -p $OUTDIR/lib
mkdir -p $OUTDIR/plugins
mkdir -p $OUTDIR/locales
mkdir -p $OUTDIR/themes
mkdir -p $OUTDIR/share/terminfo
cp bin/musikcube $OUTDIR
cp bin/musikcubed $OUTDIR
@ -65,6 +66,7 @@ cp bin/lib/* $OUTDIR/lib
cp bin/plugins/*.${DLL_EXT} $OUTDIR/plugins
cp bin/locales/*.json $OUTDIR/locales
cp bin/themes/*.json $OUTDIR/themes
cp -rfp bin/share/terminfo/* $OUTDIR/share/terminfo/
strip $OUTDIR/musikcube
strip $OUTDIR/musikcubed

View File

@ -39,6 +39,9 @@ if [[ "$PLATFORM" == 'Darwin' ]]; then
cp vendor/lame-bin/lib/libmp3lame.0.dylib ./bin/lib
mkdir -p ./bin/share/terminfo
cp -rfp /opt/homebrew/Cellar/ncurses/6.3/share/terminfo/* ./bin/share/terminfo
elif [[ "$PLATFORM" == 'Linux' ]]; then
echo "[stage-static-vendor-libraries] staging Linux .so files..."

View File

@ -78,6 +78,11 @@ configure_file("musikcube.in" "musikcube" @ONLY)
add_executable(musikcube ${CUBE_SRCS})
add_definitions(-DNCURSES_WIDECHAR)
if (${BUILD_STANDALONE} MATCHES "true")
# ensures the curses app uses our local copy of `terminfo`
add_definitions(-DBUILD_STANDALONE)
endif()
target_include_directories(musikcube BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES})
# figure out if we have a "w" suffix or not...

View File

@ -122,6 +122,14 @@ int main(int argc, char* argv[]) {
LibraryFactory::Initialize(Window::MessageQueue());
auto library = std::make_shared<library::MasterLibrary>();
#ifdef BUILD_STANDALONE
/* when we build a standalone binary we make sure to also package the terminfo used
by the version of ncurses we compile against. if the target system has ncurses5, the
terminfo format will not be compatible and the app will not run */
const std::string terminfo = core::GetApplicationDirectory() + "/share/terminfo/";
setenv("TERMINFO", terminfo.c_str(), 1);
#endif
{
auto prefs = Preferences::ForComponent(core::prefs::components::Settings);