2023-02-15 17:28:10 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoreconfHook, autogen, pkg-config, python3
|
|
|
|
, flac, lame, libmpg123, libogg, libopus, libvorbis
|
2023-02-15 17:55:37 +00:00
|
|
|
, alsa-lib, Carbon, AudioToolbox
|
2023-08-20 19:01:32 +00:00
|
|
|
|
|
|
|
# for passthru.tests
|
|
|
|
, audacity
|
|
|
|
, freeswitch
|
|
|
|
, gst_all_1
|
|
|
|
, libsamplerate
|
|
|
|
, moc
|
|
|
|
, pipewire
|
|
|
|
, pulseaudio
|
2015-11-11 21:55:44 +00:00
|
|
|
}:
|
2005-10-26 15:58:09 +00:00
|
|
|
|
2012-08-25 00:43:48 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-11-12 02:40:24 +00:00
|
|
|
pname = "libsndfile";
|
2023-08-18 08:06:44 +00:00
|
|
|
version = "1.2.2";
|
2020-11-12 02:40:24 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2021-08-04 18:37:40 +00:00
|
|
|
rev = version;
|
2023-08-18 08:06:44 +00:00
|
|
|
hash = "sha256-MOOX/O0UaoeMaQPW9PvvE0izVp+6IoE5VbtTx0RvMkI=";
|
2009-12-13 20:19:03 +00:00
|
|
|
};
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook autogen pkg-config python3 ];
|
2023-02-15 17:28:10 +00:00
|
|
|
buildInputs = [ flac lame libmpg123 libogg libopus libvorbis ]
|
2023-02-15 17:55:37 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ alsa-lib ]
|
2021-01-21 17:00:13 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Carbon AudioToolbox ];
|
2010-10-28 14:00:41 +00:00
|
|
|
|
2012-08-23 19:01:00 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-07-11 09:14:14 +00:00
|
|
|
outputs = [ "bin" "dev" "out" "man" "doc" ];
|
2012-08-23 19:01:00 +00:00
|
|
|
|
2013-07-04 05:02:09 +00:00
|
|
|
# need headers from the Carbon.framework in /System/Library/Frameworks to
|
|
|
|
# compile this on darwin -- not sure how to handle
|
2021-01-21 17:00:13 +00:00
|
|
|
preConfigure = lib.optionalString stdenv.isDarwin
|
2014-07-23 09:00:41 +00:00
|
|
|
''
|
2014-07-24 19:53:46 +00:00
|
|
|
NIX_CFLAGS_COMPILE+=" -I$SDKROOT/System/Library/Frameworks/Carbon.framework/Versions/A/Headers"
|
2014-07-23 09:00:41 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Needed on Darwin.
|
|
|
|
NIX_CFLAGS_LINK = "-logg -lvorbis";
|
2013-07-04 05:02:09 +00:00
|
|
|
|
2023-08-20 19:01:12 +00:00
|
|
|
doCheck = true;
|
|
|
|
preCheck = ''
|
|
|
|
patchShebangs tests/test_wrapper.sh tests/pedantic-header-test.sh
|
|
|
|
|
|
|
|
substituteInPlace tests/test_wrapper.sh \
|
|
|
|
--replace '/usr/bin/env' "$(type -P env)"
|
|
|
|
'';
|
|
|
|
|
2023-08-20 19:01:32 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit
|
|
|
|
audacity
|
|
|
|
freeswitch
|
|
|
|
libsamplerate
|
|
|
|
moc
|
|
|
|
pipewire
|
|
|
|
pulseaudio;
|
|
|
|
inherit (python3.pkgs)
|
|
|
|
soundfile
|
|
|
|
wavefile;
|
|
|
|
inherit (gst_all_1) gst-plugins-bad;
|
|
|
|
lame = (lame.override { sndfileFileIOSupport = true; });
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2013-07-04 05:02:09 +00:00
|
|
|
description = "A C library for reading and writing files containing sampled sound";
|
2020-11-12 02:40:24 +00:00
|
|
|
homepage = "https://libsndfile.github.io/libsndfile/";
|
2023-02-15 17:28:24 +00:00
|
|
|
changelog = "https://github.com/libsndfile/libsndfile/releases/tag/${version}";
|
2013-07-04 05:02:09 +00:00
|
|
|
license = licenses.lgpl2Plus;
|
2013-08-16 21:44:33 +00:00
|
|
|
maintainers = with maintainers; [ lovek323 ];
|
2015-04-26 03:39:49 +00:00
|
|
|
platforms = platforms.unix;
|
2013-07-04 05:02:09 +00:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Libsndfile is a C library for reading and writing files containing
|
|
|
|
sampled sound (such as MS Windows WAV and the Apple/SGI AIFF format)
|
|
|
|
through one standard library interface. It is released in source
|
|
|
|
code format under the GNU Lesser General Public License.
|
|
|
|
|
|
|
|
The library was written to compile and run on a Linux system but
|
2017-08-06 22:05:18 +00:00
|
|
|
should compile and run on just about any Unix (including macOS).
|
2013-07-04 05:02:09 +00:00
|
|
|
There are also pre-compiled binaries available for 32 and 64 bit
|
|
|
|
windows.
|
|
|
|
|
|
|
|
It was designed to handle both little-endian (such as WAV) and
|
|
|
|
big-endian (such as AIFF) data, and to compile and run correctly on
|
|
|
|
little-endian (such as Intel and DEC/Compaq Alpha) processor systems
|
|
|
|
as well as big-endian processor systems such as Motorola 68k, Power
|
|
|
|
PC, MIPS and SPARC. Hopefully the design of the library will also
|
|
|
|
make it easy to extend for reading and writing new sound file
|
|
|
|
formats.
|
|
|
|
'';
|
2005-10-26 15:58:09 +00:00
|
|
|
};
|
|
|
|
}
|