1 # Build recipe for libmad.
3 # Copyright (c) 2020 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
21 # Define a category for the output of the package name
24 tarname=${program}-${version}.tar.gz
27 fetch=http://downloads.sourceforge.net/project/mad/libmad/${version}/$tarname
32 MAD is a high-quality MPEG audio decoder. It currently supports MPEG-1
33 and the MPEG-2 extension to lower sampling frequencies, as well as the
34 de facto MPEG 2.5 format. All three audio layers: Layer I, Layer II, and
35 Layer III (i.e. MP3) are fully implemented.
38 homepage=http://www.underbit.com/products/mad/
41 # Source documentation
42 docs="CHANGES COPYING COPYRIGHT CREDITS README TODO VERSION"
43 docsdir="${docdir}/${program}-${version}"
49 unpack "${tardir}/$tarname"
53 # Set sane permissions
54 chmod -R u+w,go-w,a+rX-s .
56 # Refresh old source with patches coming from Gentoo (thanks!)
57 patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-cflags.patch"
58 patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-cflags-O2.patch"
59 patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-gcc44-mips-h-constraint-removal.patch"
60 patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch"
62 sed -e "s@AM_CONFIG_HEADER@AC_CONFIG_HEADERS@g" -i configure.ac
63 touch NEWS AUTHORS ChangeLog
66 ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
68 --libdir=/usr/lib${libSuffix} \
73 --build="$(cc -dumpmachine)"
76 make -j${jobs} DESTDIR="$destdir" install-strip
78 # Provide pkg-config file
79 mkdir -p "${destdir}/usr/lib${libSuffix}/pkgconfig"
80 cat << "EOF" > "${destdir}/usr/lib${libSuffix}"/pkgconfig/mad.pc
83 libdir=${exec_prefix}/lib
84 includedir=${prefix}/include
87 Description: MPEG audio decoder
90 Libs: -L${libdir} -lmad -lm
91 Cflags: -I${includedir}
94 # Compress and link man pages (if needed)
95 if test -d "${destdir}/$mandir"
98 cd "${destdir}/$mandir"
99 find . -type f -exec lzip -9 '{}' +
100 find . -type l | while read -r file
102 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
109 mkdir -p "${destdir}${docsdir}"
110 cp -p $docs "${destdir}${docsdir}"