@@ -49,6 +49,7 @@ endif()
4949
5050include (DownloadBinary)
5151include (CreateSymlink)
52+ include (CopyDependency)
5253
5354# Cleanup CPack "External" json, txt files, old AppImage files
5455file (GLOB cleanup "${CPACK_BINARY_DIR} /${lmms} -*.json"
@@ -87,11 +88,29 @@ foreach(_file ${files})
8788 endif ()
8889endforeach ()
8990
91+ # Gather deps
92+ list (APPEND DEPLOY_DEPS
93+ --deploy-deps-only "${APP} /usr/lib/${lmms} /"
94+ --deploy-deps-only "${APP} /usr/lib/${lmms} /ladspa/"
95+ )
96+
97+ # If usr/bin/lmms is hard-linked to libjack, copy it to a new location
98+ # See https://github.com/LMMS/lmms/issues/7689
99+ copy_dependency("${APP} /usr/bin/lmms" "libjack.so" "${APP} /usr/lib/jack" JACK_LIB_RELOC)
100+ if (JACK_LIB_RELOC)
101+ list (APPEND DEPLOY_DEPS --deploy-deps-only "${JACK_LIB_RELOC} " )
102+ endif ()
103+
104+ if (CPACK_HAVE_VST_32)
105+ list (APPEND DEPLOY_DEPS --deploy-deps-only "${APP} /usr/lib/${lmms} /32/" )
106+ endif ()
107+
90108# Copy Suil modules
91109if (CPACK_SUIL_MODULES)
92- set (SUIL_MODULES_TARGET "${APP} /usr/lib/${CPACK_SUIL_MODULES_PREFIX} " )
110+ set (SUIL_MODULES_TARGET "${APP} /usr/lib/suil-0/ " )
93111 file (MAKE_DIRECTORY "${SUIL_MODULES_TARGET} " )
94112 file (COPY ${CPACK_SUIL_MODULES} DESTINATION "${SUIL_MODULES_TARGET} " )
113+ list (APPEND DEPLOY_DEPS --deploy-deps-only "${APP} /usr/lib/suil-0/" )
95114endif ()
96115
97116# Copy stk/rawwaves
@@ -125,47 +144,18 @@ file(COPY "${APP}/usr/share/icons/hicolor/256x256/apps/${lmms}.png" DESTINATION
125144file (RENAME "${APP} /${lmms} .png" "${APP} /.DirIcon" )
126145file (COPY "${APP} /usr/share/icons/hicolor/256x256/apps/${lmms} .png" DESTINATION "${APP} " )
127146
128- # Build list of libraries to inform linuxdeploy about
129- # e.g. --library=foo.so --library=bar.so
130- file (GLOB LIBS "${APP} /usr/lib/${lmms} /*.so" )
131-
132- # Inform linuxdeploy about LADSPA plugins; may depend on bundled fftw3f, etc.
133- file (GLOB LADSPA "${APP} /usr/lib/${lmms} /ladspa/*.so" )
134-
135- # Inform linuxdeploy about remote plugins
136- file (GLOB REMOTE_PLUGINS "${APP} /usr/lib/${lmms} /*Remote*" )
137-
138147# Inform linuxdeploy-plugin-qt about wayland plugin
139148set (ENV{EXTRA_PLATFORM_PLUGINS} "libqwayland-generic.so" )
140149set (ENV{EXTRA_QT_MODULES} "waylandcompositor" )
141150
142- # Collect, sort and dedupe all libraries
143- list (APPEND LIBS ${LADSPA} )
144- list (APPEND LIBS ${REMOTE_PLUGINS} )
145- list (APPEND LIBS ${CPACK_SUIL_MODULES} )
146- list (REMOVE_DUPLICATES LIBS)
147- list (SORT LIBS)
148-
149- # Handle non-relinkable files (e.g. RemoveVstPlugin[32|64], but not NativeLinuxRemoteVstPlugin)
150- list (FILTER LIBS EXCLUDE REGEX "\\ /RemoteVst" )
151-
152- # Construct linuxdeploy parameters
153- foreach (_lib IN LISTS LIBS)
154- if (EXISTS "${_lib} " )
155- list (APPEND LIBRARIES "--library=${_lib} " )
156- endif ()
157- endforeach ()
158-
159- list (APPEND SKIP_LIBRARIES "--exclude-library=*libgallium*" )
160-
161151# Call linuxdeploy
162152message (STATUS "Calling ${LINUXDEPLOY_BIN} --appdir \" ${APP} \" ... [... libraries]." )
163153execute_process (COMMAND "${LINUXDEPLOY_BIN} "
164154 --appdir "${APP} "
165155 --desktop-file "${DESKTOP_FILE} "
166156 --plugin qt
167- ${LIBRARIES }
168- ${SKIP_LIBRARIES}
157+ ${DEPLOY_DEPS }
158+ -- exclude -library "*libgallium*"
169159 --verbosity ${VERBOSITY}
170160 WORKING_DIRECTORY "${CPACK_CURRENT_BINARY_DIR} "
171161 ${OUTPUT_QUIET}
@@ -189,83 +179,6 @@ foreach(_lib IN LISTS EXCLUDE_LIBS)
189179 endif ()
190180endforeach ()
191181
192- # FIXME: Remove when linuxdeploy supports subfolders https://github.com/linuxdeploy/linuxdeploy/issues/305
193- foreach (_lib IN LISTS LIBS)
194- if (EXISTS "${_lib} " )
195- file (REMOVE "${_lib} " )
196- endif ()
197- endforeach ()
198- # Move RemotePlugins into to LMMS_PLUGIN_DIR
199- file (GLOB WINE_VST_LIBS
200- "${APP} /usr/lib/${lmms} /RemoteVstPlugin*"
201- "${APP} /usr/lib/${lmms} /32" )
202- foreach (_file IN LISTS WINE_VST_LIBS)
203- if (EXISTS "${_file} " )
204- get_filename_component (_name "${_file} " NAME )
205- file (RENAME "${_file} " "${APP} /usr/lib/${_name} " )
206- endif ()
207- endforeach ()
208- file (GLOB WINE_32_LIBS
209- "${APP} /usr/lib/${lmms} /RemoteVstPlugin*" )
210- foreach (_lib IN LISTS WINE_64_LIBS)
211- if (EXISTS "${_lib} " )
212- get_filename_component (_file "${_lib} " NAME )
213- file (RENAME "${_lib} " "${APP} /usr/lib/${_file} " )
214- endif ()
215- endforeach ()
216-
217- file (REMOVE_RECURSE "${SUIL_MODULES_TARGET} " "${APP} /usr/lib/${lmms} /ladspa/" )
218-
219- # Copy "exclude-list" lib(s) into specified location
220- macro (copy_excluded ldd_target name_match destination relocated_lib)
221- execute_process (COMMAND ldd
222- "${ldd_target} "
223- OUTPUT_VARIABLE ldd_output
224- OUTPUT_STRIP_TRAILING_WHITESPACE
225- COMMAND_ECHO ${COMMAND_ECHO}
226- COMMAND_ERROR_IS_FATAL ANY)
227-
228- # escape periods to avoid double-escaping
229- string (REPLACE "." "\\ ." name_match "${name_match} " )
230-
231- # cli output --> list
232- string (REPLACE "\n " ";" ldd_list "${ldd_output} " )
233-
234- foreach (line ${ldd_list} )
235- if (line MATCHES "${name_match} " )
236- # Assumes format "libname.so.0 => /lib/location/libname.so.0 (0x00007f48d0b0e000)"
237- string (REPLACE " " ";" parts "${line} " )
238- list (LENGTH parts len)
239- math (EXPR index "${len} -2" )
240- list (GET parts ${index} lib)
241- # Resolve any possible symlinks
242- file (REAL_PATH "${lib} " libreal)
243- get_filename_component (symname "${lib} " NAME )
244- get_filename_component (realname "${libreal} " NAME )
245- file (MAKE_DIRECTORY "${destination} " )
246- # Copy, but with original symlink name
247- file (COPY "${libreal} " DESTINATION "${destination} " )
248- file (RENAME "${destination} /${realname} " "${destination} /${symname} " )
249- set ("${relocated_lib} " "${destination} /${symname} " )
250- break ()
251- endif ()
252- endforeach ()
253- endmacro ()
254-
255- # copy libjack
256- copy_excluded("${APP} /usr/bin/${lmms} " "libjack.so" "${APP} /usr/lib/jack" relocated_jack)
257- if (relocated_jack)
258- # libdb's not excluded however we'll re-use the macro as a convenient path calculation
259- # See https://github.com/LMMS/lmms/issues/7689s
260- copy_excluded("${relocated_jack} " "libdb-" "${APP} /usr/lib/jack" relocated_libdb)
261- get_filename_component (libdb_name "${relocated_libdb} " NAME )
262- if (relocated_libdb AND EXISTS "${APP} /usr/lib/${libdb_name} " )
263- # assume a copy already resides in usr/lib and symlink
264- file (REMOVE "${relocated_libdb} " )
265- create_symlink("${APP} /usr/lib/${libdb_name} " "${relocated_libdb} " )
266- endif ()
267- endif ()
268-
269182# cleanup empty directories
270183file (REMOVE_RECURSE "${APP} /usr/lib/${lmms} /optional/" )
271184
0 commit comments