summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-06-14 11:29:31 +0200
committerJoachim Schiele <js@lastlog.de>2017-06-14 11:29:31 +0200
commit79dd4deda5a5ee44359a88cdcbbc22a15ba26224 (patch)
tree270e42ec5d33fa623f92e352fe9025d14e269bca /pkgs
parentf6fbbabcb70a19428a7adde2e4f1ec477c439654 (diff)
downloadnixpkgs-79dd4deda5a5ee44359a88cdcbbc22a15ba26224.tar
nixpkgs-79dd4deda5a5ee44359a88cdcbbc22a15ba26224.tar.gz
nixpkgs-79dd4deda5a5ee44359a88cdcbbc22a15ba26224.tar.bz2
nixpkgs-79dd4deda5a5ee44359a88cdcbbc22a15ba26224.tar.lz
nixpkgs-79dd4deda5a5ee44359a88cdcbbc22a15ba26224.tar.xz
nixpkgs-79dd4deda5a5ee44359a88cdcbbc22a15ba26224.tar.zst
nixpkgs-79dd4deda5a5ee44359a88cdcbbc22a15ba26224.zip
Ultrastar (#26524)
* ultrastardx-beta: init at 1.3.5

* libbass, libbass_fx: init at 24

* ultrastar-creator: init at 2017-04-12

* buildSupport/plugins.nix: add diffPlugins

Helper function to compare expected plugin lists to the found plugins.

* ultrastar-manager: init at 2017-05-24

The plugins are built in their own derivations, speeding up (re-)compilation.
The `diffPlugins` function from `beets` is reused to test for changes in the
plugin list on updates.

* beets: switch to diffPlugins

The function is basically just extracted for better reusability.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/plugins.nix29
-rw-r--r--pkgs/development/libraries/audio/libbass/default.nix59
-rw-r--r--pkgs/games/ultrastardx/1.1.nix (renamed from pkgs/games/ultrastardx/default.nix)0
-rw-r--r--pkgs/games/ultrastardx/1.3-beta.nix49
-rw-r--r--pkgs/tools/audio/beets/default.nix11
-rw-r--r--pkgs/tools/misc/ultrastar-creator/default.nix41
-rw-r--r--pkgs/tools/misc/ultrastar-manager/default.nix121
-rw-r--r--pkgs/top-level/all-packages.nix15
8 files changed, 315 insertions, 10 deletions
diff --git a/pkgs/build-support/plugins.nix b/pkgs/build-support/plugins.nix
new file mode 100644
index 00000000000..bf8a982a88f
--- /dev/null
+++ b/pkgs/build-support/plugins.nix
@@ -0,0 +1,29 @@
+{ stdenv }:
+# helper functions for packaging programs with plugin systems
+{
+
+  /* Takes a list of expected plugin names
+   * and compares it to the found plugins given in the file,
+   * one plugin per line.
+   * If the lists differ, the build fails with a nice message.
+   *
+   * This is helpful to ensure maintainers don’t miss
+   * the addition or removal of a plugin.
+   */
+  diffPlugins = expectedPlugins: foundPluginsFilePath: ''
+     # sort both lists first
+     plugins_expected=$(mktemp)
+     (${stdenv.lib.concatMapStrings (s: "echo \"${s}\";") expectedPlugins}) \
+       | sort -u > "$plugins_expected"
+     plugins_found=$(mktemp)
+     sort -u "${foundPluginsFilePath}" > "$plugins_found"
+
+     if ! mismatches="$(diff -y "$plugins_expected" "$plugins_found")"; then
+       echo "The the list of expected plugins (left side) doesn't match" \
+           "the list of plugins we found (right side):" >&2
+       echo "$mismatches" >&2
+       exit 1
+     fi
+   '';
+
+}
diff --git a/pkgs/development/libraries/audio/libbass/default.nix b/pkgs/development/libraries/audio/libbass/default.nix
new file mode 100644
index 00000000000..dedfa5ceb35
--- /dev/null
+++ b/pkgs/development/libraries/audio/libbass/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, unzip, fetchurl, writeText }:
+
+let
+  version = "24";
+
+  allBass = {
+    bass = {
+      h = "bass.h";
+      so = {
+        i686_linux = "libbass.so";
+        x86_64-linux = "x64/libbass.so";
+      };
+      urlpath = "bass${version}-linux.zip";
+      sha256 = "1a2z9isabkymz7qmkgklbjpj2wxkvv1cngfp9aj0c9178v97pjd7";
+    };
+
+    bass_fx = {
+      h = "C/bass_fx.h";
+      so = {
+        i686_linux = "libbass_fx.so";
+        x86_64-linux = "x64/libbass_fx.so";
+      };
+      urlpath = "z/0/bass_fx${version}-linux.zip";
+      sha256 = "0j1cbq88j3vnqf2bibcqnfhciz904w48ldgycyh9d8954hwyg22m";
+    };
+  };
+
+  dropBass = name: bass: stdenv.mkDerivation {
+    name = "lib${name}-${version}";
+
+    src = fetchurl {
+      url = "https://www.un4seen.com/files/${bass.urlpath}";
+      inherit (bass) sha256;
+    };
+    unpackCmd = ''
+      mkdir out
+      ${unzip}/bin/unzip $curSrc -d out
+    '';
+
+    lpropagatedBuildInputs = [ unzip ];
+    dontBuild = true;
+    installPhase =
+      let so =
+            if bass.so ? ${stdenv.system} then bass.so.${stdenv.system}
+            else abort "${name} not packaged for ${stdenv.system} (yet).";
+      in ''
+        mkdir -p $out/{lib,include}
+        install -m644 -t $out/lib/ ${so}
+        install -m644 -t $out/include/ ${bass.h}
+      '';
+
+    meta = with stdenv.lib; {
+      description = "Shareware audio library";
+      homepage = https://www.un4seen.com/;
+      license = licenses.unfreeRedistributable;
+    };
+  };
+
+in stdenv.lib.mapAttrs dropBass allBass
diff --git a/pkgs/games/ultrastardx/default.nix b/pkgs/games/ultrastardx/1.1.nix
index 9810d5186b0..9810d5186b0 100644
--- a/pkgs/games/ultrastardx/default.nix
+++ b/pkgs/games/ultrastardx/1.1.nix
diff --git a/pkgs/games/ultrastardx/1.3-beta.nix b/pkgs/games/ultrastardx/1.3-beta.nix
new file mode 100644
index 00000000000..ca7d6b35a21
--- /dev/null
+++ b/pkgs/games/ultrastardx/1.3-beta.nix
@@ -0,0 +1,49 @@
+{ stdenv, autoreconfHook, fetchFromGitHub, pkgconfig
+, lua, fpc, pcre, portaudio, freetype, libpng
+, SDL2, SDL2_image, SDL2_gfx, SDL2_mixer, SDL2_net, SDL2_ttf
+, ffmpeg, sqlite, zlib, libX11, mesa }:
+
+let
+  sharedLibs = [
+    pcre portaudio freetype
+    SDL2 SDL2_image SDL2_gfx SDL2_mixer SDL2_net SDL2_ttf
+    sqlite lua zlib libX11 mesa ffmpeg
+  ];
+
+in stdenv.mkDerivation rec {
+  name = "ultrastardx-${version}";
+  version = "1.3.5-beta";
+  src = fetchFromGitHub {
+    owner = "UltraStar-Deluxe";
+    repo = "USDX";
+    rev = "v${version}";
+    sha256 = "0qp64qsj29a08cbv3i52jm1w2pcklw6ya5sniycs24zxggza5pkn";
+  };
+
+  buildInputs = [
+    pkgconfig autoreconfHook
+    fpc libpng
+  ] ++ sharedLibs;
+
+  postPatch = ''
+    # autoconf substitutes strange things otherwise
+    substituteInPlace src/config.inc.in \
+      --subst-var-by libpcre_LIBNAME libpcre.so.1
+  '';
+
+  preBuild = with stdenv.lib;
+    let items = concatMapStringsSep " " (x: "-rpath ${getLib x}/lib") sharedLibs;
+    in ''
+      export NIX_LDFLAGS="$NIX_LDFLAGS ${items}"
+    '';
+
+  # dlopened libgcc requires the rpath not to be shrinked
+  dontPatchELF = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://ultrastardx.sourceforge.net/;
+    description = "Free and open source karaoke game";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ profpatsch ];
+  };
+}
diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix
index c1418d152dd..35b4557a33c 100644
--- a/pkgs/tools/audio/beets/default.nix
+++ b/pkgs/tools/audio/beets/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, writeScript, glibcLocales
+{ stdenv, fetchFromGitHub, writeScript, glibcLocales, diffPlugins
 , pythonPackages, imagemagick, gobjectIntrospection, gst_all_1
 
 , enableAcousticbrainz ? true
@@ -158,20 +158,13 @@ in pythonPackages.buildPythonApplication rec {
   doCheck = true;
 
   preCheck = ''
-    (${concatMapStrings (s: "echo \"${s}\";") allPlugins}) \
-      | sort -u > plugins_defined
     find beetsplug -mindepth 1 \
       \! -path 'beetsplug/__init__.py' -a \
       \( -name '*.py' -o -path 'beetsplug/*/__init__.py' \) -print \
       | sed -n -re 's|^beetsplug/([^/.]+).*|\1|p' \
       | sort -u > plugins_available
 
-    if ! mismatches="$(diff -y plugins_defined plugins_available)"; then
-      echo "The the list of defined plugins (left side) doesn't match" \
-           "the list of available plugins (right side):" >&2
-      echo "$mismatches" >&2
-      exit 1
-    fi
+     ${diffPlugins allPlugins "plugins_available"}
   '';
 
   checkPhase = ''
diff --git a/pkgs/tools/misc/ultrastar-creator/default.nix b/pkgs/tools/misc/ultrastar-creator/default.nix
new file mode 100644
index 00000000000..0700c43b26e
--- /dev/null
+++ b/pkgs/tools/misc/ultrastar-creator/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub
+, qmakeHook, qtbase, makeQtWrapper
+, pkgconfig, taglib, libbass, libbass_fx }:
+
+stdenv.mkDerivation rec {
+  name = "ultrastar-creator-${version}";
+  version = "2017-04-12";
+
+  src = fetchFromGitHub {
+    owner = "UltraStar-Deluxe";
+    repo = "UltraStar-Creator";
+    rev = "ac519a003f8283bfbe5e2d8e9cdff3a3faf97001";
+    sha256 = "00idr8a178gvmylq722n13bli59kpxlsy5d8hlplqn7fih48mnzi";
+  };
+
+  postPatch = with stdenv.lib; ''
+    # we don’t want prebuild binaries checked into version control!
+    rm -rf lib include
+    sed -e "s|DESTDIR =.*$|DESTDIR = $out/bin|" \
+        -e 's|-L".*unix"||' \
+        -e "/QMAKE_POST_LINK/d" \
+        -e "s|../include/bass|${getLib libbass}/include|g" \
+        -e "s|../include/bass_fx|${getLib libbass_fx}/include|g" \
+        -e "s|../include/taglib|${getLib taglib}/include|g" \
+        -i src/UltraStar-Creator.pro
+  '';
+
+  preConfigure = ''
+    cd src
+  '';
+
+  nativeBuildInputs = [ qmakeHook makeQtWrapper pkgconfig ];
+  buildInputs = [ qtbase taglib libbass libbass_fx ];
+
+  meta = with stdenv.lib; {
+    description = "Ultrastar karaoke song creation tool";
+    homepage = https://github.com/UltraStar-Deluxe/UltraStar-Creator;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ profpatsch ];
+  };
+}
diff --git a/pkgs/tools/misc/ultrastar-manager/default.nix b/pkgs/tools/misc/ultrastar-manager/default.nix
new file mode 100644
index 00000000000..61b2c6aaa22
--- /dev/null
+++ b/pkgs/tools/misc/ultrastar-manager/default.nix
@@ -0,0 +1,121 @@
+{ stdenv, fetchFromGitHub, pkgconfig, symlinkJoin, qmakeHook, diffPlugins
+, qtbase, qtmultimedia, makeQtWrapper
+, taglib, libmediainfo, libzen, libbass }:
+
+let
+  version = "2017-05-24";
+  rev = "eed5dc41c849ab29b2dee37d97852fffdb45e390";
+  sha256 = "1ymdgaffazndg9vhh47qqjr5873ld7j066hycp670r08bm519ysg";
+  buildInputs = [ qtbase qtmultimedia taglib libmediainfo libzen libbass ];
+
+  plugins = [
+    "albumartex"
+    "amazon"
+    "audiotag"
+    "cleanup"
+    "freecovers"
+    "lyric"
+    "preparatory"
+    "rename"
+ ];
+
+  patchedSrc =
+    let src = fetchFromGitHub {
+      owner = "UltraStar-Deluxe";
+      repo = "UltraStar-Manager";
+      inherit rev sha256;
+    };
+    in stdenv.mkDerivation {
+      name = "${src.name}-patched";
+      inherit src;
+      phases = [ "unpackPhase" "patchPhase" ];
+
+      patchPhase = with stdenv.lib; ''
+        # we don’t want prebuild binaries checked into version control!
+        rm -rf lib include
+
+        # fix up main project file
+        sed -e 's|-L.*unix.*lbass.*$|-lbass|' \
+            -e "/QMAKE_POST_LINK/d" \
+            -e "s|../include/bass|${getLib libbass}/include|g" \
+            -e "s|../include/taglib|${getLib taglib}/include|g" \
+            -e "s|../include/mediainfo|${getLib libmediainfo}/include|g" \
+            -i src/UltraStar-Manager.pro
+
+        # if more plugins start depending on ../../../include,
+        # it should be abstracted out for all .pro files
+        sed -e "s|../../../include/taglib|${getLib taglib}/include/taglib|g" \
+            -i src/plugins/audiotag/audiotag.pro
+
+        mkdir $out
+        mv * $out
+      '';
+    };
+
+  patchApplicationPath = file: path: ''
+    sed -e "s|QCore.*applicationDirPath()|QString(\"${path}\")|" -i "${file}"
+  '';
+
+  buildPlugin = name: stdenv.mkDerivation {
+    name = "ultrastar-manager-${name}-plugin-${version}";
+    src = patchedSrc;
+
+    buildInputs = [ qmakeHook ] ++ buildInputs;
+
+    postPatch = ''
+      sed -e "s|DESTDIR = .*$|DESTDIR = $out|" \
+          -i src/plugins/${name}/${name}.pro
+
+      # plugins use the application’s binary folder (wtf)
+      for f in $(grep -lr "QCoreApplication::applicationDirPath" src/plugins); do
+        ${patchApplicationPath "$f" "\$out"}
+      done
+
+    '';
+    preConfigure = ''
+      cd src/plugins/${name}
+    '';
+  };
+
+  builtPlugins =
+    symlinkJoin {
+      name = "ultrastar-manager-plugins-${version}";
+      paths = map buildPlugin plugins;
+    };
+
+in stdenv.mkDerivation {
+  name = "ultrastar-manager-${version}";
+  src = patchedSrc;
+
+  postPatch = ''
+    sed -e "s|DESTDIR =.*$|DESTDIR = $out/bin|" \
+        -i src/UltraStar-Manager.pro
+    # patch plugin manager to point to the collected plugin folder
+    ${patchApplicationPath "src/plugins/QUPluginManager.cpp" builtPlugins}
+  '';
+
+  buildPhase = ''
+    find -path './src/plugins/*' -prune -type d -print0 \
+      | xargs -0 -i'{}' basename '{}' \
+      | sed -e '/shared/d' \
+      > found_plugins
+    ${diffPlugins plugins "found_plugins"}
+
+    cd src && qmake && make
+  '';
+
+  # is not installPhase so that qt post hooks can run
+  preInstall = ''
+    make install
+  '';
+
+  nativeBuildInputs = [ makeQtWrapper pkgconfig ];
+  inherit buildInputs;
+
+  meta = with stdenv.lib; {
+    description = "Ultrastar karaoke song manager";
+    homepage = https://github.com/UltraStar-Deluxe/UltraStar-Manager;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ profpatsch ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ccfdcb9385b..cbe2a9bfc5c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -98,6 +98,8 @@ with pkgs;
     inherit (haskellPackages) dhall-nix;
   };
 
+  diffPlugins = (callPackage ../build-support/plugins.nix {}).diffPlugins;
+
   dockerTools = callPackage ../build-support/docker { };
 
   docker_compose = pythonPackages.docker_compose;
@@ -8325,6 +8327,9 @@ with pkgs;
     inherit (ocamlPackages_4_02) bap ocaml findlib ctypes;
   };
 
+  libbass = (callPackage ../development/libraries/audio/libbass { }).bass;
+  libbass_fx = (callPackage ../development/libraries/audio/libbass { }).bass_fx;
+
   libbluedevil = callPackage ../development/libraries/libbluedevil { };
 
   libbdplus = callPackage ../development/libraries/libbdplus { };
@@ -17327,7 +17332,15 @@ with pkgs;
 
   ultimatestunts = callPackage ../games/ultimatestunts { };
 
-  ultrastardx = callPackage ../games/ultrastardx {
+  ultrastar-creator = libsForQt5.callPackage ../tools/misc/ultrastar-creator { };
+
+  ultrastar-manager = libsForQt5.callPackage ../tools/misc/ultrastar-manager { };
+
+  ultrastardx = callPackage ../games/ultrastardx/1.1.nix {
+    ffmpeg = ffmpeg_0;
+    lua = lua5;
+  };
+  ultrastardx-beta = callPackage ../games/ultrastardx/1.3-beta.nix {
     ffmpeg = ffmpeg_0;
     lua = lua5;
   };