TagReplc で利用可能なオープンソースソフトウェアのビルドについて

TagReplc で利用するための fdkaac と FFmpeg のビルド例を記します。
あくまで筆者が試して動作が一応確認できた例であり、最も効率的で最適な方法ではありません。
ビルドと動作確認した環境は Windows 11 Home です。
いずれも MSYS2 UCRT64 環境下でのビルドですので、MSYS2 がインストールされていることが必要です。

【MSYS2 のインストール】

MSYS2("minimal system 2") は Microsoft Windows 向けのソフトウェアの配布・構築環境です。
MSYS2 のページInstallation の指示に従ってインストールしてください。
インストール後に MSYS2 のターミナルから pacman (package manager) コマンドによってパッケージの更新を行ってください。
pacman -Syu
を入力してください。
処理後、MSYS2 のターミナルは閉じられます。

【参考】MSYS2 の解説ページ
Qiita
Wikibooks

【fdkaac のビルド】

[スタート]⇒[すべて]⇒[MSYS2]⇒[MSYS2 UCRT64]で UCRT64 環境のターミナルを開いてください。
下記を1行ずつコピーして、MSYS2 UCRT64 のターミナルウィンドウの入力プロンプト($)のあとに貼り付けて実行してください。
(なお、1行目実行中の問い合わせ "Enter a selection (default=all):" に対しては enter キー、":: Proceed with installation? [Y/n]" に対しては 'y' で応答してください。)
pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-toolchain autoconf automake-wrapper git make libtool base-devel cd ~ git clone https://github.com/mstorsjo/fdk-aac cd ~/fdk-aac autoreconf -i -f ./configure --prefix=/ucrt64 --disable-shared make -j$(nproc) make install cd ~ git clone https://github.com/nu774/fdkaac.git cd ~/fdkaac autoreconf -i export PKG_CONFIG_PATH="/ucrt64/lib/pkgconfig:$PKG_CONFIG_PATH" ./configure --prefix=/ucrt64 make -j$(nproc) make install
完了後に
ls -l fdkaac.exe
でファイルサイズを確認してください。
ビルドされた "fdkaac.exe" は Windows の File Explorer では "C:\msys64\home\(username)\fdkaac\fdkaac.exe" にありますので、適当なフォルダにコピーしてください。
なお、上記でビルドされた "fdkaac.exe" には libfdk-aac が静的リンクされていますので、"Fraunhofer FDK AAC license" により "fdkaac.exe" の配布は禁じられています。

【ffmpeg.exe のビルド】

【1】LGPL バージョンのビルド
[スタート]⇒[すべて]⇒[MSYS2]⇒[MSYS2 UCRT64]で UCRT64 環境のターミナルを開いてください。
下記を1行ずつコピーして、MSYS2 UCRT64 のターミナルウィンドウの入力プロンプト($)のあとに貼り付けて実行してください。
pacman -S base-devel mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-libunistring mingw-w64-ucrt-x86_64-perl mingw-w64-ucrt-x86_64-SDL2 nasm yasm wget git unzip p7zip make cmake tar automake autoconf libtool pkg-config mercurial pacman -S mingw-w64-ucrt-x86_64-lame mingw-w64-ucrt-x86_64-opus mingw-w64-ucrt-x86_64-libvpx mingw-w64-ucrt-x86_64-libtheora mingw-w64-ucrt-x86_64-libogg mingw-w64-ucrt-x86_64-wavpack mingw-w64-ucrt-x86_64-openjpeg2 cd ~ git clone https://github.com/AO-Yumi/vorbis_aotuv.git cd ~/vorbis_aotuv ./configure --prefix=/ucrt64 --disable-shared make -j$(nproc) make install cd ~ wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar -jxvf ffmpeg-snapshot.tar.bz2 cd ~/ffmpeg ./configure --disable-gpl --disable-version3 --disable-nonfree --enable-ffmpeg --disable-debug --disable-ffplay --disable-ffprobe --disable-doc --enable-libmp3lame --disable-libfdk-aac --enable-libopus --enable-libvorbis --enable-libvpx --enable-libtheora --enable-libopenjpeg --extra-ldflags="-L/ucrt64/lib -static" --optflags="-O2 -finline-functions" --disable-shared --pkg-config-flags="--static" --enable-small --enable-runtime-cpudetect --enable-static --extra-libs=-static --extra-cflags=--static --arch=x86_64 make -j$(nproc) make install
cd ffmpeg の次の ./configure の実行時の表示の最後に
License: LGPL version 2.1 or later
と表示されていることを確認してください。
完了後に
ls -l ffmpeg.exe
でファイルサイズを確認してください。
また、
ldd ffmpeg.exe
で表示される .dll が全て => /c/WINDOWS/.... となっておりスタティックビルドされていることを確認してください。
ビルドされた "ffmpeg.exe" は Windows の File Explorer では "C:\msys64\home\(username)\ffmpeg\ffmpeg.exe" にありますので、適当なフォルダにコピーしてください。
Windows のコマンドプロンプトで "ffmpeg -L" と入力すると "ffmpeg is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version." などのメッセージが表示されるはずです。

【2】Fraunhofer FDK AAC を含めたビルド

下記を1行ずつコピーして、MSYS2 UCRT64 のターミナルウィンドウの入力プロンプト($)のあとに貼り付けて実行してください。
cd ~ pacman -S mingw-w64-ucrt-x86_64-fdk-aac cd ~/ffmpeg ./configure --disable-gpl --disable-version3 --enable-nonfree --enable-ffmpeg --disable-debug --disable-ffplay --disable-ffprobe --disable-doc --enable-libmp3lame --enable-libfdk-aac --enable-libopus --enable-libvorbis --enable-libvpx --enable-libtheora --enable-libopenjpeg --extra-ldflags="-L/ucrt64/lib -static" --optflags="-O2 -finline-functions" --disable-shared --pkg-config-flags="--static" --enable-small --enable-runtime-cpudetect --enable-static --extra-libs=-static --extra-cflags=--static --arch=x86_64 make -j$(nproc) make install
cd ffmpeg の次の ./configure の実行時の表示の最後に
License: nonfree and unredistributable
と表示されていることを確認してください。
ビルドされた ffmpeg.exe は Windows の File Explorer では "C:\msys64\home\(username)\ffmpeg\ffmpeg.exe" にありますので、適当なフォルダにコピーしてください。
Windows のコマンドプロンプトで "ffmpeg -L" と入力すると一番下に "This version of ffmpeg has nonfree parts compiled in. Therefore it is not legally redistributable." と表示されるはずです。
libfdk-aac を含めてビルドしたため "License: LGPL version 2.1 or later" ではなくなり、バイナリの再配布は禁止されますが、FFmpeg の License についてのコメントの最終行によれば libfdk-aac"To the best of our knowledge, they are compatible with the LGPL." とのことですので、本例でビルドされた ffmpeg.exe も再配布禁止を除けば LGPL 相当とみなされるように思われます。