commit 38efba54fed3e76d0db6012cb8b3d4fc0d278665
Author: leigh123linux <leigh123linux(a)googlemail.com>
Date: Tue Dec 6 11:01:01 2016 +0000
Prepare package for export to Fedora repo
madplay-0.15.2b-abxtest-tempfile.patch | 4 +-
madplay-0.15.2b-ucs4.patch | 119 +++++++++++++++++++++++++++++++++
madplay.spec | 46 ++++++-------
sources | 1 -
4 files changed, 142 insertions(+), 28 deletions(-)
---
diff --git a/madplay-0.15.2b-abxtest-tempfile.patch
b/madplay-0.15.2b-abxtest-tempfile.patch
index a83a074..c751543 100644
--- a/madplay-0.15.2b-abxtest-tempfile.patch
+++ b/madplay-0.15.2b-abxtest-tempfile.patch
@@ -1,5 +1,5 @@
---- abxtest-dist 2004-03-19 15:20:51.677624467 +0100
-+++ abxtest 2004-03-19 15:44:01.719279507 +0100
+--- a/abxtest-dist 2004-03-19 15:20:51.677624467 +0100
++++ b/abxtest 2004-03-19 15:44:01.719279507 +0100
@@ -94,7 +94,7 @@
echo "randomizing ..."
diff --git a/madplay-0.15.2b-ucs4.patch b/madplay-0.15.2b-ucs4.patch
new file mode 100644
index 0000000..736ea7d
--- /dev/null
+++ b/madplay-0.15.2b-ucs4.patch
@@ -0,0 +1,119 @@
+Convert an ucs4 string to the current locale instead of to converting it
+to "latin1". This should make it possible to display it on an UTF-8 locale.
+
+--- madplay-0.15.2b.orig/player.c
++++ madplay-0.15.2b/player.c
+@@ -28,6 +28,8 @@
+ # include <stdio.h>
+ # include <stdarg.h>
+ # include <stdlib.h>
++# include <wchar.h>
++
+
+ # ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+@@ -598,6 +600,77 @@
+ return 0;
+ }
+
++/* Note: id3_ucs4_length and id3_ucs4_size are duplicated from
++ * libid3tag because they are not exported. */
++
++/*
++ * NAME: ucs4->length()
++ * DESCRIPTION: return the number of ucs4 chars represented by a ucs4 string
++ */
++id3_length_t id3_ucs4_length(id3_ucs4_t const *ucs4)
++{
++ id3_ucs4_t const *ptr = ucs4;
++
++ while (*ptr)
++ ++ptr;
++
++ return ptr - ucs4;
++}
++
++/*
++ * NAME: ucs4->size()
++ * DESCRIPTION: return the encoding size of a ucs4 string
++ */
++id3_length_t id3_ucs4_size(id3_ucs4_t const *ucs4)
++{
++ return id3_ucs4_length(ucs4) + 1;
++}
++
++/* NAME: ucs4_to_wchar_strdup()
++ * DESCRIPTION: convert an ucs4 string to a wchar_t string
++ */
++static
++wchar_t *ucs4_to_wchar_strdup(const id3_ucs4_t *ucs4)
++{
++ id3_length_t size = id3_ucs4_size(ucs4);
++ wchar_t *s = malloc(size * sizeof(wchar_t));
++ id3_length_t i;
++
++ for (i = 0; i < size; i++)
++ {
++ s[i] = ucs4[i];
++ }
++ return s;
++}
++
++/*
++ * NAME: ucs4_to_locale_strdup()
++ * DESCRIPTION: convert ucs4 string to locale encoding
++ */
++static
++char *ucs4_to_locale_strdup(const id3_ucs4_t *ucs4)
++#ifndef HAVE_WCSLEN
++{
++ return id3_ucs4_latin1duplicate(ucs4);
++}
++#else
++{
++ /*
++ * UTF8 is at most 5 bytes per character and should be the worst
++ * case encoding, so we use this here.
++ */
++ wchar_t *ws = ucs4_to_wchar_strdup(ucs4);
++ int len = wcslen(ws)*5;
++ char *s = malloc(len);
++
++ snprintf(s, len, "%ls", ws);
++ s[len - 1] = 0;
++ free(ws);
++
++ return s;
++}
++#endif
++
+ /*
+ * NAME: show_id3()
+ * DESCRIPTION: display ID3 tag information
+@@ -652,7 +725,7 @@
+ if (strcmp(info[i].id, ID3_FRAME_GENRE) == 0)
+ ucs4 = id3_genre_name(ucs4);
+
+- latin1 = id3_ucs4_latin1duplicate(ucs4);
++ latin1 = ucs4_to_locale_strdup(ucs4);
+ if (latin1 == 0)
+ goto fail;
+
+@@ -685,7 +758,7 @@
+ ucs4 = id3_field_getfullstring(id3_frame_field(frame, 3));
+ assert(ucs4);
+
+- latin1 = id3_ucs4_latin1duplicate(ucs4);
++ latin1 = ucs4_to_locale_strdup(ucs4);
+ if (latin1 == 0)
+ goto fail;
+
+@@ -1211,7 +1284,7 @@
+ if (nstrings > 0) {
+ id3_latin1_t *latin1;
+
+- latin1 = id3_ucs4_latin1duplicate(id3_field_getstrings(field, 0));
++ latin1 = ucs4_to_locale_strdup(id3_field_getstrings(field, 0));
+ if (latin1) {
+ signed long ms;
+
diff --git a/madplay.spec b/madplay.spec
index efb4058..2346cdc 100644
--- a/madplay.spec
+++ b/madplay.spec
@@ -1,26 +1,20 @@
Name: madplay
Version: 0.15.2b
-Release: 10%{?dist}
+Release: 11%{?dist}
Summary: MPEG audio decoder and player
-Group: Applications/Multimedia
License: GPLv2+
URL:
http://www.underbit.com/products/mad/
Source0:
http://download.sourceforge.net/mad/%{name}-%{version}.tar.gz
-Source1: mp3license
Patch0: %{name}-0.15.2b-abxtest-tempfile.patch
-Patch1:
http://ftp.debian.org/debian/pool/main/m/madplay/madplay_0.15.2b-4.diff.gz
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+Patch1: %{name}-0.15.2b-ucs4.patch
Requires: %{_sbindir}/update-alternatives
BuildRequires: libmad-devel
BuildRequires: libid3tag-devel
-#BuildRequires: esound-devel
BuildRequires: gettext
-%{?_with_alsa:BuildRequires: alsa-lib-devel}
+BuildRequires: alsa-lib-devel
Provides: mp3-cmdline
-Provides: mad = %{version}-%{release}
-Obsoletes: mad < %{version}-%{release}
%description
madplay is a command-line MPEG audio decoder and player based on the
@@ -29,10 +23,8 @@ distributed libmad package.
%prep
-%setup -q
-%patch0
-%patch1 -p1
-%{__patch} -i debian/patches/00_ucs4.diff
+%autosetup -p1
+
sed -i -e 's/[-lz]/[]/' configure.ac ; sed -i -e 's/ -lz / /' configure
touch -r aclocal.m4 configure.ac
# Recode CREDITS to utf-8
@@ -41,21 +33,19 @@ touch -r aclocal.m4 configure.ac
%build
-%configure %{?_with_alsa} --disable-dependency-tracking
-make %{?_smp_mflags}
-make %{?_smp_mflags} madtime # madmix mad123 madtag # sometime, when they work
+%configure --disable-dependency-tracking \
+ --with-alsa \
+ --enable-shared=yes \
+ --enable-static=no
+%make_build CFLAGS="$RPM_OPT_FLAGS"
+%make_build CFLAGS="$RPM_OPT_FLAGS" madtime
%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
+%make_install
install -pm 755 madtime $RPM_BUILD_ROOT%{_bindir}
-cp -p %{SOURCE1} .
-%find_lang %{name}
-
-%clean
-rm -rf $RPM_BUILD_ROOT
+%find_lang %{name}
%post
@@ -70,8 +60,8 @@ fi
%files -f %{name}.lang
-%defattr(-,root,root,-)
-%doc CHANGES COPYING COPYRIGHT CREDITS README TODO
+%doc CHANGES CREDITS README TODO
+%license COPYING COPYRIGHT
%{_bindir}/abxtest
%{_bindir}/madplay
%{_bindir}/madtime
@@ -80,6 +70,12 @@ fi
%changelog
+* Tue Dec 06 2016 leigh scott <leigh123linux(a)googlemail.com> - 0.15.2b-11
+- Prepare package for export to Fedora repo
+- Fix build flags
+- Switch to alsa (was oss)
+- Clean up spec file
+
* Sun Aug 31 2014 Sérgio Basto <sergio(a)serjux.com> - 0.15.2b-10
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
diff --git a/sources b/sources
index ddc0d0b..189ccea 100644
--- a/sources
+++ b/sources
@@ -1,2 +1 @@
6814b47ceaa99880c754c5195aa1aac1 madplay-0.15.2b.tar.gz
-4660463ff256aa90818b3d74eabf883f madplay_0.15.2b-4.diff.gz