diff options
author | Sebastien Fabbro <bicatali@gentoo.org> | 2012-08-07 02:33:07 +0000 |
---|---|---|
committer | Sebastien Fabbro <bicatali@gentoo.org> | 2012-08-07 02:33:07 +0000 |
commit | 64cdb3c9fe8a283229a9f59fea4aad9fb6b4e8b6 (patch) | |
tree | 60e9d6c08eafd9f931277aeb58715922d72ab934 /sci-visualization/spectromatic | |
parent | Stable arm, bug #419269 (diff) | |
download | gentoo-2-64cdb3c9fe8a283229a9f59fea4aad9fb6b4e8b6.tar.gz gentoo-2-64cdb3c9fe8a283229a9f59fea4aad9fb6b4e8b6.tar.bz2 gentoo-2-64cdb3c9fe8a283229a9f59fea4aad9fb6b4e8b6.zip |
Fixed for reading RIFF/WAV files on amd64, thanks to Ilya Gordeev, bug #428644
(Portage version: 2.2.01.20796-prefix/cvs/Linux x86_64)
Diffstat (limited to 'sci-visualization/spectromatic')
5 files changed, 122 insertions, 31 deletions
diff --git a/sci-visualization/spectromatic/ChangeLog b/sci-visualization/spectromatic/ChangeLog index 4c763c072f61..21f62209cc23 100644 --- a/sci-visualization/spectromatic/ChangeLog +++ b/sci-visualization/spectromatic/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for sci-visualization/spectromatic # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sci-visualization/spectromatic/ChangeLog,v 1.11 2012/05/04 08:07:00 jdhore Exp $ +# $Header: /var/cvsroot/gentoo-x86/sci-visualization/spectromatic/ChangeLog,v 1.12 2012/08/07 02:33:07 bicatali Exp $ + + 07 Aug 2012; Sébastien Fabbro <bicatali@gentoo.org> + +files/spectromatic-1.0-waveheaderstruct-amd64.patch, + -files/spectromatic-1.0-gentoo.diff, files/spectromatic-1.0-makefile.patch, + spectromatic-1.0-r2.ebuild: + Fixed for reading RIFF/WAV files on amd64, thanks to Ilya Gordeev, bug #428644 04 May 2012; Jeff Horelick <jdhore@gentoo.org> spectromatic-1.0-r2.ebuild: dev-util/pkgconfig -> virtual/pkgconfig diff --git a/sci-visualization/spectromatic/files/spectromatic-1.0-gentoo.diff b/sci-visualization/spectromatic/files/spectromatic-1.0-gentoo.diff deleted file mode 100644 index 9fef68467dfe..000000000000 --- a/sci-visualization/spectromatic/files/spectromatic-1.0-gentoo.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- Makefile.orig 2002-12-10 21:25:31.000000000 +0100 -+++ Makefile 2002-12-10 21:25:20.000000000 +0100 -@@ -13,15 +13,16 @@ - - TARGET = spectromatic - --install: all -+all: $(OBJ) -+ $(CC) -o $(TARGET) $(OBJ) $(LIBS) -+ strip $(TARGET) -+ -+install: - mkdir -p $(DESTDIR)$(TOPLEVEL_HOME)/bin - mkdir -p $(DESTDIR)$(TOPLEVEL_HOME)/man/man1 - install -o root -g root -m 0755 spectromatic $(DESTDIR)$(TOPLEVEL_HOME)/bin - install -o root -g root -m 0644 man/spectromatic.1 $(DESTDIR)$(TOPLEVEL_HOME)/man/man1 - --all: $(OBJ) -- $(CC) -o $(TARGET) $(OBJ) $(LIBS) -- strip $(TARGET) - - clean: - $(RM) $(TARGET) $(OBJ) diff --git a/sci-visualization/spectromatic/files/spectromatic-1.0-makefile.patch b/sci-visualization/spectromatic/files/spectromatic-1.0-makefile.patch index 6636484f876e..48f9d9023358 100644 --- a/sci-visualization/spectromatic/files/spectromatic-1.0-makefile.patch +++ b/sci-visualization/spectromatic/files/spectromatic-1.0-makefile.patch @@ -10,7 +10,8 @@ Fix install paths -LIBS = -lgsl -lgslcblas -lpng -lm +LIBS = -lpng `pkg-config --libs gsl` DESTDIR = - TOPLEVEL_HOME = /usr +-TOPLEVEL_HOME = /usr ++TOPLEVEL_HOME ?= /usr -CC = gcc -I. - @@ -29,7 +30,7 @@ Fix install paths all: $(OBJ) - $(CC) -o $(TARGET) $(OBJ) $(LIBS) - strip $(TARGET) -+ $(CC) $(LDFLAGS) -o $(TARGET) $(OBJ) $(LIBS) ++ $(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $(TARGET) + +install: $(TARGET) + mkdir -p $(DESTDIR)$(TOPLEVEL_HOME)/bin diff --git a/sci-visualization/spectromatic/files/spectromatic-1.0-waveheaderstruct-amd64.patch b/sci-visualization/spectromatic/files/spectromatic-1.0-waveheaderstruct-amd64.patch new file mode 100644 index 000000000000..edfb7af8c4b3 --- /dev/null +++ b/sci-visualization/spectromatic/files/spectromatic-1.0-waveheaderstruct-amd64.patch @@ -0,0 +1,103 @@ +--- wave.c.orig 2012-08-06 18:54:21.829756875 -0700 ++++ wave.c 2012-08-06 19:04:35.818049655 -0700 +@@ -1,11 +1,26 @@ + #include <stdio.h> + #include <string.h> ++#include <endian.h> + #include "wave.h" + + int read_header (FILE *f, waveheaderstruct *header) + { ++ waveheaderstruct h; + fseek (f, 0, SEEK_SET); +- return fread (header, 1, sizeof (waveheaderstruct), f); ++ size_t red = fread (&h, 1, sizeof (waveheaderstruct), f); ++ ++ h.length = le32toh(h.length); ++ h.length_chunk = le32toh(h.length_chunk); ++ h.format = le16toh(h.format); ++ h.modus = le16toh(h.modus); ++ h.sample_fq = le32toh(h.sample_fq); ++ h.byte_p_sec = le32toh(h.byte_p_sec); ++ h.byte_p_spl = le16toh(h.byte_p_spl); ++ h.bit_p_spl = le16toh(h.bit_p_spl); ++ h.data_length = le32toh(h.data_length); ++ ++ *header = h; ++ return red; + } + + int read_frames (FILE *f, int start, int length, char *data) +@@ -52,12 +67,12 @@ + + read_header (f, &header); + +- printf ("Length: %lu\n", header.length); +- printf ("Length Chunk: %lu\n", header.length_chunk); ++ printf ("Length: %lu\n", (unsigned long)header.length); ++ printf ("Length Chunk: %lu\n", (unsigned long)header.length_chunk); + printf ("Format: %u\n", header.format); + printf ("Modus: %u\n", header.modus); +- printf ("Sample Frequency: %lu\n", header.sample_fq); +- printf ("Bytes per Second: %lu\n", header.byte_p_sec); ++ printf ("Sample Frequency: %lu\n", (unsigned long)header.sample_fq); ++ printf ("Bytes per Second: %lu\n", (unsigned long)header.byte_p_sec); + printf ("Bytes per Sample: %u\n", header.byte_p_spl); +- printf ("Data Length: %lu\n", header.data_length); ++ printf ("Data Length: %lu\n", (unsigned long)header.data_length); + } +--- wave.h.orig 2012-08-06 18:55:38.009165756 -0700 ++++ wave.h 2012-08-06 18:55:50.377232324 -0700 +@@ -22,24 +22,25 @@ + #ifndef WAVE_H + #define WAVE_H + +-typedef unsigned long ulongT; +-typedef unsigned short ushortT; ++#include <stdint.h> + ++#pragma pack(push,1) + typedef struct { /* header for WAV-Files */ +- char main_chunk[4]; /* 'RIFF' */ +- unsigned long length; /* length of file */ +- char chunk_type[4]; /* 'WAVE' */ +- char sub_chunk[4]; /* 'fmt' */ +- unsigned long length_chunk; /* length sub_chunk, always 16 bytes */ +- unsigned short format; /* always 1 = PCM-Code */ +- unsigned short modus; /* 1 = Mono, 2 = Stereo */ +- unsigned long sample_fq; /* Sample Freq */ +- unsigned long byte_p_sec; /* Data per sec */ +- unsigned short byte_p_spl; /* Bytes per sample */ +- unsigned short bit_p_spl; /* bits per sample, 8, 12, 16 */ +- char data_chunk[4]; /* 'data' */ +- unsigned long data_length; /* length of data */ +-} waveheaderstruct; ++ uint8_t main_chunk[4]; /* 'RIFF' */ ++ uint32_t length; /* length of file */ ++ uint8_t chunk_type[4]; /* 'WAVE' */ ++ uint8_t sub_chunk[4]; /* 'fmt' */ ++ uint32_t length_chunk; /* length sub_chunk, always 16 bytes */ ++ uint16_t format; /* always 1 = PCM-Code */ ++ uint16_t modus; /* 1 = Mono, 2 = Stereo */ ++ uint32_t sample_fq; /* Sample Freq */ ++ uint32_t byte_p_sec; /* Data per sec */ ++ uint16_t byte_p_spl; /* Bytes per sample */ ++ uint16_t bit_p_spl; /* bits per sample, 8, 12, 16 */ ++ uint8_t data_chunk[4]; /* 'data' */ ++ uint32_t data_length; /* length of data */ ++} __attribute__ ((__packed__)) waveheaderstruct; ++#pragma pack(pop) + + int read_header (FILE *f, waveheaderstruct *header); + int read_frames (FILE *f, int start, int length, char *data); +--- spectromatic.c.orig 2012-08-06 18:54:05.260668605 -0700 ++++ spectromatic.c 2012-08-06 19:28:18.637679446 -0700 +@@ -217,7 +217,7 @@ + if (header.modus == 2) + ch2 = (double*) malloc (window_size * sizeof (double)); + +- fprintf (stderr, "samples = %li, step_size = %i, window_size = %i\n", header.data_length / header.byte_p_spl, step_size, window_size); ++ fprintf (stderr, "samples = %lu, step_size = %i, window_size = %i\n", (unsigned long)header.data_length / header.byte_p_spl, step_size, window_size); + + for (i = -window_size; i < window_size + (int)(header.data_length / header.byte_p_spl); i += step_size) { + read_frames (f, i, window_size, data); diff --git a/sci-visualization/spectromatic/spectromatic-1.0-r2.ebuild b/sci-visualization/spectromatic/spectromatic-1.0-r2.ebuild index 4b9f5c8ec929..7e696e4cf506 100644 --- a/sci-visualization/spectromatic/spectromatic-1.0-r2.ebuild +++ b/sci-visualization/spectromatic/spectromatic-1.0-r2.ebuild @@ -1,8 +1,8 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sci-visualization/spectromatic/spectromatic-1.0-r2.ebuild,v 1.4 2012/05/04 08:07:00 jdhore Exp $ +# $Header: /var/cvsroot/gentoo-x86/sci-visualization/spectromatic/spectromatic-1.0-r2.ebuild,v 1.5 2012/08/07 02:33:07 bicatali Exp $ -EAPI=2 +EAPI=4 inherit base toolchain-funcs @@ -13,7 +13,7 @@ HOMEPAGE="http://ieee.uow.edu.au/~daniel/software/spectromatic/" SRC_URI="http://ieee.uow.edu.au/~daniel/software/spectromatic/dist/${MY_P}.tar.gz" LICENSE="GPL-2" SLOT="0" -KEYWORDS="amd64 ~ppc x86" +KEYWORDS="amd64 ~ppc x86 ~amd64-linux ~x86-linux" IUSE="" RDEPEND="media-libs/libpng @@ -22,9 +22,13 @@ DEPEND="${RDEPEND} virtual/pkgconfig" DOCS=( README ) -PATCHES=( "${FILESDIR}/${P}-makefile.patch" - "${FILESDIR}/${P}-stringliteral.patch" ) +PATCHES=( + "${FILESDIR}"/${P}-makefile.patch + "${FILESDIR}"/${P}-stringliteral.patch + "${FILESDIR}"/${P}-waveheaderstruct-amd64.patch +) pkg_setup() { tc-export CC + export TOPLEVEL_HOME="${EROOT}/usr" } |