diff --git a/build_system_fixes.patch b/build_system_fixes.patch new file mode 100644 index 0000000..6bce128 --- /dev/null +++ b/build_system_fixes.patch @@ -0,0 +1,86 @@ +--- source/build_linux_common.sh.orig 2025-10-30 18:28:15.000000000 +0100 ++++ source/build_linux_common.sh 2026-01-05 14:38:13.999781422 +0100 +@@ -147,9 +147,9 @@ + #export QT_CFLAGS="-DQT_STATIC -DQT3_SUPPORT -I$RQTDIR/include/Qt3Support -I$RQTDIR/include/QtCore -I$RQTDIR/include/QtGui -I$RQTDIR/include/QtNetwork -I$RQTDIR/include/QtSql -I$RQTDIR/include/QtOpenGL -Ibin/packages/qhttpserver-master/src" + #export QT_LDFLAGS="$RQTDIR/lib/libQt3Support.a $RQTDIR/lib/libQtSql.a $RQTDIR/lib/libQtOpenGL.a $RQTDIR/lib/libQtGui.a $RQTDIR/lib/libQtNetwork.a $RQTDIR/lib/libQtCore.a -lSM -lICE -lfreetype -lfontconfig -lXrender -lpng -lglib-2.0 -lgobject-2.0" + +-QT_INCLUDE_PATH=`$QMAKE -query QT_INSTALL_HEADERS` +-export QT_UI_CFLAGS="-I $QT_INCLUDE_PATH/QtUiTools" # Doing this instead of using pkg since there are bugs in the dependencies of the pkg file in some versions of Qt. (same with the lib file below) +-export QT_UI_LDFLAGS="`$QMAKE -query QT_INSTALL_LIBS`/libQt5UiTools.a" ++#QT_INCLUDE_PATH=`$QMAKE -query QT_INSTALL_HEADERS` ++#export QT_UI_CFLAGS="-I $QT_INCLUDE_PATH/QtUiTools" # Doing this instead of using pkg since there are bugs in the dependencies of the pkg file in some versions of Qt. (same with the lib file below) ++#export QT_UI_LDFLAGS="`$QMAKE -query QT_INSTALL_LIBS`/libQt5UiTools.a" + + + #One of these: +--- source/configuration.sh.orig 2026-01-05 12:10:37.393648921 +0100 ++++ source/configuration.sh 2026-01-05 14:41:36.490185173 +0100 +@@ -239,13 +239,14 @@ + handle_failure "Not empty" + fi + +- A=$($PKGqt --libs-only-L Qt5Core | xargs) +- B="-L$($QMAKE -query QT_INSTALL_PREFIX)/lib" +- if [ "$A" != "$B" ] ; then +- handle_failure "$PKGqt and $QMAKE doesn't seem to point to the same Qt:\n" \ +- "PKG: \"$A\".\n" \ +- "${QMAKE}: \"$B\"" +- fi ++ A=$($PKGqt --libs-only-L Qt5Core | xargs) ++ B="-L$($QMAKE -query QT_INSTALL_PREFIX)/lib" ++ if [ "$A" != "$B" ] ; then ++ printf "$PKGqt and $QMAKE don't seem to point to the same Qt.\nBut we don't give a shit on NixOS.\n" ++# handle_failure "$PKGqt and $QMAKE doesn't seem to point to the same Qt:\n" \ ++# "PKG: \"$A\".\n" \ ++# "${QMAKE}: \"$B\"" ++ fi + else + if ! is_set QMAKE_LIBS_ONLY_L_SHOULD_BE_EMPTY ; then + if [ "$($QMAKE -query QT_INSTALL_PREFIX)" != "/usr" ] ; then +--- source/Makefile.Qt.orig 2026-01-05 12:12:34.852622893 +0100 ++++ source/Makefile.Qt 2026-01-05 12:12:42.535293687 +0100 +@@ -305,7 +305,7 @@ + + WARNINGS_AS_ERRORS ?= 1 + +-WERROR="" ++WERROR= + + ifeq ($(WARNINGS_AS_ERRORS), 1) + WERROR = -Werror +--- source/bin/packages/visualization.patch.orig 2026-01-05 12:29:07.853820367 +0100 ++++ source/bin/packages/visualization.patch 2026-01-05 14:49:55.207100350 +0100 +@@ -120,3 +120,14 @@ + } + + void stop(){ ++--- Visualization-Library-master/CMakeLists.txt.orig 2026-01-05 14:47:57.797898038 +0100 +++++ Visualization-Library-master/CMakeLists.txt 2026-01-05 14:48:15.249865375 +0100 ++@@ -24,7 +24,7 @@ ++ project(Visualization_Library_SDK-${VLVERSION_MAJOR}.${VLVERSION_MINOR}) ++ ++ # Must be called after project! ++-cmake_minimum_required(VERSION 2.6) +++cmake_minimum_required(VERSION 3.5) ++ ++ ################################################################################ ++ # Global Build Settings +--- source/bin/packages/build.sh.orig 2026-01-05 12:14:03.963801383 +0100 ++++ source/bin/packages/build.sh 2026-01-12 06:20:42.586497821 +0100 +@@ -86,6 +86,7 @@ + tar xvzf faust-2.81.2.tar.gz + mv faust-2.81.2 faust + cd faust ++ patch -p1 <../faust_llvm_21.patch + rm -fr libraries + tar xvzf ../faustlibraries_2024_01_05.tar.gz + mv faustlibraries libraries +@@ -149,7 +150,7 @@ + + build_libpds() { + +- NOWARNS="-Wno-return-mismatch -Wno-implicit-function-declaration -Wno-int-conversion -Wno-implicit-int" ++ NOWARNS="-Wno-return-mismatch -Wno-implicit-function-declaration -Wno-int-conversion -Wno-implicit-int -Wno-format-security" + + rm -fr libpd-master + tar xvzf libpd-master.tar.gz diff --git a/faust_llvm_21.patch b/faust_llvm_21.patch new file mode 100644 index 0000000..fb28378 --- /dev/null +++ b/faust_llvm_21.patch @@ -0,0 +1,30 @@ +--- faust/compiler/generator/llvm/llvm_dynamic_dsp_aux.cpp.orig 2025-06-30 14:55:47.000000000 +0200 ++++ faust/compiler/generator/llvm/llvm_dynamic_dsp_aux.cpp 2026-01-12 05:09:26.084389475 +0100 +@@ -296,7 +296,7 @@ + + string triple, cpu; + splitTarget(fTarget, triple, cpu); +- fModule->setTargetTriple(triple); ++ fModule->setTargetTriple(llvm::Triple(triple)); + + builder.setMCPU((cpu == "") ? sys::getHostCPUName() : StringRef(cpu)); + TargetOptions targetOptions; +@@ -485,6 +485,6 @@ + const string& object_code_path) + { + auto TargetTriple = sys::getDefaultTargetTriple(); +- fModule->setTargetTriple(TargetTriple); ++ fModule->setTargetTriple(llvm::Triple(TargetTriple)); + string Error; + auto Target = TargetRegistry::lookupTarget(TargetTriple, Error); +--- faust/compiler/generator/llvm/llvm_code_container.cpp.orig 2026-01-12 06:55:34.001904801 +0100 ++++ faust/compiler/generator/llvm/llvm_code_container.cpp 2026-01-12 06:55:02.581093125 +0100 +@@ -90,7 +90,7 @@ + fBuilder->setFastMathFlags(FMF); + } + +- fModule->setTargetTriple(sys::getDefaultTargetTriple()); ++ fModule->setTargetTriple(llvm::Triple(sys::getDefaultTargetTriple())); + } + + LLVMCodeContainer::~LLVMCodeContainer() \ No newline at end of file diff --git a/qt_paths.patch b/qt_paths.patch new file mode 100644 index 0000000..4daa689 --- /dev/null +++ b/qt_paths.patch @@ -0,0 +1,57 @@ +--- source/Qt/Qt_Error.cpp.orig 2026-01-11 12:48:06.113043420 +0100 ++++ source/Qt/Qt_Error.cpp 2026-01-11 12:52:51.018629214 +0100 +@@ -154,13 +154,13 @@ + + #if FOR_LINUX + bool faulty_installation = false; +- if(getenv("QT_QPA_PLATFORM_PLUGIN_PATH")==NULL){ +- faulty_installation = true; +- }else{ +- QCoreApplication::setLibraryPaths(QStringList()); +- } +-#else +- QCoreApplication::setLibraryPaths(QStringList()); ++// if(getenv("QT_QPA_PLATFORM_PLUGIN_PATH")==NULL){ ++// faulty_installation = true; ++// }else{ ++// QCoreApplication::setLibraryPaths(QStringList()); ++// } ++// #else ++// QCoreApplication::setLibraryPaths(QStringList()); + #endif + + QLocale::setDefault(QLocale::c()); +--- source/Qt/Qt_Main.cpp.orig 2026-01-11 15:02:21.914136144 +0100 ++++ source/Qt/Qt_Main.cpp 2026-01-11 15:03:01.648750430 +0100 +@@ -4845,7 +4845,7 @@ + qInstallMsgHandler(myMessageOutput); + #endif + +- QCoreApplication::setLibraryPaths(QStringList()); ++ // QCoreApplication::setLibraryPaths(QStringList()); + + //QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); + +--- source/crashreporter/crashreporter.cpp.orig 2026-01-11 15:05:02.946438250 +0100 ++++ source/crashreporter/crashreporter.cpp 2026-01-11 15:01:35.600732162 +0100 +@@ -599,13 +599,13 @@ + + #if FOR_LINUX + bool faulty_installation = false; +- if(getenv("QT_QPA_PLATFORM_PLUGIN_PATH")==NULL){ +- faulty_installation = true; +- }else{ +- QCoreApplication::setLibraryPaths(QStringList()); +- } +-#else +- QCoreApplication::setLibraryPaths(QStringList()); ++// if(getenv("QT_QPA_PLATFORM_PLUGIN_PATH")==NULL){ ++// faulty_installation = true; ++// }else{ ++// QCoreApplication::setLibraryPaths(QStringList()); ++// } ++// #else ++// QCoreApplication::setLibraryPaths(QStringList()); + #endif + + QLocale::setDefault(QLocale::c()); diff --git a/qwebengine_quirks.patch b/qwebengine_quirks.patch new file mode 100644 index 0000000..8cc69d0 --- /dev/null +++ b/qwebengine_quirks.patch @@ -0,0 +1,17 @@ +--- source/api/api_gui.cpp.orig 2026-01-05 12:07:11.188431964 +0100 ++++ source/api/api_gui.cpp 2026-01-05 12:08:49.721242485 +0100 +@@ -5591,7 +5591,14 @@ + #else + + # if 1 ++ ++# if USE_QWEBENGINE ++ QDesktopServices::openUrl ++ (QUrl(std::get<0>(getAbsoluteUrl(QString::fromUtf8(charstringurl))))); ++# else + QDesktopServices::openUrl(getUrl(charstringurl)); ++# endif ++ + # else + JUCE_open_external_web_browser(geAbsolutetUrl(charstringurl).toUtf8().constData()); + # endif diff --git a/radium.nix b/radium.nix new file mode 100644 index 0000000..dada088 --- /dev/null +++ b/radium.nix @@ -0,0 +1,248 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchurl +, fetchzip +, pkg-config +, bash +, coreutils +, which +, guile +, cmake +, doxygen +, git +, python311 +, qt5 +, libGLU +, alsa-lib +, jack2 +, libsamplerate +, lrdf +, libsndfile +, ladspaH +, ladspaPlugins +, glib +, calf +, binutils-unwrapped +, libiberty +, tk-8_5 +, libogg +, libvorbis +, speex +, fftw +, fftwFloat +, libxkbfile +, util-macros +, libxrandr +, llvm +, boost +, openssl +, ncurses +, libxcb-util +, gmp +, mpfr +, libmpc +, libpthread-stubs +, liblo +, util-linux +, xorg +, writeShellScriptBin +, useQwebengine ? true +}: + +let + qt-web = if useQwebengine then qt5.qtwebengine else qt5.qtwebkit; + # Static binutils is required by Radium, specifically `libbfd.a'. + binutils-static = binutils-unwrapped.override { enableShared = false; }; + + # Needs to be an older version. + xcbproto-1_13 = xorg.xcbproto.overrideAttrs (old: { + version = "1.13"; + nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ python311 ]; + + preConfigure = '' + export PYTHON=${python311}/bin/python3 + export PATH=${python311}/bin:$PATH + ''; + + src = fetchurl { + url = "https://xcb.freedesktop.org/dist/xcb-proto-1.13.tar.gz"; + sha256 = "sha256-Bpjo9ZbkwNutcdPcdU2V6w7btC31Rk4PeCYhIW+jO6c="; + }; + }); +in stdenv.mkDerivation rec { + pname = "radium"; + version = "7.5.76"; + + src = fetchFromGitHub { + owner = "kmatheussen"; + repo = "radium"; + rev = "${version}"; + sha256 = "sha256-Eiil17cbCraXF3vY2LUy2B6eyfc1XD4JHJWZUfai+wc="; + }; + + vst2Sdk = fetchzip { + url = "https://web.archive.org/web/20161002042955if_/http://www.steinberg.net/sdk_downloads/vst_sdk2_4_rev2.zip"; + sha256 = "sha256-6eDJYGfuVczOTaZNUYa/dLEoCzl6Ysi1I1NrxuN2mPQ="; + }; + + nativeBuildInputs = [ + pkg-config + bash + coreutils + which + guile + cmake + doxygen + git + + qt5.wrapQtAppsHook + + (writeShellScriptBin "arch" "#!/usr/bin/env sh\nuname -m") + ]; + + buildInputs = [ + qt5.qtbase + qt5.qttools + qt5.qtx11extras + qt-web + + # In the order of the README. + libGLU + alsa-lib + jack2 + libsamplerate + lrdf + libsndfile + ladspaH + glib + calf + binutils-static + libiberty + tk-8_5 + libogg + libvorbis + speex + fftw + fftwFloat + libxkbfile + util-macros + libxrandr + llvm + boost + openssl + ncurses + libxcb-util + gmp + mpfr + libmpc + + xorg.libXinerama + xorg.libXau + xcbproto-1_13 + + libpthread-stubs + liblo + util-linux # For libuuid + + ladspaPlugins + ]; + + patches = [ + ./qt_paths.patch + ./qwebengine_quirks.patch + ./build_system_fixes.patch + ]; + + postPatch = '' + patchShebangs . + + substituteInPlace Makefile.Qt \ + --replace-fail "/usr/bin/env" "${coreutils}/bin/env" + + # Next culprit: Python 2.7. Fucking janky build system. + substituteInPlace bin/packages/build_python27.sh \ + --replace-fail "CC=clang" "CC=${stdenv.cc}/bin/cc" \ + --replace-fail "CXX=clang++" "CXX=${stdenv.cc}/bin/c++" + + # This is so Faust can build with LLVM > 18. + cp ${./faust_llvm_21.patch} bin/packages/faust_llvm_21.patch + ''; + + configurePhase = ":"; + + env = { + # If false, build the demo version. + FULL_VERSION = true; + BUILDTYPE = "RELEASE"; + USE_QWEBENGINE = useQwebengine; + # Recommended in `configuration.sh'. + WARNINGS_AS_ERRORS = false; + # If running on an AMD GPU, this is required. + INCLUDE_FAUSTDEV_BUT_NOT_LLVM = true; + + LLVM_PATH = "${llvm.dev}"; + UIC = "${qt5.qtbase.dev}/bin/uic"; + MOC = "${qt5.qtbase.dev}/bin/moc"; + + QT_UI_CFLAGS = + "-I${qt5.qttools.dev}/include/QtUiTools"; + RADIUM_BFD_LDFLAGS = + "-L${binutils-static.lib}/lib -lbfd -lsframe"; + RADIUM_VST2SDK_PATH = "${vst2Sdk}"; + }; + + qtWrapperArgs = [ + # Does not launch with custom Qt paths otherwise. + "--set OVERRIDE_RADIUM_QPA 1" + + # This is what `run_radium_linux.sh' does. + "--prefix LD_LIBRARY_PATH : ${placeholder "out"}/opt/radium/packages/python27_install/lib" + "--prefix LD_LIBRARY_PATH : ${placeholder "out"}/opt/radium/packages/faust/build/lib" + + # No access to `libqxcb.so' otherwise. + "--prefix QT_PLUGIN_PATH : ${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins" + "--prefix QT_QPA_PLATFORM_PLUGIN_PATH : ${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins/platforms" + ]; + + buildPhase = '' + make packages + chmod +x ./build_linux.sh + ./build_linux.sh -j$(nproc) + ''; + + installPhase = '' + mkdir -p $out/{opt,bin,share/applications,share/icons} + + chmod +x ./install.sh + ./install.sh $out/opt + + ln -s $out/opt/radium/radium_linux.bin $out/bin/radium + + cp bin/graphics/radium_logo_256x256_colorized.png $out/share/icons/radium.png + cp $out/opt/radium/radium.desktop $out/share/applications/radium.desktop + ''; + + preFixup = '' + rm -f $out/opt/radium/ladspa # broken relative symlink + ln -s ${ladspaPlugins}/lib/ladspa $out/opt/radium/ladspa # working + ''; + + postFixup = '' + wrapQtApp $out/opt/radium/radium_check_opengl + wrapQtApp $out/opt/radium/radium_check_jack_status + wrapQtApp $out/opt/radium/radium_plugin_scanner + wrapQtApp $out/opt/radium/radium_error_message + wrapQtApp $out/opt/radium/radium_progress_window + ''; + + meta = with lib; { + description = "Radium – a graphical music editor / tracker (DAW)"; + homepage = "https://users.notam02.no/~kjetism/radium/"; + # Radium in itself is GPLv2. However, the ancient VST2 SDK is + # proprietary. + license = with licenses; [ gpl2 unfree ]; + maintainers = with maintainers; [ eko5z ]; + platforms = with platforms; gnu ++ linux ++ darwin; + }; +}