From b315527a21c7308b9cca4c30f43e1d476ba6390a Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Fri, 8 Sep 2023 17:58:00 +0200 Subject: [PATCH 1/3] Enable build under NixOS Enable the build under NixOS by explicitly calling the perl interpreter when building the SWH LADSPA plugins. The reason is that NixOS does not have much of a `/usr/bin` directory: ``` $ which perl /run/current-system/sw/bin/perl ``` Hence the build failed under NixOS when relying on the first hash-bang-slash line of the `makestub.pl` script which wants to be interpreted by `/usr/bin/perl -w`. --- plugins/LadspaEffect/swh/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/LadspaEffect/swh/CMakeLists.txt b/plugins/LadspaEffect/swh/CMakeLists.txt index aec01c22f8e..ece3070060b 100644 --- a/plugins/LadspaEffect/swh/CMakeLists.txt +++ b/plugins/LadspaEffect/swh/CMakeLists.txt @@ -24,7 +24,7 @@ FOREACH(_item ${XML_SOURCES}) # Coerce XML source file to C ADD_CUSTOM_COMMAND( OUTPUT "${_out_file}" - COMMAND ./makestub.pl "${_item}" > "${_out_file}" + COMMAND perl ./makestub.pl "${_item}" > "${_out_file}" DEPENDS "${_item}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ladspa" VERBATIM From 3df3f2e2e99697b07d71cc14a65137dbb147ae9e Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Mon, 11 Sep 2023 18:49:56 +0200 Subject: [PATCH 2/3] Fix MacOS build (from PR-6758) Cherry-pick some changes from PR #6758 to keep MacOS building. --- CMakeLists.txt | 28 +++++++++++++++++++++++-- plugins/LadspaEffect/swh/CMakeLists.txt | 3 ++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e20f1352701..ef35cd5e921 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,21 @@ SET(LMMS_BINARY_DIR ${CMAKE_BINARY_DIR}) SET(LMMS_SOURCE_DIR ${CMAKE_SOURCE_DIR}) # CMAKE_POLICY Section +IF(COMMAND CMAKE_POLICY) + CMAKE_POLICY(SET CMP0005 NEW) + CMAKE_POLICY(SET CMP0003 NEW) + IF (CMAKE_MAJOR_VERSION GREATER 2) + CMAKE_POLICY(SET CMP0026 NEW) + CMAKE_POLICY(SET CMP0045 NEW) + CMAKE_POLICY(SET CMP0050 OLD) + ENDIF() + CMAKE_POLICY(SET CMP0020 NEW) + CMAKE_POLICY(SET CMP0057 NEW) + # TODO: Keep CMP0074 but remove this condition when cmake 3.12+ is guaranteed + IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12) + CMAKE_POLICY(SET CMP0074 NEW) # find_package() uses _ROOT variables + ENDIF() +ENDIF(COMMAND CMAKE_POLICY) # Import of windows.h breaks min()/max() ADD_DEFINITIONS(-DNOMINMAX) @@ -262,8 +277,17 @@ ELSE(WANT_CMT) ENDIF(WANT_CMT) IF(WANT_SWH) - SET(LMMS_HAVE_SWH TRUE) - SET(STATUS_SWH "OK") + IF(LMMS_BUILD_APPLE) + # Prefer system perl over Homebrew, MacPorts, etc + SET(Perl_ROOT "/usr/bin") + ENDIF() + FIND_PACKAGE(Perl) + IF(PERL_FOUND) + SET(LMMS_HAVE_SWH TRUE) + SET(STATUS_SWH "OK") + ELSE() + SET(STATUS_SWH "Skipping, perl is missing") + ENDIF() ELSE(WANT_SWH) SET(STATUS_SWH "not built as requested") ENDIF(WANT_SWH) diff --git a/plugins/LadspaEffect/swh/CMakeLists.txt b/plugins/LadspaEffect/swh/CMakeLists.txt index ece3070060b..a8300117735 100644 --- a/plugins/LadspaEffect/swh/CMakeLists.txt +++ b/plugins/LadspaEffect/swh/CMakeLists.txt @@ -16,6 +16,7 @@ SET(COMPILE_FLAGS "${COMPILE_FLAGS} ${PIC_FLAGS}") # Loop over every XML file FILE(GLOB XML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/*.xml") LIST(SORT XML_SOURCES) + FOREACH(_item ${XML_SOURCES}) # Get library name and (soon to be) C file GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE) @@ -24,7 +25,7 @@ FOREACH(_item ${XML_SOURCES}) # Coerce XML source file to C ADD_CUSTOM_COMMAND( OUTPUT "${_out_file}" - COMMAND perl ./makestub.pl "${_item}" > "${_out_file}" + COMMAND "${PERL_EXECUTABLE}" ./makestub.pl "${_item}" > "${_out_file}" DEPENDS "${_item}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ladspa" VERBATIM From 49da37465a8637536d46b1e3bed30d605e31c8e7 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Tue, 12 Sep 2023 23:14:49 +0200 Subject: [PATCH 3/3] Only keep needed CMake policies Only keep the CMake policy that's needed in the context of the SWH Ladspa plugins. --- CMakeLists.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef35cd5e921..8cc1878c91f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,17 +8,9 @@ SET(LMMS_SOURCE_DIR ${CMAKE_SOURCE_DIR}) # CMAKE_POLICY Section IF(COMMAND CMAKE_POLICY) - CMAKE_POLICY(SET CMP0005 NEW) - CMAKE_POLICY(SET CMP0003 NEW) - IF (CMAKE_MAJOR_VERSION GREATER 2) - CMAKE_POLICY(SET CMP0026 NEW) - CMAKE_POLICY(SET CMP0045 NEW) - CMAKE_POLICY(SET CMP0050 OLD) - ENDIF() - CMAKE_POLICY(SET CMP0020 NEW) - CMAKE_POLICY(SET CMP0057 NEW) # TODO: Keep CMP0074 but remove this condition when cmake 3.12+ is guaranteed IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12) + # Needed for the SWH Ladspa plugins. See below. CMAKE_POLICY(SET CMP0074 NEW) # find_package() uses _ROOT variables ENDIF() ENDIF(COMMAND CMAKE_POLICY)