diff --git a/mingw-w64-supercollider/001-cmake-mingw-fix.patch b/mingw-w64-supercollider/001-cmake-mingw-fix.patch new file mode 100644 index 0000000000..de75728e89 --- /dev/null +++ b/mingw-w64-supercollider/001-cmake-mingw-fix.patch @@ -0,0 +1,299 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ac592a..83121ed 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -50,7 +50,7 @@ ADD_CUSTOM_TARGET(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + + # identify target architecture +-if(WIN32) ++if(MSVC) + SET(SC_WIN_BUNDLE_NAME "SuperCollider" CACHE STRING "Folder name of SC install") + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) +@@ -64,7 +64,7 @@ if(WIN32) + SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE PATH "Cmake install path" FORCE) + endif() + +-endif(WIN32) ++endif(MSVC) + + ############################################# + # Compiler flags etc +@@ -100,7 +100,7 @@ if (${CMAKE_COMPILER_IS_GNUCXX}) + add_definitions("-fpascal-strings") + endif() + add_definitions("-D_REENTRANT") +- elseif(NOT (WIN32 AND NOT CYGWIN)) ++ elseif(NOT MSVC) + add_definitions("-pthread") + endif() + +@@ -113,6 +113,16 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL + set(CMAKE_COMPILER_IS_CLANG 1) + endif() + ++if(MINGW) ++ # Suppress some annoying warnings ++ add_compile_options(-Wno-deprecated-declarations -Wno-format) ++ if(CMAKE_COMPILER_IS_CLANG) ++ add_compile_options(-Wno-constant-conversion -Wno-enum-compare-switch -Wno-parentheses) ++ else() ++ add_compile_options(-Wno-ignored-attributes -Wno-overflow) ++ endif() ++endif() ++ + if(APPLE) + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE STRING "Cmake install path" FORCE) +@@ -122,7 +132,7 @@ elseif(UNIX) + endif() + + if(WIN32) +- add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_WIN32_WINNT=0x0600) ++ add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX) + + #avoid unnecesary autolink + add_definitions(-DBOOST_DATE_TIME_NO_LIB -DBOOST_ALL_NO_LIB) +@@ -305,7 +315,7 @@ endif() + ############################################# + # some default libraries + +-if (NOT WIN32) ++if (NOT MSVC) + find_package(Pthreads) + + if (NOT PTHREADS_FOUND) +@@ -489,7 +499,7 @@ add_subdirectory(lang) + add_subdirectory(platform) + add_subdirectory(editors) + +-if(UNIX AND NOT APPLE) ++if((UNIX AND NOT APPLE) OR MINGW) + install(DIRECTORY include/common include/plugin_interface include/server include/lang + DESTINATION ${CMAKE_INSTALL_PREFIX}/include/SuperCollider + FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" +@@ -499,10 +509,12 @@ if(UNIX AND NOT APPLE) + ) + endif() + +-if (WIN32) ++if (MSVC) + set(auxresourcesdir "${SC_WIN_BUNDLE_NAME}" CACHE STRING "Resources directory") + elseif(APPLE) + set(auxresourcesdir ${scappbundlename} CACHE STRING "Resources directory") ++elseif(MINGW) ++ set(auxresourcesdir "${CMAKE_INSTALL_PREFIX}/share/SuperCollider" CACHE STRING "Resources directory") + else() + set(auxresourcesdir "share/SuperCollider" CACHE STRING "Resources directory") + endif() +diff --git a/editors/sc-ide/CMakeLists.txt b/editors/sc-ide/CMakeLists.txt +index 569022b..20c1664 100644 +--- a/editors/sc-ide/CMakeLists.txt ++++ b/editors/sc-ide/CMakeLists.txt +@@ -347,7 +347,7 @@ if(APPLE) + target_link_libraries( libscide PUBLIC "-framework CoreServices -framework Foundation") + target_link_libraries( libscide PUBLIC "-framework Cocoa" ) + elseif(WIN32) +- target_link_libraries( libscide PUBLIC wsock32 ) ++ target_link_libraries( libscide PUBLIC wsock32 shlwapi ) + target_compile_definitions( libscide PUBLIC UNICODE _UNICODE) + # The following prevents a Windows console from showing up + # when the executable is started: +@@ -402,7 +402,7 @@ if(APPLE) + set_property(TARGET SuperCollider + PROPERTY MACOSX_BUNDLE_BUNDLE_NAME ${scappbundlename}) + +-elseif(WIN32) ++elseif(WIN32 AND NOT MINGW) + + if(NOT MSVC) + set_target_properties(SuperCollider PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$") +@@ -473,7 +473,7 @@ endif() + # mac/windows: find the Qt deploy utility. + # See https://doc.qt.io/qt-5/windows-deployment.html for windeployqt + # See https://doc.qt.io/qt-5/osx-deployment.html for macdeployqt +-if(APPLE OR WIN32) ++if(APPLE OR MSVC) + if(APPLE) + find_program(DEPLOY_PROG macdeployqt PATHS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES bin) + # only the IDE executable is scanned normally, so force scanning of sclang as well +diff --git a/external_libraries/hidapi/CMakeLists.txt b/external_libraries/hidapi/CMakeLists.txt +index ce5937e..5af9f46 100644 +--- a/external_libraries/hidapi/CMakeLists.txt ++++ b/external_libraries/hidapi/CMakeLists.txt +@@ -26,7 +26,7 @@ if( HID_DEBUG_PARSER ) + endif() + + # some default libraries +-if (NOT WIN32) ++if (NOT MSVC) + find_package(Pthreads) + if (NOT PTHREADS_FOUND) + message(SEND_ERROR "cannot find libpthreads") +@@ -113,7 +113,7 @@ if( HID_DEBUG_PARSER OR HID_INSTALL_HUT ) + set(scappbundlename "SuperCollider") + set(scappauxresourcesdir "${scappbundlename}/${scappbundlename}.app/Contents/Resources") + set(HID_HUT_PATH "${CMAKE_INSTALL_PREFIX}/${scappauxresourcesdir}/HID_Support") +- elseif(WIN32) ++ elseif(MSVC) + set(auxresourcesdir "SuperCollider" CACHE STRING "Resources directory") + set(HID_HUT_PATH "${CMAKE_INSTALL_PREFIX}/${auxresourcesdir}/HID_Support") + else() +diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt +index 561023d..75bb510 100644 +--- a/lang/CMakeLists.txt ++++ b/lang/CMakeLists.txt +@@ -253,7 +253,7 @@ else() + target_compile_definitions(libsclang PUBLIC NO_INTERNAL_SERVER) + endif() + +-if (NOT WIN32) ++if (NOT MSVC) + set_property(TARGET libsclang + PROPERTY OUTPUT_NAME sclang) + endif() +@@ -346,6 +346,10 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") + target_link_libraries(libsclang rt) + endif() + ++if(MINGW) ++ target_link_libraries(libsclang shlwapi) ++endif() ++ + target_link_libraries(libsclang ${YAMLCPP_LIBRARY}) + + add_executable(sclang LangSource/cmdLineFuncs.cpp ${RES_FILES}) +@@ -372,7 +376,7 @@ if(APPLE) + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_INSTALL_PREFIX}/${scappbindir} + ) + endif() +-elseif(WIN32) ++elseif(WIN32 AND NOT MINGW) + if(NOT MSVC) + set_target_properties(sclang PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$") + endif(NOT MSVC) +diff --git a/server/plugins/CMakeLists.txt b/server/plugins/CMakeLists.txt +index 171dfb6..87853e9 100644 +--- a/server/plugins/CMakeLists.txt ++++ b/server/plugins/CMakeLists.txt +@@ -301,7 +301,7 @@ if (APPLE) + endif() + endif() + +-if (WIN32) ++if (WIN32 AND NOT MINGW) + foreach(plugin ${plugins} ${supernova_plugins}) + add_custom_command(TARGET ${plugin} + POST_BUILD +diff --git a/server/scsynth/CMakeLists.txt b/server/scsynth/CMakeLists.txt +index 3cad565..87782c1 100644 +--- a/server/scsynth/CMakeLists.txt ++++ b/server/scsynth/CMakeLists.txt +@@ -176,7 +176,7 @@ endif() + + target_compile_definitions(libscsynth PUBLIC SC_MEMORY_ALIGNMENT=32) + +-target_link_libraries(libscsynth tlsf) ++target_link_libraries(libscsynth tlsf ${PTHREADS_LIBRARIES}) + + find_library(DL NAMES dl) + if(DL) +@@ -234,11 +234,11 @@ endif() + target_include_directories(libscsynth PUBLIC ${boost_include_dirs}) + + if (WIN32) +- target_link_libraries(libscsynth wsock32 ws2_32 winmm) ++ target_link_libraries(libscsynth wsock32 ws2_32 winmm shlwapi) + target_compile_definitions(libscsynth PUBLIC UNICODE _UNICODE) + endif() + +-if(NOT WIN32) ++if(NOT MSVC) + set_property(TARGET libscsynth PROPERTY OUTPUT_NAME scsynth) + endif() + +@@ -275,10 +275,6 @@ if(AUDIOAPI STREQUAL bela) + target_link_libraries(scsynth ${XENOMAI_LIBRARIES} ${BELA_LIBRARIES} belaextra) + endif() + +-if (PTHREADS_FOUND) +- target_link_libraries(scsynth ${PTHREADS_LIBRARIES}) +-endif() +- + if(LTO) + set_property(TARGET scsynth libscsynth + APPEND PROPERTY COMPILE_FLAGS "-flto -flto-report") +@@ -303,7 +299,7 @@ if(APPLE) + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_INSTALL_PREFIX}/${scappauxresourcesdir} + ) + endif() +-elseif(WIN32) ++elseif(WIN32 AND NOT MINGW) + if(NOT MSVC) + target_link_libraries(scsynth "-municode") + set_target_properties(scsynth libscsynth PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$") +@@ -345,8 +341,13 @@ elseif(WIN32) + ) + + else() ++ if(MINGW) ++ target_link_libraries(scsynth "-municode") ++ endif() ++ + install(TARGETS ${INSTALL_TARGETS} + RUNTIME DESTINATION "bin" ++ ARCHIVE DESTINATION "lib${LIB_SUFFIX}" + LIBRARY DESTINATION "lib${LIB_SUFFIX}" + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + endif() +diff --git a/server/supernova/CMakeLists.txt b/server/supernova/CMakeLists.txt +index 6e92edd..e768bdf 100644 +--- a/server/supernova/CMakeLists.txt ++++ b/server/supernova/CMakeLists.txt +@@ -85,7 +85,7 @@ if(LINUX AND CMAKE_COMPILER_IS_CLANG) + message(STATUS "Clang on Linux detected, linking to libatomic") + target_link_libraries(libsupernova atomic) + endif() +-if(NOT WIN32) ++if(NOT MSVC) + set_property(TARGET libsupernova + PROPERTY OUTPUT_NAME supernova) + endif() +@@ -201,14 +201,14 @@ endif() + target_link_libraries(libsupernova boost_system_lib boost_program_options_lib) + target_include_directories(libsupernova PUBLIC ${boost_include_dirs}) + +-if(CMAKE_COMPILER_IS_GNUCXX) ++if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW) + if( ${_gcc_version} VERSION_GREATER 5 ) + target_link_libraries( libsupernova atomic ) + endif() + endif() + + if(WIN32) +- target_link_libraries(libsupernova wsock32 ws2_32 winmm) ++ target_link_libraries(libsupernova wsock32 ws2_32 winmm shlwapi) + target_compile_definitions(libsupernova PUBLIC UNICODE _UNICODE) + endif() + +@@ -223,7 +223,7 @@ add_executable(supernova + ) + target_link_libraries(supernova libsupernova) + +-if(WIN32) ++if(WIN32 AND NOT MINGW) + if(NOT MSVC) + target_link_libraries(supernova "-municode") + set_target_properties(supernova libsupernova PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$") +@@ -273,6 +273,10 @@ elseif(APPLE) + ) + endif() + else() ++ if(MINGW) ++ target_link_libraries(supernova "-municode") ++ endif() ++ + install(TARGETS supernova + DESTINATION "bin" + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/mingw-w64-supercollider/002-reduce-warnings.patch b/mingw-w64-supercollider/002-reduce-warnings.patch new file mode 100644 index 0000000000..5e37cbbd05 --- /dev/null +++ b/mingw-w64-supercollider/002-reduce-warnings.patch @@ -0,0 +1,150 @@ +diff --git a/editors/sc-ide/widgets/settings/editor_page.cpp b/editors/sc-ide/widgets/settings/editor_page.cpp +index 9cf3e78..7605a53 100644 +--- a/editors/sc-ide/widgets/settings/editor_page.cpp ++++ b/editors/sc-ide/widgets/settings/editor_page.cpp +@@ -39,7 +39,7 @@ EditorPage::EditorPage(QWidget* parent): + QWidget(parent), + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) + fontDatabase(new QFontDatabase), +-#endif() ++#endif + ui(new Ui::EditorConfigPage) { + ui->setupUi(this); + +diff --git a/lang/LangPrimSource/SC_PortMIDI.cpp b/lang/LangPrimSource/SC_PortMIDI.cpp +index fe84fde..3bb773c 100644 +--- a/lang/LangPrimSource/SC_PortMIDI.cpp ++++ b/lang/LangPrimSource/SC_PortMIDI.cpp +@@ -28,8 +28,8 @@ added prRestartMIDI + 04/feb/03 prListMIDIEndpoints modification by Ron Kuivila added jt. + */ + +-#include "PortMIDI.h" +-#include "PortTime.h" ++#include "portmidi.h" ++#include "porttime.h" + + #include "SCBase.h" + #include "VMGlobals.h" +diff --git a/lang/LangSource/DumpParseNode.cpp b/lang/LangSource/DumpParseNode.cpp +index ef03671..0e3bfb8 100644 +--- a/lang/LangSource/DumpParseNode.cpp ++++ b/lang/LangSource/DumpParseNode.cpp +@@ -29,7 +29,7 @@ + #include + #include + +-#ifdef _WIN32 ++#ifndef PATH_MAX + # define PATH_MAX _MAX_PATH + #endif + +diff --git a/server/scsynth/SC_ComPort.cpp b/server/scsynth/SC_ComPort.cpp +index 50c2616..d765048 100644 +--- a/server/scsynth/SC_ComPort.cpp ++++ b/server/scsynth/SC_ComPort.cpp +@@ -107,7 +107,7 @@ static bool UnrollOSCPacket(World* inWorld, int inSize, char* inData, OSC_Packet + data += sizeof(int32); + if (!strcmp(data, "#bundle")) { // is a bundle + OSC_Packet* packet = (OSC_Packet*)malloc(sizeof(OSC_Packet)); +- memcpy(packet, inPacket, sizeof(OSC_Packet)); // clone inPacket ++ memcpy(reinterpret_cast(packet), inPacket, sizeof(OSC_Packet)); // clone inPacket + + if (!UnrollOSCPacket(inWorld, msgSize, data, packet)) { + free(packet); +diff --git a/server/scsynth/SC_PortAudio.cpp b/server/scsynth/SC_PortAudio.cpp +index ebd646a..f87d9e8 100644 +--- a/server/scsynth/SC_PortAudio.cpp ++++ b/server/scsynth/SC_PortAudio.cpp +@@ -127,7 +127,7 @@ int SC_PortAudioDriver::PortAudioCallback(const void* input, void* output, unsig + const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags) { + sc_SetDenormalFlags(); + World* world = mWorld; +- (void)frameCount, timeInfo, statusFlags; // suppress unused parameter warnings ++ (void)frameCount, (void)timeInfo, (void)statusFlags; // suppress unused parameter warnings + #ifdef SC_PA_USE_DLL + mDLL.Update(sc_PAOSCTimeSeconds()); + +diff --git a/server/scsynth/SC_World.cpp b/server/scsynth/SC_World.cpp +index 25682d4..a437f77 100644 +--- a/server/scsynth/SC_World.cpp ++++ b/server/scsynth/SC_World.cpp +@@ -626,7 +626,7 @@ void World_NonRealTimeSynthesis(struct World* world, WorldOptions* inOptions) { + throw std::runtime_error("Couldn't open non real time command file.\n"); + + OSC_Packet packet; +- memset(&packet, 0, sizeof(packet)); ++ memset(reinterpret_cast(&packet), 0, sizeof(packet)); + packet.mData = (char*)malloc(8192); + packet.mIsBundle = true; + packet.mReplyAddr.mReplyFunc = null_reply_func; +diff --git a/server/supernova/audio_backend/portaudio_backend.hpp b/server/supernova/audio_backend/portaudio_backend.hpp +index 00bc5f0..37a76b4 100644 +--- a/server/supernova/audio_backend/portaudio_backend.hpp ++++ b/server/supernova/audio_backend/portaudio_backend.hpp +@@ -298,12 +298,13 @@ private: + super::fetch_inputs(inputs, blocksize_, input_channels); + engine_functor::run_tick(); + super::deliver_outputs(outputs, blocksize_, m_hwOutputChannels); +- if (IsClipping) ++ if (IsClipping) { + for (uint16_t i = 0; i != m_hwOutputChannels; ++i) + if (super::is_aligned(out[i])) + clip2_vec_simd(out[i], out[i], safety_clip_threshold_, blocksize_); + else + clip2_vec(out[i], out[i], safety_clip_threshold_, blocksize_); ++ } + processed += blocksize_; + } + +diff --git a/server/supernova/sc/sc_plugin_interface.cpp b/server/supernova/sc/sc_plugin_interface.cpp +index 8bc8832..972b367 100644 +--- a/server/supernova/sc/sc_plugin_interface.cpp ++++ b/server/supernova/sc/sc_plugin_interface.cpp +@@ -699,9 +699,9 @@ void sc_plugin_interface::initialize(server_arguments const& args, float* contro + world.mSndBufs = new SndBuf[world.mNumSndBufs]; + world.mSndBufsNonRealTimeMirror = new SndBuf[world.mNumSndBufs]; + world.mSndBufUpdates = new SndBufUpdates[world.mNumSndBufs]; +- memset(world.mSndBufs, 0, world.mNumSndBufs * sizeof(SndBuf)); +- memset(world.mSndBufsNonRealTimeMirror, 0, world.mNumSndBufs * sizeof(SndBuf)); +- memset(world.mSndBufUpdates, 0, world.mNumSndBufs * sizeof(SndBufUpdates)); ++ memset(reinterpret_cast(world.mSndBufs), 0, world.mNumSndBufs * sizeof(SndBuf)); ++ memset(reinterpret_cast(world.mSndBufsNonRealTimeMirror), 0, world.mNumSndBufs * sizeof(SndBuf)); ++ memset(reinterpret_cast(world.mSndBufUpdates), 0, world.mNumSndBufs * sizeof(SndBufUpdates)); + world.mBufCounter = 0; + + async_buffer_guards.reset(new std::mutex[world.mNumSndBufs]); +diff --git a/server/supernova/utilities/callback_interpreter.hpp b/server/supernova/utilities/callback_interpreter.hpp +index aab9c09..7aaeaef 100644 +--- a/server/supernova/utilities/callback_interpreter.hpp ++++ b/server/supernova/utilities/callback_interpreter.hpp +@@ -104,7 +104,7 @@ public: + void start_thread(void) { + semaphore sync_sem; + std::thread thr([&]() { this->run_thread(sync_sem); }); +- callback_thread = move(thr); ++ callback_thread = std::move(thr); + sync_sem.wait(); + } + +diff --git a/testsuite/server/supernova/sized_array_test.cpp b/testsuite/server/supernova/sized_array_test.cpp +index 2d1a414..7558773 100644 +--- a/testsuite/server/supernova/sized_array_test.cpp ++++ b/testsuite/server/supernova/sized_array_test.cpp +@@ -38,14 +38,14 @@ BOOST_AUTO_TEST_CASE(sized_array_test_1) { + + // move assignment + sized_array array3(0); +- move(&array, &array + 1, &array3); ++ std::move(&array, &array + 1, &array3); + BOOST_REQUIRE_EQUAL(array3.size(), 5u); + BOOST_REQUIRE_EQUAL(array3[1], 3); + BOOST_REQUIRE_EQUAL(array3[0], -1); + BOOST_REQUIRE_EQUAL(array.size(), 0u); + + // move assignment +- sized_array array4(move(array3)); ++ sized_array array4(std::move(array3)); + BOOST_REQUIRE_EQUAL(array4.size(), 5u); + BOOST_REQUIRE_EQUAL(array4[1], 3); + BOOST_REQUIRE_EQUAL(array4[0], -1); diff --git a/mingw-w64-supercollider/003-mingw-filesystem.patch b/mingw-w64-supercollider/003-mingw-filesystem.patch new file mode 100644 index 0000000000..a07b9cd3c3 --- /dev/null +++ b/mingw-w64-supercollider/003-mingw-filesystem.patch @@ -0,0 +1,70 @@ +diff --git a/common/SC_Filesystem_win.cpp b/common/SC_Filesystem_win.cpp +index 9873a05..62c4b02 100644 +--- a/common/SC_Filesystem_win.cpp ++++ b/common/SC_Filesystem_win.cpp +@@ -33,7 +33,8 @@ + # include + + // system +-# include // SHGetKnownFolderPath ++# include // SHGetKnownFolderPath ++# include // PathRemoveFileSpec + + using Path = SC_Filesystem::Path; + using DirName = SC_Filesystem::DirName; +@@ -124,21 +125,38 @@ bool SC_Filesystem::isNonHostPlatformDirectoryName(const std::string& s) { + } + + Path SC_Filesystem::defaultSystemAppSupportDirectory() { ++#ifdef _MSC_VER + PWSTR wptr = nullptr; + const HRESULT hr = SHGetKnownFolderPath(FOLDERID_ProgramData, 0, nullptr, &wptr); + return FAILED(hr) ? Path() : Path(wptr) / SC_FOLDERNAME_APPLICATION_NAME; ++#else ++ WCHAR buf[MAX_PATH]; ++ GetModuleFileNameW(nullptr, buf, MAX_PATH-1); ++ PathRemoveFileSpecW(buf); ++ return Path(buf).parent_path() / "share" / SC_FOLDERNAME_APPLICATION_NAME; ++#endif + } + + Path SC_Filesystem::defaultUserHomeDirectory() { ++#ifdef _MSC_VER + PWSTR wptr = nullptr; + const HRESULT hr = SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &wptr); + return FAILED(hr) ? Path() : Path(wptr); ++#else ++ const char* home = getenv("HOME"); ++ return Path(home); ++#endif + } + + Path SC_Filesystem::defaultUserAppSupportDirectory() { ++#ifdef _MSC_VER + PWSTR wptr = nullptr; + const HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &wptr); + return FAILED(hr) ? Path() : Path(wptr) / SC_FOLDERNAME_APPLICATION_NAME; ++#else ++ const char* home = getenv("HOME"); ++ return Path(home) / "supercollider"; ++#endif + } + + Path SC_Filesystem::defaultUserConfigDirectory() { return defaultUserAppSupportDirectory(); } +@@ -150,9 +168,16 @@ Path SC_Filesystem::defaultMyDocumentsDirectory() { + } + + Path SC_Filesystem::defaultResourceDirectory() { ++#ifdef _MSC_VER + WCHAR buf[MAX_PATH]; + GetModuleFileNameW(nullptr, buf, MAX_PATH); + return Path(buf).parent_path(); ++#else ++ WCHAR buf[MAX_PATH]; ++ GetModuleFileNameW(nullptr, buf, MAX_PATH-1); ++ PathRemoveFileSpecW(buf); ++ return Path(buf).parent_path() / "share" / SC_FOLDERNAME_APPLICATION_NAME; ++#endif + } + + #endif // _WIN32 diff --git a/mingw-w64-supercollider/PKGBUILD b/mingw-w64-supercollider/PKGBUILD new file mode 100644 index 0000000000..82345c54e9 --- /dev/null +++ b/mingw-w64-supercollider/PKGBUILD @@ -0,0 +1,75 @@ +# Contributor: Raed Rizqie + +_realname=supercollider +pkgbase=mingw-w64-${_realname} +pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" +pkgver=3.14.0 +pkgrel=1 +pkgdesc="Platform for audio synthesis and algorithmic composition (mingw-w64)" +arch=(any) +mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') +url='https://supercollider.github.io' +msys2_repository_url='https://github.com/supercollider/supercollider' +license=('spdx:GPL-3.0-or-later') +depends=("${MINGW_PACKAGE_PREFIX}-cc-libs" + "${MINGW_PACKAGE_PREFIX}-fftw" + "${MINGW_PACKAGE_PREFIX}-libsndfile" + "${MINGW_PACKAGE_PREFIX}-libwinpthread" + "${MINGW_PACKAGE_PREFIX}-qt5-base" + "${MINGW_PACKAGE_PREFIX}-qt5-svg" + "${MINGW_PACKAGE_PREFIX}-qt5-webchannel" + "${MINGW_PACKAGE_PREFIX}-qt5-websockets" + "${MINGW_PACKAGE_PREFIX}-readline") +makedepends=("${MINGW_PACKAGE_PREFIX}-cc" + "${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-ninja" + "${MINGW_PACKAGE_PREFIX}-pkgconf" + "${MINGW_PACKAGE_PREFIX}-qt5-tools" + "${MINGW_PACKAGE_PREFIX}-winpthreads") +source=(https://github.com/supercollider/supercollider/releases/download/Version-${pkgver}/SuperCollider-${pkgver}-Source.tar.bz2 + 001-cmake-mingw-fix.patch + 002-reduce-warnings.patch + 003-mingw-filesystem.patch) +sha256sums=('ab710e84376f5c082c92fcea7465b85d375934f3da7deed583457a0a48b0a918' + '0a3f449a38c631dd927dbb357ac05ec0a404e802fd2c4d044b8935fbfc1717eb' + 'a9b5189376408130641e9f44ec83ea23cb55eecaa37f096c53d06cf2d957e70a' + '03c8e88c2fab5ae29792fa589498d357094395126c521a250671b652d5982cf6') + +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying ${_patch}" + patch -p1 -i "${srcdir}/${_patch}" + done +} + +prepare() { + cd SuperCollider-${pkgver}-Source + + apply_patch_with_msg \ + 001-cmake-mingw-fix.patch \ + 002-reduce-warnings.patch \ + 003-mingw-filesystem.patch +} + +build() { + MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ + cmake -Wno-dev \ + -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ + -DSC_USE_QTWEBENGINE=OFF \ + -DLIBSCSYNTH=ON \ + -DSUPERNOVA=ON \ + -DINSTALL_HELP=OFF \ + -S SuperCollider-${pkgver}-Source \ + -B build-${MSYSTEM} + + cmake --build build-${MSYSTEM} +} + +package() { + DESTDIR="$pkgdir" cmake --install build-${MSYSTEM} + + install -Dm644 SuperCollider-${pkgver}-Source/COPYING "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE +}