Skip to content

Commit

Permalink
Attempt to fix weakjack
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Feb 8, 2025
1 parent b45b462 commit ea2b21d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
33 changes: 5 additions & 28 deletions cmake/linux/LinuxDeploy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ execute_process(COMMAND "${LINUXDEPLOY_BIN}"
# Remove svg ambitiously placed by linuxdeploy
file(REMOVE "${APP}/${lmms}.svg")

# Remove libraries that are normally sytem-provided
# Remove libraries that are normally system-provided
file(GLOB EXCLUDE_LIBS
"${APP}/usr/lib/libwine*"
"${APP}/usr/lib/libcarla_native*"
"${APP}/usr/lib/${lmms}/optional/libcarla*"
"${APP}/usr/lib/${lmms}/optional/libweakjack*"
"${APP}/usr/lib/libjack*")

list(SORT EXCLUDE_LIBS)
Expand All @@ -189,6 +190,9 @@ foreach(_lib IN LISTS EXCLUDE_LIBS)
endif()
endforeach()

# Symlink jack to avoid crash for systems without it
create_symlink("${APP}/usr/lib/libweakjack.so" "${APP}/usr/lib/${lmms}/optional/libjack.so.0")

# FIXME: Remove when linuxdeploy supports subfolders https://github.com/linuxdeploy/linuxdeploy/issues/305
foreach(_lib IN LISTS LIBS)
if(EXISTS "${_lib}")
Expand Down Expand Up @@ -216,33 +220,6 @@ endforeach()

file(REMOVE_RECURSE "${SUIL_MODULES_TARGET}" "${APP}/usr/lib/${lmms}/ladspa/")

# Bundle jack to avoid crash for systems without it
# See https://github.com/LMMS/lmms/pull/4186
execute_process(COMMAND ldd "${APP}/usr/bin/${lmms}"
OUTPUT_VARIABLE LDD_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ECHO ${COMMAND_ECHO}
COMMAND_ERROR_IS_FATAL ANY)
string(REPLACE "\n" ";" LDD_LIST "${LDD_OUTPUT}")
foreach(line ${LDD_LIST})
if(line MATCHES "libjack\\.so")
# Assume format "libjack.so.0 => /lib/x86_64-linux-gnu/libjack.so.0 (0x00007f48d0b0e000)"
string(REPLACE " " ";" parts "${line}")
list(LENGTH parts len)
math(EXPR index "${len}-2")
list(GET parts ${index} lib)
# Get symlink target
file(REAL_PATH "${lib}" libreal)
get_filename_component(symname "${lib}" NAME)
get_filename_component(realname "${libreal}" NAME)
file(MAKE_DIRECTORY "${APP}/usr/lib/${lmms}/optional/")
# Copy, but with original symlink name
file(COPY "${libreal}" DESTINATION "${APP}/usr/lib/${lmms}/optional/")
file(RENAME "${APP}/usr/lib/${lmms}/optional/${realname}" "${APP}/usr/lib/${lmms}/optional/${symname}")
continue()
endif()
endforeach()

if(CPACK_TOOL STREQUAL "appimagetool")
# Create ".AppImage" file using appimagetool (default)

Expand Down
6 changes: 4 additions & 2 deletions src/3rdparty/weakjack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use weak jack library linking
if(LMMS_HAVE_WEAKJACK)
add_library(weakjack STATIC
add_library(weakjack SHARED
weakjack/weak_libjack.c
)
target_include_directories(weakjack PUBLIC weakjack)
Expand All @@ -11,4 +11,6 @@ if(LMMS_HAVE_WEAKJACK)
USE_WEAK_JACK=1
NO_JACK_METADATA=1
)
endif()

install(TARGETS weakjack LIBRARY DESTINATION "${PLUGIN_DIR}/optional")
endif()

0 comments on commit ea2b21d

Please sign in to comment.