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
commit 2f3db1d327
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 166 additions and 67 deletions

View File

@ -2,42 +2,51 @@
stdenv,
lib,
fetchFromGitLab,
python3,
gitUpdater,
python3Packages,
}:
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "bencodetools";
version = "unstable-2022-05-11";
version = "1.0.1";
src = fetchFromGitLab {
owner = "heikkiorsila";
repo = "bencodetools";
rev = "384d78d297a561dddbbd0f4632f0c74c0db41577";
sha256 = "1d699q9r33hkmmqkbh92ax54mcdf9smscmc0dza2gp4srkhr83qm";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-5Y1r6+aVtK22lYr2N+YUPPdUts9PIF9I/Pq/mI+WqQs=";
};
postPatch = ''
patchShebangs configure
substituteInPlace configure \
--replace 'python_install_option=""' 'python_install_option="--prefix=$out"'
'';
enableParallelBuilding = true;
nativeBuildInputs = [
(python3.withPackages (ps: with ps; [ distutils ]))
];
configureFlags = [ (lib.strings.withFeature false "python") ];
# installCheck instead of check due to -install_name'd library on Darwin
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";
homepage = "https://gitlab.com/heikkiorsila/bencodetools";
license = licenses.bsd2;
maintainers = with maintainers; [ OPNA2608 ];
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ OPNA2608 ];
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
, fetchFromGitLab
, python3
, pkg-config
, which
, makeWrapper
, libao
, bencodetools
, sox
, lame
, flac
, vorbis-tools
# https://gitlab.com/uade-music-player/uade/-/issues/38
, withWriteAudio ? !stdenv.hostPlatform.isDarwin
{
lib,
stdenv,
fetchFromGitLab,
gitUpdater,
bencodetools,
flac,
lame,
libao,
libzakalwe,
makeWrapper,
python3,
pkg-config,
sox,
vorbis-tools,
which,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "uade";
version = "3.02";
version = "3.05";
src = fetchFromGitLab {
owner = "uade-music-player";
repo = "uade";
rev = "uade-${version}";
hash = "sha256-skPEXBQwyr326zCmZ2jwGxcBoTt3Y/h2hagDeeqbMpw=";
rev = "uade-${finalAttrs.version}";
hash = "sha256-k6t8EQ/G8PbfRrBMXubn1XfBPvw1qDoMGh5xJKrcX+E=";
};
postPatch = ''
patchShebangs configure
substituteInPlace configure \
--replace 'PYTHON_SETUP_ARGS=""' 'PYTHON_SETUP_ARGS="--prefix=$out"'
substituteInPlace src/frontends/mod2ogg/mod2ogg2.sh.in \
--replace '-e stat' '-n stat' \
--replace '/usr/local' "$out"
--replace-fail '-e stat' '-n stat' \
--replace-fail '/usr/local' "$out"
substituteInPlace python/uade/generate_oscilloscope_view.py \
--replace "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++'
--replace-fail "default='uade123'" "default='$out/bin/uade123'"
'';
nativeBuildInputs = [
makeWrapper
pkg-config
which
makeWrapper
] ++ lib.optionals withWriteAudio [
python3
];
buildInputs = [
libao
bencodetools
sox
lame
flac
lame
libao
libzakalwe
sox
vorbis-tools
] ++ lib.optionals withWriteAudio [
(python3.withPackages (p: with p; [
pillow
tqdm
more-itertools
]))
];
configureFlags = [
"--bencode-tools-prefix=${bencodetools}"
"--with-text-scope"
] ++ lib.optionals (!withWriteAudio) [
"--without-write-audio"
"--libzakalwe-prefix=${libzakalwe}"
(lib.strings.withFeature true "text-scope")
(lib.strings.withFeature false "write-audio")
];
enableParallelBuilding = true;
@ -76,24 +67,31 @@ stdenv.mkDerivation rec {
postInstall = ''
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
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";
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.
# - hippel-coso player is "[not] under any Open Source certified license"
# - infogrames player is disassembled from Andi Silvas player, unknown license
# Let's make it easy and flag the whole package as unfree.
license = licenses.unfree;
maintainers = with maintainers; [ OPNA2608 ];
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ OPNA2608 ];
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 { };
bencodetools = callPackage ../development/python-modules/bencodetools {
bencodetools = pkgs.bencodetools;
};
beniget = callPackage ../development/python-modules/beniget { };
bentoml = callPackage ../development/python-modules/bentoml { };