1 { lib, mkDerivation, fetchFromGitHub, pkg-config, symlinkJoin, qmake, diffPlugins
2 , qtbase, qtmultimedia, taglib, libmediainfo, libzen, libbass }:
5 version = "2019-04-23";
6 rev = "ef4524e2239ddbb60f26e05bfba1f4f28cb7b54f";
7 sha256 = "0dl2qp686vbs160b3i9qypb7sv37phy2wn21kgzljbk3wnci3yv4";
8 buildInputs = [ qtbase qtmultimedia taglib libmediainfo libzen libbass ];
22 let src = fetchFromGitHub {
23 owner = "UltraStar-Deluxe";
24 repo = "UltraStar-Manager";
28 name = "${src.name}-patched";
34 # we don’t want prebuild binaries checked into version control!
37 # fix up main project file
38 sed -e 's|-L.*unix.*lbass.*$|-lbass|' \
39 -e "/QMAKE_POST_LINK/d" \
40 -e "s|../include/bass|${lib.getLib libbass}/include|g" \
41 -e "s|../include/taglib|${lib.getLib taglib}/include|g" \
42 -e "s|../include/mediainfo|${lib.getLib libmediainfo}/include|g" \
43 -i src/UltraStar-Manager.pro
45 # if more plugins start depending on ../../../include,
46 # it should be abstracted out for all .pro files
47 sed -e "s|../../../include/taglib|${lib.getLib taglib}/include/taglib|g" \
48 -i src/plugins/audiotag/audiotag.pro
55 patchApplicationPath = file: path: ''
56 sed -e "s|QCore.*applicationDirPath()|QString(\"${path}\")|" -i "${file}"
59 buildPlugin = name: mkDerivation {
60 name = "ultrastar-manager-${name}-plugin-${version}";
63 buildInputs = [ qmake ] ++ buildInputs;
66 sed -e "s|DESTDIR = .*$|DESTDIR = $out|" \
67 -i src/plugins/${name}/${name}.pro
69 # plugins use the application’s binary folder (wtf)
70 for f in $(grep -lr "QCoreApplication::applicationDirPath" src/plugins); do
71 ${patchApplicationPath "$f" "\$out"}
76 cd src/plugins/${name}
82 name = "ultrastar-manager-plugins-${version}";
83 paths = map buildPlugin plugins;
87 pname = "ultrastar-manager";
92 sed -e "s|DESTDIR =.*$|DESTDIR = $out/bin|" \
93 -i src/UltraStar-Manager.pro
94 # patch plugin manager to point to the collected plugin folder
95 ${patchApplicationPath "src/plugins/QUPluginManager.cpp" builtPlugins}
99 find -path './src/plugins/*' -prune -type d -print0 \
100 | xargs -0 -i'{}' basename '{}' \
101 | sed -e '/shared/d' \
103 ${diffPlugins plugins "found_plugins"}
105 cd src && qmake && make
108 # is not installPhase so that qt post hooks can run
113 nativeBuildInputs = [ pkg-config ];
117 description = "Ultrastar karaoke song manager";
118 homepage = "https://github.com/UltraStar-Deluxe/UltraStar-Manager";
119 license = licenses.gpl2Only;
120 maintainers = with maintainers; [ Profpatsch ];