diff --git a/.cmake/CheckDependencies.cmake b/.cmake/CheckDependencies.cmake deleted file mode 100644 index e34a8da9c..000000000 --- a/.cmake/CheckDependencies.cmake +++ /dev/null @@ -1,17 +0,0 @@ -function(ensure_library_exists libname) - get_property(ALL_LINK_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY LINK_DIRECTORIES) - foreach(CURRENT_LINK_DIR ${ALL_LINK_DIRS}) - unset(__TEMP_ENSURE_LIBRARY CACHE) - find_library( - __TEMP_ENSURE_LIBRARY - NAMES ${libname} - PATHS ${CURRENT_LINK_DIR} ${VENDOR_LINK_DIRECTORIES}) - if(NOT __TEMP_ENSURE_LIBRARY) - #message(STATUS "[check-dependencies] ${libname} not found") - else() - message(STATUS "[check-dependencies] ${libname} found at ${__TEMP_ENSURE_LIBRARY}") - return() - endif() - endforeach() - message(FATAL_ERROR "\n\n[check-dependencies] ${libname} not found\n\n") -endfunction(ensure_library_exists) diff --git a/.cmake/ConfigureStandalone.cmake b/.cmake/ConfigureStandalone.cmake index 44e221c95..871378563 100644 --- a/.cmake/ConfigureStandalone.cmake +++ b/.cmake/ConfigureStandalone.cmake @@ -14,7 +14,8 @@ if (${BUILD_STANDALONE} MATCHES "true") "${CMAKE_CURRENT_SOURCE_DIR}/vendor/lame-bin/include" "${CMAKE_CURRENT_SOURCE_DIR}/vendor/libmicrohttpd-bin/include" "${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib-bin/include" - "${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/include") + "${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/include" + "${CMAKE_CURRENT_SOURCE_DIR}/vendor/ncurses-bin/include") list( APPEND @@ -23,7 +24,8 @@ if (${BUILD_STANDALONE} MATCHES "true") "${CMAKE_CURRENT_SOURCE_DIR}/vendor/lame-bin/lib" "${CMAKE_CURRENT_SOURCE_DIR}/vendor/libmicrohttpd-bin/lib" "${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib-bin/lib" - "${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/lib") + "${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/lib" + "${CMAKE_CURRENT_SOURCE_DIR}/vendor/ncurses-bin/lib") else() message(STATUS "[standalone-build] *NOT* enabled!") endif() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 026ae4715..c2dedd123 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,6 @@ set (EXECUTABLE_OUTPUT_PATH ${musikcube_SOURCE_DIR}/bin) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake) include(CMakeToolsHelpers OPTIONAL) -include(CheckDependencies) include(CheckAtomic) include(ConfigureRpath) include(ConfigureStandalone) @@ -45,7 +44,6 @@ message(STATUS "[boost] libs: " ${Boost_LIBRARIES}) message(STATUS "[boost] includes: " ${Boost_INCLUDE_DIRS}) if (${BUILD_STANDALONE} MATCHES "true") - target_include_directories(musikcube BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) find_library(LIBCURL NAMES curl PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) else() find_library(LIBCURL NAMES curl) diff --git a/script/bootstrap-static-vendors.sh b/script/bootstrap-static-vendors.sh index 0c2b1df31..7034fe3b9 100755 --- a/script/bootstrap-static-vendors.sh +++ b/script/bootstrap-static-vendors.sh @@ -9,9 +9,26 @@ if [[ "$PLATFORM" == 'Darwin' ]]; then export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/opt/homebrew/opt/openssl/lib/pkgconfig/" fi +NCURSES_TERMINFO= +if [[ "$PLATFORM" == 'Linux' ]]; then + NCURSES_TERMINFO="--with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo" +fi + export CFLAGS="-fPIC" export CXXFLAGS="-fPIC" +# +# ncurses +# +https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz +tar xvfz ncurses-6.3.tar.gz +cd ncurses-6.3 +./configure --enable-pc-files --enable-sigwinch --enable-symlinks --enable-widec --with-shared --with-cxx-shared --with-gpm=no --without-ada ${NCURSES_TERMINFO} --prefix=`pwd`/output +make -j8 || exit $? +make install +mv output ../ncurses-bin +cd .. + # # boost # diff --git a/script/stage-static-vendor-libraries.sh b/script/stage-static-vendor-libraries.sh index a04eb445e..156817fdb 100755 --- a/script/stage-static-vendor-libraries.sh +++ b/script/stage-static-vendor-libraries.sh @@ -20,6 +20,8 @@ elif [[ "$PLATFORM" == 'Linux' ]]; then cp vendor/ffmpeg-bin/lib/libavutil-musikcube.so.57 ./bin/lib/ cp vendor/ffmpeg-bin/lib/libswresample-musikcube.so.4 ./bin/lib/ cp vendor/curl-bin/lib/libcurl.so.4 ./bin/lib/ + cp vendor/ncurses-bin/lib/libncursesw.so.6 ./bin/lib + cp vendor/ncurses-bin/lib/libpanelw.so.6 ./bin/lib cp /lib/x86_64-linux-gnu/libssl.so.1.1 ./bin/lib/ cp /lib/x86_64-linux-gnu/libcrypto.so.1.1 ./bin/lib/ @@ -30,4 +32,6 @@ elif [[ "$PLATFORM" == 'Linux' ]]; then cp /lib/x86_64-linux-gnu/libvorbis.so.0 ./bin/lib cp /lib/x86_64-linux-gnu/libvorbisfile.so.3 ./bin/lib cp /lib/x86_64-linux-gnu/libogg.so.0 ./bin/lib + + chmod -x ./bin/lib/* fi diff --git a/script/strip-nix.sh b/script/strip-nix.sh index aa4ea62e5..98383386b 100755 --- a/script/strip-nix.sh +++ b/script/strip-nix.sh @@ -5,7 +5,7 @@ if [ -z "$DIR" ]; then DIR=`pwd` fi echo "[strip] resolved directory: ${DIR}" -strip "$DIR/bin/musikcube" -strip "$DIR/bin/musikcubed" -find "$DIR/bin/" -name "*.so" -exec strip "{}" \; 2> /dev/null +strip "$DIR/bin/*" 2> /dev/null +strip "$DIR/bin/lib/*" 2> /dev/null +strip "$DIR/bin/plugin/*" 2> /dev/null echo "[strip] finished" diff --git a/src/musikcore/CMakeLists.txt b/src/musikcore/CMakeLists.txt index 2dd13b23e..a70db632e 100644 --- a/src/musikcore/CMakeLists.txt +++ b/src/musikcore/CMakeLists.txt @@ -81,9 +81,14 @@ include_directories( add_definitions(-DMCSDK_DEFINE_EXPORTS) add_library(musikcore SHARED ${CORE_SOURCES}) + set_target_properties(musikcore PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${musikcube_SOURCE_DIR}/bin) target_link_libraries(musikcore ${musikcube_LINK_LIBS}) +if (${BUILD_STANDALONE} MATCHES "true") + target_include_directories(musikcore BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) +endif() + if (ENABLE_PCH MATCHES "true") message(STATUS "[musikcore] enabling precompiled headers") include(./pch.cmake) diff --git a/src/musikcube/CMakeLists.txt b/src/musikcube/CMakeLists.txt index d248e14ec..a3e332f40 100644 --- a/src/musikcube/CMakeLists.txt +++ b/src/musikcube/CMakeLists.txt @@ -79,46 +79,36 @@ configure_file("musikcube.in" "musikcube" @ONLY) add_executable(musikcube ${CUBE_SRCS}) add_definitions(-DNCURSES_WIDECHAR) -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - if (${BUILD_STANDALONE} MATCHES "true") - find_library( - NCURSESWLIB - NAMES libncursesw.a ncursesw - PATHS ${VENDOR_LINK_DIRECTORIES}) - - find_library( - PANELWLIB - NAMES libpanelw.a panelw - PATHS ${VENDOR_LINK_DIRECTORIES}) - - message(STATUS "[musikcube] using libncursesw at " ${NCURSESWLIB}) - message(STATUS "[musikcube] using libpanelw at " ${PANELWLIB}) - - target_link_libraries(musikcube ${musikcube_LINK_LIBS} ${NCURSESWLIB} ${PANELWLIB} musikcore) - else() - target_link_libraries(musikcube ${musikcube_LINK_LIBS} ncursesw panelw musikcore) - endif() -else() - find_package(PkgConfig) - if (${NCURSES_DISABLE_LIB_SUFFIXES} MATCHES "true") - # 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 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) +if (${BUILD_STANDALONE} MATCHES "true") + target_include_directories(musikcube BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) endif() +# figure out if we have a "w" suffix or not... +if (${NCURSES_DISABLE_LIB_SUFFIXES} MATCHES "true") + message(STATUS "[ncurses] using library names *WITHOUT* 'w' prefix") + set(CURSES_LIBRARY_NAME ncurses) + set(PANEL_LIBRARY_NAME panel) +else() + message(STATUS "[ncurses] using library names with 'w' prefix") + set(CURSES_LIBRARY_NAME ncursesw) + set(PANEL_LIBRARY_NAME panelw) +endif() + +if (${BUILD_STANDALONE} MATCHES "true") + find_library(LIBNCURSES NAMES ${CURSES_LIBRARY_NAME} PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) + find_library(LIBPANEL NAMES ${PANEL_LIBRARY_NAME} PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) +else() + find_library(LIBNCURSES NAMES ${CURSES_LIBRARY_NAME} PATHS ${VENDOR_LINK_DIRECTORIES}) + find_library(LIBPANEL NAMES ${PANEL_LIBRARY_NAME} PATHS ${VENDOR_LINK_DIRECTORIES}) +endif() + +message(STATUS "[musikcube] using libncurses at: " ${LIBNCURSES}) +message(STATUS "[musikcube] using libpanel at: " ${LIBPANEL}) +message(STATUS "[musikcube] using libtinfo at: " ${LIBTINFO}) +target_link_libraries(musikcube ${musikcube_LINK_LIBS} ${LIBNCURSES} ${LIBPANEL} musikcore) + if (ENABLE_PCH MATCHES "true") message(STATUS "[musikcube] enabling precompiled headers") include(./pch.cmake) endif() + diff --git a/src/musikcubed/CMakeLists.txt b/src/musikcubed/CMakeLists.txt index f1b995593..c38fc2837 100644 --- a/src/musikcubed/CMakeLists.txt +++ b/src/musikcubed/CMakeLists.txt @@ -2,8 +2,6 @@ set (DAEMON_SRCS ./main.cpp ) -ensure_library_exists(ev) - set(musikcube_INSTALL_DIR ${HOMEBREW_PREFIX}) if (NOT DEFINED musikcube_INSTALL_DIR) set(musikcube_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) @@ -13,8 +11,10 @@ configure_file("musikcubed.in" "musikcubed" @ONLY) add_executable(musikcubed ${DAEMON_SRCS}) if (${BUILD_STANDALONE} MATCHES "true") + target_include_directories(musikcubed BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) find_library(EVLIB NAMES libev.a ev) - target_link_libraries(musikcubed ${musikcube_LINK_LIBS} ${EVLIB} musikcore) else() - target_link_libraries(musikcubed ${musikcube_LINK_LIBS} musikcore ev) + find_library(EVLIB NAMES ev) endif() + +target_link_libraries(musikcubed ${musikcube_LINK_LIBS} ${EVLIB} musikcore) \ No newline at end of file diff --git a/src/plugins/alsaout/CMakeLists.txt b/src/plugins/alsaout/CMakeLists.txt index 6f6bda335..28b05c2a8 100755 --- a/src/plugins/alsaout/CMakeLists.txt +++ b/src/plugins/alsaout/CMakeLists.txt @@ -3,8 +3,8 @@ set (alsaout_SOURCES AlsaOut.cpp ) -ensure_library_exists(asound) - add_library(alsaout SHARED ${alsaout_SOURCES}) -target_link_libraries(alsaout asound) + +find_library(LIBASOUND asound) +target_link_libraries(alsaout ${LIBASOUND}) diff --git a/src/plugins/libopenmptdecoder/CMakeLists.txt b/src/plugins/libopenmptdecoder/CMakeLists.txt index 701d1da50..8d7b3544f 100644 --- a/src/plugins/libopenmptdecoder/CMakeLists.txt +++ b/src/plugins/libopenmptdecoder/CMakeLists.txt @@ -6,8 +6,6 @@ set (openmptdecoder_SOURCES Utility.cpp ) -ensure_library_exists(openmpt) - add_library(openmptdecoder SHARED ${openmptdecoder_SOURCES}) find_library(OPENMPTLIB NAMES openmpt) diff --git a/src/plugins/pipewireout/CMakeLists.txt b/src/plugins/pipewireout/CMakeLists.txt index 57280d556..1d957836a 100644 --- a/src/plugins/pipewireout/CMakeLists.txt +++ b/src/plugins/pipewireout/CMakeLists.txt @@ -3,8 +3,6 @@ set (pipewireout_SOURCES PipeWireOut.cpp ) -ensure_library_exists(pipewire-0.3) - message(STATUS "[pipewireout] plugin enabled") find_package(PkgConfig) diff --git a/src/plugins/pulseout/CMakeLists.txt b/src/plugins/pulseout/CMakeLists.txt index e13baa15b..a42277d3f 100755 --- a/src/plugins/pulseout/CMakeLists.txt +++ b/src/plugins/pulseout/CMakeLists.txt @@ -4,7 +4,7 @@ set (pulseout_SOURCES PulseOut.cpp ) -ensure_library_exists(pulse) - add_library(pulseout SHARED ${pulseout_SOURCES}) -target_link_libraries(pulseout pulse) + +find_library(LIBPULSE pulse) +target_link_libraries(pulseout ${LIBPULSE}) diff --git a/src/plugins/sndioout/CMakeLists.txt b/src/plugins/sndioout/CMakeLists.txt index 3e2d68c7b..28f7432fd 100644 --- a/src/plugins/sndioout/CMakeLists.txt +++ b/src/plugins/sndioout/CMakeLists.txt @@ -3,7 +3,7 @@ set (sndioout_SOURCES SndioOut.cpp ) -ensure_library_exists(sndio) - add_library(sndioout SHARED ${sndioout_SOURCES}) -target_link_libraries(sndioout sndio) + +find_library(LIBSNDIO sndio) +target_link_libraries(sndioout ${LIBSNDIO}) diff --git a/src/plugins/taglib_plugin/CMakeLists.txt b/src/plugins/taglib_plugin/CMakeLists.txt index 62225d7de..d5db8ed2d 100644 --- a/src/plugins/taglib_plugin/CMakeLists.txt +++ b/src/plugins/taglib_plugin/CMakeLists.txt @@ -6,6 +6,8 @@ set (taglibreader_SOURCES add_library(taglibreader SHARED ${taglibreader_SOURCES}) include_directories(${Boost_INCLUDE_DIRS}) +find_library(LIBZ z) + if (NOT ${ENABLE_BUNDLED_TAGLIB} MATCHES "false") message(STATUS "[taglibmetadatareader] using bundled taglib = true") @@ -21,10 +23,10 @@ if (NOT ${ENABLE_BUNDLED_TAGLIB} MATCHES "false") include_directories("${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/include") add_dependencies(taglibreader taglib) - target_link_libraries(taglibreader ${Boost_LIBRARIES} "${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/lib/libtag.a" z) - message(STATUS "[taglibmetadatareader] using ${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/lib/libtag.a") + set(LIBTAG "${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/lib/libtag.a") else() - message(STATUS "[taglibmetadatareader] using bundled taglib = false") - ensure_library_exists(tag) - target_link_libraries(taglibreader ${Boost_LIBRARIES} tag z) + find_library(LIBTAG tag) endif() + +message(STATUS "[taglibmetadatareader] using ${LIBTAG}") +target_link_libraries(taglibreader ${Boost_LIBRARIES} ${LIBTAG} ${LIBZ})