mpc123: refactor

+42 -33
+42 -20
pkgs/applications/audio/mpc123/default.nix
··· 1 - { fetchurl, lib, stdenv, gettext, libmpcdec, libao }: 1 + { lib 2 + , stdenv 3 + , fetchFromGitLab 4 + , gettext 5 + , libao 6 + , libmpcdec 7 + }: 2 8 3 - let version = "0.2.4"; in 4 - stdenv.mkDerivation rec { 9 + stdenv.mkDerivation (finalAttrs: { 5 10 pname = "mpc123"; 6 - inherit version; 11 + version = "0.2.4"; 7 12 8 - src = fetchurl { 9 - url = "mirror://sourceforge/mpc123/version%20${version}/${pname}-${version}.tar.gz"; 10 - sha256 = "0sf4pns0245009z6mbxpx7kqy4kwl69bc95wz9v23wgappsvxgy1"; 13 + src = fetchFromGitLab { 14 + domain = "salsa.debian.org"; 15 + owner = "debian"; 16 + repo = "mpc123"; 17 + rev = "upstream/${finalAttrs.version}"; 18 + hash = "sha256-+/yxb19CJzyjQmT3O21pEmPR5YudmyCxWwo+W3uOB9Q="; 11 19 }; 12 20 13 - patches = [ ./use-gcc.patch ]; 21 + strictDeps = true; 22 + 23 + nativeBuildInputs = [ 24 + gettext 25 + ]; 26 + 27 + buildInputs = [ 28 + gettext 29 + libao 30 + libmpcdec 31 + ]; 32 + 33 + makeFlags = [ 34 + "CC=${stdenv.cc.targetPrefix}cc" 35 + ]; 14 36 15 37 # Workaround build failure on -fno-common toolchains like upstream 16 38 # gcc-10. Otherwise build fails as: 17 39 # ld: /build/cc566Cj9.o:(.bss+0x0): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here 18 40 env.NIX_CFLAGS_COMPILE = "-fcommon"; 19 41 20 - buildInputs = [ gettext libmpcdec libao ]; 42 + # XXX: Should install locales too (though there's only 1 available). 43 + installPhase = '' 44 + runHook preInstall 21 45 22 - installPhase = 23 - # XXX: Should install locales too (though there's only 1 available). 24 - '' mkdir -p "$out/bin" 25 - cp -v mpc123 "$out/bin" 26 - ''; 46 + mkdir -p "$out/bin" 47 + cp -v mpc123 "$out/bin" 48 + 49 + runHook postInstall 50 + ''; 27 51 28 52 meta = { 29 - homepage = "https://mpc123.sourceforge.net/"; 30 - 31 53 description = "A Musepack (.mpc) audio player"; 32 - 54 + homepage = "https://github.com/bucciarati/mpc123"; 33 55 license = lib.licenses.gpl2Plus; 34 - 56 + mainProgram = "mpc123"; 35 57 maintainers = [ ]; 36 - platforms = lib.platforms.gnu ++ lib.platforms.linux; # arbitrary choice 58 + platforms = lib.platforms.unix; 37 59 }; 38 - } 60 + })
-13
pkgs/applications/audio/mpc123/use-gcc.patch
··· 1 - Don't worry, just use GCC and everything's gonna be alright. 2 - 3 - --- mpc123-0.2.4/Makefile 2008-03-21 22:14:38.000000000 +0100 4 - +++ mpc123-0.2.4/Makefile 2010-01-28 23:26:49.000000000 +0100 5 - @@ -17,7 +17,7 @@ 6 - # along with this program; if not, write to the Free Software Foundation, 7 - # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 8 - 9 - -CC := $(shell which colorgcc || which cc) 10 - +CC := gcc 11 - 12 - TAGSPRG := ctags 13 -