diff --git a/pkgs/by-name/sn/sndpeek/ambiguous-complex.patch b/pkgs/by-name/sn/sndpeek/ambiguous-complex.patch new file mode 100644 index 000000000000..6d391f2a27b8 --- /dev/null +++ b/pkgs/by-name/sn/sndpeek/ambiguous-complex.patch @@ -0,0 +1,40 @@ +diff --git a/src/marsyas/MagFFT.cpp b/src/marsyas/MagFFT.cpp +index 056f998..525ffa8 100644 +--- a/src/marsyas/MagFFT.cpp ++++ b/src/marsyas/MagFFT.cpp +@@ -37,10 +37,10 @@ typedef struct { float re ; float im ; } complex ; + + #define CABS(x) hypot( (x).re, (x).im ) + +-complex cadd(), csub(), cmult(), smult(), cdiv(), conjg(), csqrt() ; ++::complex cadd(), csub(), cmult(), smult(), cdiv(), conjg(), csqrt() ; + +-extern complex zero ; +-extern complex one ; ++extern ::complex zero ; ++extern ::complex one ; + extern float synt ; + + +diff --git a/src/sndpeek/sndpeek.cpp b/src/sndpeek/sndpeek.cpp +index 77fca13..a95275f 100644 +--- a/src/sndpeek/sndpeek.cpp ++++ b/src/sndpeek/sndpeek.cpp +@@ -1583,7 +1583,7 @@ void displayFunc( ) + // take forward FFT; result in buffer as FFT_SIZE/2 complex values + rfft( (float *)buffer, g_fft_size/2, FFT_FORWARD ); + // cast to complex +- complex * cbuf = (complex *)buffer; ++ ::complex * cbuf = (::complex *)buffer; + + // reset drawing offsets + x = -1.8f; +@@ -1910,7 +1910,7 @@ void extract_buffer( ) + // take the forward fft, leaving fftsize/2 complex values + rfft( (float *)buffer, g_buffer_size/2, FFT_FORWARD ); + // cast to complex +- complex * cbuf = (complex *)buffer; ++ ::complex * cbuf = (::complex *)buffer; + + // get magnitude spectrum + for( i = 0; i < g_buffer_size/2; i++ ) diff --git a/pkgs/by-name/sn/sndpeek/package.nix b/pkgs/by-name/sn/sndpeek/package.nix index ae6082b93820..b28c4aee720d 100644 --- a/pkgs/by-name/sn/sndpeek/package.nix +++ b/pkgs/by-name/sn/sndpeek/package.nix @@ -15,17 +15,24 @@ stdenv.mkDerivation (finalAttrs: { pname = "sndpeek"; - version = "1.4"; + version = "1.41"; src = fetchurl { url = "https://soundlab.cs.princeton.edu/software/sndpeek/files/sndpeek-${finalAttrs.version}.tgz"; - sha256 = "2d86cf74854fa00dcdc05a35dd92bc4cf6115e87102b17023be5cba9ead8eedf"; + hash = "sha256-ZVMLZRDQfCCI5f+i5LEb34uHKqiTkT2pa2sBjnSyTk0="; }; - sourceRoot = "sndpeek-${finalAttrs.version}/src/sndpeek"; - # this patch adds -lpthread to the list of libraries, without it a - # symbol-not-found-error is thrown - patches = [ ./pthread.patch ]; + patches = [ + # this patch adds -lpthread to the list of libraries, without it a + # symbol-not-found-error is thrown + ./pthread.patch + # fix error: reference to 'complex' is ambiguous + ./ambiguous-complex.patch + ]; + + postPatch = '' + cd "src/sndpeek" + ''; buildInputs = [ libglut diff --git a/pkgs/by-name/sn/sndpeek/pthread.patch b/pkgs/by-name/sn/sndpeek/pthread.patch index b2f1d37da6be..b6d2c7b94828 100644 --- a/pkgs/by-name/sn/sndpeek/pthread.patch +++ b/pkgs/by-name/sn/sndpeek/pthread.patch @@ -1,11 +1,11 @@ -diff --git a/makefile.alsa b/makefile.alsa +diff --git a/src/sndpeek/makefile.alsa b/src/sndpeek/makefile.alsa index 34fb848..cdaeaec 100644 ---- a/makefile.alsa -+++ b/makefile.alsa +--- a/src/sndpeek/makefile.alsa ++++ b/src/sndpeek/makefile.alsa @@ -4,7 +4,7 @@ CPP=g++ INCLUDES=-I../marsyas/ MARSYAS_DIR=../marsyas/ - CFLAGS=-D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ $(INCLUDES) -O3 -c + CFLAGS=-D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -D__USE_GLUT__ $(INCLUDES) -O3 -c -LIBS=-L/usr/X11R6/lib -lglut -lGL -lGLU -lasound -lXmu -lX11 -lXext -lXi -lm -lsndfile +LIBS=-L/usr/X11R6/lib -lglut -lGL -lGLU -lasound -lXmu -lX11 -lXext -lXi -lm -lsndfile -lpthread