recipes: Rename 'pkghashtag' variable to 'pkgcategory'
[dragora.git] / recipes / libs / libmad / recipe
blob23cd166237496c1ef720bb10447b69116f16cf1e
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.
17 program=libmad
18 version=0.15.1b
19 release=1
21 # Define a category for the output of the package name
22 pkgcategory=libs
24 tarname=${program}-${version}.tar.gz
26 # Remote source(s)
27 fetch=http://downloads.sourceforge.net/project/mad/libmad/${version}/$tarname
29 description="
30 MPEG Audio Decoder.
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/
39 license=GPLv2+
41 # Source documentation
42 docs="CHANGES COPYING COPYRIGHT CREDITS README TODO VERSION"
43 docsdir="${docdir}/${program}-${version}"
45 build()
47     set -e
49     unpack "${tardir}/$tarname"
51     cd "$srcdir"
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
64     autoreconf -vif
66     ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
67      $configure_args \
68      --libdir=/usr/lib${libSuffix} \
69      --mandir=$mandir \
70      --docdir=$docsdir \
71      --enable-shared=yes \
72      --enable-static=yes \
73      --build="$(cc -dumpmachine)"
75     make -j${jobs} V=1
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
81 prefix=/usr
82 exec_prefix=${prefix}
83 libdir=${exec_prefix}/lib
84 includedir=${prefix}/include
86 Name: mad
87 Description: MPEG audio decoder
88 Requires:
89 Version: 0.15.1b
90 Libs: -L${libdir} -lmad -lm
91 Cflags: -I${includedir}
92 EOF
94     # Compress and link man pages (if needed)
95     if test -d "${destdir}/$mandir"
96     then
97         (
98             cd "${destdir}/$mandir"
99             find . -type f -exec lzip -9 '{}' +
100             find . -type l | while read -r file
101             do
102                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
103                 rm -- "$file"
104             done
105         )
106     fi
108     # Copy documentation
109     mkdir -p "${destdir}${docsdir}"
110     cp -p $docs "${destdir}${docsdir}"