diff --git a/README.rst b/README.rst index bf27ef1c..9a7e2a4e 100644 --- a/README.rst +++ b/README.rst @@ -16,7 +16,7 @@ Features Currently FFmpeg 8.1.2 is built with the following packages enabled for all platforms: -- lame 3.100 +- lame 3.100.1 (basswood-io/lamer) - opus 1.6.1 - dav1d 1.5.3 - libsvtav1 4.1.0 diff --git a/patches/lame.patch b/patches/lame.patch deleted file mode 100644 index c4ed8538..00000000 --- a/patches/lame.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -urN lame-3.100.orig/include/libmp3lame.sym lame-3.100/include/libmp3lame.sym ---- lame-3.100.orig/include/libmp3lame.sym 2017-09-06 21:33:35.000000000 +0200 -+++ lame-3.100/include/libmp3lame.sym 2022-03-07 20:44:59.057774572 +0100 -@@ -1,5 +1,4 @@ - lame_init --lame_init_old - lame_set_num_samples - lame_get_num_samples - lame_set_in_samplerate -diff -urN lame-3.100.orig/Makefile.in lame-3.100/Makefile.in ---- lame-3.100.orig/Makefile.in 2017-10-13 22:21:58.000000000 +0200 -+++ lame-3.100/Makefile.in 2022-03-07 20:46:02.497996649 +0100 -@@ -353,7 +353,7 @@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - AUTOMAKE_OPTIONS = 1.15 foreign --SUBDIRS = mpglib libmp3lame frontend Dll doc include misc dshow ACM \ -+SUBDIRS = mpglib libmp3lame Dll doc include misc dshow ACM \ - mac macosx vc_solution - - CLEANFILES = testcase.new.mp3 diff --git a/scripts/cibuildpkg.py b/scripts/cibuildpkg.py index e6fb768f..06791f81 100644 --- a/scripts/cibuildpkg.py +++ b/scripts/cibuildpkg.py @@ -95,7 +95,9 @@ def build(self, package: Package, *, for_builder: bool = False): with log_group(f"build {package.name}"): self._extract(package) - if package.name == "x265": + if package.name == "lamer": + self._build_lame(package, for_builder=for_builder) + elif package.name == "x265": self._build_x265(package) elif package.build_system == "cmake": self._build_with_cmake(package, for_builder=for_builder) @@ -161,6 +163,37 @@ def _build_with_make(self, package: Package, for_builder: bool) -> None: run(make_command, env=env) run(install_command, env=env) + def _build_lame(self, package: Package, for_builder: bool) -> None: + # basswood-io/lamer builds libmp3lame with a plain Makefile. Build only + # the static encoder library (the `lib` target, not the ncurses CLI + # frontend or mpglib decoder) as position-independent code -- it is + # linked into the shared libavcodec -- then install it where FFmpeg's + # configure looks (-lmp3lame, ). + package_source_path = os.path.join( + self.build_dir, package.name, package.source_dir + ) + env = self._environment(for_builder=for_builder) + prefix = self._prefix(for_builder=for_builder) + + make_vars = ["DECODER=0"] + if platform.system() == "Windows": + # The CLANGARM64 toolchain ships llvm-ar/llvm-ranlib, not ar/ranlib. + if platform.machine().lower() in {"arm64", "aarch64"}: + env.setdefault("AR", "llvm-ar") + env.setdefault("RANLIB", "llvm-ranlib") + else: + env.setdefault("CC", "gcc") + else: + # -fPIC is required to link the static archive into libavcodec.so. + make_vars.append("PIC=1") + + with chdir(package_source_path): + run(["make", "-j", "4", "lib", *make_vars], env=env) + run( + ["make", "install", f"PREFIX={self._mangle_path(prefix)}", *make_vars], + env=env, + ) + def _build_with_autoconf(self, package: Package, for_builder: bool) -> None: assert package.build_system == "autoconf" package_path = os.path.join(self.build_dir, package.name) diff --git a/scripts/pkg.py b/scripts/pkg.py index e95b7336..f536e0a8 100644 --- a/scripts/pkg.py +++ b/scripts/pkg.py @@ -61,10 +61,11 @@ def __lt__(self, other): codec_group = [ Package( - name="lame", - source_url="http://deb.debian.org/debian/pool/main/l/lame/lame_3.100.orig.tar.gz", - sha256="ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e", - build_arguments=["--disable-gtktest"], + name="lamer", + source_url="https://github.com/basswood-io/lamer/archive/refs/tags/v3.100.1.tar.gz", + source_filename="lamer-3.100.1.tar.gz", + sha256="943eac863ff803b5a698cec0bdc483ce9081b1e74ca8978e94daafb44522c946", + build_system="make", ), Package( name="opus",