bencodetools,uade: Fix build, update, modernise (#352867)

This commit is contained in:
Cosima Neidahl
2024-11-16 17:33:40 +01:00
committed by GitHub
5 changed files with 166 additions and 67 deletions

View File

@@ -2,42 +2,51 @@
stdenv, stdenv,
lib, lib,
fetchFromGitLab, fetchFromGitLab,
python3, gitUpdater,
python3Packages,
}: }:
stdenv.mkDerivation { stdenv.mkDerivation (finalAttrs: {
pname = "bencodetools"; pname = "bencodetools";
version = "unstable-2022-05-11"; version = "1.0.1";
src = fetchFromGitLab { src = fetchFromGitLab {
owner = "heikkiorsila"; owner = "heikkiorsila";
repo = "bencodetools"; repo = "bencodetools";
rev = "384d78d297a561dddbbd0f4632f0c74c0db41577"; rev = "refs/tags/v${finalAttrs.version}";
sha256 = "1d699q9r33hkmmqkbh92ax54mcdf9smscmc0dza2gp4srkhr83qm"; hash = "sha256-5Y1r6+aVtK22lYr2N+YUPPdUts9PIF9I/Pq/mI+WqQs=";
}; };
postPatch = '' postPatch = ''
patchShebangs configure patchShebangs configure
substituteInPlace configure \
--replace 'python_install_option=""' 'python_install_option="--prefix=$out"'
''; '';
enableParallelBuilding = true; enableParallelBuilding = true;
nativeBuildInputs = [ configureFlags = [ (lib.strings.withFeature false "python") ];
(python3.withPackages (ps: with ps; [ distutils ]))
];
# installCheck instead of check due to -install_name'd library on Darwin # installCheck instead of check due to -install_name'd library on Darwin
doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
installCheckTarget = "check";
meta = with lib; { installCheckPhase = ''
runHook preInstallCheck
./bencodetest
runHook postInstallCheck
'';
passthru = {
tests.python-module = python3Packages.bencodetools;
updateScript = gitUpdater { rev-prefix = "v"; };
};
meta = {
description = "Collection of tools for manipulating bencoded data"; description = "Collection of tools for manipulating bencoded data";
homepage = "https://gitlab.com/heikkiorsila/bencodetools"; homepage = "https://gitlab.com/heikkiorsila/bencodetools";
license = licenses.bsd2; license = lib.licenses.bsd2;
maintainers = with maintainers; [ OPNA2608 ]; maintainers = with lib.maintainers; [ OPNA2608 ];
mainProgram = "bencat"; mainProgram = "bencat";
platforms = platforms.unix; platforms = lib.platforms.unix;
}; };
} })

View File

@@ -0,0 +1,58 @@
{
stdenv,
lib,
fetchFromGitLab,
unstableGitUpdater,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libzakalwe";
version = "1.0.0-unstable-2024-02-26";
src = fetchFromGitLab {
owner = "hors";
repo = "libzakalwe";
rev = "c7eba014ba14dc6fa145f6e71e75cca2b65bbc8a";
hash = "sha256-2a30ztFnemCgGW/I5S6Dz4eC1Y6K2aV9dPvysvQtBxo=";
};
outputs = [
"out"
"dev"
];
postPatch =
''
substituteInPlace Makefile.in \
--replace-fail 'libzakalwe.so' "libzakalwe${stdenv.hostPlatform.extensions.sharedLibrary}"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace Makefile.in \
--replace-fail '-soname' '-install_name'
'';
strictDeps = true;
enableParallelBuilding = true;
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-D_DARWIN_C_SOURCE";
# Darwin: Assertion failed at thread_util_test_0:52: tr != NULL
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform && (!stdenv.hostPlatform.isDarwin);
installFlags = [ "PREFIX=$(out)" ];
preInstall = ''
mkdir -p $out/lib
'';
passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; };
meta = {
description = "Library for functions shared across zakalwe projects";
homepage = "https://gitlab.com/hors/libzakalwe";
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ OPNA2608 ];
platforms = lib.platforms.unix;
};
})

View File

@@ -1,73 +1,64 @@
{ lib {
, stdenv lib,
, fetchFromGitLab stdenv,
, python3 fetchFromGitLab,
, pkg-config gitUpdater,
, which bencodetools,
, makeWrapper flac,
, libao lame,
, bencodetools libao,
, sox libzakalwe,
, lame makeWrapper,
, flac python3,
, vorbis-tools pkg-config,
# https://gitlab.com/uade-music-player/uade/-/issues/38 sox,
, withWriteAudio ? !stdenv.hostPlatform.isDarwin vorbis-tools,
which,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "uade"; pname = "uade";
version = "3.02"; version = "3.05";
src = fetchFromGitLab { src = fetchFromGitLab {
owner = "uade-music-player"; owner = "uade-music-player";
repo = "uade"; repo = "uade";
rev = "uade-${version}"; rev = "uade-${finalAttrs.version}";
hash = "sha256-skPEXBQwyr326zCmZ2jwGxcBoTt3Y/h2hagDeeqbMpw="; hash = "sha256-k6t8EQ/G8PbfRrBMXubn1XfBPvw1qDoMGh5xJKrcX+E=";
}; };
postPatch = '' postPatch = ''
patchShebangs configure patchShebangs configure
substituteInPlace configure \
--replace 'PYTHON_SETUP_ARGS=""' 'PYTHON_SETUP_ARGS="--prefix=$out"'
substituteInPlace src/frontends/mod2ogg/mod2ogg2.sh.in \ substituteInPlace src/frontends/mod2ogg/mod2ogg2.sh.in \
--replace '-e stat' '-n stat' \ --replace-fail '-e stat' '-n stat' \
--replace '/usr/local' "$out" --replace-fail '/usr/local' "$out"
substituteInPlace python/uade/generate_oscilloscope_view.py \ substituteInPlace python/uade/generate_oscilloscope_view.py \
--replace "default='uade123'" "default='$out/bin/uade123'" --replace-fail "default='uade123'" "default='$out/bin/uade123'"
# https://gitlab.com/uade-music-player/uade/-/issues/37
substituteInPlace write_audio/Makefile.in \
--replace 'g++' '${stdenv.cc.targetPrefix}c++'
''; '';
nativeBuildInputs = [ nativeBuildInputs = [
makeWrapper
pkg-config pkg-config
which which
makeWrapper
] ++ lib.optionals withWriteAudio [
python3
]; ];
buildInputs = [ buildInputs = [
libao
bencodetools bencodetools
sox
lame
flac flac
lame
libao
libzakalwe
sox
vorbis-tools vorbis-tools
] ++ lib.optionals withWriteAudio [
(python3.withPackages (p: with p; [
pillow
tqdm
more-itertools
]))
]; ];
configureFlags = [ configureFlags = [
"--bencode-tools-prefix=${bencodetools}" "--bencode-tools-prefix=${bencodetools}"
"--with-text-scope" "--libzakalwe-prefix=${libzakalwe}"
] ++ lib.optionals (!withWriteAudio) [ (lib.strings.withFeature true "text-scope")
"--without-write-audio" (lib.strings.withFeature false "write-audio")
]; ];
enableParallelBuilding = true; enableParallelBuilding = true;
@@ -76,24 +67,31 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
wrapProgram $out/bin/mod2ogg2.sh \ wrapProgram $out/bin/mod2ogg2.sh \
--prefix PATH : $out/bin:${lib.makeBinPath [ sox lame flac vorbis-tools ]} --prefix PATH : $out/bin:${
lib.makeBinPath [
flac
lame
sox
vorbis-tools
]
}
# This is an old script, don't break expectations by renaming it # This is an old script, don't break expectations by renaming it
ln -s $out/bin/mod2ogg2{.sh,} ln -s $out/bin/mod2ogg2{.sh,}
'' + lib.optionalString withWriteAudio ''
wrapProgram $out/bin/generate_amiga_oscilloscope_view \
--prefix PYTHONPATH : "$PYTHONPATH:$out/${python3.sitePackages}"
''; '';
meta = with lib; { passthru.updateScript = gitUpdater { rev-prefix = "uade-"; };
meta = {
description = "Plays old Amiga tunes through UAE emulation and cloned m68k-assembler Eagleplayer API"; description = "Plays old Amiga tunes through UAE emulation and cloned m68k-assembler Eagleplayer API";
homepage = "https://zakalwe.fi/uade/"; homepage = "https://zakalwe.fi/uade/";
# It's a mix of licenses. "GPL", Public Domain, "LGPL", GPL2+, BSD, LGPL21+ and source code with unknown licenses. E.g. # It's a mix of licenses. "GPL", Public Domain, "LGPL", GPL2+, BSD, LGPL21+ and source code with unknown licenses. E.g.
# - hippel-coso player is "[not] under any Open Source certified license" # - hippel-coso player is "[not] under any Open Source certified license"
# - infogrames player is disassembled from Andi Silvas player, unknown license # - infogrames player is disassembled from Andi Silvas player, unknown license
# Let's make it easy and flag the whole package as unfree. # Let's make it easy and flag the whole package as unfree.
license = licenses.unfree; license = lib.licenses.unfree;
maintainers = with maintainers; [ OPNA2608 ]; maintainers = with lib.maintainers; [ OPNA2608 ];
mainProgram = "uade123"; mainProgram = "uade123";
platforms = platforms.unix; platforms = lib.platforms.unix;
}; };
} })

View File

@@ -0,0 +1,30 @@
{
buildPythonPackage,
bencodetools,
pytestCheckHook,
setuptools,
}:
buildPythonPackage {
inherit (bencodetools) pname version src;
format = "pyproject";
nativeBuildInputs = [ setuptools ];
nativeCheckInputs = [ pytestCheckHook ];
dontConfigure = true;
pythonImportsCheck = [
"bencode"
"typevalidator"
];
meta = {
inherit (bencodetools.meta)
description
homepage
license
maintainers
;
};
}

View File

@@ -1575,6 +1575,10 @@ self: super: with self; {
bencoder = callPackage ../development/python-modules/bencoder { }; bencoder = callPackage ../development/python-modules/bencoder { };
bencodetools = callPackage ../development/python-modules/bencodetools {
bencodetools = pkgs.bencodetools;
};
beniget = callPackage ../development/python-modules/beniget { }; beniget = callPackage ../development/python-modules/beniget { };
bentoml = callPackage ../development/python-modules/bentoml { }; bentoml = callPackage ../development/python-modules/bentoml { };