aboutsummaryrefslogtreecommitdiffstats
path: root/testing/mp3info
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2015-05-20 11:29:59 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2015-05-20 11:30:06 +0200
commitcf52c70d524fbc12adbd6e474c121fedc3c62e82 (patch)
tree24fca42207d10dc32b7f5e46aa8f2493aeb94b70 /testing/mp3info
parente1f741fc44cd67b52122191fa6b64926cdb21f6e (diff)
downloadaports-cf52c70d524fbc12adbd6e474c121fedc3c62e82.tar.bz2
aports-cf52c70d524fbc12adbd6e474c121fedc3c62e82.tar.xz
testing/mp3info: fix build on musl
Diffstat (limited to 'testing/mp3info')
-rw-r--r--testing/mp3info/APKBUILD41
-rw-r--r--testing/mp3info/escape_chars.patch138
-rw-r--r--testing/mp3info/types.patch11
3 files changed, 190 insertions, 0 deletions
diff --git a/testing/mp3info/APKBUILD b/testing/mp3info/APKBUILD
new file mode 100644
index 0000000000..a033ee8360
--- /dev/null
+++ b/testing/mp3info/APKBUILD
@@ -0,0 +1,41 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
+pkgname=mp3info
+pkgver=0.8.5a
+pkgrel=1
+pkgdesc="An MP3 technical info viewer and ID3 1.x tag editor"
+url="http://www.ibiblio.org/mp3info/"
+arch="all"
+license="GPL"
+depends=
+makedepends="ncurses-dev"
+subpackages=""
+source="ftp://ftp.ibiblio.org/pub/linux/apps/sound/mp3-utils/mp3info/mp3info-0.8.5a.tgz
+ escape_chars.patch
+ types.patch"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ patch -p1 -i "$srcdir"/escape_chars.patch || return 1
+ patch -p1 -i "$srcdir"/types.patch || return 1
+
+ make mp3info || return 1
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ install -Dm755 mp3info "$pkgdir"/usr/bin/mp3info
+ install -Dm644 mp3info.1 "$pkgdir"/usr/share/man/man1/mp3info.1
+
+}
+
+md5sums="cb7b619a10a40aaac2113b87bb2b2ea2 mp3info-0.8.5a.tgz
+d0be1068503056b775bf10f05a8497b8 escape_chars.patch
+0ecc00596019ca4530af8eae6f5d4ce3 types.patch"
+sha256sums="0438ac68e9f04947fb14ca5573d27c62454cb9db3a93b7f1d2c226cd3e0b4e10 mp3info-0.8.5a.tgz
+452edfebd1d9a647e89b9d88712b1eaec9f7aa4982eeae5c3c884aa21c283df5 escape_chars.patch
+fa63e57cc3e3ddb0e23ecab99bcce5bb95f18dce83214f307bddbfe3dcd431c2 types.patch"
+sha512sums="30e0ef62deaa090fc115317f6c372f408077dfceed7e05faa6744b8516291e38d21f1742732f6532585f0c3d8c705d8c7026c2bed84c97e1f497d433637affd2 mp3info-0.8.5a.tgz
+e2768cb89514e7cec47552384b5166774037fd188caa6e8ed0f6bd6b3a688e0b747c056eddfe3af4613b3947181d3df2bb68a786c9a764598995b8401c561b25 escape_chars.patch
+52378d1b27cd6ae002c99a93854efbef5166cedd1c078aca071f822bdefb1b1d457ef00d3949e96a27e09d2309d320d7ace2417bb25117762ad4536ac68785fa types.patch"
diff --git a/testing/mp3info/escape_chars.patch b/testing/mp3info/escape_chars.patch
new file mode 100644
index 0000000000..ec697a2863
--- /dev/null
+++ b/testing/mp3info/escape_chars.patch
@@ -0,0 +1,138 @@
+--- orig/mp3info-0.8.5a/mp3info.c Mon Nov 6 04:03:17 2006
++++ mp3info-0.8.5a/mp3info.c Thu Mar 19 12:33:27 2009
+@@ -32,6 +32,7 @@
+ #undef __MAIN
+ #include <sys/stat.h>
+
++char *escape_chars=NULL;
+ char FILENAME_FORMAT_STRING[]="File: %F\n";
+ char ID3_FORMAT_STRING[]="Title: %-30t Track: %n\nArtist: %a\nAlbum: %-30l Year: %y\nComment: %-30c Genre: %g [%G]\n";
+ char TECH_FORMAT_STRING[]="Media Type: MPEG %2.1v Layer %L\nAudio: %r KB/s, %qKHz (%o)\nEmphasis: %e\nCRC: %E\nCopyright: %C\nOriginal: %O\nPadding: %p\nLength: %m:%02s\n";
+@@ -66,7 +67,7 @@
+
+
+
+- while ((c=getopt(argc,argv,"vhGidfxFt:a:l:y:c:n:g:p:r:"))!=-1) {
++ while ((c=getopt(argc,argv,"vhGidfxFmt:a:l:y:c:n:g:p:r:e:"))!=-1) {
+
+ switch(c) {
+ case 'v': /* View mode is now automatic when no changes are
+@@ -159,6 +160,12 @@
+ }
+ break;
+ case 'F': quickscan=0; break;
++ case 'e':
++ escape_chars = optarg;
++ break;
++ case 'm':
++ escape_chars = "'\"\b\n\r\t\\";
++ break;
+ }
+ }
+
+--- orig/mp3info-0.8.5a/mp3info.h Fri Nov 10 00:14:52 2006
++++ mp3info-0.8.5a/mp3info.h Thu Mar 19 10:42:07 2009
+@@ -111,6 +111,7 @@
+ extern int galphagenreindex [MAXGENRE+2];
+ #endif
+
++extern char *escape_chars;
+ void tagedit_curs(char *filename, int filenum, int fileoutof, id3tag *tag);
+
+
+--- orig/mp3info-0.8.5a/textfunc.c Mon Nov 6 08:59:12 2006
++++ mp3info-0.8.5a/textfunc.c Thu Mar 19 12:24:52 2009
+@@ -24,6 +24,7 @@
+ */
+
+ #include "mp3info.h"
++#include "libgen.h"
+
+ char *layer_text[] = {
+ "I", "II", "III"
+@@ -70,6 +71,8 @@
+ "\t-n track\tSpecify ID3 v1.1 track number\n"\
+ "\t-t title\tSpecify ID3 track title\n"\
+ "\t-y year\t\tSpecify ID3 copyright year\n\n"\
++ "\t-m\t\tMySQL safe output\n"\
++ "\t-e\t\tCharacters to escape\n"\
+ "\t-G\t\tDisplay valid genres\n"\
+ "\t-h\t\tDisplay this help page\n"\
+ "\t-x\t\tDisplay technical attributes of the MP3 file\n"\
+@@ -85,6 +88,7 @@
+ "\n\t\tConversion Specifiers\n\n"\
+ "\t\t%%f\tFilename without the path (string)\n"\
+ "\t\t%%F\tFilename with the path (string)\n"\
++ "\t\t%%d\tPath without filename (string)\n"\
+ "\t\t%%k\tFile size in KB (integer)\n"\
+ "\n\t\t%%a\tArtist (string)\n"\
+ "\t\t%%c\tComment (string)\n"\
+@@ -217,7 +221,27 @@
+ }
+ }
+
++/* const char *escape_chars = "'\"\b\n\r\t\\%_"; */
++/* escape the chars so its sql safe */
++char *escape_string(char *str)
++{
++ static char buf[8192];
++ char *src = str;
++ char *dest = buf;
+
++ /* we might want a cmdline flag to enable escaping */
++ if (escape_chars == NULL || str == NULL)
++ return str;
++
++ while (*src && dest < (buf + sizeof(buf) - 1)) {
++ if (strchr(escape_chars, *src))
++ *dest++ = '\\';
++ *dest++ = *src++;
++ }
++ *dest = '\0';
++ return buf;
++}
++
+ void format_output (char *format_string,mp3info *mp3, int vbr_report) {
+
+ char genre[40]="";
+@@ -242,16 +266,16 @@
+ mod[modlen]=0;
+ mod[modlen-1]='s';
+ switch (*code) {
+- case 't': printf(mod,mp3->id3.title); break;
++ case 't': printf(mod,escape_string(mp3->id3.title)); break;
+ case 'f': pos = (pos=strrchr(mp3->filename,'/')) ?
+ pos+1 : mp3->filename;
+- printf(mod,pos); break;
+- case 'F': printf(mod,mp3->filename); break;
+- case 'a': printf(mod,mp3->id3.artist); break;
+- case 'l': printf(mod,mp3->id3.album); break;
++ printf(mod,escape_string(pos)); break;
++ case 'F': printf(mod,escape_string(mp3->filename)); break;
++ case 'a': printf(mod,escape_string(mp3->id3.artist)); break;
++ case 'l': printf(mod,escape_string(mp3->id3.album)); break;
+ case 'k': mod[modlen-1] = 'd'; printf(mod,mp3->datasize / 1024); break;
+- case 'y': printf(mod,mp3->id3.year); break;
+- case 'c': printf(mod,mp3->id3.comment); break;
++ case 'y': printf(mod,escape_string(mp3->id3.year)); break;
++ case 'c': printf(mod,escape_string(mp3->id3.comment)); break;
+ case 'n': if(mp3->id3_isvalid && mp3->id3.track[0]) {
+ mod[modlen-1]='d';
+ printf(mod, (int) mp3->id3.track[0]);
+@@ -259,7 +283,7 @@
+ break;
+ case 'g': if(mp3->id3_isvalid) {
+ text_genre(mp3->id3.genre,genre);
+- printf(mod,genre);
++ printf(mod,escape_string(genre));
+ }
+ break;
+ case 'G': if(mp3->id3_isvalid) {
+@@ -348,6 +372,7 @@
+ }
+ break;
+ case '%': printf("%%"); break;
++ case 'd': printf(mod,escape_string(dirname(mp3->filename))); break;
+ default: printf("%%%c",*(code=percent+1)); break;
+ }
+ format=code+1;
diff --git a/testing/mp3info/types.patch b/testing/mp3info/types.patch
new file mode 100644
index 0000000000..760ebf708d
--- /dev/null
+++ b/testing/mp3info/types.patch
@@ -0,0 +1,11 @@
+--- ./mp3tech.c.orig
++++ ./mp3tech.c
+@@ -279,7 +279,7 @@
+ }
+
+ int sameConstant(mp3header *h1, mp3header *h2) {
+- if((*(uint*)h1) == (*(uint*)h2)) return 1;
++ if((*(unsigned int*)h1) == (*(unsigned int*)h2)) return 1;
+
+ if((h1->version == h2->version ) &&
+ (h1->layer == h2->layer ) &&