当前位置: 首页 > news >正文

FFmpeg 中./configure的解析

        本文以ffmpeg-5.1.6中的./configure为蓝本进行编译过程的解析。

        接上文“Android Liunx ffmpeg交叉编译”中的android_build1.sh的脚本执行过程来分析。

一、ffmpeg-5.1.6中的./configure:

        1、定位./configure脚本:

        进入ffmpeg文件夹中,可以找到./configure脚本文件。现在在此文件目录下只执行./configure脚本会发生什么。

./configure 

      2、执行./configure:

         执行./configure打印出如的log:

        3、在./configure脚本log代码定位:

        ./configure脚本代码中的7474行,开启了终端的log的打印,对应上图的终端打印的显示结果。

 

       4、./configure脚本log打印代码:

        当quite设置不为yes时会执行如下代码:

if test "$quiet" != "yes"; thenecho "install prefix            $prefix"
echo "source path               $source_path"
echo "C compiler                $cc"
echo "C library                 $libc_type"
if test "$host_cc" != "$cc"; thenecho "host C compiler           $host_cc"echo "host C library            $host_libc_type"
fi
echo "ARCH                      $arch ($cpu)"
if test "$build_suffix" != ""; thenecho "build suffix              $build_suffix"
fi
if test "$progs_suffix" != ""; thenecho "progs suffix              $progs_suffix"
fi
if test "$extra_version" != ""; thenecho "version string suffix     $extra_version"
fi
echo "big-endian                ${bigendian-no}"
echo "runtime cpu detection     ${runtime_cpudetect-no}"
if enabled x86; thenecho "standalone assembly       ${x86asm-no}"echo "x86 assembler             ${x86asmexe}"echo "MMX enabled               ${mmx-no}"echo "MMXEXT enabled            ${mmxext-no}"echo "3DNow! enabled            ${amd3dnow-no}"echo "3DNow! extended enabled   ${amd3dnowext-no}"echo "SSE enabled               ${sse-no}"echo "SSSE3 enabled             ${ssse3-no}"echo "AESNI enabled             ${aesni-no}"echo "AVX enabled               ${avx-no}"echo "AVX2 enabled              ${avx2-no}"echo "AVX-512 enabled           ${avx512-no}"echo "AVX-512ICL enabled        ${avx512icl-no}"echo "XOP enabled               ${xop-no}"echo "FMA3 enabled              ${fma3-no}"echo "FMA4 enabled              ${fma4-no}"echo "i686 features enabled     ${i686-no}"echo "CMOV is fast              ${fast_cmov-no}"echo "EBX available             ${ebx_available-no}"echo "EBP available             ${ebp_available-no}"
fi
if enabled aarch64; thenecho "NEON enabled              ${neon-no}"echo "VFP enabled               ${vfp-no}"
fi
if enabled arm; thenecho "ARMv5TE enabled           ${armv5te-no}"echo "ARMv6 enabled             ${armv6-no}"echo "ARMv6T2 enabled           ${armv6t2-no}"echo "VFP enabled               ${vfp-no}"echo "NEON enabled              ${neon-no}"echo "THUMB enabled             ${thumb-no}"
fi
if enabled mips; thenecho "MIPS FPU enabled          ${mipsfpu-no}"echo "MIPS DSP R1 enabled       ${mipsdsp-no}"echo "MIPS DSP R2 enabled       ${mipsdspr2-no}"echo "MIPS MSA enabled          ${msa-no}"echo "LOONGSON MMI enabled      ${mmi-no}"
fi
if enabled ppc; thenecho "AltiVec enabled           ${altivec-no}"echo "VSX enabled               ${vsx-no}"echo "POWER8 enabled            ${power8-no}"echo "PPC 4xx optimizations     ${ppc4xx-no}"echo "dcbzl available           ${dcbzl-no}"
fi
if enabled loongarch; thenecho "LSX enabled               ${lsx-no}"echo "LASX enabled              ${lasx-no}"
fi
echo "debug symbols             ${debug-no}"
echo "strip symbols             ${stripping-no}"
echo "optimize for size         ${small-no}"
echo "optimizations             ${optimizations-no}"
echo "static                    ${static-no}"
echo "shared                    ${shared-no}"
echo "postprocessing support    ${postproc-no}"
echo "network support           ${network-no}"
echo "threading support         ${thread_type-no}"
echo "safe bitstream reader     ${safe_bitstream_reader-no}"
echo "texi2html enabled         ${texi2html-no}"
echo "perl enabled              ${perl-no}"
echo "pod2man enabled           ${pod2man-no}"
echo "makeinfo enabled          ${makeinfo-no}"
echo "makeinfo supports HTML    ${makeinfo_html-no}"
echo "xmllint enabled           ${xmllint-no}"
test -n "$random_seed" &&echo "random seed               ${random_seed}"
echoecho "External libraries:"
print_enabled '' $EXTERNAL_LIBRARY_LIST $EXTERNAL_AUTODETECT_LIBRARY_LIST | print_in_columns
echoecho "External libraries providing hardware acceleration:"
print_enabled '' $HWACCEL_LIBRARY_LIST $HWACCEL_AUTODETECT_LIBRARY_LIST | print_in_columns
echoecho "Libraries:"
print_enabled '' $LIBRARY_LIST | print_in_columns
echoecho "Programs:"
print_enabled '' $PROGRAM_LIST | print_in_columns
echofor type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; doecho "Enabled ${type}s:"eval list=\$$(toupper $type)_LISTprint_enabled '_*' $list | print_in_columnsecho
doneif test -n "$ignore_tests"; thenignore_tests=$(echo $ignore_tests | tr ',' ' ')echo "Ignored FATE tests:"echo $ignore_tests | print_in_columnsecho
fiecho "License: $license"fi # test "$quiet" != "yes"

    5、./configure中Options设置选项:

        执行./configure --help会打印出所有的Option可设置的选项如下图:

         

        6、在./configure脚本Options代码定位:

        ./configure脚本源码Options的开始行为59行,如下图显示:

       

        这些设置的选择就是android_build1.sh中编译设置的来源,可根据的编译的需求进行可选编译设置。

show_help(){cat <<EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]Help options:--help                   print this message--quiet                  Suppress showing informative output--list-decoders          show all available decoders--list-encoders          show all available encoders--list-hwaccels          show all available hardware accelerators--list-demuxers          show all available demuxers--list-muxers            show all available muxers--list-parsers           show all available parsers--list-protocols         show all available protocols--list-bsfs              show all available bitstream filters--list-indevs            show all available input devices--list-outdevs           show all available output devices--list-filters           show all available filtersStandard options:--logfile=FILE           log tests and output to FILE [ffbuild/config.log]--disable-logging        do not log configure debug information--fatal-warnings         fail if any configure warning is generated--prefix=PREFIX          install in PREFIX [$prefix_default]--bindir=DIR             install binaries in DIR [PREFIX/bin]--datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]--docdir=DIR             install documentation in DIR [PREFIX/share/doc/ffmpeg]--libdir=DIR             install libs in DIR [PREFIX/lib]--shlibdir=DIR           install shared libs in DIR [LIBDIR]--incdir=DIR             install includes in DIR [PREFIX/include]--mandir=DIR             install man page in DIR [PREFIX/share/man]--pkgconfigdir=DIR       install pkg-config files in DIR [LIBDIR/pkgconfig]--enable-rpath           use rpath to allow installing libraries in pathsnot part of the dynamic linker search pathuse rpath when linking programs (USE WITH CARE)--install-name-dir=DIR   Darwin directory name for installed targetsLicensing options:--enable-gpl             allow use of GPL code, the resulting libsand binaries will be under GPL [no]--enable-version3        upgrade (L)GPL to version 3 [no]--enable-nonfree         allow use of nonfree code, the resulting libsand binaries will be unredistributable [no]Configuration options:--disable-static         do not build static libraries [no]--enable-shared          build shared libraries [no]--enable-small           optimize for size instead of speed--disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)--enable-gray            enable full grayscale support (slower color)--disable-swscale-alpha  disable alpha channel support in swscale--disable-all            disable building components, libraries and programs--disable-autodetect     disable automatically detected external libraries [no]Program options:--disable-programs       do not build command line programs--disable-ffmpeg         disable ffmpeg build--disable-ffplay         disable ffplay build--disable-ffprobe        disable ffprobe buildDocumentation options:--disable-doc            do not build documentation--disable-htmlpages      do not build HTML documentation pages--disable-manpages       do not build man documentation pages--disable-podpages       do not build POD documentation pages--disable-txtpages       do not build text documentation pagesComponent options:--disable-avdevice       disable libavdevice build--disable-avcodec        disable libavcodec build--disable-avformat       disable libavformat build--disable-swresample     disable libswresample build--disable-swscale        disable libswscale build--disable-postproc       disable libpostproc build--disable-avfilter       disable libavfilter build--disable-pthreads       disable pthreads [autodetect]--disable-w32threads     disable Win32 threads [autodetect]--disable-os2threads     disable OS/2 threads [autodetect]--disable-network        disable network support [no]--disable-dct            disable DCT code--disable-dwt            disable DWT code--disable-error-resilience disable error resilience code--disable-lsp            disable LSP code--disable-mdct           disable MDCT code--disable-rdft           disable RDFT code--disable-fft            disable FFT code--disable-faan           disable floating point AAN (I)DCT code--disable-pixelutils     disable pixel utils in libavutilIndividual component options:--disable-everything     disable all components listed below--disable-encoder=NAME   disable encoder NAME--enable-encoder=NAME    enable encoder NAME--disable-encoders       disable all encoders--disable-decoder=NAME   disable decoder NAME--enable-decoder=NAME    enable decoder NAME--disable-decoders       disable all decoders--disable-hwaccel=NAME   disable hwaccel NAME--enable-hwaccel=NAME    enable hwaccel NAME--disable-hwaccels       disable all hwaccels--disable-muxer=NAME     disable muxer NAME--enable-muxer=NAME      enable muxer NAME--disable-muxers         disable all muxers--disable-demuxer=NAME   disable demuxer NAME--enable-demuxer=NAME    enable demuxer NAME--disable-demuxers       disable all demuxers--enable-parser=NAME     enable parser NAME--disable-parser=NAME    disable parser NAME--disable-parsers        disable all parsers--enable-bsf=NAME        enable bitstream filter NAME--disable-bsf=NAME       disable bitstream filter NAME--disable-bsfs           disable all bitstream filters--enable-protocol=NAME   enable protocol NAME--disable-protocol=NAME  disable protocol NAME--disable-protocols      disable all protocols--enable-indev=NAME      enable input device NAME--disable-indev=NAME     disable input device NAME--disable-indevs         disable input devices--enable-outdev=NAME     enable output device NAME--disable-outdev=NAME    disable output device NAME--disable-outdevs        disable output devices--disable-devices        disable all devices--enable-filter=NAME     enable filter NAME--disable-filter=NAME    disable filter NAME--disable-filters        disable all filtersExternal library support:Using any of the following switches will allow FFmpeg to link to thecorresponding external library. All the components depending on that librarywill become enabled, if all their other dependencies are met and they are notexplicitly disabled. E.g. --enable-libopus will enable linking tolibopus and allow the libopus encoder to be built, unless it isspecifically disabled with --disable-encoder=libopus.Note that only the system libraries are auto-detected. All the other externallibraries must be explicitly enabled.Also note that the following help text describes the purpose of the librariesthemselves, not all their features will necessarily be usable by FFmpeg.--disable-alsa           disable ALSA support [autodetect]--disable-appkit         disable Apple AppKit framework [autodetect]--disable-avfoundation   disable Apple AVFoundation framework [autodetect]--enable-avisynth        enable reading of AviSynth script files [no]--disable-bzlib          disable bzlib [autodetect]--disable-coreimage      disable Apple CoreImage framework [autodetect]--enable-chromaprint     enable audio fingerprinting with chromaprint [no]--enable-frei0r          enable frei0r video filtering [no]--enable-gcrypt          enable gcrypt, needed for rtmp(t)e supportif openssl, librtmp or gmp is not used [no]--enable-gmp             enable gmp, needed for rtmp(t)e supportif openssl or librtmp is not used [no]--enable-gnutls          enable gnutls, needed for https supportif openssl, libtls or mbedtls is not used [no]--disable-iconv          disable iconv [autodetect]--enable-jni             enable JNI support [no]--enable-ladspa          enable LADSPA audio filtering [no]--enable-lcms2           enable ICC profile support via LittleCMS 2 [no]--enable-libaom          enable AV1 video encoding/decoding via libaom [no]--enable-libaribb24      enable ARIB text and caption decoding via libaribb24 [no]--enable-libass          enable libass subtitles rendering,needed for subtitles and ass filter [no]--enable-libbluray       enable BluRay reading using libbluray [no]--enable-libbs2b         enable bs2b DSP library [no]--enable-libcaca         enable textual display using libcaca [no]--enable-libcelt         enable CELT decoding via libcelt [no]--enable-libcdio         enable audio CD grabbing with libcdio [no]--enable-libcodec2       enable codec2 en/decoding using libcodec2 [no]--enable-libdav1d        enable AV1 decoding via libdav1d [no]--enable-libdavs2        enable AVS2 decoding via libdavs2 [no]--enable-libdc1394       enable IIDC-1394 grabbing using libdc1394and libraw1394 [no]--enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]--enable-libflite        enable flite (voice synthesis) support via libflite [no]--enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]--enable-libfreetype     enable libfreetype, needed for drawtext filter [no]--enable-libfribidi      enable libfribidi, improves drawtext filter [no]--enable-libglslang      enable GLSL->SPIRV compilation via libglslang [no]--enable-libgme          enable Game Music Emu via libgme [no]--enable-libgsm          enable GSM de/encoding via libgsm [no]--enable-libiec61883     enable iec61883 via libiec61883 [no]--enable-libilbc         enable iLBC de/encoding via libilbc [no]--enable-libjack         enable JACK audio sound server [no]--enable-libjxl          enable JPEG XL de/encoding via libjxl [no]--enable-libklvanc       enable Kernel Labs VANC processing [no]--enable-libkvazaar      enable HEVC encoding via libkvazaar [no]--enable-liblensfun      enable lensfun lens correction [no]--enable-libmodplug      enable ModPlug via libmodplug [no]--enable-libmp3lame      enable MP3 encoding via libmp3lame [no]--enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]--enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]--enable-libopencv       enable video filtering via libopencv [no]--enable-libopenh264     enable H.264 encoding via OpenH264 [no]--enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]--enable-libopenmpt      enable decoding tracked files via libopenmpt [no]--enable-libopenvino     enable OpenVINO as a DNN module backendfor DNN based filters like dnn_processing [no]--enable-libopus         enable Opus de/encoding via libopus [no]--enable-libplacebo      enable libplacebo library [no]--enable-libpulse        enable Pulseaudio input via libpulse [no]--enable-librabbitmq     enable RabbitMQ library [no]--enable-librav1e        enable AV1 encoding via rav1e [no]--enable-librist         enable RIST via librist [no]--enable-librsvg         enable SVG rasterization via librsvg [no]--enable-librubberband   enable rubberband needed for rubberband filter [no]--enable-librtmp         enable RTMP[E] support via librtmp [no]--enable-libshaderc      enable GLSL->SPIRV compilation via libshaderc [no]--enable-libshine        enable fixed-point MP3 encoding via libshine [no]--enable-libsmbclient    enable Samba protocol via libsmbclient [no]--enable-libsnappy       enable Snappy compression, needed for hap encoding [no]--enable-libsoxr         enable Include libsoxr resampling [no]--enable-libspeex        enable Speex de/encoding via libspeex [no]--enable-libsrt          enable Haivision SRT protocol via libsrt [no]--enable-libssh          enable SFTP protocol via libssh [no]--enable-libsvtav1       enable AV1 encoding via SVT [no]--enable-libtensorflow   enable TensorFlow as a DNN module backendfor DNN based filters like sr [no]--enable-libtesseract    enable Tesseract, needed for ocr filter [no]--enable-libtheora       enable Theora encoding via libtheora [no]--enable-libtls          enable LibreSSL (via libtls), needed for https supportif openssl, gnutls or mbedtls is not used [no]--enable-libtwolame      enable MP2 encoding via libtwolame [no]--enable-libuavs3d       enable AVS3 decoding via libuavs3d [no]--enable-libv4l2         enable libv4l2/v4l-utils [no]--enable-libvidstab      enable video stabilization using vid.stab [no]--enable-libvmaf         enable vmaf filter via libvmaf [no]--enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]--enable-libvorbis       enable Vorbis en/decoding via libvorbis,native implementation exists [no]--enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]--enable-libwebp         enable WebP encoding via libwebp [no]--enable-libx264         enable H.264 encoding via x264 [no]--enable-libx265         enable HEVC encoding via x265 [no]--enable-libxavs         enable AVS encoding via xavs [no]--enable-libxavs2        enable AVS2 encoding via xavs2 [no]--enable-libxcb          enable X11 grabbing using XCB [autodetect]--enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]--enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]--enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]--enable-libxvid         enable Xvid encoding via xvidcore,native MPEG-4/Xvid encoder exists [no]--enable-libxml2         enable XML parsing using the C library libxml2, neededfor dash and imf demuxing support [no]--enable-libzimg         enable z.lib, needed for zscale filter [no]--enable-libzmq          enable message passing via libzmq [no]--enable-libzvbi         enable teletext support via libzvbi [no]--enable-lv2             enable LV2 audio filtering [no]--disable-lzma           disable lzma [autodetect]--enable-decklink        enable Blackmagic DeckLink I/O support [no]--enable-mbedtls         enable mbedTLS, needed for https supportif openssl, gnutls or libtls is not used [no]--enable-mediacodec      enable Android MediaCodec support [no]--enable-mediafoundation enable encoding via MediaFoundation [auto]--disable-metal          disable Apple Metal framework [autodetect]--enable-libmysofa       enable libmysofa, needed for sofalizer filter [no]--enable-openal          enable OpenAL 1.1 capture support [no]--enable-opencl          enable OpenCL processing [no]--enable-opengl          enable OpenGL rendering [no]--enable-openssl         enable openssl, needed for https supportif gnutls, libtls or mbedtls is not used [no]--enable-pocketsphinx    enable PocketSphinx, needed for asr filter [no]--disable-sndio          disable sndio support [autodetect]--disable-schannel       disable SChannel SSP, needed for TLS support onWindows if openssl and gnutls are not used [autodetect]--disable-sdl2           disable sdl2 [autodetect]--disable-securetransport disable Secure Transport, needed for TLS supporton OSX if openssl and gnutls are not used [autodetect]--enable-vapoursynth     enable VapourSynth demuxer [no]--disable-vulkan         disable Vulkan code [autodetect]--disable-xlib           disable xlib [autodetect]--disable-zlib           disable zlib [autodetect]The following libraries provide various hardware acceleration features:--disable-amf            disable AMF video encoding code [autodetect]--disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]--enable-cuda-nvcc       enable Nvidia CUDA compiler [no]--disable-cuda-llvm      disable CUDA compilation using clang [autodetect]--disable-cuvid          disable Nvidia CUVID support [autodetect]--disable-d3d11va        disable Microsoft Direct3D 11 video acceleration code [autodetect]--disable-dxva2          disable Microsoft DirectX 9 video acceleration code [autodetect]--disable-ffnvcodec      disable dynamically linked Nvidia code [autodetect]--enable-libdrm          enable DRM code (Linux) [no]--enable-libmfx          enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]--enable-libnpp          enable Nvidia Performance Primitives-based code [no]--enable-mmal            enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]--disable-nvdec          disable Nvidia video decoding acceleration (via hwaccel) [autodetect]--disable-nvenc          disable Nvidia video encoding code [autodetect]--enable-omx             enable OpenMAX IL code [no]--enable-omx-rpi         enable OpenMAX IL code for Raspberry Pi [no]--enable-rkmpp           enable Rockchip Media Process Platform code [no]--disable-v4l2-m2m       disable V4L2 mem2mem code [autodetect]--disable-vaapi          disable Video Acceleration API (mainly Unix/Intel) code [autodetect]--disable-vdpau          disable Nvidia Video Decode and Presentation API for Unix code [autodetect]--disable-videotoolbox   disable VideoToolbox code [autodetect]Toolchain options:--arch=ARCH              select architecture [$arch]--cpu=CPU                select the minimum required CPU (affectsinstruction selection, may crash on older CPUs)--cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]--progs-suffix=SUFFIX    program name suffix []--enable-cross-compile   assume a cross-compiler is used--sysroot=PATH           root of cross-build tree--sysinclude=PATH        location of cross-build system headers--target-os=OS           compiler targets OS [$target_os]--target-exec=CMD        command to run executables on target--target-path=DIR        path to view of build directory on target--target-samples=DIR     path to samples directory on target--tempprefix=PATH        force fixed dir/prefix instead of mktemp for checks--toolchain=NAME         set tool defaults according to NAME(gcc-asan, clang-asan, gcc-msan, clang-msan,gcc-tsan, clang-tsan, gcc-usan, clang-usan,valgrind-massif, valgrind-memcheck,msvc, icl, gcov, llvm-cov, hardened)--nm=NM                  use nm tool NM [$nm_default]--ar=AR                  use archive tool AR [$ar_default]--as=AS                  use assembler AS [$as_default]--ln_s=LN_S              use symbolic link tool LN_S [$ln_s_default]--strip=STRIP            use strip tool STRIP [$strip_default]--windres=WINDRES        use windows resource compiler WINDRES [$windres_default]--x86asmexe=EXE          use nasm-compatible assembler EXE [$x86asmexe_default]--cc=CC                  use C compiler CC [$cc_default]--cxx=CXX                use C compiler CXX [$cxx_default]--objcc=OCC              use ObjC compiler OCC [$cc_default]--dep-cc=DEPCC           use dependency generator DEPCC [$cc_default]--nvcc=NVCC              use Nvidia CUDA compiler NVCC or clang [$nvcc_default]--ld=LD                  use linker LD [$ld_default]--metalcc=METALCC        use metal compiler METALCC [$metalcc_default]--metallib=METALLIB      use metal linker METALLIB [$metallib_default]--pkg-config=PKGCONFIG   use pkg-config tool PKGCONFIG [$pkg_config_default]--pkg-config-flags=FLAGS pass additional flags to pkgconf []--ranlib=RANLIB          use ranlib RANLIB [$ranlib_default]--doxygen=DOXYGEN        use DOXYGEN to generate API doc [$doxygen_default]--host-cc=HOSTCC         use host C compiler HOSTCC--host-cflags=HCFLAGS    use HCFLAGS when compiling for host--host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host--host-ld=HOSTLD         use host linker HOSTLD--host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host--host-extralibs=HLIBS   use libs HLIBS when linking for host--host-os=OS             compiler host OS [$target_os]--extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]--extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]--extra-objcflags=FLAGS  add FLAGS to OBJCFLAGS [$CFLAGS]--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]--extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]--extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS [$LDSOFLAGS]--extra-libs=ELIBS       add ELIBS [$ELIBS]--extra-version=STRING   version string suffix []--optflags=OPTFLAGS      override optimization-related compiler flags--nvccflags=NVCCFLAGS    override nvcc flags [$nvccflags_default]--build-suffix=SUFFIX    library name suffix []--enable-pic             build position-independent code--enable-thumb           compile for Thumb instruction set--enable-lto             use link-time optimization--env="ENV=override"     override the environment variablesAdvanced options (experts only):--malloc-prefix=PREFIX   prefix malloc and related names with PREFIX--custom-allocator=NAME  use a supported custom allocator--disable-symver         disable symbol versioning--enable-hardcoded-tables use hardcoded tables instead of runtime generation--disable-safe-bitstream-readerdisable buffer boundary checking in bitreaders(faster, but may crash)--sws-max-filter-size=N  the max filter size swscale uses [$sws_max_filter_size_default]Optimization options (experts only):--disable-asm            disable all assembly optimizations--disable-altivec        disable AltiVec optimizations--disable-vsx            disable VSX optimizations--disable-power8         disable POWER8 optimizations--disable-amd3dnow       disable 3DNow! optimizations--disable-amd3dnowext    disable 3DNow! extended optimizations--disable-mmx            disable MMX optimizations--disable-mmxext         disable MMXEXT optimizations--disable-sse            disable SSE optimizations--disable-sse2           disable SSE2 optimizations--disable-sse3           disable SSE3 optimizations--disable-ssse3          disable SSSE3 optimizations--disable-sse4           disable SSE4 optimizations--disable-sse42          disable SSE4.2 optimizations--disable-avx            disable AVX optimizations--disable-xop            disable XOP optimizations--disable-fma3           disable FMA3 optimizations--disable-fma4           disable FMA4 optimizations--disable-avx2           disable AVX2 optimizations--disable-avx512         disable AVX-512 optimizations--disable-avx512icl      disable AVX-512ICL optimizations--disable-aesni          disable AESNI optimizations--disable-armv5te        disable armv5te optimizations--disable-armv6          disable armv6 optimizations--disable-armv6t2        disable armv6t2 optimizations--disable-vfp            disable VFP optimizations--disable-neon           disable NEON optimizations--disable-inline-asm     disable use of inline assembly--disable-x86asm         disable use of standalone x86 assembly--disable-mipsdsp        disable MIPS DSP ASE R1 optimizations--disable-mipsdspr2      disable MIPS DSP ASE R2 optimizations--disable-msa            disable MSA optimizations--disable-mipsfpu        disable floating point MIPS optimizations--disable-mmi            disable Loongson MMI optimizations--disable-lsx            disable Loongson LSX optimizations--disable-lasx           disable Loongson LASX optimizations--disable-fast-unaligned consider unaligned accesses slowDeveloper options (useful when working on FFmpeg itself):--disable-debug          disable debugging symbols--enable-debug=LEVEL     set the debug level [$debuglevel]--disable-optimizations  disable compiler optimizations--enable-extra-warnings  enable more compiler warnings--disable-stripping      disable stripping of executables and shared libraries--assert-level=level     0(default), 1 or 2, amount of assertion testing,2 causes a slowdown at runtime.--enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data--valgrind=VALGRIND      run "make fate" tests through valgrind to detect memoryleaks and errors, using the specified valgrind binary.Cannot be combined with --target-exec--enable-ftrapv          Trap arithmetic overflows--samples=PATH           location of test samples for FATE, if not set use\$FATE_SAMPLES at make invocation time.--enable-neon-clobber-test check NEON registers for clobbering (should beused only for debugging purposes)--enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;should be used only for debugging purposes)--enable-random          randomly enable/disable components--disable-random--enable-random=LIST     randomly enable/disable specific components or--disable-random=LIST    component groups. LIST is a comma-separated listof NAME[:PROB] entries where NAME is a component(group) and PROB the probability associated withNAME (default 0.5).--random-seed=VALUE      seed value for --enable/disable-random--disable-valgrind-backtrace do not print a backtrace under Valgrind(only applies to --disable-optimizations builds)--enable-ossfuzz         Enable building fuzzer tool--libfuzzer=PATH         path to libfuzzer--ignore-tests=TESTS     comma-separated list (without "fate-" prefixin the name) of tests whose result is ignored--enable-linux-perf      enable Linux Performance Monitor API--enable-macos-kperf     enable macOS kperf (private) API--disable-large-tests    disable tests that use a large amount of memory--disable-ptx-compression don't compress CUDA PTX code even when possibleNOTE: Object files are built at the place where configure is launched.
EOFexit 0
}

       

二、android_build1.sh分析:

        执行流程如下:

        1、build all(方法入口)——> 2、拼接./configure的Option参数(如:“--disable-static”不编译静态库)——>  3、build函数(如:build "arm64-v8a",传入"arm64-v8a"参数到函数build())——>  4、build()根据不同平台遍历出对应的所需的交叉工具链,设置到./configure的Option参数中 ——>  5、执行./configure ${CONFIGURATION}  ——>  6、make -j 及make install开始make操作。

       

        代码如下:

#!/bin/bash
# 用于编译android平台的脚本# NDK所在目录
NDK_PATH=/home/wyy/Android/NDKS/android-ndk-r27c # tag1
# macOS 平台编译,其他平台看一下 $NDK_PATH/toolchains/llvm/prebuilt/ 下的文件夹名称
HOST_PLATFORM=linux-x86_64  #tag1
# minSdkVersion
API=23TOOLCHAINS="$NDK_PATH/toolchains/llvm/prebuilt/$HOST_PLATFORM"
SYSROOT="$NDK_PATH/toolchains/llvm/prebuilt/$HOST_PLATFORM/sysroot"
# 生成 -fpic 与位置无关的代码
CFLAG="-D__ANDROID_API__=$API -Os -fPIC -DANDROID "
LDFLAG="-lc -lm -ldl -llog "# 输出目录
PREFIX=`pwd`/android
# 日志输出目录
CONFIG_LOG_PATH=${PREFIX}/log
# 公共配置
COMMON_OPTIONS=
# 交叉配置
CONFIGURATION=build() {APP_ABI=$1echo "======== > Start build $APP_ABI"case ${APP_ABI} inarmeabi-v7a)ARCH="arm"CPU="armv7-a"MARCH="armv7-a"TARGET=armv7a-linux-androideabiCC="$TOOLCHAINS/bin/$TARGET$API-clang"CXX="$TOOLCHAINS/bin/$TARGET$API-clang++"LD="$TOOLCHAINS/bin/$TARGET$API-clang"# 交叉编译工具前缀CROSS_PREFIX="$TOOLCHAINS/bin/arm-linux-androideabi-"EXTRA_CFLAGS="$CFLAG -mfloat-abi=softfp -mfpu=vfp -marm -march=$MARCH "EXTRA_LDFLAGS="$LDFLAG"EXTRA_OPTIONS="--enable-neon --cpu=$CPU ";;arm64-v8a)ARCH="aarch64"TARGET=$ARCH-linux-androidCC="$TOOLCHAINS/bin/$TARGET$API-clang"CXX="$TOOLCHAINS/bin/$TARGET$API-clang++"LD="$TOOLCHAINS/bin/$TARGET$API-clang"CROSS_PREFIX="$TOOLCHAINS/bin/$TARGET-"EXTRA_CFLAGS="$CFLAG"EXTRA_LDFLAGS="$LDFLAG"EXTRA_OPTIONS="";;x86)ARCH="x86"CPU="i686"MARCH="i686"TARGET=i686-linux-androidCC="$TOOLCHAINS/bin/$TARGET$API-clang"CXX="$TOOLCHAINS/bin/$TARGET$API-clang++"LD="$TOOLCHAINS/bin/$TARGET$API-clang"CROSS_PREFIX="$TOOLCHAINS/bin/$TARGET-"#EXTRA_CFLAGS="$CFLAG -march=$MARCH -mtune=intel -mssse3 -mfpmath=sse -m32"EXTRA_CFLAGS="$CFLAG -march=$MARCH  -mssse3 -mfpmath=sse -m32"EXTRA_LDFLAGS="$LDFLAG"EXTRA_OPTIONS="--cpu=$CPU ";;x86_64)ARCH="x86_64"CPU="x86-64"MARCH="x86_64"TARGET=$ARCH-linux-androidCC="$TOOLCHAINS/bin/$TARGET$API-clang"CXX="$TOOLCHAINS/bin/$TARGET$API-clang++"LD="$TOOLCHAINS/bin/$TARGET$API-clang"CROSS_PREFIX="$TOOLCHAINS/bin/$TARGET-"#EXTRA_CFLAGS="$CFLAG -march=$CPU -mtune=intel -msse4.2 -mpopcnt -m64"EXTRA_CFLAGS="$CFLAG -march=$CPU -msse4.2 -mpopcnt -m64"EXTRA_LDFLAGS="$LDFLAG"EXTRA_OPTIONS="--cpu=$CPU ";;esacecho "-------- > Start clean workspace"
make cleanecho "-------- > Start build configuration"CONFIGURATION="$COMMON_OPTIONS"CONFIGURATION="$CONFIGURATION --logfile=$CONFIG_LOG_PATH/config_$APP_ABI.log"CONFIGURATION="$CONFIGURATION --prefix=$PREFIX"CONFIGURATION="$CONFIGURATION --libdir=$PREFIX/libs/$APP_ABI"CONFIGURATION="$CONFIGURATION --incdir=$PREFIX/includes/$APP_ABI"CONFIGURATION="$CONFIGURATION --pkgconfigdir=$PREFIX/pkgconfig/$APP_ABI"CONFIGURATION="$CONFIGURATION --cross-prefix=$CROSS_PREFIX"CONFIGURATION="$CONFIGURATION --arch=$ARCH"CONFIGURATION="$CONFIGURATION --sysroot=$SYSROOT"CONFIGURATION="$CONFIGURATION --cc=$CC"CONFIGURATION="$CONFIGURATION --cxx=$CXX"CONFIGURATION="$CONFIGURATION --ld=$LD"# nm 和 stripCONFIGURATION="$CONFIGURATION --nm=$TOOLCHAINS/bin/llvm-nm"CONFIGURATION="$CONFIGURATION --strip=$TOOLCHAINS/bin/llvm-strip"CONFIGURATION="$CONFIGURATION $EXTRA_OPTIONS"echo "-------- > Start config makefile with $CONFIGURATION --extra-cflags=${EXTRA_CFLAGS} --extra-ldflags=${EXTRA_LDFLAGS}"./configure ${CONFIGURATION} \--extra-cflags="$EXTRA_CFLAGS" \--extra-ldflags="$EXTRA_LDFLAGS"echo "-------- > Start make $APP_ABI with -j1"make -j1echo "-------- > Start install $APP_ABI"make installecho "++++++++ > make and install $APP_ABI complete."}build_all() {#配置开源协议声明COMMON_OPTIONS="$COMMON_OPTIONS --enable-gpl"#目标android平台COMMON_OPTIONS="$COMMON_OPTIONS --target-os=android"#取消默认的静态库COMMON_OPTIONS="$COMMON_OPTIONS --disable-static"COMMON_OPTIONS="$COMMON_OPTIONS --enable-shared"COMMON_OPTIONS="$COMMON_OPTIONS --enable-protocols"#开启交叉编译COMMON_OPTIONS="$COMMON_OPTIONS --enable-cross-compile"COMMON_OPTIONS="$COMMON_OPTIONS --enable-optimizations"COMMON_OPTIONS="$COMMON_OPTIONS --disable-debug"#尽可能小COMMON_OPTIONS="$COMMON_OPTIONS --enable-small"COMMON_OPTIONS="$COMMON_OPTIONS --disable-doc"#不要命令(执行文件)COMMON_OPTIONS="$COMMON_OPTIONS --disable-programs"  # do not build command line programsCOMMON_OPTIONS="$COMMON_OPTIONS --disable-ffmpeg"    # disable ffmpeg buildCOMMON_OPTIONS="$COMMON_OPTIONS --disable-ffplay"    # disable ffplay buildCOMMON_OPTIONS="$COMMON_OPTIONS --disable-ffprobe"   # disable ffprobe buildCOMMON_OPTIONS="$COMMON_OPTIONS --disable-symver"COMMON_OPTIONS="$COMMON_OPTIONS --disable-network"COMMON_OPTIONS="$COMMON_OPTIONS --disable-x86asm"COMMON_OPTIONS="$COMMON_OPTIONS --disable-asm"#启用COMMON_OPTIONS="$COMMON_OPTIONS --enable-pthreads"COMMON_OPTIONS="$COMMON_OPTIONS --enable-mediacodec"COMMON_OPTIONS="$COMMON_OPTIONS --enable-jni"COMMON_OPTIONS="$COMMON_OPTIONS --enable-zlib"COMMON_OPTIONS="$COMMON_OPTIONS --enable-pic"COMMON_OPTIONS="$COMMON_OPTIONS --enable-muxer=flv"#COMMON_OPTIONS="$COMMON_OPTIONS --enable-avresample"COMMON_OPTIONS="$COMMON_OPTIONS --enable-decoder=h264"COMMON_OPTIONS="$COMMON_OPTIONS --enable-decoder=mpeg4"COMMON_OPTIONS="$COMMON_OPTIONS --enable-decoder=mjpeg"COMMON_OPTIONS="$COMMON_OPTIONS --enable-decoder=png"COMMON_OPTIONS="$COMMON_OPTIONS --enable-decoder=vorbis"COMMON_OPTIONS="$COMMON_OPTIONS --enable-decoder=opus"COMMON_OPTIONS="$COMMON_OPTIONS --enable-decoder=flac"echo "COMMON_OPTIONS=$COMMON_OPTIONS"echo "PREFIX=$PREFIX"echo "CONFIG_LOG_PATH=$CONFIG_LOG_PATH"mkdir -p ${CONFIG_LOG_PATH}#build "armeabi-v7a"build "arm64-v8a"build "x86"build "x86_64"
}echo "-------- Start --------"
build_all
echo "-------- End --------"

http://www.lryc.cn/news/578443.html

相关文章:

  • Linux基本命令篇 —— bc命令
  • 微软服务器安全问题
  • 【蓝牙】Linux Qt4查看已经配对的蓝牙信息
  • MCP 协议使用核心讲解
  • HDMI2.1 FRL流控 概览
  • 基于OPUS-MT模型的中译英程序实现
  • swing音频输入
  • Vue 安装使用教程
  • 【机器学习深度学习】模型微调的基本概念与流程
  • 动手实践:如何提取Python代码中的字符串变量的值
  • QA - RAG智能问答系统中的文档切片与实现原理
  • 深入金融与多模态场景实战:金融文档分块技术与案例汇总
  • 打造可观测的 iOS CICD 流程:调试、追踪与质量保障全记录
  • python下划线开头函数总结
  • 服务器安装 ros2时遇到底层库依赖冲突的问题
  • Crystaldiskinfo查询的硬盘参数信息
  • 2.3.1 Nginx Web服务器安全加固
  • 基于Pandas和FineBI的昆明职位数据分析与可视化实现(四)- 职位数据可视化(FineBI)
  • 【开源项目】一款真正可修改视频MD5工具视频质量不损失
  • Python 数据分析:numpy,抽提,布尔索引2。
  • github代码中遇到的问题-解决方案
  • 【C++】备忘录模式
  • mini-electron使用方法
  • 时空数据挖掘五大革新方向详解篇!
  • 多探头分布式雷达测流系统解决方案概述
  • HakcMyVM-Arroutada
  • 软考中级【网络工程师】第6版教材 第1章 计算机网络概述
  • CompletableFuture源码分析
  • Android 网络全栈攻略(四)—— TCPIP 协议族与 HTTPS 协议
  • 计算机网络:【socket】【UDP】【地址转换函数】【TCP】