recipe 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Build recipe for libmad.
  2. #
  3. # Copyright (c) 2020 Matias Fonzo, <selk@dragora.org>.
  4. #
  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
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  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.
  16. program=libmad
  17. version=0.15.1b
  18. release=1
  19. # Set 'outdir' for a nice and well-organized output directory
  20. outdir="${outdir}/${arch}/libs"
  21. tarname=${program}-${version}.tar.gz
  22. # Remote source(s)
  23. fetch=http://downloads.sourceforge.net/project/mad/libmad/${version}/$tarname
  24. description="
  25. MPEG Audio Decoder.
  26. MAD is a high-quality MPEG audio decoder. It currently supports MPEG-1
  27. and the MPEG-2 extension to lower sampling frequencies, as well as the
  28. de facto MPEG 2.5 format. All three audio layers: Layer I, Layer II, and
  29. Layer III (i.e. MP3) are fully implemented.
  30. "
  31. homepage=http://www.underbit.com/products/mad/
  32. license=GPLv2+
  33. # Source documentation
  34. docs="CHANGES COPYING COPYRIGHT CREDITS README TODO VERSION"
  35. docsdir="${docdir}/${program}-${version}"
  36. build()
  37. {
  38. set -e
  39. unpack "${tardir}/$tarname"
  40. cd "$srcdir"
  41. # Set sane permissions
  42. chmod -R u+w,go-w,a+rX-s .
  43. # Refresh old source with patches coming from Gentoo (thanks!)
  44. patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-cflags.patch"
  45. patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-cflags-O2.patch"
  46. patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-gcc44-mips-h-constraint-removal.patch"
  47. patch -Np1 -i "${worktree}/patches/libmad/libmad-0.15.1b-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch"
  48. sed -e "s@AM_CONFIG_HEADER@AC_CONFIG_HEADERS@g" -i configure.ac
  49. touch NEWS AUTHORS ChangeLog
  50. autoreconf -vif
  51. ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  52. $configure_args \
  53. --libdir=/usr/lib${libSuffix} \
  54. --mandir=$mandir \
  55. --docdir=$docsdir \
  56. --enable-shared=yes \
  57. --enable-static=yes \
  58. --build="$(cc -dumpmachine)"
  59. make -j${jobs} V=1
  60. make -j${jobs} DESTDIR="$destdir" install-strip
  61. # Provide pkg-config file
  62. mkdir -p "${destdir}/usr/lib${libSuffix}/pkgconfig"
  63. cat << "EOF" > "${destdir}/usr/lib${libSuffix}"/pkgconfig/mad.pc
  64. prefix=/usr
  65. exec_prefix=${prefix}
  66. libdir=${exec_prefix}/lib
  67. includedir=${prefix}/include
  68. Name: mad
  69. Description: MPEG audio decoder
  70. Requires:
  71. Version: 0.15.1b
  72. Libs: -L${libdir} -lmad -lm
  73. Cflags: -I${includedir}
  74. EOF
  75. # Compress and link man pages (if needed)
  76. if test -d "${destdir}/$mandir"
  77. then
  78. (
  79. cd "${destdir}/$mandir"
  80. find . -type f -exec lzip -9 '{}' +
  81. find . -type l | while read -r file
  82. do
  83. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  84. rm -- "$file"
  85. done
  86. )
  87. fi
  88. # Copy documentation
  89. mkdir -p "${destdir}${docsdir}"
  90. cp -p $docs "${destdir}${docsdir}"
  91. }