├── LICENSE ├── README.md ├── ffmpeg-cxc-build-hints ├── ffmpeg-cxc-build-hints-file-head ├── ffmpeg-cxc-build-hints-slim ├── ffmpeg-cxc-mingw64 ├── ffmpeg-native ├── ffmpeg-native-build-hints ├── ffmpeg-native-build-hints-ffserver ├── ffmpeg-native-build-hints-file-head ├── ffmpeg-native-build-hints-slim ├── ffmpeg-native-osx ├── ffmpeg-native-pi ├── ffmpeg-native-x86 ├── ffmpeg-osx-build-hints ├── ffmpeg-pi-build-hints ├── get-repo-cur-rev └── update-repo /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ffmpeg-cxc-build 2 | Fast cross-compile ffmpeg for Windows with MinGW on Linux and Cygwin to produce a statically linked ffmpeg. 3 | 4 | **Enabled Features** 5 | 6 | amf aom ass/ssa avisynth bzip2 dav1d decklink fdk-aac fontconfig freetype frei0r fribidi harfbuzz lame mfx/qsv nvenc/nvdec ogg openssl opus placebo png rubberband sdl sofalizer soxr srt svt-av1 theora vmaf vorbis vpx webp x264 x265(8/10/12-bit) xml2 zlib 7 | 8 | **Package Requirements** 9 | 10 | Debian/Ubuntu/Mint: 11 | 12 | sudo apt-get -y install autoconf automake autopoint build-essential libarchive-tools cmake git-core gperf g++-mingw-w64 libssl-dev libtool libunwind-dev mercurial meson nasm pkg-config python3-lxml ragel subversion texinfo yasm wget win-iconv-mingw-w64-dev 13 | 14 | Fedora: 15 | 16 | sudo yum install make autogen automake bsdtar cmake gcc gcc-c++ git gettext-devel gperf kernel-devel libtool libunwind-devel mercurial meson mingw64-gcc mingw64-gcc-c++ mingw64-libgomp mingw64-winpthreads-static mingw64-win-iconv-static nasm openssl-devel perl-FindBin python3-lxml ragel subversion uuid-devel yasm 17 | 18 | *Fedora Preconditions:* 19 | 20 | With FC39 and later, a link from the mingw sys-root directory to the sandbox build path must be created (not pretty but works for now). Assuming the default configuration is used for the ROOT_PATH variable: 21 | 22 | sudo ln -s /home /usr/x86_64-w64-mingw32/sys-root/mingw/home 23 | 24 | Arch/Manjaro: 25 | 26 | autoconf automake bsdtar cmake git gperf libtool mercurial meson mingw-w64-binutils mingw-w64-crt mingw-w64-gcc mingw-w64-headers mingw-w64-tools mingw-w64-winpthreads nasm openssl-1.1 python-lxml ragel subversion wget yasm 27 | 28 | Cygwin: 29 | 30 | After a baseline install, run setup and install the packages: autoconf autoconf2.1 autoconf2.5 autogen automake automake1.10 automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 automake1.9 binutils bsdtar cmake gcc-core gcc-g++ gettext gettext-devel gettext-doc git gperf libtool libuuid-devel make mercurial meson mingw64-x86_64-binutils mingw64-x86_64-gcc-core mingw64-x86_64-gcc-g++ mingw64-x86_64-gettext mingw64-x86_64-headers mingw64-x86_64-runtime mingw64-x86_64-win-iconv mingw64-x86_64-windows-default-manifest mingw64-x86_64-winpthreads nasm python27 python27-lxml python27-six ragel rsync subversion wget yasm 31 | 32 | *Cygwin Preconditions:* 33 | 34 | The mingw toolchain files must be in the path, and a link from the mingw sys-root directory to the sandbox build path must be created. As an example, assuming the default configuration is used for the ROOT_PATH variable, *ffmpeg-cxc-build-hints* has been placed in the user's home directory, and *ffmpeg-cxc-mingw64* is executable in the environment's path: 35 | 36 | ln -s /home /usr/x86_64-w64-mingw32/sys-root/home 37 | export PATH=$PATH:/usr/x86_64-w64-mingw32/sys-root/mingw/bin 38 | HINTS_FILE=~/ffmpeg-cxc-build-hints ffmpeg-cxc-mingw64 39 | 40 | **rav1e/cargo Installation** 41 | 42 | If you want to enable the rav1e AV1 encoder, you will need to install the rust toolchain. A minimal working toolchain with support for the x86_64-pc-windows-gnu target can be installed as below. 43 | 44 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 45 | source "$HOME/.cargo/env" 46 | rustup install 1.87.0 47 | rustup default 1.87.0 48 | cargo install --version 0.10.7+cargo-0.84.0 cargo-c 49 | rustup target add x86_64-pc-windows-gnu 50 | rustup target add x86_64-unknown-linux-musl 51 | 52 | **Example Build Procedure** 53 | 54 | Assumptions: ROOT_PATH is left to the default ($HOME) and *ffmpeg-cxc-mingw64* is executable in the environment's path. 55 | 56 | #fetch the source projects to the ~/src directory 57 | ROOT_PATH=~/ SRC_PATH=src HINTS_FILE=/dev/null CXC_FETCH_ONLY=1 ffmpeg-cxc-mingw64 58 | #copy ffmpeg-cxc-build-hints to ~/ and edit to fetch files from ~/src via URL override 59 | ffmpeg-cxc-mingw64 60 | 61 | Similarly, a native (linux) version of ffmpeg can be built as below assuming the SRC_PATH has a complete set of repositories. If desired, the VPL package should be installed as per your distro, and the prefix path, usually /usr, should be specified as a variable before the script. The native build script should find the VPL files to copy and patch allowing the sanboxed build to work. An MFX (deprecated) build works essentially the same, but VPL should cover all options at this point. 62 | 63 | HINTS_FILE=~/ffmpeg-native-build-hints-slim VPL_DEV=/usr ffmpeg-native 64 | 65 | Using these techniques, the script *update-repo* can be used to maintain up to date repositories by cd'ing into ~/src and running it. Subsequent builds will then pull via the file URL override allowing up to date builds of ffmpeg and libraries if you edit the hints file and remove the commit hashes (empty means latest). Note that fontconfig and openssl will likely require the hashes specified in the hints file to build and operate as expected. 66 | 67 | **FFmpeg Latest Build Procedure** 68 | 69 | 70 | #using the ~/src directory as above - update and specify the path to ffmpeg-cxc-build-hints-file-head 71 | cd ~/src 72 | update-repo 73 | HINTS_FILE=~/ffmpeg-cxc-build-hints-file-head ffmpeg-cxc-mingw64 74 | 75 | **Using frei0r** 76 | 77 | Frei0r is a collection of video effect plugins which can be used as ffmpeg filters. The effects are self-contained in individual DLLs/shared libraries and are not compiled into ffmepg. After a successful build, the compiled modules will be at "$ROOT_PATH/$OUT_PATH/lib/frei0r". After moving them to the desired path and setting the location of the plugins in an environment variable, they are easily enabled as an ffmpeg video filter (-vf). Assuming *.frei0r* has been created in the user's home directory and the modules have been copied there, the FREI0R_PATH can be defined as below. 78 | 79 | Sample: 80 | 81 | #Unixish: export FREI0R_PATH=$HOME/.frei0r-1 82 | #Windows: set FREI0R_PATH=%USERPROFILE%\.frei0r-1 83 | #Test the plugin 84 | ffmpeg -i in.mp4 -vf frei0r=vignette out.mp4 85 | 86 | **Using fontconfig** 87 | 88 | Fontconfig allows the user to specify fonts by name instead of file path making drawtext filters easier to construct. To access user and system fonts on Windows, a minimal fonts.conf file should be specified in the environment. A sample fonts.conf and drawtext filter to test font access appear below. 89 | 90 | fonts.conf: 91 | 92 | 93 | 94 | 95 | 96 | WINDOWSFONTDIR 97 | ~/AppData/Local/Microsoft/Windows/Fonts 98 | LOCAL_APPDATA_FONTCONFIG_CACHE 99 | 100 | 101 | Sample: 102 | 103 | #Windows 104 | set FONTCONFIG_FILE=%USERPROFILE%\.fonts\fonts.conf 105 | #Test font access 106 | ffmpeg -y -t 10 -i in.mp4 -filter_complex "drawtext='font=Segoe UI:\ 107 | fontsize=64:x=20:y=50:fontcolor=white:bordercolor=black:borderw=1:\ 108 | shadowcolor=black:shadowx=2:shadowy=2:alpha=0.5:text=Testing 1, 2, 3'" -an out.mp4 109 | -------------------------------------------------------------------------------- /ffmpeg-cxc-build-hints: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | #ffmpeg-cxc-build-hints - 2025-05-23 working build 3 | #------------------------------------------------- 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH or 6 | #set via the command line: 7 | #HINTS_FILE=/media/user/usb/my-build-hints ffmpeg-cxc-mingw64 8 | 9 | #fields are TAB delimited triplets enabling control of the build 10 | #source key value 11 | 12 | #------------ 13 | #CXC options 14 | #------------ 15 | CXC CFLAGS -mtune=generic -march=x86-64 -pipe 16 | #x86-64 generic skylake broadwell haswell ivybridge sandybridge corei7-avx westmere nehalem 17 | CXC OPTIM -O3 18 | CXC RUSTFLAGS -C target-feature=+avx2,+fma 19 | #override getconf _NPROCESSORS_ONLN 20 | #CXC JOBS 6 21 | #use FETCH_ONLY to clone all the repositories without a build 22 | #CXC FETCH_ONLY 0 23 | #display the config only - no fetch/build 24 | #CXC SHOW_ONLY 0 25 | 26 | #----------------------------------------------- 27 | #constrain parallel make or disable/enable build 28 | #----------------------------------------------- 29 | #source make job_count 30 | #source disable 31 | #source enable 32 | #lame make 1 33 | #fribidi make 1 34 | #fontconfig make 1 35 | #freetype make 1 36 | #harfbuzz make 1 37 | openssl make 1 38 | mfx disable 39 | 40 | #--------------------------- 41 | #set override URL for source 42 | #--------------------------- 43 | #source url url_string 44 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 45 | 46 | #amf url file://~/src/amf 47 | #aom url file://~/src/aom 48 | #ass url file://~/src/ass 49 | #avisynth url file://~/src/avisynth 50 | #bzip2 url file://~/src/bzip2 51 | #dav1d url file://~/src/dav1d 52 | #decklink url file://~/src/decklink 53 | #dlfcn url file://~/src/dlfcn 54 | #fdk-aac url file://~/src/fdk-aac 55 | #ffmpeg url file://~/src/ffmpeg 56 | #fftw3 url file://~/src/fftw3 57 | #fontconfig url file://~/src/fontconfig 58 | #freetype url file://~/src/freetype 59 | #frei0r url file://~/src/frei0r 60 | #fribidi url file://~/src/fribidi 61 | #harfbuzz url file://~/src/harfbuzz 62 | #ladspa url file://~/src/ladspa 63 | #lame url file://~/src/lame 64 | #mfx url file://~/src/mfx 65 | #nv-codec-headers url file://~/src/nv-codec-headers 66 | #ogg url file://~/src/ogg 67 | #openssl url file://~/src/openssl 68 | #opus url file://~/src/opus 69 | #placebo url file://~/src/placebo 70 | #png url file://~/src/png 71 | #rav1e url file://~/src/rav1e 72 | #rubberband url file://~/src/rubberband 73 | #sdl url file://~/src/sdl 74 | #samplerate url file://~/src/samplerate 75 | #sofa url file://~/src/sofa 76 | #soxr url file://~/src/soxr 77 | #srt url file://~/src/srt 78 | #svt-av1 url file://~/src/svt-av1 79 | #theora url file://~/src/theora 80 | #vmaf url file://~/src/vmaf 81 | #vorbis url file://~/src/vorbis 82 | #vpl url file://~/src/vpl 83 | #vpx url file://~/src/vpx 84 | #vulkan-headers url file://~/src/vulkan-headers 85 | #webp url file://~/src/webp 86 | #x264 url file://~/src/x264 87 | #x265 url file://~/src/x265 88 | #xml2 url file://~/src/xml2 89 | #zlib url file://~/src/zlib 90 | 91 | #------------------------ 92 | #fetch specified revision 93 | #------------------------ 94 | #source fetch_method revision_id 95 | amf git d7311e30a53b7d36fb401d2efa3b04fe5d942e28 96 | aom git eecb55e22a7dc6731cfb6273fbebe7426a10cb37 97 | ass git 695509365f152bd28720a0c0e036d46836ee9345 98 | avisynth git c506611e5ed0fbe97b24ee898cabafa178b4687a 99 | bzip2 git fbc4b11da543753b3b803e5546f56e26ec90c2a7 100 | dav1d git 8d956180934f16244bdb58b39175824775125e55 101 | decklink git 23194d695a3ae4aca7bc6c2f16dd6e7325a41c27 102 | dlfcn git 8bfddb5aa345ce10ba98e925acbc7bfb53639679 103 | fdk-aac git 2ef9a141c40bf254bde7d22c197c615db5b265ed 104 | ffmpeg git f414038779217034b4d062d538df3e0d3ca48343 105 | fftw3 wget fftw-3.3.10.tar.gz 106 | fontconfig git 3454d29ef0761978897de5f28e388e5b0a3489f4 107 | freetype git f35bb7595462af6588c59a866b354a72e4f4be4b 108 | frei0r git b47c180376dc0ebfb9f57ca9373070eb8afcf9e9 109 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 110 | harfbuzz git 7dfbe50dfa6aacf0b2a8c7f357107691dc798a98 111 | ladspa git 0f54d2430febb4d5f02d13132dd91d7345e080b5 112 | lame svn 6531 113 | mfx git f6aac4576826ed821c81231fdfb0d24047158e7d 114 | #v11.1 115 | #nv-codec-headers git 43d91706e097565f57b311e567f0219838bcc2f6 116 | #v12.1 117 | #nv-codec-headers git 1889e62e2d35ff7aa9baca2bceb14f053785e6f1 118 | #v12.2 119 | nv-codec-headers git c69278340ab1d5559c7d7bf0edf615dc33ddbba 120 | ogg git fa80aae9d50096160f2b56ada35527d7aee3f746 121 | #commit below is for openssl 1.1.1.w, head may not build/work as expected 122 | openssl git e04bd3433fd84e1861bf258ea37928d9845e6a86 123 | opus git 08bcc6e46227fca01aa3de3f3512f8b692d8d36b 124 | png git b4800bae3379f1abf82359703c28e727b5df4135 125 | placebo git 3188549fba13bbdf3a5a98de2a38c2e71f04e21e 126 | #commit below is for rav1e 0.8.x, head may not build/work as expected 127 | rav1e git cda12985b9bebd2f4d940ac5d32c945b78752e5b 128 | rubberband hg 6fca9f344e6d 129 | samplerate git 15c392d47e71b9395a759544b3818a1235fe1a1d 130 | #commit below is for sdl release-2.30.12, head may not build/work as expected 131 | sdl git 8236e01a9f758d15927624925c6043f84d8a261f 132 | sofa git dd315a8ec1fee7193d40e4a59b12c5590a4a918c 133 | soxr git 945b592b70470e29f917f4de89b4281fbbd540c0 134 | #commit below is for srt v1.5.4, head may not build/work as expected 135 | srt git a8c6b65520f814c5bd8f801be48c33ceece7c4a6 136 | svt-av1 git 5def505f7f193d890be61e869831378f212a07bd 137 | theora git b167cb4a3e3e2d3239d71f0ca2cbc25af4f2183c 138 | #commit below is for vmaf v3.0.0, head may not build/work as expected 139 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 140 | vorbis git 84c023699cdf023a32fa4ded32019f194afcdad0 141 | vpl git c45b5d786bf7cdabbe49ff1bab78693ad78feb78 142 | vpx git e922e894bd44017f091e19b8f3bbe97e31e42657 143 | vulkan-headers git 9c77de5c3dd216f28e407eec65ed9c0a296c1f74 144 | webp git eb3ff781599e311cc27f1d34c6ba8953cf8d7e5b 145 | x264 git 32c3b801191522961102d4bea292cdb61068d0dd 146 | x265 git 78e5ac35c13c5cbccc5933083edceb0d3eaeaa21 147 | xml2 git 38ea8fa9dea1ff4777c17581350795a3691ee88a 148 | zlib git 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71 149 | 150 | -------------------------------------------------------------------------------- /ffmpeg-cxc-build-hints-file-head: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------- 2 | #ffmpeg-cxc-build-hints-file-head - local source, head/tip 3 | #--------------------------------------------------------- 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH or 6 | #set via the command line: 7 | #HINTS_FILE=/media/user/usb/my-build-hints ffmpeg-cxc-mingw64 8 | 9 | #fields are TAB delimited triplets enabling control of the build 10 | #source key value 11 | 12 | #------------ 13 | #CXC options 14 | #------------ 15 | CXC CFLAGS -mtune=generic -march=x86-64 -pipe 16 | #x86-64 generic skylake broadwell haswell ivybridge sandybridge corei7-avx westmere nehalem 17 | CXC OPTIM -O3 18 | CXC RUSTFLAGS -C target-feature=+avx2,+fma 19 | #override getconf _NPROCESSORS_ONLN 20 | #CXC JOBS 6 21 | #use FETCH_ONLY to clone all the repositories without a build 22 | #CXC FETCH_ONLY 0 23 | #display the config only - no fetch/build 24 | #CXC SHOW_ONLY 0 25 | 26 | #----------------------------------------------- 27 | #constrain parallel make or disable/enable build 28 | #----------------------------------------------- 29 | #source make job_count 30 | #source disable 31 | #source enable 32 | #lame make 1 33 | #fribidi make 1 34 | #fontconfig make 1 35 | #freetype make 1 36 | #harfbuzz make 1 37 | openssl make 1 38 | mfx disable 39 | 40 | #--------------------------- 41 | #set override URL for source 42 | #--------------------------- 43 | #source url url_string 44 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 45 | 46 | amf url file://~/src/amf 47 | aom url file://~/src/aom 48 | ass url file://~/src/ass 49 | avisynth url file://~/src/avisynth 50 | bzip2 url file://~/src/bzip2 51 | dav1d url file://~/src/dav1d 52 | decklink url file://~/src/decklink 53 | dlfcn url file://~/src/dlfcn 54 | fdk-aac url file://~/src/fdk-aac 55 | ffmpeg url file://~/src/ffmpeg 56 | fftw3 url file://~/src/fftw3 57 | fontconfig url file://~/src/fontconfig 58 | freetype url file://~/src/freetype 59 | frei0r url file://~/src/frei0r 60 | fribidi url file://~/src/fribidi 61 | harfbuzz url file://~/src/harfbuzz 62 | ladspa url file://~/src/ladspa 63 | lame url file://~/src/lame 64 | mfx url file://~/src/mfx 65 | nv-codec-headers url file://~/src/nv-codec-headers 66 | ogg url file://~/src/ogg 67 | openssl url file://~/src/openssl 68 | opus url file://~/src/opus 69 | placebo url file://~/src/placebo 70 | png url file://~/src/png 71 | rav1e url file://~/src/rav1e 72 | rubberband url file://~/src/rubberband 73 | sdl url file://~/src/sdl 74 | samplerate url file://~/src/samplerate 75 | sofa url file://~/src/sofa 76 | soxr url file://~/src/soxr 77 | srt url file://~/src/srt 78 | svt-av1 url file://~/src/svt-av1 79 | theora url file://~/src/theora 80 | vmaf url file://~/src/vmaf 81 | vorbis url file://~/src/vorbis 82 | vpl url file://~/src/vpx 83 | vpx url file://~/src/vpx 84 | vulkan-headers url file://~/src/vulkan-headers 85 | webp url file://~/src/webp 86 | x264 url file://~/src/x264 87 | x265 url file://~/src/x265 88 | xml2 url file://~/src/xml2 89 | zlib url file://~/src/zlib 90 | 91 | #------------------------ 92 | #fetch specified revision 93 | #------------------------ 94 | #source fetch_method revision_id 95 | amf git 96 | aom git 97 | ass git 98 | avisynth git 99 | bzip2 git 100 | dav1d git 101 | decklink git 102 | dlfcn git 103 | fdk-aac git 104 | ffmpeg git 105 | fftw3 wget fftw-3.3.10.tar.gz 106 | fontconfig git 107 | freetype git 108 | frei0r git 109 | fribidi git 110 | harfbuzz git 111 | ladspa git 112 | lame svn 113 | mfx git 114 | nv-codec-headers git 115 | ogg git 116 | openssl git 117 | opus git 118 | placebo git 119 | png git 120 | rav1e git 121 | rubberband hg 122 | samplerate git 123 | sdl git 124 | sofa git 125 | soxr git 126 | srt git 127 | svt-av1 git 128 | theora git 129 | vmaf git 130 | vorbis git 131 | vpl git 132 | vpx git 133 | vulkan-headers git 134 | webp git 135 | x264 git 136 | x265 git 137 | xml2 git 138 | zlib git 139 | 140 | -------------------------------------------------------------------------------- /ffmpeg-cxc-build-hints-slim: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------ 2 | #ffmpeg-cxc-build-hints-slim - 2025-05-23 working build 3 | #------------------------------------------------------ 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH or 6 | #set via the command line: 7 | #HINTS_FILE=/media/user/usb/my-build-hints ffmpeg-cxc-mingw64 8 | 9 | #fields are TAB delimited triplets enabling control of the build 10 | #source key value 11 | 12 | #------------ 13 | #CXC options 14 | #------------ 15 | CXC CFLAGS -mtune=generic -march=x86-64 -pipe 16 | #x86-64 generic skylake broadwell haswell ivybridge sandybridge corei7-avx westmere nehalem 17 | CXC OPTIM -O3 18 | CXC RUSTFLAGS -C target-feature=+avx2,+fma 19 | #override getconf _NPROCESSORS_ONLN 20 | #CXC JOBS 6 21 | #use FETCH_ONLY to clone all the repositories without a build 22 | #CXC FETCH_ONLY 0 23 | #display the config only - no fetch/build 24 | #CXC SHOW_ONLY 0 25 | 26 | #----------------------------------------------- 27 | #constrain parallel make or disable/enable build 28 | #----------------------------------------------- 29 | #source make job_count 30 | #source disable 31 | #source enable 32 | 33 | #disabled 34 | amf disable 35 | aom disable 36 | ass disable 37 | avisynth disable 38 | bzip2 disable 39 | decklink disable 40 | dlfcn disable 41 | fftw3 disable 42 | fontconfig disable 43 | freetype disable 44 | frei0r disable 45 | fribidi disable 46 | harfbuzz disable 47 | ladspa disable 48 | mfx disable 49 | nv-codec-headers disable 50 | png disable 51 | rav1e disable 52 | rubberband disable 53 | samplerate disable 54 | sofa disable 55 | srt disable 56 | svt-av1 disable 57 | theora disable 58 | vmaf disable 59 | vpx disable 60 | webp disable 61 | xml2 disable 62 | 63 | #enabled 64 | dav1d enable 65 | fdk-aac enable 66 | ffmpeg enable 67 | lame enable 68 | #lame make 1 69 | ogg enable 70 | openssl enable 71 | openssl make 1 72 | opus enable 73 | placebo enable 74 | sdl enable 75 | soxr enable 76 | vorbis enable 77 | vpl enable 78 | vulkan-headers enable 79 | x264 enable 80 | x265 enable 81 | zlib enable 82 | 83 | #--------------------------- 84 | #set override URL for source 85 | #--------------------------- 86 | #source url url_string 87 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 88 | 89 | #amf url file://~/src/amf 90 | #aom url file://~/src/aom 91 | #ass url file://~/src/ass 92 | #avisynth url file://~/src/avisynth 93 | #bzip2 url file://~/src/bzip2 94 | #decklink url file://~/src/decklink 95 | #dlfcn url file://~/src/dlfcn 96 | #fftw3 url file://~/src/fftw3 97 | #fontconfig url file://~/src/fontconfig 98 | #freetype url file://~/src/freetype 99 | #frei0r url file://~/src/frei0r 100 | #fribidi url file://~/src/fribidi 101 | #harfbuzz url file://~/src/harfbuzz 102 | #ladspa url file://~/src/ladspa 103 | #mfx url file://~/src/mfx 104 | #nv-codec-headers url file://~/src/nv-codec-headers 105 | #png url file://~/src/png 106 | #rav1e url file://~/src/rav1e 107 | #rubberband url file://~/src/rubberband 108 | #samplerate url file://~/src/samplerate 109 | #sofa url file://~/src/sofa 110 | #srt url file://~/src/srt 111 | #svt-av1 url file://~/src/svt-av1 112 | #theora url file://~/src/theora 113 | #vmaf url file://~/src/vmaf 114 | #vpx url file://~/src/vpx 115 | #vulkan-headers url file://~/src/vulkan-headers 116 | #webp url file://~/src/webp 117 | #xml2 url file://~/src/xml2 118 | 119 | #enabled 120 | #dav1d url file://~/src/dav1d 121 | #fdk-aac url file://~/src/fdk-aac 122 | #ffmpeg url file://~/src/ffmpeg 123 | #lame url file://~/src/lame 124 | #ogg url file://~/src/ogg 125 | #openssl url file://~/src/openssl 126 | #opus url file://~/src/opus 127 | #placebo url file://~/src/placebo 128 | #sdl url file://~/src/sdl 129 | #soxr url file://~/src/soxr 130 | #vorbis url file://~/src/vorbis 131 | #vpl url file://~/src/vpl 132 | #vulkan-headers url file://~/src/vulkan-headers 133 | #x264 url file://~/src/x264 134 | #x265 url file://~/src/x265 135 | #zlib url file://~/src/zlib 136 | 137 | #------------------------ 138 | #fetch specified revision 139 | #------------------------ 140 | #source fetch_method revision_id 141 | amf git d7311e30a53b7d36fb401d2efa3b04fe5d942e28 142 | aom git eecb55e22a7dc6731cfb6273fbebe7426a10cb37 143 | ass git 695509365f152bd28720a0c0e036d46836ee9345 144 | avisynth git c506611e5ed0fbe97b24ee898cabafa178b4687a 145 | bzip2 git fbc4b11da543753b3b803e5546f56e26ec90c2a7 146 | dav1d git 8d956180934f16244bdb58b39175824775125e55 147 | decklink git 23194d695a3ae4aca7bc6c2f16dd6e7325a41c27 148 | dlfcn git 8bfddb5aa345ce10ba98e925acbc7bfb53639679 149 | fdk-aac git 2ef9a141c40bf254bde7d22c197c615db5b265ed 150 | ffmpeg git f414038779217034b4d062d538df3e0d3ca48343 151 | fftw3 wget fftw-3.3.10.tar.gz 152 | fontconfig git 3454d29ef0761978897de5f28e388e5b0a3489f4 153 | freetype git f35bb7595462af6588c59a866b354a72e4f4be4b 154 | frei0r git b47c180376dc0ebfb9f57ca9373070eb8afcf9e9 155 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 156 | harfbuzz git 7dfbe50dfa6aacf0b2a8c7f357107691dc798a98 157 | ladspa git 0f54d2430febb4d5f02d13132dd91d7345e080b5 158 | lame svn 6531 159 | mfx git f6aac4576826ed821c81231fdfb0d24047158e7d 160 | #v11.1 161 | #nv-codec-headers git 43d91706e097565f57b311e567f0219838bcc2f6 162 | #v12.1 163 | #nv-codec-headers git 1889e62e2d35ff7aa9baca2bceb14f053785e6f1 164 | #v12.2 165 | nv-codec-headers git c69278340ab1d5559c7d7bf0edf615dc33ddbba 166 | ogg git fa80aae9d50096160f2b56ada35527d7aee3f746 167 | #commit below is for openssl 1.1.1.w, head may not build/work as expected 168 | openssl git e04bd3433fd84e1861bf258ea37928d9845e6a86 169 | opus git 08bcc6e46227fca01aa3de3f3512f8b692d8d36b 170 | png git b4800bae3379f1abf82359703c28e727b5df4135 171 | placebo git 3188549fba13bbdf3a5a98de2a38c2e71f04e21e 172 | #commit below is for rav1e 0.8.x, head may not build/work as expected 173 | rav1e git cda12985b9bebd2f4d940ac5d32c945b78752e5b 174 | rubberband hg 6fca9f344e6d 175 | samplerate git 15c392d47e71b9395a759544b3818a1235fe1a1d 176 | #commit below is for sdl release-2.30.12, head may not build/work as expected 177 | sdl git 8236e01a9f758d15927624925c6043f84d8a261f 178 | sofa git dd315a8ec1fee7193d40e4a59b12c5590a4a918c 179 | soxr git 945b592b70470e29f917f4de89b4281fbbd540c0 180 | #commit below is for srt v1.5.4, head may not build/work as expected 181 | srt git a8c6b65520f814c5bd8f801be48c33ceece7c4a6 182 | svt-av1 git 5def505f7f193d890be61e869831378f212a07bd 183 | theora git b167cb4a3e3e2d3239d71f0ca2cbc25af4f2183c 184 | #commit below is for vmaf v3.0.0, head may not build/work as expected 185 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 186 | vorbis git 84c023699cdf023a32fa4ded32019f194afcdad0 187 | vpl git c45b5d786bf7cdabbe49ff1bab78693ad78feb78 188 | vpx git e922e894bd44017f091e19b8f3bbe97e31e42657 189 | vulkan-headers git 9c77de5c3dd216f28e407eec65ed9c0a296c1f74 190 | webp git eb3ff781599e311cc27f1d34c6ba8953cf8d7e5b 191 | x264 git 32c3b801191522961102d4bea292cdb61068d0dd 192 | x265 git 78e5ac35c13c5cbccc5933083edceb0d3eaeaa21 193 | xml2 git 38ea8fa9dea1ff4777c17581350795a3691ee88a 194 | zlib git 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71 195 | 196 | -------------------------------------------------------------------------------- /ffmpeg-cxc-mingw64: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_VERSION="1.9.3" 4 | THIS="ffmpeg-cxc-mingw64" 5 | 6 | #build paths 7 | ROOT_PATH="${ROOT_PATH:-$HOME}" 8 | SRC_PATH="${SRC_PATH:-ffmpeg_sources}" 9 | OUT_PATH="${OUT_PATH:-ffmpeg_build}" 10 | BIN_PATH="${BIN_PATH:-$ROOT_PATH/$OUT_PATH/bin}" 11 | HINTS_FILE="${HINTS_FILE:-$ROOT_PATH/ffmpeg-cxc-build-hints}" 12 | CXC_PATH_LIST=\ 13 | ( \ 14 | "ROOT_PATH" "SRC_PATH" "OUT_PATH" "BIN_PATH" "HINTS_FILE" \ 15 | ) 16 | 17 | #cross compiler settings 18 | CXC_HOST="x86_64-w64-mingw32" 19 | CXC_OPTIM="-O2" 20 | CXC_CFLAGS="-mtune=generic -march=x86-64 -pipe" 21 | CXC_CPPFLAGS="-DNDEBUG -I$ROOT_PATH/$OUT_PATH/include" 22 | CXC_RUSTFLAGS="" 23 | CXC_BUILD="" 24 | CXC_MACHINE="$(uname -m | tr '[:upper:]' '[:lower:]')" 25 | CXC_OS="$(uname -o | tr '[:upper:]' '[:lower:]')" 26 | #make settings 27 | CXC_JOBS=$(getconf _NPROCESSORS_ONLN) 28 | CXC_FETCH_ONLY="${CXC_FETCH_ONLY:-0}" 29 | CXC_SHOW_ONLY="${CXC_SHOW_ONLY:-0}" 30 | CXC_DISABLE_DEFAULT="${CXC_DISABLE_DEFAULT:-0}" 31 | CXC_OPTION_LIST=\ 32 | ( \ 33 | "HOST" "OPTIM" "CFLAGS" "JOBS" "FETCH_ONLY" "SHOW_ONLY" "DISABLE_DEFAULT" "RUSTFLAGS" \ 34 | ) 35 | 36 | CXC_SYSTEM_LIST=\ 37 | ( \ 38 | "MACHINE" "OS" \ 39 | ) 40 | 41 | CXC_SOURCE_LIST=\ 42 | ( \ 43 | "amf" "aom" "ass" "avisynth" "bzip2" "dav1d" "decklink" "dlfcn" "fdk-aac" "ffmpeg" \ 44 | "fftw3" "fontconfig" "freetype" "frei0r" "fribidi" "harfbuzz" "ladspa" \ 45 | "lame" "mfx" "nv-codec-headers" "ogg" "openssl" "opus" "placebo" "png" "rav1e" \ 46 | "rubberband" "samplerate" "sdl" "sofa" "soxr" "srt" "svt-av1" "theora" "vmaf" \ 47 | "vorbis" "vpl" "vpx" "vulkan-headers" "webp" "xml2" "x264" "x265" "zlib" \ 48 | ) 49 | 50 | #lib options 51 | CXC_FFMPEG_EXTRA_LIBS="-lwinpthread -lssp" 52 | 53 | #fix pkg-config env 54 | export PKG_CONFIG_DIR= 55 | export PKG_CONFIG_PATH= 56 | export PKG_CONFIG_LIBDIR="$ROOT_PATH/$OUT_PATH/lib/pkgconfig:$ROOT_PATH/$OUT_PATH/share/pkgconfig" 57 | 58 | build_message() { 59 | 60 | local BM_WHITE=15 61 | local BM_GREEN=10 62 | local BM_CYAN=14 63 | local BM_MAGENTA=200 64 | local BM_YELLOW=11 65 | local BM_RED=9 66 | local color=$1 67 | 68 | shift 69 | printf "\e[38;5;${!color}m====> $@ <====\e[0m\n" 1>&2 70 | } 71 | 72 | build_die() { 73 | 74 | build_message BM_RED "$@" 75 | exit 1 76 | } 77 | 78 | build_make() { 79 | 80 | local jobs="${1:-1}" 81 | shift 82 | local hint=$(get_hint "$SRC_NAME" "make") 83 | jobs="${hint:-$jobs}" 84 | 85 | make -j $jobs "$@" 86 | [ $? -eq 0 ] || build_die "$THIS: make stage failed (jobs = $jobs) -> $SRC_NAME" 87 | 88 | grep -E '((^[ ]*)|([ ]*))[^ ]*install[^ ]*[ ]*$' <<< "$@" &> /dev/null 89 | [ $? -eq 0 ] || make install 90 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 91 | 92 | build_message BM_GREEN "$SRC_NAME: built successfully (jobs = $jobs)" 93 | } 94 | 95 | build_meson() { 96 | 97 | local jobs="${1:-1}" 98 | shift 99 | 100 | ninja -j $jobs -C . 101 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 102 | ninja -C . install 103 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 104 | 105 | build_message BM_GREEN "$SRC_NAME: built successfully (jobs = $jobs)" 106 | } 107 | 108 | fetch_source() { 109 | 110 | local revision=$(get_hint "$SRC_NAME" "$SRC_METHOD") 111 | local url=$(get_hint "$SRC_NAME" "url") 112 | local status=1 113 | local scheme; 114 | local path; 115 | 116 | if [ -z "$url" ] 117 | then 118 | url="$SRC_URL" 119 | fi 120 | 121 | [[ "$url" =~ ^(file://)(.+)$ ]] 122 | scheme="${BASH_REMATCH[1]}" 123 | path="${BASH_REMATCH[2]}" 124 | 125 | if [ "$scheme" == "file://" ] 126 | then 127 | build_message BM_YELLOW "rsync $path/ ./$SRC_NAME/" 128 | if [ "$CXC_SHOW_ONLY" -eq 0 ] 129 | then 130 | mkdir "$SRC_NAME" 131 | eval "rsync -ritl --stats $path/ ./$SRC_NAME/" 132 | status=$? 133 | fi 134 | fi 135 | 136 | if [ "$CXC_SHOW_ONLY" -ne 0 ] 137 | then 138 | build_message BM_MAGENTA "$SRC_NAME: fetch -> $SRC_METHOD $url $revision" 139 | return 0 140 | fi 141 | 142 | case "$SRC_METHOD" in 143 | git) 144 | if [ "$scheme" != "file://" ] 145 | then 146 | git clone --recursive "$url" "$SRC_NAME" 147 | status=$? 148 | fi 149 | 150 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 151 | then 152 | cd_source 153 | git reset --hard "$revision" 154 | status=$? 155 | cd .. 156 | fi 157 | ;; 158 | svn) 159 | if [ "$scheme" != "file://" ] 160 | then 161 | svn checkout "$url" "$SRC_NAME" 162 | status=$? 163 | fi 164 | 165 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 166 | then 167 | cd_source 168 | svn up -r"$revision" 169 | status=$? 170 | cd .. 171 | fi 172 | ;; 173 | hg) 174 | if [ "$scheme" != "file://" ] 175 | then 176 | hg clone "$url" "$SRC_NAME" 177 | status=$? 178 | fi 179 | 180 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 181 | then 182 | cd_source 183 | hg revert -r "$revision" --all 184 | status=$? 185 | cd .. 186 | fi 187 | ;; 188 | wget) 189 | if [ "$scheme" != "file://" ] 190 | then 191 | local wOrigin="${url%/*}" 192 | local wFile="${url##*/}" 193 | if [ ! -z "$revision" ] 194 | then 195 | wFile="$revision" 196 | fi 197 | #echo "SRC_NAME="$SRC_NAME "SRC_URL="$SRC_URL "url="$url "revision="$revision "origin/file="$wOrigin/$wFile 198 | status=0 199 | if [ ! -d "$SRC_NAME" ] 200 | then 201 | mkdir "$SRC_NAME" 202 | status=$? 203 | fi 204 | [ $status -eq 0 ] && \ 205 | wget -O "$wFile" "$wOrigin/$wFile" && \ 206 | bsdtar -xvf "$wFile" -C "$SRC_NAME" 207 | status=$? 208 | fi 209 | ;; 210 | *) 211 | build_die "$THIS: invalid fetch method -> $SRC_NAME: $SRC_METHOD" 212 | ;; 213 | esac 214 | if [ $status -eq 0 ] 215 | then 216 | build_message BM_MAGENTA "$SRC_NAME: fetch success -> $SRC_METHOD $url $revision" 217 | else 218 | build_die "$THIS: fetch stage failed -> $SRC_NAME: $SRC_METHOD $url" 219 | fi 220 | } 221 | 222 | get_hint() { 223 | 224 | local status=1 225 | if [ -r "$HINTS_FILE" ] 226 | then 227 | #$1 name 228 | #$2 hint 229 | local name=$1 230 | shift 231 | local hint=$1 232 | shift 233 | 234 | awk -F'\t' -v name=$name -v hint=$hint \ 235 | '!($0 ~ /^[[:space:]]*#/) && !($0 ~ /^[[:space:]]*$/) && $1 == name && $2 == hint \ 236 | {printf "%s", $3; found=1; exit} \ 237 | END { if (found) {exit 0} else {exit 1}}' "$HINTS_FILE" 238 | 239 | status=$? 240 | fi 241 | return $status 242 | } 243 | 244 | get_CXC_hints() { 245 | 246 | local h 247 | local val 248 | local var 249 | 250 | #initialize enabled builds based on enable/disable default 251 | for h in "${CXC_SOURCE_LIST[@]}" 252 | do 253 | var="CXC_ENABLE_${h}" 254 | var="${var//[^A-Za-z0-9]/_}" 255 | var="${var^^}" 256 | #echo "$var" 257 | if [ $CXC_DISABLE_DEFAULT -eq 0 ] 258 | then 259 | val=1 260 | else 261 | val=0 262 | fi 263 | eval "$var=\$val" 264 | done 265 | 266 | #check for values from the hints file 267 | if [ -r "$HINTS_FILE" ] 268 | then 269 | for h in "${CXC_OPTION_LIST[@]}" 270 | do 271 | val="$(get_hint "CXC" "$h")" 272 | if [ $? -eq 0 ] 273 | then 274 | var="CXC_${h}" 275 | eval "$var=\$val" 276 | fi 277 | done 278 | 279 | for h in "${CXC_SOURCE_LIST[@]}" 280 | do 281 | var="CXC_ENABLE_${h}" 282 | var="${var//[^A-Za-z0-9]/_}" 283 | var="${var^^}" 284 | #echo "$var" 285 | if [ $CXC_DISABLE_DEFAULT -eq 0 ] 286 | then 287 | val="$(get_hint "$h" "disable")" 288 | if [ $? -eq 0 ] 289 | then 290 | val=0 291 | else 292 | val=1 293 | fi 294 | else 295 | val="$(get_hint "$h" "enable")" 296 | if [ $? -eq 0 ] 297 | then 298 | val=1 299 | else 300 | val=0 301 | fi 302 | fi 303 | eval "$var=\$val" 304 | done 305 | fi 306 | } 307 | 308 | set_source() { 309 | 310 | if [ "$CXC_SHOW_ONLY" -eq 0 ] 311 | then 312 | cd "$ROOT_PATH/$SRC_PATH" 313 | fi 314 | 315 | SRC_NAME="$1" 316 | if [ "$#" -eq 1 ] 317 | then 318 | return 319 | fi 320 | 321 | shift 322 | SRC_ENABLE="CXC_ENABLE_${SRC_NAME}" 323 | SRC_ENABLE="${SRC_ENABLE//[^A-Za-z0-9]/_}" 324 | SRC_ENABLE="${SRC_ENABLE^^}" 325 | SRC_URL=$(get_hint "$SRC_NAME" "url") 326 | SRC_METHOD="$1" 327 | shift 328 | SRC_URL="${SRC_URL:-$1}" 329 | shift 330 | 331 | if [ "${!SRC_ENABLE}" -ne 0 ] 332 | then 333 | for arg in "$@" 334 | do 335 | CXC_FFMPEG_LIB_OPTIONS="$CXC_FFMPEG_LIB_OPTIONS --enable-$arg" 336 | done 337 | build_message BM_CYAN "$SRC_NAME" 338 | fi 339 | } 340 | 341 | cd_source() { 342 | 343 | cd $SRC_NAME 344 | [ $? -eq 0 ] || build_die "$THIS: unable to change to directory -> $SRC_NAME" 345 | if [ ! -z "$1" ] 346 | then 347 | cd $(ls -d1 $1*/ | head -n 1) 348 | [ $? -eq 0 ] || build_die "$THIS: unable to change to directory -> $SRC_NAME" 349 | fi 350 | } 351 | 352 | #startup banner 353 | build_message BM_WHITE "$THIS: Version $SCRIPT_VERSION" 354 | build_message BM_WHITE "$THIS: $(${CXC_HOST}-gcc -v 2>&1 | grep '^gcc version')" 355 | 356 | #load CXC hints 357 | get_CXC_hints 358 | if [ "$CXC_SHOW_ONLY" -ne 0 ] 359 | then 360 | { 361 | for i in "${CXC_PATH_LIST[@]}" 362 | do 363 | echo "$i: ${!i}" 364 | done 365 | } | sort 366 | { 367 | for i in "${CXC_OPTION_LIST[@]}" 368 | do 369 | var="CXC_${i}" 370 | echo "$var: ${!var}" 371 | done 372 | } | sort 373 | { 374 | for i in "${CXC_SOURCE_LIST[@]}" 375 | do 376 | var="CXC_ENABLE_${i}" 377 | var="${var//[^A-Za-z0-9]/_}" 378 | var="${var^^}" 379 | echo "$var: ${!var} ($i)" 380 | done 381 | } | sort 382 | fi 383 | 384 | if [ "$CXC_FETCH_ONLY" -eq 0 ] && [ "$CXC_SHOW_ONLY" -eq 0 ] 385 | then 386 | BUILD=1 387 | else 388 | BUILD=0 389 | fi 390 | 391 | #ensure clean build 392 | if [ "$BUILD" -ne 0 ] 393 | then 394 | rm -rf "$ROOT_PATH/$OUT_PATH" 395 | [ -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to remove build directory -> $ROOT_PATH/$OUT_PATH" 396 | fi 397 | 398 | if [ "$BUILD" -ne 0 ] || [ "$CXC_FETCH_ONLY" -ne 0 ] 399 | then 400 | rm -rf "$ROOT_PATH/$SRC_PATH" 401 | [ -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to remove source directory -> $ROOT_PATH/$SRC_PATH" 402 | fi 403 | 404 | if [ "$BUILD" -ne 0 ] 405 | then 406 | mkdir --parents "$ROOT_PATH/$OUT_PATH/misc" 407 | [ ! -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to create build directory -> $ROOT_PATH/$OUT_PATH" 408 | fi 409 | 410 | if [ "$BUILD" -ne 0 ] || [ "$CXC_FETCH_ONLY" -ne 0 ] 411 | then 412 | mkdir "$ROOT_PATH/$SRC_PATH" 413 | [ ! -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to create source directory -> $ROOT_PATH/$SRC_PATH" 414 | fi 415 | 416 | if [ "$BUILD" -ne 0 ] 417 | then 418 | #cmake toolchain settings 419 | touch $ROOT_PATH/$SRC_PATH/cross.cmake 420 | FORCE_CMAKE_VALUE='CACHE STRING "" FORCE' 421 | #echo "SET(CMAKE_VERBOSE_MAKEFILE 1 $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 422 | echo "SET(CMAKE_SYSTEM_NAME Windows $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 423 | echo "SET(CMAKE_BUILD_TYPE Release $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 424 | echo "SET(CMAKE_SYSTEM_PROCESSOR x86_64 $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 425 | echo "SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 426 | echo "SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++ $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 427 | echo "SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 428 | echo "SET(CMAKE_C_FLAGS \"$CXC_CFLAGS -I $ROOT_PATH/$OUT_PATH/include\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 429 | echo "SET(CMAKE_C_FLAGS_RELEASE \"$CXC_OPTIM -DNDEBUG\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 430 | echo "SET(CMAKE_CXX_FLAGS \"$CXC_CFLAGS -fpermissive -I $ROOT_PATH/$OUT_PATH/include\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 431 | echo "SET(CMAKE_CXX_FLAGS_RELEASE \"$CXC_OPTIM -DNDEBUG\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 432 | echo "SET(CMAKE_CPP_FLAGS \"$CXC_CPPFLAGS\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 433 | echo "SET(CMAKE_ASM_YASM_COMPILER yasm $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 434 | echo "SET(CMAKE_ASM_NASM_COMPILER nasm $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 435 | echo "SET(CMAKE_FIND_LIBRARY_SUFFIXES .a $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 436 | echo 'SET(CMAKE_STATIC_LIBRARY_LINK_C_FLAGS "-static-libgcc -static-libstdc++ -static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 437 | echo 'SET(CMAKE_STATIC_LIBRARY_LINK_CXX_FLAGS "-static-libgcc -static-libstdc++ -static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 438 | #echo 'SET(CMAKE_STATIC_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 439 | echo 'SET(CMAKE_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 440 | echo 'SET(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 441 | echo 'SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/cross.cmake 442 | 443 | #meson toolchain settings 444 | touch $ROOT_PATH/$SRC_PATH/cross.meson 445 | echo "[binaries]" >> $ROOT_PATH/$SRC_PATH/cross.meson 446 | echo "c = 'x86_64-w64-mingw32-gcc'" >> $ROOT_PATH/$SRC_PATH/cross.meson 447 | echo "cpp = 'x86_64-w64-mingw32-g++'" >> $ROOT_PATH/$SRC_PATH/cross.meson 448 | echo "windres = 'x86_64-w64-mingw32-windres'" >> $ROOT_PATH/$SRC_PATH/cross.meson 449 | echo "dlltool = 'x86_64-w64-mingw32-dlltool'" >> $ROOT_PATH/$SRC_PATH/cross.meson 450 | echo "strip = 'x86_64-w64-mingw32-strip'" >> $ROOT_PATH/$SRC_PATH/cross.meson 451 | echo "pkgconfig = 'pkg-config'" >> $ROOT_PATH/$SRC_PATH/cross.meson 452 | echo "[built-in options]" >> $ROOT_PATH/$SRC_PATH/cross.meson 453 | echo "c_args = ['$(echo "$CXC_OPTIM $CXC_CFLAGS $CXC_CPPFLAGS" | sed -r "s/\s+/','/g")']" >> $ROOT_PATH/$SRC_PATH/cross.meson 454 | echo "cpp_args = ['$(echo "$CXC_OPTIM $CXC_CFLAGS $CXC_CPPFLAGS -fpermissive" | sed -r "s/\s+/','/g")']" >> $ROOT_PATH/$SRC_PATH/cross.meson 455 | echo "c_link_args = ['-static-libgcc','-static','-s']" >> $ROOT_PATH/$SRC_PATH/cross.meson 456 | echo "cpp_link_args = ['-static-libgcc','-static-libstdc++','-static','-s']" >> $ROOT_PATH/$SRC_PATH/cross.meson 457 | echo "[host_machine]" >> $ROOT_PATH/$SRC_PATH/cross.meson 458 | echo "system = 'windows'" >> $ROOT_PATH/$SRC_PATH/cross.meson 459 | echo "cpu_family = 'x86_64'" >> $ROOT_PATH/$SRC_PATH/cross.meson 460 | echo "cpu = 'x86_64'" >> $ROOT_PATH/$SRC_PATH/cross.meson 461 | echo "endian = 'little'" >> $ROOT_PATH/$SRC_PATH/cross.meson 462 | 463 | fi 464 | 465 | #test and fix cross for build environments 466 | if [[ "$CXC_OS" == *cygwin* ]] 467 | then 468 | if [[ "$PATH" == *x86_64*mingw*sys-root*mingw/bin* ]] 469 | then 470 | CXC_BUILD='--build=x86_64-pc-cygwin' 471 | else 472 | build_die "$THIS: mingw 'sys-root/bin' must be in PATH" 473 | fi 474 | build_message BM_YELLOW "$THIS: Cygwin build detected - ensure sys-root contains a symlink to construct a valid path for '$OUT_PATH/include'" 475 | elif [[ "$CXC_OS" == *linux* ]] 476 | then 477 | CXC_BUILD='--build=x86_64-pc-linux-gnu' 478 | if [ ! -z "$(x86_64-w64-mingw32-gcc -print-sysroot)" ] && [ ! -d "$(x86_64-w64-mingw32-gcc -print-sysroot)/mingw$ROOT_PATH" ] 479 | then 480 | build_message BM_YELLOW "$THIS: Linux build detected - ensure '$(x86_64-w64-mingw32-gcc -print-sysroot)/mingw$ROOT_PATH' is accessible" 481 | build_die "$THIS: $(x86_64-w64-mingw32-gcc -print-sysroot)/mingw$ROOT_PATH/$OUT_PATH/include' not found" 482 | fi 483 | fi 484 | 485 | #display the detected system type and hints file in use 486 | if [ "$BUILD" -ne 0 ] 487 | then 488 | for i in "${CXC_SYSTEM_LIST[@]}" 489 | do 490 | var="CXC_${i}" 491 | echo "$var: ${!var}" 492 | done 493 | echo -n "HINTS_FILE: $HINTS_FILE" 494 | if [ ! -e "$HINTS_FILE" ] || [ ! -r "$HINTS_FILE" ] 495 | then 496 | echo " (unreadable)" 497 | else 498 | echo " (readable)" 499 | fi 500 | fi 501 | 502 | #build the sources 503 | 504 | #zlib 505 | set_source "zlib" "git" "https://github.com/madler/zlib.git" "zlib" 506 | if [ "${!SRC_ENABLE}" -ne 0 ] 507 | then 508 | fetch_source 509 | if [ "$BUILD" -ne 0 ] 510 | then 511 | cd_source 512 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 . 513 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 514 | build_make $CXC_JOBS 515 | [ -e "$ROOT_PATH/$OUT_PATH/lib/libzlibstatic.a" ] && cp "$ROOT_PATH/$OUT_PATH/lib/libzlibstatic.a" "$ROOT_PATH/$OUT_PATH/lib/libzs.a" 516 | ln -s "$ROOT_PATH/$OUT_PATH/lib/libzs.a" "$ROOT_PATH/$OUT_PATH/lib/libz.a" 517 | fi 518 | fi 519 | 520 | #bzip2 521 | set_source "bzip2" "git" "https://sourceware.org/git/bzip2.git" "bzlib" 522 | if [ "${!SRC_ENABLE}" -ne 0 ] 523 | then 524 | fetch_source 525 | if [ "$BUILD" -ne 0 ] 526 | then 527 | cd_source 528 | sed -i -r 's///' bzip2.c 529 | sed -i -r "s/^(CFLAGS=.+)-O2 -g(.+)/\1${CXC_OPTIM} ${CXC_CFLAGS}\2/" Makefile 530 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 531 | build_make $CXC_JOBS PREFIX="$ROOT_PATH/$OUT_PATH" CC="x86_64-w64-mingw32-gcc" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" -i libbz2.a install 532 | fi 533 | fi 534 | 535 | #png16 536 | set_source "png" "git" "https://git.code.sf.net/p/libpng/code" 537 | if [ "${!SRC_ENABLE}" -ne 0 ] 538 | then 539 | fetch_source 540 | if [ "$BUILD" -ne 0 ] 541 | then 542 | cd_source 543 | autoreconf -fiv 544 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" LDFLAGS="-L$ROOT_PATH/$OUT_PATH/lib" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared 545 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 546 | build_make $CXC_JOBS 547 | fi 548 | fi 549 | 550 | #webp 551 | set_source "webp" "git" "https://chromium.googlesource.com/webm/libwebp" "libwebp" 552 | if [ "${!SRC_ENABLE}" -ne 0 ] 553 | then 554 | fetch_source 555 | if [ "$BUILD" -ne 0 ] 556 | then 557 | cd_source 558 | mkdir "${SRC_NAME}_build" 559 | cd "${SRC_NAME}_build" 560 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DWEBP_BUILD_ANIM_UTILS=0 -DWEBP_BUILD_CWEBP=0 -DWEBP_BUILD_DWEBP=0 -DWEBP_BUILD_VWEBP=0 -DWEBP_BUILD_IMG2WEBP=0 -DWEBP_BUILD_GIF2WEBP=0 -DWEBP_BUILD_WEBPINFO=0 -DWEBP_BUILD_EXTRAS=0 -DWEBP_BUILD_WEBPMUX=0 -DWEBP_BUILD_WEBP_JS=0 .. 561 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 562 | build_make $CXC_JOBS 563 | fi 564 | fi 565 | 566 | #freetype 567 | set_source "freetype" "git" "https://gitlab.freedesktop.org/freetype/freetype.git" "libfreetype" 568 | if [ "${!SRC_ENABLE}" -ne 0 ] 569 | then 570 | fetch_source 571 | if [ "$BUILD" -ne 0 ] 572 | then 573 | cd_source 574 | ./autogen.sh 575 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" LDFLAGS="-L$ROOT_PATH/$OUT_PATH/lib" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared 576 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 577 | build_make $CXC_JOBS 578 | fi 579 | fi 580 | 581 | #fribidi 582 | set_source "fribidi" "git" "https://github.com/fribidi/fribidi.git" "libfribidi" 583 | if [ "${!SRC_ENABLE}" -ne 0 ] 584 | then 585 | fetch_source 586 | if [ "$BUILD" -ne 0 ] 587 | then 588 | CXC_CPPFLAGS="$CXC_CPPFLAGS -DFRIBIDI_LIB_STATIC" 589 | mkdir "${SRC_NAME}_build" 590 | cd "${SRC_NAME}_build" 591 | meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Ddocs=false -Dtests=false --strip --cross-file="$ROOT_PATH/$SRC_PATH/cross.meson" "../$SRC_NAME" 592 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 593 | build_meson $CXC_JOBS 594 | fi 595 | fi 596 | 597 | #libxml2 598 | set_source "xml2" "git" "https://github.com/GNOME/libxml2.git" "libxml2" 599 | if [ "${!SRC_ENABLE}" -ne 0 ] 600 | then 601 | fetch_source 602 | if [ "$BUILD" -ne 0 ] 603 | then 604 | cd_source 605 | autoreconf -fiv 606 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS -D_FORTIFY_SOURCE=0" LDFLAGS="-lssp -L$ROOT_PATH/$OUT_PATH/lib" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared --with-python=no 607 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 608 | build_make $CXC_JOBS 609 | fi 610 | fi 611 | 612 | #fontconfig 613 | set_source "fontconfig" "git" "https://gitlab.freedesktop.org/fontconfig/fontconfig.git" "libfontconfig" 614 | if [ "${!SRC_ENABLE}" -ne 0 ] 615 | then 616 | fetch_source 617 | if [ "$BUILD" -ne 0 ] 618 | then 619 | cd_source 620 | #mkdir "${SRC_NAME}_build" 621 | #cd "${SRC_NAME}_build" 622 | #meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Dtools=disabled -Ddoc=disabled -Dtests=disabled --strip --cross-file="$ROOT_PATH/$SRC_PATH/cross.meson" ".." 623 | autoreconf -fiv 624 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" LDFLAGS="-lxml2 -lm -lws2_32 -lbcrypt -L$ROOT_PATH/$OUT_PATH/lib" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared --disable-docs --enable-libxml2 --disable-nls 625 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 626 | build_make $CXC_JOBS 627 | fi 628 | fi 629 | 630 | #harfbuzz - handle the freetype circular dependency 631 | set_source "harfbuzz" "git" "https://github.com/harfbuzz/harfbuzz.git" 632 | if [ "${!SRC_ENABLE}" -ne 0 ] 633 | then 634 | fetch_source 635 | if [ "$BUILD" -ne 0 ] 636 | then 637 | cd_source 638 | mkdir "${SRC_NAME}_build" 639 | cd "${SRC_NAME}_build" 640 | meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Dfreetype=enabled -Dcairo=disabled -Dglib=disabled -Dicu=disabled -Dintrospection=disabled -Dbenchmark=disabled -Ddocs=disabled -Dtests=disabled --strip --cross-file="$ROOT_PATH/$SRC_PATH/cross.meson" ".." 641 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 642 | build_meson $CXC_JOBS 643 | #now rebuild freetype to be harfbuzz aware 644 | set_source "freetype" 645 | cd_source 646 | make clean 647 | ./autogen.sh 648 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" LDFLAGS="-L$ROOT_PATH/$OUT_PATH/lib" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared 649 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 650 | build_make $CXC_JOBS 651 | CXC_FFMPEG_EXTRA_LIBS="-lharfbuzz -lfreetype -lpng16 -lz $CXC_FFMPEG_EXTRA_LIBS" 652 | fi 653 | fi 654 | 655 | #libass 656 | set_source "ass" "git" "https://github.com/libass/libass.git" "libass" 657 | if [ "${!SRC_ENABLE}" -ne 0 ] 658 | then 659 | fetch_source 660 | if [ "$BUILD" -ne 0 ] 661 | then 662 | cd_source 663 | autoreconf -fiv 664 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS -Wno-error=incompatible-pointer-types" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared 665 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 666 | build_make $CXC_JOBS 667 | fi 668 | fi 669 | 670 | #libsamplerate 671 | set_source "samplerate" "git" "https://github.com/erikd/libsamplerate.git" 672 | if [ "${!SRC_ENABLE}" -ne 0 ] 673 | then 674 | fetch_source 675 | if [ "$BUILD" -ne 0 ] 676 | then 677 | cd_source 678 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DBUILD_TESTING=0 -DLIBSAMPLERATE_EXAMPLES=0 . 679 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 680 | build_make $CXC_JOBS 681 | fi 682 | fi 683 | 684 | #fftw3 685 | set_source "fftw3" "wget" "http://fftw.org/fftw-3.3.10.tar.gz" 686 | if [ "${!SRC_ENABLE}" -ne 0 ] 687 | then 688 | fetch_source 689 | if [ "$BUILD" -ne 0 ] 690 | then 691 | cd_source "fftw-" 692 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DBUILD_TESTS=0 -DDISABLE_FORTRAN=1 . 693 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 694 | build_make $CXC_JOBS 695 | ln -s "$ROOT_PATH/$OUT_PATH"/lib/pkgconfig/fftw*.pc "$ROOT_PATH/$OUT_PATH"/lib/pkgconfig/fftw3.pc 696 | fi 697 | fi 698 | 699 | #ladspa 700 | set_source "ladspa" "git" "https://github.com/swh/ladspa.git" 701 | if [ "${!SRC_ENABLE}" -ne 0 ] 702 | then 703 | fetch_source 704 | if [ "$BUILD" -ne 0 ] 705 | then 706 | cd_source 707 | cp -pv ladspa.h "$ROOT_PATH/$OUT_PATH/include" 708 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 709 | build_message BM_GREEN "$SRC_NAME: installed" 710 | fi 711 | fi 712 | 713 | #librubberband 714 | set_source "rubberband" "hg" "https://hg.sr.ht/~breakfastquay/rubberband" "librubberband" 715 | if [ "${!SRC_ENABLE}" -ne 0 ] 716 | then 717 | fetch_source 718 | if [ "$BUILD" -ne 0 ] 719 | then 720 | cd_source 721 | mkdir "${SRC_NAME}_build" 722 | sed -r -i 's/^system = build_machine\.system\(\)/system = host_machine.system()/' meson.build 723 | cd "${SRC_NAME}_build" 724 | meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Dfft=fftw -Dvamp=disabled -Dlv2=disabled -Dcmdline=disabled --strip --cross-file="$ROOT_PATH/$SRC_PATH/cross.meson" ".." 725 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 726 | build_meson $CXC_JOBS && \ 727 | cp -pv -r "../rubberband/" "$ROOT_PATH/$OUT_PATH/include" && \ 728 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 729 | build_message BM_GREEN "$SRC_NAME: installed" 730 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lsamplerate -lfftw3" 731 | fi 732 | fi 733 | 734 | #sofa 735 | set_source "sofa" "git" "https://github.com/hoene/libmysofa.git" "libmysofa" 736 | if [ "${!SRC_ENABLE}" -ne 0 ] 737 | then 738 | fetch_source 739 | if [ "$BUILD" -ne 0 ] 740 | then 741 | cd_source 742 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DZLIB_LIBRARY="$ROOT_PATH/$OUT_PATH/lib/libz.a" -DBUILD_SHARED_LIBS=0 -DBUILD_TESTS=0 -DCODE_COVERAGE=0 . 743 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 744 | build_make $CXC_JOBS 745 | fi 746 | fi 747 | 748 | #soxr 749 | set_source "soxr" "git" "https://git.code.sf.net/p/soxr/code" "libsoxr" 750 | if [ "${!SRC_ENABLE}" -ne 0 ] 751 | then 752 | fetch_source 753 | if [ "$BUILD" -ne 0 ] 754 | then 755 | cd_source 756 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DBUILD_EXAMPLES=0 -DBUILD_TESTS=0 -DBUILD_LSR_TESTS=0 . 757 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 758 | build_make $CXC_JOBS 759 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lgomp -lpthread" 760 | fi 761 | fi 762 | 763 | #fdk-aac 764 | set_source "fdk-aac" "git" "https://github.com/mstorsjo/fdk-aac.git" "libfdk-aac" 765 | if [ "${!SRC_ENABLE}" -ne 0 ] 766 | then 767 | fetch_source 768 | if [ "$BUILD" -ne 0 ] 769 | then 770 | cd_source 771 | autoreconf -fiv 772 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared 773 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 774 | build_make $CXC_JOBS 775 | fi 776 | fi 777 | 778 | #lame 779 | set_source "lame" "svn" "https://svn.code.sf.net/p/lame/svn/trunk/lame" "libmp3lame" 780 | if [ "${!SRC_ENABLE}" -ne 0 ] 781 | then 782 | fetch_source 783 | if [ "$BUILD" -ne 0 ] 784 | then 785 | cd_source 786 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS " CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS -Wno-error=incompatible-pointer-types" --host="$CXC_HOST" "$CXC_BUILD" --enable-nasm --disable-shared --disable-frontend --disable-decoder 787 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 788 | build_make $CXC_JOBS 789 | fi 790 | fi 791 | 792 | #ogg 793 | set_source "ogg" "git" "https://github.com/xiph/ogg.git" 794 | if [ "${!SRC_ENABLE}" -ne 0 ] 795 | then 796 | fetch_source 797 | if [ "$BUILD" -ne 0 ] 798 | then 799 | cd_source 800 | ./autogen.sh 801 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared 802 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 803 | build_make $CXC_JOBS 804 | fi 805 | fi 806 | 807 | #opus 808 | set_source "opus" "git" "https://github.com/xiph/opus.git" "libopus" 809 | if [ "${!SRC_ENABLE}" -ne 0 ] 810 | then 811 | fetch_source 812 | if [ "$BUILD" -ne 0 ] 813 | then 814 | cd_source 815 | ./autogen.sh 816 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS -D_FORTIFY_SOURCE=0" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared --disable-doc 817 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 818 | build_make $CXC_JOBS 819 | fi 820 | fi 821 | 822 | #vorbis 823 | set_source "vorbis" "git" "https://github.com/xiph/vorbis.git" "libvorbis" 824 | if [ "${!SRC_ENABLE}" -ne 0 ] 825 | then 826 | fetch_source 827 | if [ "$BUILD" -ne 0 ] 828 | then 829 | cd_source 830 | ./autogen.sh 831 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared -disable-docs --disable-examples 832 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 833 | build_make $CXC_JOBS 834 | fi 835 | fi 836 | 837 | #theora 838 | set_source "theora" "git" "https://github.com/xiph/theora.git" "libtheora" 839 | if [ "${!SRC_ENABLE}" -ne 0 ] 840 | then 841 | fetch_source 842 | if [ "$BUILD" -ne 0 ] 843 | then 844 | cd_source 845 | ./autogen.sh 846 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" --host="$CXC_HOST" "$CXC_BUILD" --enable-static --disable-shared --disable-doc --disable-oggtest --disable-vorbistest --disable-examples 847 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 848 | build_make $CXC_JOBS 849 | fi 850 | fi 851 | 852 | #aom AV1 853 | set_source "aom" "git" "https://aomedia.googlesource.com/aom" "libaom" 854 | if [ "${!SRC_ENABLE}" -ne 0 ] 855 | then 856 | fetch_source 857 | if [ "$BUILD" -ne 0 ] 858 | then 859 | mkdir "${SRC_NAME}_build" 860 | cd "${SRC_NAME}_build" 861 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_C_FLAGS_RELEASE="$CXC_OPTIM -DNDEBUG" -DCMAKE_C_FLAGS="$CXC_CFLAGS" -DCMAKE_CXX_FLAGS_RELEASE="$CXC_OPTIM -DNDEBUG" -DCMAKE_CXX_FLAGS="$CXC_CFLAGS" -DCMAKE_TOOLCHAIN_FILE="../aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake" -DAOM_TARGET_CPU="x86_64" -DBUILD_SHARED_LIBS=0 -DENABLE_NASM=1 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TOOLS=0 -DENABLE_TESTS=0 "../$SRC_NAME" 862 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 863 | build_make $CXC_JOBS 864 | fi 865 | fi 866 | 867 | #svtav1 868 | set_source "svt-av1" "git" "https://gitlab.com/AOMediaCodec/SVT-AV1.git" "libsvtav1" 869 | if [ "${!SRC_ENABLE}" -ne 0 ] 870 | then 871 | fetch_source 872 | if [ "$BUILD" -ne 0 ] 873 | then 874 | mkdir "${SRC_NAME}_build" 875 | cd "${SRC_NAME}_build" 876 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DENABLE_NASM=1 "../$SRC_NAME" 877 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 878 | build_make $CXC_JOBS 879 | fi 880 | fi 881 | 882 | #dav1d 883 | set_source "dav1d" "git" "https://code.videolan.org/videolan/dav1d.git" "libdav1d" 884 | if [ "${!SRC_ENABLE}" -ne 0 ] 885 | then 886 | fetch_source 887 | if [ "$BUILD" -ne 0 ] 888 | then 889 | mkdir "${SRC_NAME}_build" 890 | cd "${SRC_NAME}_build" 891 | meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Denable_tools=false -Denable_tests=false --strip --cross-file="$ROOT_PATH/$SRC_PATH/cross.meson" "../$SRC_NAME" 892 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 893 | build_meson $CXC_JOBS 894 | fi 895 | fi 896 | 897 | #rav1e 898 | set_source "rav1e" "git" "https://github.com/xiph/rav1e.git" "librav1e" 899 | if [ "${!SRC_ENABLE}" -ne 0 ] 900 | then 901 | fetch_source 902 | if [ "$BUILD" -ne 0 ] 903 | then 904 | cd_source 905 | PKG_CONFIG_LIBDIR="" RUSTFLAGS="$CXC_RUSTFLAGS" cargo cinstall --prefix="$ROOT_PATH/$OUT_PATH" --lib --release --target x86_64-pc-windows-gnu --dlltool=/usr/bin/x86_64-w64-mingw32-dlltool 906 | [ $? -eq 0 ] || build_die "$THIS: build stage failed -> $SRC_NAME" 907 | fi 908 | fi 909 | 910 | #vpx 911 | set_source "vpx" "git" "https://chromium.googlesource.com/webm/libvpx.git" "libvpx" 912 | if [ "${!SRC_ENABLE}" -ne 0 ] 913 | then 914 | fetch_source 915 | if [ "$BUILD" -ne 0 ] 916 | then 917 | cd_source 918 | export CROSS="$CXC_HOST"- 919 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$CXC_CFLAGS -fno-asynchronous-unwind-tables" --disable-debug --target=x86_64-win64-gcc --as=yasm --enable-static --disable-shared --disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-vp9 --enable-vp8 --enable-postproc --enable-vp9-postproc --enable-vp9-highbitdepth 920 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 921 | build_make $CXC_JOBS 922 | unset CROSS 923 | fi 924 | fi 925 | 926 | #x264 927 | set_source "x264" "git" "https://code.videolan.org/videolan/x264.git" "libx264" 928 | if [ "${!SRC_ENABLE}" -ne 0 ] 929 | then 930 | fetch_source 931 | if [ "$BUILD" -ne 0 ] 932 | then 933 | cd_source 934 | CFLAGS="$CXC_OPTIM" ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$CXC_OPTIM $CXC_CFLAGS" --host="$CXC_HOST" --bindir="$BIN_PATH" --enable-static --cross-prefix="$CXC_HOST"- --disable-cli 935 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 936 | build_make $CXC_JOBS 937 | fi 938 | fi 939 | 940 | #x265 941 | set_source "x265" "git" "https://bitbucket.org/multicoreware/x265_git.git" "libx265" 942 | if [ "${!SRC_ENABLE}" -ne 0 ] 943 | then 944 | fetch_source 945 | if [ "$BUILD" -ne 0 ] 946 | then 947 | cd_source 948 | 949 | build_message BM_WHITE "$SRC_NAME: configuring 12-bit" 950 | mkdir "${SRC_NAME}_build_12" 951 | cd "${SRC_NAME}_build_12" 952 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy -DENABLE_SHARED=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DHIGH_BIT_DEPTH=1 -DMAIN12=1 -DEXPORT_C_API=0 ../source 953 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 954 | make -j$CXC_JOBS 955 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 956 | 957 | build_message BM_WHITE "$SRC_NAME: configuring 10-bit" 958 | mkdir "../${SRC_NAME}_build_10" 959 | cd "../${SRC_NAME}_build_10" 960 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy -DENABLE_SHARED=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 ../source 961 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 962 | make -j$CXC_JOBS 963 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 964 | 965 | build_message BM_WHITE "$SRC_NAME: configuring 8-bit" 966 | mkdir "../${SRC_NAME}_build" 967 | cd "../${SRC_NAME}_build" 968 | ln -sf "../${SRC_NAME}_build_12/libx265.a" libx265_main12.a 969 | ln -sf "../${SRC_NAME}_build_10/libx265.a" libx265_main10.a 970 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy -DENABLE_SHARED=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS="-L." ../source 971 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 972 | make -j$CXC_JOBS 973 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 974 | mv libx265.a libx265_main.a 975 | ar -M <<<$(echo -e "CREATE libx265.a\nADDLIB libx265_main.a\nADDLIB libx265_main10.a\nADDLIB libx265_main12.a\nSAVE\nEND\n") 976 | [ $? -eq 0 ] || build_die "$THIS: (ar) multilib merge failed -> $SRC_NAME" 977 | 978 | build_make $CXC_JOBS 979 | if [[ "$CXC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 980 | then 981 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lstdc++" 982 | fi 983 | fi 984 | fi 985 | 986 | #dlfcn 987 | set_source "dlfcn" "git" "https://github.com/dlfcn-win32/dlfcn-win32.git" 988 | if [ "${!SRC_ENABLE}" -ne 0 ] 989 | then 990 | fetch_source 991 | if [ "$BUILD" -ne 0 ] 992 | then 993 | cd_source 994 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 . 995 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 996 | build_make $CXC_JOBS 997 | fi 998 | fi 999 | 1000 | #frei0r 1001 | set_source "frei0r" "git" "https://github.com/dyne/frei0r.git" "frei0r" 1002 | if [ "${!SRC_ENABLE}" -ne 0 ] 1003 | then 1004 | fetch_source 1005 | if [ "$BUILD" -ne 0 ] 1006 | then 1007 | cd_source 1008 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DWITHOUT_OPENCV=1 -DBUILD_SHARED_LIBS=0 . 1009 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1010 | build_make $CXC_JOBS 1011 | find "$ROOT_PATH/$OUT_PATH/lib/frei0r-1" -type f -name "*.dll" -print0 | xargs -0 strip 1012 | fi 1013 | fi 1014 | 1015 | #sdl 1016 | set_source "sdl" "git" "https://github.com/libsdl-org/SDL.git" 1017 | if [ "${!SRC_ENABLE}" -ne 0 ] 1018 | then 1019 | fetch_source 1020 | if [ "$BUILD" -ne 0 ] 1021 | then 1022 | cd_source 1023 | mkdir "${SRC_NAME}_build" 1024 | cd "${SRC_NAME}_build" 1025 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 .. 1026 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1027 | build_make $CXC_JOBS 1028 | rm -f "$BIN_PATH"/sdl* 1029 | fi 1030 | fi 1031 | 1032 | #amf 1033 | set_source "amf" "git" "https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git" "amf" 1034 | if [ "${!SRC_ENABLE}" -ne 0 ] 1035 | then 1036 | fetch_source 1037 | if [ "$BUILD" -ne 0 ] 1038 | then 1039 | cd_source 1040 | mkdir --parents "$ROOT_PATH/$OUT_PATH"/include/AMF && \ 1041 | cp -pv -r amf/public/include/* "$ROOT_PATH/$OUT_PATH"/include/AMF && \ 1042 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 1043 | build_message BM_GREEN "$SRC_NAME: installed" 1044 | fi 1045 | fi 1046 | 1047 | #mfx 1048 | set_source "mfx" "git" "https://github.com/lu-zero/mfx_dispatch.git" "libmfx" 1049 | if [ "${!SRC_ENABLE}" -ne 0 ] 1050 | then 1051 | fetch_source 1052 | if [ "$BUILD" -ne 0 ] 1053 | then 1054 | cd_source 1055 | autoreconf -fiv 1056 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$CXC_OPTIM $CXC_CFLAGS" CXXFLAGS="$CXC_OPTIM $CXC_CFLAGS" CPPFLAGS="$CXC_CPPFLAGS" --host="$CXC_HOST" "$CXC_BUILD" --bindir="$BIN_PATH" --enable-static --disable-shared 1057 | build_make $CXC_JOBS 1058 | ln -s "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/libmfx.pc" "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/mfx.pc" 1059 | fi 1060 | fi 1061 | 1062 | #vpl 1063 | set_source "vpl" "git" "https://github.com/intel/libvpl.git" "libvpl" 1064 | if [ "${!SRC_ENABLE}" -ne 0 ] 1065 | then 1066 | fetch_source 1067 | if [ "$BUILD" -ne 0 ] 1068 | then 1069 | cd_source 1070 | mkdir "${SRC_NAME}_build" 1071 | cd "${SRC_NAME}_build" 1072 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" ".." 1073 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1074 | build_make $CXC_JOBS 1075 | ln -s "$ROOT_PATH/$OUT_PATH/lib/libvpl.dll.a" "$ROOT_PATH/$OUT_PATH/lib/libvpl.a" 1076 | fi 1077 | fi 1078 | 1079 | #nvenc 1080 | set_source "nv-codec-headers" "git" "https://github.com/FFmpeg/nv-codec-headers.git" "nvenc" "nvdec" 1081 | if [ "${!SRC_ENABLE}" -ne 0 ] 1082 | then 1083 | fetch_source 1084 | if [ "$BUILD" -ne 0 ] 1085 | then 1086 | cd_source 1087 | build_make $CXC_JOBS PREFIX="$ROOT_PATH/$OUT_PATH" install 1088 | fi 1089 | fi 1090 | 1091 | #placebo 1092 | set_source "placebo" "git" "https://code.videolan.org/videolan/libplacebo.git" "libplacebo" 1093 | if [ "${!SRC_ENABLE}" -ne 0 ] 1094 | then 1095 | fetch_source 1096 | if [ "$BUILD" -ne 0 ] 1097 | then 1098 | mkdir "${SRC_NAME}_build" 1099 | cd "${SRC_NAME}_build" 1100 | meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release --strip --cross-file="$ROOT_PATH/$SRC_PATH/cross.meson" "../$SRC_NAME" 1101 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1102 | build_meson $CXC_JOBS 1103 | if [[ "$CXC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 1104 | then 1105 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lstdc++" 1106 | fi 1107 | fi 1108 | fi 1109 | 1110 | #vulkan 1111 | set_source "vulkan-headers" "git" "https://github.com/KhronosGroup/Vulkan-Headers.git" "vulkan" 1112 | if [ "${!SRC_ENABLE}" -ne 0 ] 1113 | then 1114 | fetch_source 1115 | if [ "$BUILD" -ne 0 ] 1116 | then 1117 | cd_source 1118 | mkdir "${SRC_NAME}_build" 1119 | cd "${SRC_NAME}_build" 1120 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" ".." 1121 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1122 | build_make 1123 | fi 1124 | fi 1125 | 1126 | #avisynth 1127 | set_source "avisynth" "git" "https://github.com/AviSynth/AviSynthPlus.git" "avisynth" 1128 | if [ "${!SRC_ENABLE}" -ne 0 ] 1129 | then 1130 | fetch_source 1131 | if [ "$BUILD" -ne 0 ] 1132 | then 1133 | cd_source 1134 | mkdir "${SRC_NAME}_build" 1135 | cd "${SRC_NAME}_build" 1136 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DHEADERS_ONLY=1 .. 1137 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1138 | build_make $CXC_JOBS VersionGen install 1139 | fi 1140 | fi 1141 | 1142 | #decklink 1143 | set_source "decklink" "git" "https://github.com/nanake/decklink-headers.git" "decklink" 1144 | if [ "${!SRC_ENABLE}" -ne 0 ] 1145 | then 1146 | fetch_source 1147 | if [ "$BUILD" -ne 0 ] 1148 | then 1149 | cd_source 1150 | build_make $CXC_JOBS PREFIX="$ROOT_PATH/$OUT_PATH" install 1151 | fi 1152 | fi 1153 | 1154 | #openssl 1155 | set_source "openssl" "git" "https://github.com/openssl/openssl.git" "openssl" 1156 | if [ "${!SRC_ENABLE}" -ne 0 ] 1157 | then 1158 | fetch_source 1159 | if [ "$BUILD" -ne 0 ] 1160 | then 1161 | cd_source 1162 | ./Configure no-ssl2 no-ssl3 no-weak-ssl-ciphers no-shared no-hw no-engine no-dso no-err no-tests zlib --prefix="$ROOT_PATH/$OUT_PATH" --libdir="$ROOT_PATH/$OUT_PATH/lib" --openssldir="$ROOT_PATH/$OUT_PATH" "$CXC_OPTIM $CXC_CFLAGS" --with-zlib-include="$ROOT_PATH/$OUT_PATH/include" --with-zlib-lib=$ROOT_PATH/$OUT_PATH/lib --cross-compile-prefix="$CXC_HOST-" mingw64 1163 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1164 | build_make $CXC_JOBS -i install_sw 1165 | fi 1166 | fi 1167 | 1168 | #libsrt 1169 | set_source "srt" "git" "https://github.com/Haivision/srt.git" "libsrt" 1170 | if [ "${!SRC_ENABLE}" -ne 0 ] 1171 | then 1172 | fetch_source 1173 | if [ "$BUILD" -ne 0 ] 1174 | then 1175 | cd_source 1176 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/cross.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DENABLE_SHARED=0 -DENABLE_APPS=0 -DENABLE_PROFILE=0 . 1177 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1178 | build_make $CXC_JOBS 1179 | fi 1180 | fi 1181 | 1182 | #vmaf 1183 | set_source "vmaf" "git" "https://github.com/Netflix/vmaf.git" "libvmaf" 1184 | if [ "${!SRC_ENABLE}" -ne 0 ] 1185 | then 1186 | fetch_source 1187 | if [ "$BUILD" -ne 0 ] 1188 | then 1189 | cd_source 1190 | mkdir "${SRC_NAME}_build" 1191 | cd "${SRC_NAME}_build" 1192 | meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Denable_docs=false -Denable_tests=false --strip --cross-file="$ROOT_PATH/$SRC_PATH/cross.meson" "../lib$SRC_NAME" 1193 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1194 | build_meson $CXC_JOBS 1195 | if [[ "$CXC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 1196 | then 1197 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lstdc++" 1198 | fi 1199 | fi 1200 | fi 1201 | 1202 | #ffmpeg 1203 | set_source "ffmpeg" "git" "https://git.ffmpeg.org/ffmpeg.git" "gpl" "version3" "nonfree" 1204 | if [ "${!SRC_ENABLE}" -ne 0 ] 1205 | then 1206 | fetch_source 1207 | BUILD_CMD="CPPFLAGS=\"$CXC_CPPFLAGS -Wno-error=incompatible-pointer-types\" ./configure\ 1208 | --cross-prefix=\"$CXC_HOST\"-\ 1209 | --arch=\"x86_64\"\ 1210 | --target-os=\"mingw64\"\ 1211 | --disable-debug\ 1212 | --disable-w32threads\ 1213 | --disable-shared\ 1214 | --enable-static\ 1215 | --prefix=\"$ROOT_PATH/$OUT_PATH\"\ 1216 | --pkg-config=\"pkg-config\"\ 1217 | --pkg-config-flags=\"--static\"\ 1218 | --extra-cflags=\"$CXC_OPTIM $CXC_CFLAGS\"\ 1219 | --extra-cxxflags=\"-fpermissive\"\ 1220 | --extra-ldflags=\"-static-libgcc -static-libstdc++ -static -s\"\ 1221 | --extra-ldflags=\"-L$ROOT_PATH/$OUT_PATH/lib\"\ 1222 | --extra-libs=\"$CXC_FFMPEG_EXTRA_LIBS\"\ 1223 | --bindir=\"$BIN_PATH\"\ 1224 | $CXC_FFMPEG_LIB_OPTIONS" 1225 | echo $BUILD_CMD 1226 | if [ "$BUILD" -ne 0 ] 1227 | then 1228 | cd_source 1229 | eval $BUILD_CMD 1230 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1231 | build_make $CXC_JOBS 1232 | fi 1233 | fi 1234 | -------------------------------------------------------------------------------- /ffmpeg-native: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_VERSION="1.9.2" 4 | THIS="ffmpeg-native" 5 | 6 | #build paths 7 | ROOT_PATH="${ROOT_PATH:-$HOME}" 8 | SRC_PATH="${SRC_PATH:-ffmpeg_sources}" 9 | OUT_PATH="${OUT_PATH:-ffmpeg_build}" 10 | BIN_PATH="${BIN_PATH:-$ROOT_PATH/$OUT_PATH/bin}" 11 | HINTS_FILE="${HINTS_FILE:-$ROOT_PATH/ffmpeg-native-build-hints}" 12 | NCC_PATH_LIST=\ 13 | ( \ 14 | "ROOT_PATH" "SRC_PATH" "OUT_PATH" "BIN_PATH" "HINTS_FILE" \ 15 | ) 16 | 17 | #compiler settings 18 | NCC_OPTIM="-O2" 19 | NCC_CFLAGS="-mtune=generic -march=x86-64 -pipe" 20 | NCC_CPPFLAGS="-DNDEBUG -I$ROOT_PATH/$OUT_PATH/include" 21 | NCC_RUSTFLAGS="" 22 | NCC_MACHINE="$(uname -m | tr '[:upper:]' '[:lower:]')" 23 | NCC_OS="$(uname -o | tr '[:upper:]' '[:lower:]')" 24 | #make settings 25 | NCC_JOBS=$(getconf _NPROCESSORS_ONLN) 26 | NCC_FETCH_ONLY="${NCC_FETCH_ONLY:-0}" 27 | NCC_SHOW_ONLY="${NCC_SHOW_ONLY:-0}" 28 | NCC_DISABLE_DEFAULT="${NCC_DISABLE_DEFAULT:-0}" 29 | NCC_OPTION_LIST=\ 30 | ( \ 31 | "HOST" "OPTIM" "CFLAGS" "JOBS" "FETCH_ONLY" "SHOW_ONLY" "DISABLE_DEFAULT" "RUSTFLAGS" \ 32 | ) 33 | 34 | NCC_SYSTEM_LIST=\ 35 | ( \ 36 | "MACHINE" "OS" \ 37 | ) 38 | 39 | NCC_SOURCE_LIST=\ 40 | ( \ 41 | "aom" "ass" "bzip2" "dav1d" "decklink-linux" "fdk-aac" "ffmpeg" "fftw3" \ 42 | "fontconfig" "freetype" "frei0r" "fribidi" "harfbuzz" "ladspa" \ 43 | "lame" "nv-codec-headers" "ogg" "openssl" "opus" "png" "rav1e" "rubberband" \ 44 | "samplerate" "sdl" "sofa" "soxr" "srt" "svt-av1" "theora" "vmaf" "vorbis" \ 45 | "vpx" "vulkan-headers" "webp" "xml2" "x264" "x265" "zlib" \ 46 | ) 47 | 48 | #lib options 49 | NCC_FFMPEG_EXTRA_LIBS="-lpthread -lm" 50 | 51 | #fix pkg-config env 52 | export PKG_CONFIG_DIR= 53 | export PKG_CONFIG_PATH= 54 | export PKG_CONFIG_LIBDIR="$ROOT_PATH/$OUT_PATH/lib/pkgconfig:$ROOT_PATH/$OUT_PATH/share/pkgconfig" 55 | 56 | build_message() { 57 | 58 | local BM_WHITE=15 59 | local BM_GREEN=10 60 | local BM_CYAN=14 61 | local BM_MAGENTA=200 62 | local BM_YELLOW=11 63 | local BM_RED=9 64 | local color=$1 65 | 66 | shift 67 | printf "\e[38;5;${!color}m====> $@ <====\e[0m\n" 1>&2 68 | } 69 | 70 | build_die() { 71 | 72 | build_message BM_RED "$@" 73 | exit 1 74 | } 75 | 76 | build_make() { 77 | 78 | local jobs="${1:-1}" 79 | shift 80 | local hint=$(get_hint "$SRC_NAME" "make") 81 | jobs="${hint:-$jobs}" 82 | 83 | make -j $jobs "$@" 84 | [ $? -eq 0 ] || build_die "$THIS: make stage failed (jobs = $jobs) -> $SRC_NAME" 85 | 86 | grep -E '((^[ ]*)|([ ]*))[^ ]*install[^ ]*[ ]*$' <<< "$@" &> /dev/null 87 | [ $? -eq 0 ] || make install 88 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 89 | 90 | build_message BM_GREEN "$SRC_NAME: built successfully (jobs = $jobs)" 91 | } 92 | 93 | build_meson() { 94 | 95 | local jobs="${1:-1}" 96 | shift 97 | 98 | ninja -j $jobs -C . 99 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 100 | ninja -C . install 101 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 102 | 103 | build_message BM_GREEN "$SRC_NAME: built successfully (jobs = $jobs)" 104 | } 105 | 106 | fetch_source() { 107 | 108 | local revision=$(get_hint "$SRC_NAME" "$SRC_METHOD") 109 | local url=$(get_hint "$SRC_NAME" "url") 110 | local status=1 111 | local scheme; 112 | local path; 113 | 114 | if [ -z "$url" ] 115 | then 116 | url="$SRC_URL" 117 | fi 118 | 119 | [[ "$url" =~ ^(file://)(.+)$ ]] 120 | scheme="${BASH_REMATCH[1]}" 121 | path="${BASH_REMATCH[2]}" 122 | 123 | if [ "$scheme" == "file://" ] 124 | then 125 | build_message BM_YELLOW "rsync $path/ ./$SRC_NAME/" 126 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 127 | then 128 | mkdir "$SRC_NAME" 129 | eval "rsync -ritl --stats $path/ ./$SRC_NAME/" 130 | status=$? 131 | fi 132 | fi 133 | 134 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 135 | then 136 | build_message BM_MAGENTA "$SRC_NAME: fetch -> $SRC_METHOD $url $revision" 137 | return 0 138 | fi 139 | 140 | case "$SRC_METHOD" in 141 | git) 142 | if [ "$scheme" != "file://" ] 143 | then 144 | git clone "$url" "$SRC_NAME" 145 | status=$? 146 | fi 147 | 148 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 149 | then 150 | cd_source 151 | git reset --hard "$revision" 152 | status=$? 153 | cd .. 154 | fi 155 | ;; 156 | svn) 157 | if [ "$scheme" != "file://" ] 158 | then 159 | svn checkout "$url" "$SRC_NAME" 160 | status=$? 161 | fi 162 | 163 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 164 | then 165 | cd_source 166 | svn up -r"$revision" 167 | status=$? 168 | cd .. 169 | fi 170 | ;; 171 | hg) 172 | if [ "$scheme" != "file://" ] 173 | then 174 | hg clone "$url" "$SRC_NAME" 175 | status=$? 176 | fi 177 | 178 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 179 | then 180 | cd_source 181 | hg revert -r "$revision" --all 182 | status=$? 183 | cd .. 184 | fi 185 | ;; 186 | wget) 187 | if [ "$scheme" != "file://" ] 188 | then 189 | local wOrigin="${url%/*}" 190 | local wFile="${url##*/}" 191 | if [ ! -z "$revision" ] 192 | then 193 | wFile="$revision" 194 | fi 195 | #echo "SRC_NAME="$SRC_NAME "SRC_URL="$SRC_URL "url="$url "revision="$revision "origin/file="$wOrigin/$wFile 196 | status=0 197 | if [ ! -d "$SRC_NAME" ] 198 | then 199 | mkdir "$SRC_NAME" 200 | status=$? 201 | fi 202 | [ $status -eq 0 ] && \ 203 | wget -O "$wFile" "$wOrigin/$wFile" && \ 204 | bsdtar -xvf "$wFile" -C "$SRC_NAME" 205 | status=$? 206 | fi 207 | ;; 208 | *) 209 | build_die "$THIS: invalid fetch method -> $SRC_NAME: $SRC_METHOD" 210 | ;; 211 | esac 212 | if [ $status -eq 0 ] 213 | then 214 | build_message BM_MAGENTA "$SRC_NAME: fetch success -> $SRC_METHOD $url $revision" 215 | else 216 | build_die "$THIS: fetch stage failed -> $SRC_NAME: $SRC_METHOD $url" 217 | fi 218 | } 219 | 220 | get_hint() { 221 | 222 | local status=1 223 | if [ -r "$HINTS_FILE" ] 224 | then 225 | #$1 name 226 | #$2 hint 227 | local name=$1 228 | shift 229 | local hint=$1 230 | shift 231 | 232 | awk -F'\t' -v name=$name -v hint=$hint \ 233 | '!($0 ~ /^[[:space:]]*#/) && !($0 ~ /^[[:space:]]*$/) && $1 == name && $2 == hint \ 234 | {printf "%s", $3; found=1; exit} \ 235 | END { if (found) {exit 0} else {exit 1}}' "$HINTS_FILE" 236 | 237 | status=$? 238 | fi 239 | return $status 240 | } 241 | 242 | get_NCC_hints() { 243 | 244 | local h 245 | local val 246 | local var 247 | 248 | #initialize enabled builds based on enable/disable default 249 | for h in "${NCC_SOURCE_LIST[@]}" 250 | do 251 | var="NCC_ENABLE_${h}" 252 | var="${var//[^A-Za-z0-9]/_}" 253 | var="${var^^}" 254 | #echo "$var" 255 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 256 | then 257 | val=1 258 | else 259 | val=0 260 | fi 261 | eval "$var=\$val" 262 | done 263 | 264 | #check for values from the hints file 265 | if [ -r "$HINTS_FILE" ] 266 | then 267 | for h in "${NCC_OPTION_LIST[@]}" 268 | do 269 | val="$(get_hint "NCC" "$h")" 270 | if [ $? -eq 0 ] 271 | then 272 | var="NCC_${h}" 273 | eval "$var=\$val" 274 | fi 275 | done 276 | 277 | for h in "${NCC_SOURCE_LIST[@]}" 278 | do 279 | var="NCC_ENABLE_${h}" 280 | var="${var//[^A-Za-z0-9]/_}" 281 | var="${var^^}" 282 | #echo "$var" 283 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 284 | then 285 | val="$(get_hint "$h" "disable")" 286 | if [ $? -eq 0 ] 287 | then 288 | val=0 289 | else 290 | val=1 291 | fi 292 | else 293 | val="$(get_hint "$h" "enable")" 294 | if [ $? -eq 0 ] 295 | then 296 | val=1 297 | else 298 | val=0 299 | fi 300 | fi 301 | eval "$var=\$val" 302 | done 303 | fi 304 | } 305 | 306 | set_source() { 307 | 308 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 309 | then 310 | cd "$ROOT_PATH/$SRC_PATH" 311 | fi 312 | 313 | SRC_NAME="$1" 314 | if [ "$#" -eq 1 ] 315 | then 316 | return 317 | fi 318 | 319 | shift 320 | SRC_ENABLE="NCC_ENABLE_${SRC_NAME}" 321 | SRC_ENABLE="${SRC_ENABLE//[^A-Za-z0-9]/_}" 322 | SRC_ENABLE="${SRC_ENABLE^^}" 323 | SRC_URL=$(get_hint "$SRC_NAME" "url") 324 | SRC_METHOD="$1" 325 | shift 326 | SRC_URL="${SRC_URL:-$1}" 327 | shift 328 | 329 | if [ "${!SRC_ENABLE}" -ne 0 ] 330 | then 331 | for arg in "$@" 332 | do 333 | NCC_FFMPEG_LIB_OPTIONS="$NCC_FFMPEG_LIB_OPTIONS --enable-$arg" 334 | done 335 | build_message BM_CYAN "$SRC_NAME" 336 | fi 337 | } 338 | 339 | cd_source() { 340 | 341 | cd $SRC_NAME 342 | [ $? -eq 0 ] || build_die "$THIS: unable to change to directory -> $SRC_NAME" 343 | if [ ! -z "$1" ] 344 | then 345 | cd $(ls -d1 $1*/ | head -n 1) 346 | [ $? -eq 0 ] || build_die "$THIS: unable to change to directory -> $SRC_NAME" 347 | fi 348 | } 349 | 350 | #startup banner 351 | build_message BM_WHITE "$THIS: Version $SCRIPT_VERSION" 352 | build_message BM_WHITE "$THIS: $(gcc -v 2>&1 | grep '^gcc version')" 353 | 354 | #load NCC hints 355 | get_NCC_hints 356 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 357 | then 358 | { 359 | for i in "${NCC_PATH_LIST[@]}" 360 | do 361 | echo "$i: ${!i}" 362 | done 363 | } | sort 364 | { 365 | for i in "${NCC_OPTION_LIST[@]}" 366 | do 367 | var="NCC_${i}" 368 | echo "$var: ${!var}" 369 | done 370 | } | sort 371 | { 372 | for i in "${NCC_SOURCE_LIST[@]}" 373 | do 374 | var="NCC_ENABLE_${i}" 375 | var="${var//[^A-Za-z0-9]/_}" 376 | var="${var^^}" 377 | echo "$var: ${!var} ($i)" 378 | done 379 | } | sort 380 | fi 381 | 382 | if [ "$NCC_FETCH_ONLY" -eq 0 ] && [ "$NCC_SHOW_ONLY" -eq 0 ] 383 | then 384 | BUILD=1 385 | else 386 | BUILD=0 387 | fi 388 | 389 | #ensure clean build 390 | if [ "$BUILD" -ne 0 ] 391 | then 392 | rm -rf "$ROOT_PATH/$OUT_PATH" 393 | [ -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to remove build directory -> $ROOT_PATH/$OUT_PATH" 394 | fi 395 | 396 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 397 | then 398 | rm -rf "$ROOT_PATH/$SRC_PATH" 399 | [ -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to remove source directory -> $ROOT_PATH/$SRC_PATH" 400 | fi 401 | 402 | if [ "$BUILD" -ne 0 ] 403 | then 404 | mkdir --parents "$ROOT_PATH/$OUT_PATH/misc" 405 | [ ! -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to create build directory -> $ROOT_PATH/$OUT_PATH" 406 | fi 407 | 408 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 409 | then 410 | mkdir "$ROOT_PATH/$SRC_PATH" 411 | [ ! -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to create source directory -> $ROOT_PATH/$SRC_PATH" 412 | fi 413 | 414 | if [ "$BUILD" -ne 0 ] 415 | then 416 | #cmake toolchain settings 417 | touch $ROOT_PATH/$SRC_PATH/native.cmake 418 | FORCE_CMAKE_VALUE='CACHE STRING "" FORCE' 419 | #echo "SET(CMAKE_VERBOSE_MAKEFILE 1 $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 420 | echo "SET(CMAKE_SYSTEM_NAME Linux $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 421 | echo "SET(CMAKE_BUILD_TYPE Release $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 422 | echo "SET(CMAKE_SYSTEM_PROCESSOR x86_64 $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 423 | echo "SET(CMAKE_C_COMPILER gcc $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 424 | echo "SET(CMAKE_CXX_COMPILER g++ $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 425 | echo "SET(CMAKE_C_FLAGS \"$NCC_CFLAGS -I $ROOT_PATH/$OUT_PATH/include\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 426 | echo "SET(CMAKE_C_FLAGS_RELEASE \"$NCC_OPTIM -DNDEBUG\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 427 | echo "SET(CMAKE_CXX_FLAGS \"$NCC_CFLAGS -fpermissive -I $ROOT_PATH/$OUT_PATH/include\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 428 | echo "SET(CMAKE_CXX_FLAGS_RELEASE \"$NCC_OPTIM -DNDEBUG\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 429 | echo "SET(CMAKE_CPP_FLAGS \"$NCC_CPPFLAGS\" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 430 | echo "SET(CMAKE_ASM_YASM_COMPILER yasm $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 431 | echo "SET(CMAKE_ASM_NASM_COMPILER nasm $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 432 | echo "SET(CMAKE_FIND_LIBRARY_SUFFIXES .a $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 433 | echo 'SET(CMAKE_STATIC_LIBRARY_LINK_C_FLAGS "-static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 434 | echo 'SET(CMAKE_STATIC_LIBRARY_LINK_CXX_FLAGS "-static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 435 | #echo 'SET(CMAKE_STATIC_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 436 | echo 'SET(CMAKE_MODULE_LINKER_FLAGS "-s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 437 | echo 'SET(CMAKE_SHARED_LINKER_FLAGS "-static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 438 | echo 'SET(CMAKE_EXE_LINKER_FLAGS "-static -s"'" $FORCE_CMAKE_VALUE)" >> $ROOT_PATH/$SRC_PATH/native.cmake 439 | 440 | fi 441 | 442 | #display the detected system type and hints file in use 443 | if [ "$BUILD" -ne 0 ] 444 | then 445 | for i in "${NCC_SYSTEM_LIST[@]}" 446 | do 447 | var="NCC_${i}" 448 | echo "$var: ${!var}" 449 | done 450 | echo -n "HINTS_FILE: $HINTS_FILE" 451 | if [ ! -e "$HINTS_FILE" ] || [ ! -r "$HINTS_FILE" ] 452 | then 453 | echo " (unreadable)" 454 | else 455 | echo " (readable)" 456 | fi 457 | fi 458 | 459 | #build the sources 460 | 461 | #zlib 462 | set_source "zlib" "git" "https://github.com/madler/zlib.git" "zlib" 463 | if [ "${!SRC_ENABLE}" -ne 0 ] 464 | then 465 | fetch_source 466 | if [ "$BUILD" -ne 0 ] 467 | then 468 | cd_source 469 | CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" LDFLAGS="-L$ROOT_PATH/$OUT_PATH/lib -l:libz.a" ./configure --prefix="$ROOT_PATH/$OUT_PATH" --static 470 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 471 | build_make $NCC_JOBS 472 | fi 473 | fi 474 | 475 | #bzip2 476 | set_source "bzip2" "git" "https://sourceware.org/git/bzip2.git" "bzlib" 477 | if [ "${!SRC_ENABLE}" -ne 0 ] 478 | then 479 | fetch_source 480 | if [ "$BUILD" -ne 0 ] 481 | then 482 | cd_source 483 | sed -i -r "s/^(CFLAGS=.+)-O2 -g(.+)/\1${NCC_OPTIM} ${NCC_CFLAGS}\2/" Makefile 484 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 485 | build_make $NCC_JOBS PREFIX="$ROOT_PATH/$OUT_PATH" libbz2.a install 486 | fi 487 | fi 488 | 489 | #png16 490 | set_source "png" "git" "https://git.code.sf.net/p/libpng/code" 491 | if [ "${!SRC_ENABLE}" -ne 0 ] 492 | then 493 | fetch_source 494 | if [ "$BUILD" -ne 0 ] 495 | then 496 | cd_source 497 | autoreconf -fiv 498 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" LDFLAGS="-L$ROOT_PATH/$OUT_PATH/lib" --enable-static --disable-shared 499 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 500 | build_make $NCC_JOBS 501 | fi 502 | fi 503 | 504 | #webp 505 | set_source "webp" "git" "https://chromium.googlesource.com/webm/libwebp" "libwebp" 506 | if [ "${!SRC_ENABLE}" -ne 0 ] 507 | then 508 | fetch_source 509 | if [ "$BUILD" -ne 0 ] 510 | then 511 | cd_source 512 | mkdir "${SRC_NAME}_build" 513 | cd "${SRC_NAME}_build" 514 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DWEBP_BUILD_ANIM_UTILS=0 -DWEBP_BUILD_CWEBP=0 -DWEBP_BUILD_DWEBP=0 -DWEBP_BUILD_VWEBP=0 -DWEBP_BUILD_IMG2WEBP=0 -DWEBP_BUILD_GIF2WEBP=0 -DWEBP_BUILD_WEBPINFO=0 -DWEBP_BUILD_EXTRAS=0 -DWEBP_BUILD_WEBPMUX=0 -DWEBP_BUILD_WEBP_JS=0 .. 515 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 516 | build_make $NCC_JOBS 517 | fi 518 | fi 519 | 520 | #freetype 521 | set_source "freetype" "git" "https://gitlab.freedesktop.org/freetype/freetype.git" "libfreetype" 522 | if [ "${!SRC_ENABLE}" -ne 0 ] 523 | then 524 | fetch_source 525 | if [ "$BUILD" -ne 0 ] 526 | then 527 | cd_source 528 | ./autogen.sh 529 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared 530 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 531 | build_make $NCC_JOBS 532 | fi 533 | fi 534 | 535 | #fribidi 536 | set_source "fribidi" "git" "https://github.com/fribidi/fribidi.git" "libfribidi" 537 | if [ "${!SRC_ENABLE}" -ne 0 ] 538 | then 539 | fetch_source 540 | if [ "$BUILD" -ne 0 ] 541 | then 542 | NCC_CPPFLAGS="$NCC_CPPFLAGS -DFRIBIDI_LIB_STATIC" 543 | mkdir "${SRC_NAME}_build" 544 | cd "${SRC_NAME}_build" 545 | CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" CFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Ddocs=false -Dtests=false "../$SRC_NAME" 546 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 547 | build_meson $NCC_JOBS 548 | fi 549 | fi 550 | 551 | #libxml2 552 | set_source "xml2" "git" "https://github.com/GNOME/libxml2.git" "libxml2" 553 | if [ "${!SRC_ENABLE}" -ne 0 ] 554 | then 555 | fetch_source 556 | if [ "$BUILD" -ne 0 ] 557 | then 558 | cd_source 559 | autoreconf -fiv 560 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared --with-python=no 561 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 562 | build_make $NCC_JOBS 563 | fi 564 | fi 565 | 566 | #fontconfig 567 | set_source "fontconfig" "git" "https://gitlab.freedesktop.org/fontconfig/fontconfig.git" "libfontconfig" 568 | if [ "${!SRC_ENABLE}" -ne 0 ] 569 | then 570 | fetch_source 571 | if [ "$BUILD" -ne 0 ] 572 | then 573 | cd_source 574 | #mkdir "${SRC_NAME}_build" 575 | #cd "${SRC_NAME}_build" 576 | #CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" CFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Dtools=disabled -Ddoc=disabled -Dtests=disabled Dnls=disabled --strip ".." 577 | autoreconf -fiv 578 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared --disable-docs --enable-libxml2 579 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 580 | build_make $NCC_JOBS 581 | fi 582 | fi 583 | 584 | #harfbuzz - handle the freetype circular dependency 585 | set_source "harfbuzz" "git" "https://github.com/harfbuzz/harfbuzz.git" 586 | if [ "${!SRC_ENABLE}" -ne 0 ] 587 | then 588 | fetch_source 589 | if [ "$BUILD" -ne 0 ] 590 | then 591 | cd_source 592 | mkdir "${SRC_NAME}_build" 593 | cd "${SRC_NAME}_build" 594 | CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" CFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Dfreetype=enabled -Dcairo=disabled -Dglib=disabled -Dicu=disabled -Dintrospection=disabled -Dbenchmark=disabled -Ddocs=disabled -Dtests=disabled --strip ".." 595 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 596 | build_meson $NCC_JOBS 597 | #now rebuild freetype to be harfbuzz aware 598 | set_source "freetype" 599 | cd_source 600 | make clean 601 | ./autogen.sh 602 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared 603 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 604 | build_make $NCC_JOBS 605 | NCC_FFMPEG_EXTRA_LIBS="-lharfbuzz -lfreetype -lpng16 -lz $NCC_FFMPEG_EXTRA_LIBS" 606 | fi 607 | fi 608 | 609 | #libass 610 | set_source "ass" "git" "https://github.com/libass/libass.git" "libass" 611 | if [ "${!SRC_ENABLE}" -ne 0 ] 612 | then 613 | fetch_source 614 | if [ "$BUILD" -ne 0 ] 615 | then 616 | cd_source 617 | autoreconf -fiv 618 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS -Wno-error=incompatible-pointer-types" --enable-static --disable-shared 619 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 620 | build_make $NCC_JOBS 621 | fi 622 | fi 623 | 624 | #libsamplerate 625 | set_source "samplerate" "git" "https://github.com/erikd/libsamplerate.git" 626 | if [ "${!SRC_ENABLE}" -ne 0 ] 627 | then 628 | fetch_source 629 | if [ "$BUILD" -ne 0 ] 630 | then 631 | cd_source 632 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DBUILD_TESTING=0 -DLIBSAMPLERATE_EXAMPLES=0 . 633 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 634 | build_make $NCC_JOBS 635 | fi 636 | fi 637 | 638 | #fftw3 639 | set_source "fftw3" "wget" "http://fftw.org/fftw-3.3.10.tar.gz" 640 | if [ "${!SRC_ENABLE}" -ne 0 ] 641 | then 642 | fetch_source 643 | if [ "$BUILD" -ne 0 ] 644 | then 645 | cd_source "fftw-" 646 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DBUILD_TESTS=0 -DDISABLE_FORTRAN=1 . 647 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 648 | build_make $NCC_JOBS 649 | ln -s "$ROOT_PATH/$OUT_PATH"/lib/pkgconfig/fftw*.pc "$ROOT_PATH/$OUT_PATH"/lib/pkgconfig/fftw3.pc 650 | fi 651 | fi 652 | 653 | #ladspa 654 | set_source "ladspa" "git" "https://github.com/swh/ladspa.git" 655 | if [ "${!SRC_ENABLE}" -ne 0 ] 656 | then 657 | fetch_source 658 | if [ "$BUILD" -ne 0 ] 659 | then 660 | cd_source 661 | cp --verbose ladspa.h "$ROOT_PATH/$OUT_PATH/include" 662 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 663 | build_message BM_GREEN "$SRC_NAME: installed" 664 | fi 665 | fi 666 | 667 | #librubberband 668 | set_source "rubberband" "hg" "https://hg.sr.ht/~breakfastquay/rubberband" "librubberband" 669 | if [ "${!SRC_ENABLE}" -ne 0 ] 670 | then 671 | fetch_source 672 | if [ "$BUILD" -ne 0 ] 673 | then 674 | cd_source 675 | mkdir "${SRC_NAME}_build" 676 | cd "${SRC_NAME}_build" 677 | meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Dfft=fftw -Dvamp=disabled -Dlv2=disabled -Dcmdline=disabled --strip ".." 678 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 679 | build_meson $NCC_JOBS && \ 680 | cp --verbose -r "../rubberband/" "$ROOT_PATH/$OUT_PATH/include" && \ 681 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 682 | build_message BM_GREEN "$SRC_NAME: installed" 683 | NCC_FFMPEG_EXTRA_LIBS="$NCC_FFMPEG_EXTRA_LIBS -lsamplerate -lfftw3" 684 | fi 685 | fi 686 | 687 | #sofa 688 | set_source "sofa" "git" "https://github.com/hoene/libmysofa.git" "libmysofa" 689 | if [ "${!SRC_ENABLE}" -ne 0 ] 690 | then 691 | fetch_source 692 | if [ "$BUILD" -ne 0 ] 693 | then 694 | cd_source 695 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DZLIB_LIBRARY="$ROOT_PATH/$OUT_PATH/lib/libz.a" -DBUILD_SHARED_LIBS=0 -DBUILD_TESTS=0 -DCODE_COVERAGE=0 . 696 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 697 | build_make $NCC_JOBS 698 | fi 699 | fi 700 | 701 | #soxr 702 | set_source "soxr" "git" "https://git.code.sf.net/p/soxr/code" "libsoxr" 703 | if [ "${!SRC_ENABLE}" -ne 0 ] 704 | then 705 | fetch_source 706 | if [ "$BUILD" -ne 0 ] 707 | then 708 | cd_source 709 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DBUILD_EXAMPLES=0 -DBUILD_TESTS=0 -DBUILD_LSR_TESTS=0 . 710 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 711 | build_make $NCC_JOBS 712 | NCC_FFMPEG_EXTRA_LIBS="$NCC_FFMPEG_EXTRA_LIBS -lgomp" 713 | fi 714 | fi 715 | 716 | #fdk-aac 717 | set_source "fdk-aac" "git" "https://github.com/mstorsjo/fdk-aac.git" "libfdk-aac" 718 | if [ "${!SRC_ENABLE}" -ne 0 ] 719 | then 720 | fetch_source 721 | if [ "$BUILD" -ne 0 ] 722 | then 723 | cd_source 724 | autoreconf -fiv 725 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared 726 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 727 | build_make $NCC_JOBS 728 | fi 729 | fi 730 | 731 | #lame 732 | set_source "lame" "svn" "https://svn.code.sf.net/p/lame/svn/trunk/lame" "libmp3lame" 733 | if [ "${!SRC_ENABLE}" -ne 0 ] 734 | then 735 | fetch_source 736 | if [ "$BUILD" -ne 0 ] 737 | then 738 | cd_source 739 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS -Wno-error=incompatible-pointer-types" --enable-nasm --disable-shared --disable-frontend --disable-decoder 740 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 741 | build_make $NCC_JOBS 742 | fi 743 | fi 744 | 745 | #ogg 746 | set_source "ogg" "git" "https://github.com/xiph/ogg.git" 747 | if [ "${!SRC_ENABLE}" -ne 0 ] 748 | then 749 | fetch_source 750 | if [ "$BUILD" -ne 0 ] 751 | then 752 | cd_source 753 | ./autogen.sh 754 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared 755 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 756 | build_make $NCC_JOBS 757 | fi 758 | fi 759 | 760 | #opus 761 | set_source "opus" "git" "https://github.com/xiph/opus.git" "libopus" 762 | if [ "${!SRC_ENABLE}" -ne 0 ] 763 | then 764 | fetch_source 765 | if [ "$BUILD" -ne 0 ] 766 | then 767 | cd_source 768 | ./autogen.sh 769 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared --disable-doc --disable-examples 770 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 771 | build_make $NCC_JOBS 772 | fi 773 | fi 774 | 775 | #vorbis 776 | set_source "vorbis" "git" "https://github.com/xiph/vorbis.git" "libvorbis" 777 | if [ "${!SRC_ENABLE}" -ne 0 ] 778 | then 779 | fetch_source 780 | if [ "$BUILD" -ne 0 ] 781 | then 782 | cd_source 783 | ./autogen.sh 784 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared -disable-docs --disable-examples 785 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 786 | build_make $NCC_JOBS 787 | fi 788 | fi 789 | 790 | #theora 791 | set_source "theora" "git" "https://github.com/xiph/theora.git" "libtheora" 792 | if [ "${!SRC_ENABLE}" -ne 0 ] 793 | then 794 | fetch_source 795 | if [ "$BUILD" -ne 0 ] 796 | then 797 | cd_source 798 | ./autogen.sh 799 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared --disable-doc --disable-oggtest --disable-vorbistest --disable-examples 800 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 801 | build_make $NCC_JOBS 802 | fi 803 | fi 804 | 805 | #aom AV1 806 | set_source "aom" "git" "https://aomedia.googlesource.com/aom" "libaom" 807 | if [ "${!SRC_ENABLE}" -ne 0 ] 808 | then 809 | fetch_source 810 | if [ "$BUILD" -ne 0 ] 811 | then 812 | mkdir "${SRC_NAME}_build" 813 | cd "${SRC_NAME}_build" 814 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DAOM_TARGET_CPU="x86_64" -DBUILD_SHARED_LIBS=0 -DENABLE_NASM=1 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TOOLS=0 -DENABLE_TESTS=0 "../$SRC_NAME" 815 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 816 | build_make $NCC_JOBS 817 | fi 818 | fi 819 | 820 | #svtav1 821 | set_source "svt-av1" "git" "https://gitlab.com/AOMediaCodec/SVT-AV1.git" "libsvtav1" 822 | if [ "${!SRC_ENABLE}" -ne 0 ] 823 | then 824 | fetch_source 825 | if [ "$BUILD" -ne 0 ] 826 | then 827 | mkdir "${SRC_NAME}_build" 828 | cd "${SRC_NAME}_build" 829 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 -DENABLE_NASM=1 "../$SRC_NAME" 830 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 831 | build_make $NCC_JOBS 832 | fi 833 | fi 834 | 835 | #dav1d 836 | set_source "dav1d" "git" "https://code.videolan.org/videolan/dav1d.git" "libdav1d" 837 | if [ "${!SRC_ENABLE}" -ne 0 ] 838 | then 839 | fetch_source 840 | if [ "$BUILD" -ne 0 ] 841 | then 842 | mkdir "${SRC_NAME}_build" 843 | cd "${SRC_NAME}_build" 844 | CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" CFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Denable_tools=false -Denable_tests=false --strip "../${SRC_NAME}" 845 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 846 | build_meson $NCC_JOBS 847 | fi 848 | fi 849 | 850 | #rav1e 851 | set_source "rav1e" "git" "https://github.com/xiph/rav1e.git" "librav1e" 852 | if [ "${!SRC_ENABLE}" -ne 0 ] 853 | then 854 | fetch_source 855 | if [ "$BUILD" -ne 0 ] 856 | then 857 | cd_source 858 | PKG_CONFIG_LIBDIR="" RUSTFLAGS="$NCC_RUSTFLAGS" cargo cinstall --prefix="$ROOT_PATH/$OUT_PATH" --lib --release --target x86_64-unknown-linux-musl 859 | [ $? -eq 0 ] || build_die "$THIS: build stage failed -> $SRC_NAME" 860 | fi 861 | fi 862 | 863 | #vpx 864 | set_source "vpx" "git" "https://chromium.googlesource.com/webm/libvpx.git" "libvpx" 865 | if [ "${!SRC_ENABLE}" -ne 0 ] 866 | then 867 | fetch_source 868 | if [ "$BUILD" -ne 0 ] 869 | then 870 | cd_source 871 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_CFLAGS" --disable-debug --target=x86_64-linux-gcc --as=yasm --enable-static --disable-shared --disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-vp9 --enable-vp8 --enable-postproc --enable-vp9-postproc --enable-vp9-highbitdepth 872 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 873 | build_make $NCC_JOBS 874 | fi 875 | fi 876 | 877 | #x264 878 | set_source "x264" "git" "https://code.videolan.org/videolan/x264.git" "libx264" 879 | if [ "${!SRC_ENABLE}" -ne 0 ] 880 | then 881 | fetch_source 882 | if [ "$BUILD" -ne 0 ] 883 | then 884 | cd_source 885 | CFLAGS="$NCC_OPTIM" ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_OPTIM $NCC_CFLAGS" --bindir="$BIN_PATH" --enable-static --disable-cli 886 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 887 | build_make $NCC_JOBS 888 | fi 889 | fi 890 | 891 | #x265 892 | set_source "x265" "git" "https://bitbucket.org/multicoreware/x265_git.git" "libx265" 893 | if [ "${!SRC_ENABLE}" -ne 0 ] 894 | then 895 | fetch_source 896 | if [ "$BUILD" -ne 0 ] 897 | then 898 | cd_source 899 | 900 | build_message BM_WHITE "$SRC_NAME: configuring 12-bit" 901 | mkdir "${SRC_NAME}_build_12" 902 | cd "${SRC_NAME}_build_12" 903 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy -DENABLE_SHARED=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DHIGH_BIT_DEPTH=1 -DMAIN12=1 -DEXPORT_C_API=0 ../source 904 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 905 | make -j$NCC_JOBS 906 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 907 | 908 | build_message BM_WHITE "$SRC_NAME: configuring 10-bit" 909 | mkdir "../${SRC_NAME}_build_10" 910 | cd "../${SRC_NAME}_build_10" 911 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy -DENABLE_SHARED=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 ../source 912 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 913 | make -j$NCC_JOBS 914 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 915 | 916 | build_message BM_WHITE "$SRC_NAME: configuring 8-bit" 917 | mkdir "../${SRC_NAME}_build" 918 | cd "../${SRC_NAME}_build" 919 | ln -sf "../${SRC_NAME}_build_12/libx265.a" libx265_main12.a 920 | ln -sf "../${SRC_NAME}_build_10/libx265.a" libx265_main10.a 921 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy -DENABLE_SHARED=0 -DENABLE_CLI=0 -DENABLE_TESTS=0 -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS="-L." ../source 922 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 923 | make -j$NCC_JOBS 924 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 925 | mv libx265.a libx265_main.a 926 | ar -M <<<$(echo -e "CREATE libx265.a\nADDLIB libx265_main.a\nADDLIB libx265_main10.a\nADDLIB libx265_main12.a\nSAVE\nEND\n") 927 | [ $? -eq 0 ] || build_die "$THIS: (ar) multilib merge failed -> $SRC_NAME" 928 | 929 | build_make $NCC_JOBS 930 | if [[ "$NCC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 931 | then 932 | NCC_FFMPEG_EXTRA_LIBS="$NCC_FFMPEG_EXTRA_LIBS -lstdc++" 933 | fi 934 | fi 935 | fi 936 | 937 | #frei0r 938 | set_source "frei0r" "git" "https://github.com/dyne/frei0r.git" "frei0r" 939 | if [ "${!SRC_ENABLE}" -ne 0 ] 940 | then 941 | fetch_source 942 | if [ "$BUILD" -ne 0 ] 943 | then 944 | cd_source 945 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DWITHOUT_OPENCV=1 -DBUILD_SHARED_LIBS=0 . 946 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 947 | build_make $NCC_JOBS 948 | find "$ROOT_PATH/$OUT_PATH/lib/frei0r-1" -type f -name "*.so" -print0 | xargs -0 strip 949 | fi 950 | fi 951 | 952 | #sdl 953 | set_source "sdl" "git" "https://github.com/libsdl-org/SDL.git" 954 | if [ "${!SRC_ENABLE}" -ne 0 ] 955 | then 956 | fetch_source 957 | if [ "$BUILD" -ne 0 ] 958 | then 959 | cd_source 960 | mv .git .temp_git 961 | # mkdir "${SRC_NAME}_build" 962 | # cd "${SRC_NAME}_build" 963 | # cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DBUILD_SHARED_LIBS=0 .. 964 | CFLAGS=-DDECLSPEC= ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --bindir="$BIN_PATH" --enable-static --disable-shared 965 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 966 | build_make $NCC_JOBS 967 | rm -f "$BIN_PATH"/sdl* 968 | mv .temp_git .git 969 | fi 970 | fi 971 | 972 | #nvenc 973 | set_source "nv-codec-headers" "git" "https://github.com/FFmpeg/nv-codec-headers.git" "nvenc" "nvdec" 974 | if [ "${!SRC_ENABLE}" -ne 0 ] 975 | then 976 | fetch_source 977 | if [ "$BUILD" -ne 0 ] 978 | then 979 | cd_source 980 | build_make $NCC_JOBS PREFIX="$ROOT_PATH/$OUT_PATH" install 981 | fi 982 | fi 983 | 984 | #vulkan 985 | set_source "vulkan-headers" "git" "https://github.com/KhronosGroup/Vulkan-Headers.git" "vulkan" 986 | if [ "${!SRC_ENABLE}" -ne 0 ] 987 | then 988 | fetch_source 989 | if [ "$BUILD" -ne 0 ] 990 | then 991 | cd_source 992 | mkdir "${SRC_NAME}_build" 993 | cd "${SRC_NAME}_build" 994 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" ".." 995 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 996 | build_make 997 | fi 998 | fi 999 | 1000 | #decklink 1001 | set_source "decklink-linux" "git" "https://github.com/nachochip/Blackmagic-SDK.git" "decklink" 1002 | if [ "${!SRC_ENABLE}" -ne 0 ] 1003 | then 1004 | fetch_source 1005 | if [ "$BUILD" -ne 0 ] 1006 | then 1007 | cd_source 1008 | cp --verbose Linux/include/* "$ROOT_PATH/$OUT_PATH/include" 1009 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 1010 | build_message BM_GREEN "$SRC_NAME: installed" 1011 | fi 1012 | fi 1013 | 1014 | #openssl 1015 | set_source "openssl" "git" "https://github.com/openssl/openssl.git" "openssl" 1016 | if [ "${!SRC_ENABLE}" -ne 0 ] 1017 | then 1018 | fetch_source 1019 | if [ "$BUILD" -ne 0 ] 1020 | then 1021 | cd_source 1022 | ./config no-ssl2 no-ssl3 no-weak-ssl-ciphers no-shared no-hw no-engine no-dso no-err no-tests zlib --prefix="$ROOT_PATH/$OUT_PATH" --libdir="$ROOT_PATH/$OUT_PATH/lib" --openssldir="$ROOT_PATH/$OUT_PATH" "$NCC_OPTIM $NCC_CFLAGS" --with-zlib-include="$ROOT_PATH/$OUT_PATH/include" --with-zlib-lib="$ROOT_PATH/$OUT_PATH/lib" 1023 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1024 | build_make $NCC_JOBS install_sw 1025 | fi 1026 | fi 1027 | 1028 | #libsrt 1029 | set_source "srt" "git" "https://github.com/Haivision/srt.git" "libsrt" 1030 | if [ "${!SRC_ENABLE}" -ne 0 ] 1031 | then 1032 | fetch_source 1033 | if [ "$BUILD" -ne 0 ] 1034 | then 1035 | cd_source 1036 | cmake -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DCMAKE_FIND_ROOT_PATH="$ROOT_PATH/$OUT_PATH" -DENABLE_SHARED=0 -DENABLE_APPS=0 -DENABLE_PROFILE=0 . 1037 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1038 | build_make $NCC_JOBS 1039 | fi 1040 | fi 1041 | 1042 | #vmaf 1043 | set_source "vmaf" "git" "https://github.com/Netflix/vmaf.git" "libvmaf" 1044 | if [ "${!SRC_ENABLE}" -ne 0 ] 1045 | then 1046 | fetch_source 1047 | if [ "$BUILD" -ne 0 ] 1048 | then 1049 | cd_source 1050 | mkdir "${SRC_NAME}_build" 1051 | cd "${SRC_NAME}_build" 1052 | CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" CFLAGS="$NCC_OPTIM $NCC_CFLAGS $NCC_CPPFLAGS" meson setup --prefix="$ROOT_PATH/$OUT_PATH" --libdir="lib" -Ddefault_library=static --buildtype=release -Denable_docs=false -Denable_tests=false --strip "../lib$SRC_NAME" 1053 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1054 | build_meson $NCC_JOBS 1055 | if [[ "$NCC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 1056 | then 1057 | NCC_FFMPEG_EXTRA_LIBS="$NCC_FFMPEG_EXTRA_LIBS -lstdc++" 1058 | fi 1059 | fi 1060 | fi 1061 | 1062 | if [ "$BUILD" -ne 0 ] 1063 | then 1064 | #move shared libs to 'misc' to hide from linker 1065 | find "$ROOT_PATH/$OUT_PATH/lib" -type f -a -! -path "*/frei0r-1/*" -a -\( -name "*.so" -o -name "*.so.*" -\) -exec mv -t "$ROOT_PATH/$OUT_PATH/misc" '{}' \; 2>/dev/null 1066 | find "$ROOT_PATH/$OUT_PATH/lib" -type l -a -\( -name "*.so" -o -name "*.so.*" -\) -delete \; 2>/dev/null 1067 | 1068 | if [ ! -z "$MFX_DEV" ] 1069 | then 1070 | #try to find libmfx & libva at the specified locations and make files available to the build 1071 | while read lp 1072 | do 1073 | build_message BM_YELLOW "enable-libmfx: searching path '$lp'" 1074 | rsync -rvt -R --files-from=<(find "$lp" -type f \( -path "*/lib*" -o -path "*/include/*" \) -a \( -name "*libmfx[.-]*" -o -path "*/mfx/*" -o -name "*libva[.-]*" -o -path "*/va/*" \) -a -! \( -name "*.so.*" -o -name "*.so" \) 2>/dev/null |\ 1075 | sed -r "s#^${lp}/#/${lp}/./#") / "$ROOT_PATH/$OUT_PATH" 1076 | done < <(awk -F':' '{for (i = 1 ; i <= NF ; i++) { print $i }}' <<< ${MFX_DEV}) 1077 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> enable-libmfx" 1078 | 1079 | #make links if the *.pc files are not in .../lib/pkgconfig 1080 | find $ROOT_PATH/$OUT_PATH/lib* -type f \( -name "*libmfx[.-]*" -o -name "*libva[.-]*" \) -name "*.pc" -! -path "*/lib/pkgconfig/*" | tee >(cat 1>&2) | while read f ; do ln -sf "$f" "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/${f##*/}" ; done 1081 | NCC_FFMPEG_LIB_OPTIONS="$NCC_FFMPEG_LIB_OPTIONS --enable-vaapi --enable-libmfx" 1082 | build_message BM_GREEN "enable-libmfx: success" 1083 | fi 1084 | 1085 | if [ ! -z "$VPL_DEV" ] 1086 | then 1087 | #try to find libvpl & libva at the specified locations and make files available to the build 1088 | while read lp 1089 | do 1090 | build_message BM_YELLOW "enable-libvpl: searching path '$lp'" 1091 | #verify the VPL lib install 1092 | if [ -z "$VPL_PREFIX" ] 1093 | then 1094 | CHKPC=$(find "$lp" -path "*/lib*" -name vpl.pc | head -n 1 | sed -r 's#/[^/]+$##' | sed -r "s#^${lp}##") 1095 | CHKLIB=$(find "$lp" -path "*/lib*" -name "libvpl.so*" | head -n 1 | sed -r 's#/[^/]+$##' | sed -r "s#^${lp}##") 1096 | CHKINC=$(find "$lp" -path "*/include/*" -name "vpl" | head -n 1 |sed -r 's#/[^/]+$##' | sed -r "s#^${lp}##") 1097 | #find the actual prefix since vpl.pc might be configured with relative paths? 1098 | if [ ! -z "$CHKPC" ] && [ ! -z "$CHKLIB" ] && [ ! -z "$CHKINC" ] 1099 | then 1100 | build_message BM_WHITE "enable-libvpl: configure -> $(printf 'prefix=%s\tlibdir=%s\tincludedir=%s\tpc=%s' $lp $CHKLIB $CHKINC $CHKPC)" 1101 | VPL_PREFIX="$lp" 1102 | fi 1103 | fi 1104 | rsync -rvt -R --files-from=<(find "$lp" -type f \( -path "*/lib*" -o -path "*/include/*" \) -a \( -name "*libvpl[.-]*" -o -name "*vpl*" -o -path "*/vpl/*" -o -name "*libva[.-]*" -o -path "*/va/*" \) -a -! \( -name "*.so.*" -o -name "*.so" \) 2>/dev/null |\ 1105 | sed -r "s#^${lp}/#/${lp}/./#") / "$ROOT_PATH/$OUT_PATH" 1106 | done < <(awk -F':' '{for (i = 1 ; i <= NF ; i++) { print $i }}' <<< ${VPL_DEV}) 1107 | [ $? -eq 0 ] && [ ! -z "$VPL_PREFIX" ] || build_die "$THIS: install stage failed -> enable-libvpl - verify prefix" 1108 | 1109 | #make links if the *.pc files are not in .../lib/pkgconfig 1110 | find $ROOT_PATH/$OUT_PATH/lib* -type f \( -name "*libvpl[.-]*" -o -name "*libva[.-]*" -o -name "*vpl*" \) -name "*.pc" -! -path "*/lib/pkgconfig/*" | tee >(cat 1>&2) | while read f ; do ln -sf "$f" "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/${f##*/}" ; done 1111 | #fix/force absolute paths in the copied .pc file? 1112 | if [ -e "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/vpl.pc" ] 1113 | then 1114 | sed -i -r "s#^(prefix=).+#\1${VPL_PREFIX}#" "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/vpl.pc" 1115 | sed -i -r "s#^(includedir=).+#\1\$\{prefix\}${CHKINC}#" "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/vpl.pc" 1116 | sed -i -r "s#^(libdir=).+#\1\$\{prefix\}${CHKLIB}#" "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/vpl.pc" 1117 | NCC_FFMPEG_LIB_OPTIONS="$NCC_FFMPEG_LIB_OPTIONS --enable-vaapi --enable-libvpl" 1118 | build_message BM_GREEN "enable-libvpl: success" 1119 | else 1120 | build_die "$THIS: install stage failed -> enable-libvpl - modify pc file" 1121 | fi 1122 | fi 1123 | fi 1124 | 1125 | #ffmpeg 1126 | set_source "ffmpeg" "git" "https://git.ffmpeg.org/ffmpeg.git" "gpl" "version3" "nonfree" 1127 | if [ "${!SRC_ENABLE}" -ne 0 ] 1128 | then 1129 | fetch_source 1130 | BUILD_CMD="CPPFLAGS=\"$NCC_CPPFLAGS -Wno-error=incompatible-pointer-types\" ./configure\ 1131 | --arch=\"x86_64\"\ 1132 | --disable-debug\ 1133 | --disable-shared\ 1134 | --enable-static\ 1135 | --prefix=\"$ROOT_PATH/$OUT_PATH\"\ 1136 | --pkg-config=\"pkg-config\"\ 1137 | --pkg-config-flags=\"--static\"\ 1138 | --extra-cflags=\"$NCC_OPTIM $NCC_CFLAGS\"\ 1139 | --extra-cxxflags=\"-fpermissive\"\ 1140 | --extra-ldflags=\"-no-pie\"\ 1141 | --extra-ldflags=\"-L$ROOT_PATH/$OUT_PATH/lib\"\ 1142 | --extra-libs=\"$NCC_FFMPEG_EXTRA_LIBS\"\ 1143 | --bindir=\"$BIN_PATH\"\ 1144 | $NCC_FFMPEG_LIB_OPTIONS" 1145 | echo $BUILD_CMD 1146 | #exit 1 1147 | if [ "$BUILD" -ne 0 ] 1148 | then 1149 | cd_source 1150 | eval $BUILD_CMD 1151 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1152 | build_make $NCC_JOBS 1153 | fi 1154 | fi 1155 | -------------------------------------------------------------------------------- /ffmpeg-native-build-hints: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------- 2 | #ffmpeg-native-build-hints - 2025-05-08 working build 3 | #---------------------------------------------------- 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH or 6 | #set via the command line: 7 | #HINTS_FILE=/media/user/usb/my-build-hints ffmpeg-native 8 | 9 | #fields are TAB delimited triplets enabling control of the build 10 | #source key value 11 | 12 | #------------ 13 | #NCC options 14 | #------------ 15 | NCC CFLAGS -mtune=generic -march=x86-64 -pipe 16 | #x86-64 generic skylake broadwell haswell ivybridge sandybridge corei7-avx westmere nehalem 17 | NCC OPTIM -O3 18 | NCC RUSTFLAGS -C target-feature=+avx2,+fma 19 | #override getconf _NPROCESSORS_ONLN 20 | #NCC JOBS 6 21 | #use FETCH_ONLY to clone all the repositories without a build 22 | #NCC FETCH_ONLY 0 23 | #display the config only - no fetch/build 24 | #NCC SHOW_ONLY 0 25 | 26 | #----------------------------------------------- 27 | #constrain parallel make or disable/enable build 28 | #----------------------------------------------- 29 | #source make job_count 30 | #source disable 31 | #source enable 32 | #lame make 1 33 | #fribidi make 1 34 | #fontconfig make 1 35 | #freetype make 1 36 | #harfbuzz make 1 37 | openssl make 1 38 | 39 | #--------------------------- 40 | #set override URL for source 41 | #--------------------------- 42 | #source url url_string 43 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 44 | 45 | #aom url file://~/src/aom 46 | #ass url file://~/src/ass 47 | #bzip2 url file://~/src/bzip2 48 | #dav1d url file://~/src/dav1d 49 | #decklink-linux url file://~/src/decklink-linux 50 | #fdk-aac url file://~/src/fdk-aac 51 | #ffmpeg url file://~/src/ffmpeg 52 | #fftw3 url file://~/src/fftw3 53 | #fontconfig url file://~/src/fontconfig 54 | #freetype url file://~/src/freetype 55 | #frei0r url file://~/src/frei0r 56 | #fribidi url file://~/src/fribidi 57 | #harfbuzz url file://~/src/harfbuzz 58 | #ladspa url file://~/src/ladspa 59 | #lame url file://~/src/lame 60 | #nv-codec-headers url file://~/src/nv-codec-headers 61 | #ogg url file://~/src/ogg 62 | #openssl url file://~/src/openssl 63 | #opus url file://~/src/opus 64 | #png url file://~/src/png 65 | #rav1e url file://~/src/rav1e 66 | #rubberband url file://~/src/rubberband 67 | #sdl url file://~/src/sdl 68 | #samplerate url file://~/src/samplerate 69 | #sofa url file://~/src/sofa 70 | #soxr url file://~/src/soxr 71 | #srt url file://~/src/srt 72 | #svt-av1 url file://~/src/svt-av1 73 | #theora url file://~/src/theora 74 | #vmaf url file://~/src/vmaf 75 | #vorbis url file://~/src/vorbis 76 | #vpx url file://~/src/vpx 77 | #vulkan-headers url file://~/src/vulkan-headers 78 | #webp url file://~/src/webp 79 | #x264 url file://~/src/x264 80 | #x265 url file://~/src/x265 81 | #xml2 url file://~/src/xml2 82 | #zlib url file://~/src/zlib 83 | 84 | #------------------------ 85 | #fetch specified revision 86 | #------------------------ 87 | #source fetch_method revision_id 88 | aom git 4c983381cd254becfb17435cdeecfdc56c982e37 89 | ass git 695509365f152bd28720a0c0e036d46836ee9345 90 | bzip2 git fbc4b11da543753b3b803e5546f56e26ec90c2a7 91 | dav1d git 8d956180934f16244bdb58b39175824775125e55 92 | decklink-linux git 6e9b591d9a3ad7946d2f401cae9832fef722889e 93 | fdk-aac git 2ef9a141c40bf254bde7d22c197c615db5b265ed 94 | ffmpeg git 1b643e3f65d75a4e6a25986466254bdd4fc1a01a 95 | fftw3 wget fftw-3.3.10.tar.gz 96 | fontconfig git 3454d29ef0761978897de5f28e388e5b0a3489f4 97 | freetype git f35bb7595462af6588c59a866b354a72e4f4be4b 98 | frei0r git b47c180376dc0ebfb9f57ca9373070eb8afcf9e9 99 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 100 | harfbuzz git 7dfbe50dfa6aacf0b2a8c7f357107691dc798a98 101 | ladspa git 0f54d2430febb4d5f02d13132dd91d7345e080b5 102 | lame svn 6531 103 | #v11.1 104 | #nv-codec-headers git 43d91706e097565f57b311e567f0219838bcc2f6 105 | #v12.1 106 | #nv-codec-headers git 1889e62e2d35ff7aa9baca2bceb14f053785e6f1 107 | #v12.2 108 | nv-codec-headers git c69278340ab1d5559c7d7bf0edf615dc33ddbba 109 | ogg git fa80aae9d50096160f2b56ada35527d7aee3f746 110 | #commit below is for openssl 1.1.1.w, head may not build/work as expected 111 | openssl git e04bd3433fd84e1861bf258ea37928d9845e6a86 112 | opus git 08bcc6e46227fca01aa3de3f3512f8b692d8d36b 113 | png git b4800bae3379f1abf82359703c28e727b5df4135 114 | #commit below is for rav1e 0.8.x, head may not build/work as expected 115 | rav1e git cda12985b9bebd2f4d940ac5d32c945b78752e5b 116 | rubberband hg 6fca9f344e6d 117 | samplerate git 15c392d47e71b9395a759544b3818a1235fe1a1d 118 | #commit below is for sdl release-2.30.12, head may not build/work as expected 119 | sdl git 8236e01a9f758d15927624925c6043f84d8a261f 120 | sofa git dd315a8ec1fee7193d40e4a59b12c5590a4a918c 121 | soxr git 945b592b70470e29f917f4de89b4281fbbd540c0 122 | #commit below is for srt v1.5.4, head may not build/work as expected 123 | srt git a8c6b65520f814c5bd8f801be48c33ceece7c4a6 124 | svt-av1 git 5def505f7f193d890be61e869831378f212a07bd 125 | theora git b167cb4a3e3e2d3239d71f0ca2cbc25af4f2183c 126 | #commit below is for vmaf v3.0.0, head may not build/work as expected 127 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 128 | vorbis git 84c023699cdf023a32fa4ded32019f194afcdad0 129 | vpx git e922e894bd44017f091e19b8f3bbe97e31e42657 130 | vulkan-headers git 9c77de5c3dd216f28e407eec65ed9c0a296c1f74 131 | webp git eb3ff781599e311cc27f1d34c6ba8953cf8d7e5b 132 | x264 git 32c3b801191522961102d4bea292cdb61068d0dd 133 | x265 git f8be4634f6db0b67d149552386559095a840ccf2 134 | xml2 git 38ea8fa9dea1ff4777c17581350795a3691ee88a 135 | zlib git 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71 136 | 137 | -------------------------------------------------------------------------------- /ffmpeg-native-build-hints-ffserver: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | #ffmpeg-native-build-hints-ffserver - last commit 3 | #------------------------------------------------- 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH or 6 | #set via the command line: 7 | #HINTS_FILE=/media/user/usb/my-build-hints ffmpeg-native 8 | 9 | #fields are TAB delimited triplets enabling control of the build 10 | #source key value 11 | 12 | #------------ 13 | #NCC options 14 | #------------ 15 | NCC CFLAGS -march=core-avx-i -mtune=core-avx-i -pipe 16 | NCC OPTIM -O3 17 | #NCC JOBS 6 18 | #use FETCH_ONLY to clone all the repositories without a build 19 | #NCC FETCH_ONLY 1 20 | #display the config only - no fetch/build 21 | #NCC SHOW_ONLY 1 22 | 23 | #----------------------- 24 | #constrain parallel make 25 | #----------------------- 26 | #source make job_count 27 | 28 | #aom must be disabled for ffserver 29 | aom disable 30 | 31 | #--------------------------- 32 | #set override URL for source 33 | #--------------------------- 34 | #source url url_string 35 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 36 | 37 | #file:// url can be used to rsync from a local source repository 38 | #ffmpeg url file://~/src/ffmpeg 39 | #aom url file://~/src/aom 40 | #fdk-aac url file://~/src/fdk-aac 41 | #lame url file://~/src/lame 42 | #nv-codec-headers url file://~/src/nv-codec-headers 43 | #ogg url file://~/src/ogg 44 | #opus url file://~/src/opus 45 | #sdl url file://~/src/sdl 46 | #theora url file://~/src/theora 47 | #vorbis url file://~/src/vorbis 48 | #vpx url file://~/src/vpx 49 | #x264 url file://~/src/x264 50 | #x265 url file://~/src/x265 51 | 52 | #------------------------ 53 | #fetch specified revision 54 | #------------------------ 55 | #source fetch_method revision_id 56 | 57 | aom git 0b3fd892e1e56d56279d531302855c7d36e2e12e 58 | fdk-aac git 74c1a2a 59 | ffmpeg git 2ca65fc 60 | lame svn 6432 61 | nv-codec-headers git e6f3a414a599529ce5da0863f3e060c19c8a19ce 62 | ogg git bc82844df068429d209e909da47b1f730b53b689 63 | opus git 5cbd7d5f7d981385fb948a161a7cd5a0146d9039 64 | sdl hg 02509665751f 65 | theora git e5d205bfe849f1b41f45b91a0b71a3bdc6cd458f 66 | vorbis git 46e70fa6573e206c2555cd99a53204ffd6bf58fd 67 | vpx git edc203c4c7a0cff746a8f340ad21d91cb8cba852 68 | x264 git 303c484ec828ed0d8bfe743500e70314d026c3bd 69 | x265 hg 88ee12651e30 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg-native-build-hints-file-head: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------ 2 | #ffmpeg-native-build-hints-file-head - local source, head/tip 3 | #------------------------------------------------------------ 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH or 6 | #set via the command line: 7 | #HINTS_FILE=/media/user/usb/my-build-hints ffmpeg-native 8 | 9 | #fields are TAB delimited triplets enabling control of the build 10 | #source key value 11 | 12 | #------------ 13 | #NCC options 14 | #------------ 15 | NCC CFLAGS -mtune=generic -march=x86-64 -pipe 16 | #x86-64 generic skylake broadwell haswell ivybridge sandybridge corei7-avx westmere nehalem 17 | NCC OPTIM -O3 18 | NCC RUSTFLAGS -C target-feature=+avx2,+fma 19 | #override getconf _NPROCESSORS_ONLN 20 | #NCC JOBS 6 21 | #use FETCH_ONLY to clone all the repositories without a build 22 | #NCC FETCH_ONLY 0 23 | #display the config only - no fetch/build 24 | #NCC SHOW_ONLY 0 25 | 26 | #----------------------------------------------- 27 | #constrain parallel make or disable/enable build 28 | #----------------------------------------------- 29 | #source make job_count 30 | #source disable 31 | #source enable 32 | #lame make 1 33 | #fribidi make 1 34 | #fontconfig make 1 35 | #freetype make 1 36 | #harfbuzz make 1 37 | openssl make 1 38 | 39 | #--------------------------- 40 | #set override URL for source 41 | #--------------------------- 42 | #source url url_string 43 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 44 | 45 | aom url file://~/src/aom 46 | ass url file://~/src/ass 47 | bzip2 url file://~/src/bzip2 48 | dav1d url file://~/src/dav1d 49 | decklink-linux url file://~/src/decklink-linux 50 | fdk-aac url file://~/src/fdk-aac 51 | ffmpeg url file://~/src/ffmpeg 52 | fftw3 url file://~/src/fftw3 53 | fontconfig url file://~/src/fontconfig 54 | freetype url file://~/src/freetype 55 | frei0r url file://~/src/frei0r 56 | fribidi url file://~/src/fribidi 57 | harfbuzz url file://~/src/harfbuzz 58 | ladspa url file://~/src/ladspa 59 | lame url file://~/src/lame 60 | nv-codec-headers url file://~/src/nv-codec-headers 61 | ogg url file://~/src/ogg 62 | openssl url file://~/src/openssl 63 | opus url file://~/src/opus 64 | png url file://~/src/png 65 | rav1e url file://~/src/rav1e 66 | rubberband url file://~/src/rubberband 67 | sdl url file://~/src/sdl 68 | samplerate url file://~/src/samplerate 69 | sofa url file://~/src/sofa 70 | soxr url file://~/src/soxr 71 | srt url file://~/src/srt 72 | svt-av1 url file://~/src/svt-av1 73 | theora url file://~/src/theora 74 | vmaf url file://~/src/vmaf 75 | vorbis url file://~/src/vorbis 76 | vpx url file://~/src/vpx 77 | vulkan-headers url file://~/src/vulkan-headers 78 | webp url file://~/src/webp 79 | x264 url file://~/src/x264 80 | x265 url file://~/src/x265 81 | xml2 url file://~/src/xml2 82 | zlib url file://~/src/zlib 83 | 84 | #------------------------ 85 | #fetch specified revision 86 | #------------------------ 87 | #source fetch_method revision_id 88 | aom git 89 | ass git 90 | bzip2 git 91 | dav1d git 92 | decklink-linux git 93 | fdk-aac git 94 | ffmpeg git 95 | fftw3 wget fftw-3.3.10.tar.gz 96 | fontconfig git 97 | freetype git 98 | frei0r git 99 | fribidi git 100 | harfbuzz git 101 | ladspa git 102 | lame svn 103 | nv-codec-headers git 104 | ogg git 105 | openssl git 106 | opus git 107 | png git 108 | rav1e git 109 | rubberband hg 110 | samplerate git 111 | sdl git 112 | sofa git 113 | soxr git 114 | srt git 115 | svt-av1 git 116 | theora git 117 | vmaf git 118 | vorbis git 119 | vpx git 120 | vulkan-headers git 121 | webp git 122 | x264 git 123 | x265 git 124 | xml2 git 125 | zlib git 126 | 127 | -------------------------------------------------------------------------------- /ffmpeg-native-build-hints-slim: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------- 2 | #ffmpeg-native-build-hints-slim - 2025-05-08 working build 3 | #--------------------------------------------------------- 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH or 6 | #set via the command line: 7 | #HINTS_FILE=/media/user/usb/my-build-hints ffmpeg-native 8 | 9 | #fields are TAB delimited triplets enabling control of the build 10 | #source key value 11 | 12 | #------------ 13 | #NCC options 14 | #------------ 15 | NCC CFLAGS -mtune=generic -march=x86-64 -pipe 16 | #x86-64 generic skylake broadwell haswell ivybridge sandybridge corei7-avx westmere nehalem 17 | NCC OPTIM -O3 18 | NCC RUSTFLAGS -C target-feature=+avx2,+fma 19 | #override getconf _NPROCESSORS_ONLN 20 | #NCC JOBS 6 21 | #use FETCH_ONLY to clone all the repositories without a build 22 | #NCC FETCH_ONLY 0 23 | #display the config only - no fetch/build 24 | #NCC SHOW_ONLY 0 25 | 26 | #----------------------------------------------- 27 | #constrain parallel make or disable/enable build 28 | #----------------------------------------------- 29 | #source make job_count 30 | #source disable 31 | #source enable 32 | 33 | #disabled 34 | aom disable 35 | ass disable 36 | bzip2 disable 37 | decklink-linux disable 38 | fftw3 disable 39 | fontconfig disable 40 | freetype disable 41 | frei0r disable 42 | fribidi disable 43 | harfbuzz disable 44 | ladspa disable 45 | nv-codec-headers disable 46 | png disable 47 | rav1e disable 48 | rubberband disable 49 | samplerate disable 50 | sofa disable 51 | srt disable 52 | svt-av1 disable 53 | theora disable 54 | vmaf disable 55 | vpx disable 56 | vulkan-headers disable 57 | webp disable 58 | xml2 disable 59 | 60 | #enabled 61 | dav1d enable 62 | fdk-aac enable 63 | ffmpeg enable 64 | lame enable 65 | #lame make 1 66 | ogg enable 67 | openssl enable 68 | openssl make 1 69 | opus enable 70 | sdl enable 71 | soxr enable 72 | vorbis enable 73 | x264 enable 74 | x265 enable 75 | zlib enable 76 | 77 | #--------------------------- 78 | #set override URL for source 79 | #--------------------------- 80 | #source url url_string 81 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 82 | 83 | #aom url file://~/src/aom 84 | #ass url file://~/src/ass 85 | #bzip2 url file://~/src/bzip2 86 | #decklink-linux url file://~/src/decklink-linux 87 | #fftw3 url file://~/src/fftw3 88 | #fontconfig url file://~/src/fontconfig 89 | #freetype url file://~/src/freetype 90 | #frei0r url file://~/src/frei0r 91 | #fribidi url file://~/src/fribidi 92 | #harfbuzz url file://~/src/harfbuzz 93 | #ladspa url file://~/src/ladspa 94 | #nv-codec-headers url file://~/src/nv-codec-headers 95 | #png url file://~/src/png 96 | #rav1e url file://~/src/rav1e 97 | #rubberband url file://~/src/rubberband 98 | #samplerate url file://~/src/samplerate 99 | #sofa url file://~/src/sofa 100 | #srt url file://~/src/srt 101 | #svt-av1 url file://~/src/svt-av1 102 | #theora url file://~/src/theora 103 | #vmaf url file://~/src/vmaf 104 | #vpx url file://~/src/vpx 105 | #vulkan-headers url file://~/src/vulkan-headers 106 | #webp url file://~/src/webp 107 | #xml2 url file://~/src/xml2 108 | 109 | #enabled 110 | #dav1d url file://~/src/dav1d 111 | #fdk-aac url file://~/src/fdk-aac 112 | #ffmpeg url file://~/src/ffmpeg 113 | #lame url file://~/src/lame 114 | #ogg url file://~/src/ogg 115 | #openssl url file://~/src/openssl 116 | #opus url file://~/src/opus 117 | #sdl url file://~/src/sdl 118 | #soxr url file://~/src/soxr 119 | #vorbis url file://~/src/vorbis 120 | #x264 url file://~/src/x264 121 | #x265 url file://~/src/x265 122 | #zlib url file://~/src/zlib 123 | 124 | #------------------------ 125 | #fetch specified revision 126 | #------------------------ 127 | #source fetch_method revision_id 128 | aom git 4c983381cd254becfb17435cdeecfdc56c982e37 129 | ass git 695509365f152bd28720a0c0e036d46836ee9345 130 | bzip2 git fbc4b11da543753b3b803e5546f56e26ec90c2a7 131 | dav1d git 8d956180934f16244bdb58b39175824775125e55 132 | decklink-linux git 6e9b591d9a3ad7946d2f401cae9832fef722889e 133 | fdk-aac git 2ef9a141c40bf254bde7d22c197c615db5b265ed 134 | ffmpeg git 1b643e3f65d75a4e6a25986466254bdd4fc1a01a 135 | fftw3 wget fftw-3.3.10.tar.gz 136 | fontconfig git 3454d29ef0761978897de5f28e388e5b0a3489f4 137 | freetype git f35bb7595462af6588c59a866b354a72e4f4be4b 138 | frei0r git b47c180376dc0ebfb9f57ca9373070eb8afcf9e9 139 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 140 | harfbuzz git 7dfbe50dfa6aacf0b2a8c7f357107691dc798a98 141 | ladspa git 0f54d2430febb4d5f02d13132dd91d7345e080b5 142 | lame svn 6531 143 | #v11.1 144 | #nv-codec-headers git 43d91706e097565f57b311e567f0219838bcc2f6 145 | #v12.1 146 | #nv-codec-headers git 1889e62e2d35ff7aa9baca2bceb14f053785e6f1 147 | #v12.2 148 | nv-codec-headers git c69278340ab1d5559c7d7bf0edf615dc33ddbba 149 | ogg git fa80aae9d50096160f2b56ada35527d7aee3f746 150 | #commit below is for openssl 1.1.1.w, head may not build/work as expected 151 | openssl git e04bd3433fd84e1861bf258ea37928d9845e6a86 152 | opus git 08bcc6e46227fca01aa3de3f3512f8b692d8d36b 153 | png git b4800bae3379f1abf82359703c28e727b5df4135 154 | #commit below is for rav1e 0.8.x, head may not build/work as expected 155 | rav1e git cda12985b9bebd2f4d940ac5d32c945b78752e5b 156 | rubberband hg 6fca9f344e6d 157 | samplerate git 15c392d47e71b9395a759544b3818a1235fe1a1d 158 | #commit below is for sdl release-2.30.12, head may not build/work as expected 159 | sdl git 8236e01a9f758d15927624925c6043f84d8a261f 160 | sofa git dd315a8ec1fee7193d40e4a59b12c5590a4a918c 161 | soxr git 945b592b70470e29f917f4de89b4281fbbd540c0 162 | #commit below is for srt v1.5.4, head may not build/work as expected 163 | srt git a8c6b65520f814c5bd8f801be48c33ceece7c4a6 164 | svt-av1 git 5def505f7f193d890be61e869831378f212a07bd 165 | theora git b167cb4a3e3e2d3239d71f0ca2cbc25af4f2183c 166 | #commit below is for vmaf v3.0.0, head may not build/work as expected 167 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 168 | vorbis git 84c023699cdf023a32fa4ded32019f194afcdad0 169 | vpx git e922e894bd44017f091e19b8f3bbe97e31e42657 170 | vulkan-headers git 9c77de5c3dd216f28e407eec65ed9c0a296c1f74 171 | webp git eb3ff781599e311cc27f1d34c6ba8953cf8d7e5b 172 | x264 git 32c3b801191522961102d4bea292cdb61068d0dd 173 | x265 git f8be4634f6db0b67d149552386559095a840ccf2 174 | xml2 git 38ea8fa9dea1ff4777c17581350795a3691ee88a 175 | zlib git 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71 176 | 177 | -------------------------------------------------------------------------------- /ffmpeg-native-osx: -------------------------------------------------------------------------------- 1 | #!/opt/local/bin/bash 2 | 3 | SCRIPT_VERSION="1.4.0" 4 | THIS="ffmpeg-native-osx" 5 | 6 | #build paths 7 | ROOT_PATH="${ROOT_PATH:-$HOME}" 8 | SRC_PATH="${SRC_PATH:-ffmpeg_sources}" 9 | OUT_PATH="${OUT_PATH:-ffmpeg_build}" 10 | BIN_PATH="${BIN_PATH:-$ROOT_PATH/$OUT_PATH/bin}" 11 | HINTS_FILE="${HINTS_FILE:-$ROOT_PATH/ffmpeg-osx-build-hints}" 12 | NCC_PATH_LIST=\ 13 | ( \ 14 | "ROOT_PATH" "SRC_PATH" "OUT_PATH" "BIN_PATH" "HINTS_FILE" \ 15 | ) 16 | 17 | #compiler settings 18 | NCC_OPTIM="-O2" 19 | NCC_CFLAGS="-mtune=generic -march=x86-64 -pipe" 20 | #make settings 21 | NCC_JOBS=$(getconf _NPROCESSORS_ONLN) 22 | NCC_FETCH_ONLY="${NCC_FETCH_ONLY:-0}" 23 | NCC_SHOW_ONLY="${NCC_SHOW_ONLY:-0}" 24 | NCC_DISABLE_DEFAULT="${NCC_DISABLE_DEFAULT:-0}" 25 | NCC_OPTION_LIST=\ 26 | ( \ 27 | "HOST" "OPTIM" "CFLAGS" "JOBS" "FETCH_ONLY" "SHOW_ONLY" "DISABLE_DEFAULT" "DARWIN_VERSION" \ 28 | ) 29 | NCC_SOURCE_LIST=\ 30 | ( \ 31 | "aom" "fdk-aac" "ffmpeg" "lame" \ 32 | "nv-codec-headers" "ogg" "opus" "sdl" \ 33 | "theora" "vorbis" "vpx" "x264" "x265" \ 34 | ) 35 | NCC_DARWIN_VERSION="${NCC_DARWIN_VERSION:-17}" 36 | 37 | #fix pkg-config paths for cross 38 | export PKG_CONFIG_DIR= 39 | export PKG_CONFIG_PATH= 40 | export PKG_CONFIG_SYSROOT_PATH="$ROOT_PATH" 41 | export PKG_CONFIG_LIBDIR="$ROOT_PATH/$OUT_PATH/lib/pkgconfig" 42 | 43 | build_message() { 44 | 45 | local BM_WHITE=15 46 | local BM_GREEN=10 47 | local BM_CYAN=14 48 | local BM_MAGENTA=200 49 | local BM_YELLOW=11 50 | local BM_RED=9 51 | local color=$1 52 | 53 | shift 54 | printf "\e[38;5;${!color}m====> $@ <====\e[0m\n" 1>&2 55 | } 56 | 57 | build_die() { 58 | 59 | build_message BM_RED "$@" 60 | exit 1 61 | } 62 | 63 | build_make() { 64 | 65 | local jobs="${1:-1}" 66 | local hint=$(get_hint "$SRC_NAME" "make") 67 | jobs="${hint:-$jobs}" 68 | 69 | make -j $jobs 70 | [ $? -eq 0 ] || build_die "$THIS: make stage failed (jobs = $jobs) -> $SRC_NAME" 71 | 72 | make install 73 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 74 | 75 | build_message BM_GREEN "$SRC_NAME: built successfully (jobs = $jobs)" 76 | } 77 | 78 | fetch_source() { 79 | 80 | local revision=$(get_hint "$SRC_NAME" "$SRC_METHOD") 81 | local url=$(get_hint "$SRC_NAME" "url") 82 | local status=1 83 | local scheme; 84 | local path; 85 | 86 | if [ -z "$url" ] 87 | then 88 | url="$SRC_URL" 89 | fi 90 | 91 | [[ "$url" =~ ^(file://)(.+)$ ]] 92 | scheme="${BASH_REMATCH[1]}" 93 | path="${BASH_REMATCH[2]}" 94 | 95 | if [ "$scheme" == "file://" ] 96 | then 97 | build_message BM_YELLOW "rsync $path/ ./$SRC_NAME/" 98 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 99 | then 100 | mkdir "$SRC_NAME" 101 | eval "rsync -rit --stats $path/ ./$SRC_NAME/" 102 | status=$? 103 | fi 104 | fi 105 | 106 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 107 | then 108 | build_message BM_MAGENTA "$SRC_NAME: fetch -> $SRC_METHOD $url $revision" 109 | return 0 110 | fi 111 | 112 | case "$SRC_METHOD" in 113 | git) 114 | if [ "$scheme" != "file://" ] 115 | then 116 | git clone "$url" "$SRC_NAME" 117 | status=$? 118 | fi 119 | 120 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 121 | then 122 | cd_source 123 | git reset --hard "$revision" 124 | status=$? 125 | cd .. 126 | fi 127 | ;; 128 | svn) 129 | if [ "$scheme" != "file://" ] 130 | then 131 | svn checkout "$url" "$SRC_NAME" 132 | status=$? 133 | fi 134 | 135 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 136 | then 137 | cd_source 138 | svn up -r"$revision" 139 | status=$? 140 | cd .. 141 | fi 142 | ;; 143 | hg) 144 | if [ "$scheme" != "file://" ] 145 | then 146 | hg clone "$url" "$SRC_NAME" 147 | status=$? 148 | fi 149 | 150 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 151 | then 152 | cd_source 153 | hg revert -r "$revision" --all 154 | status=$? 155 | cd .. 156 | fi 157 | ;; 158 | #wget) 159 | #wget -O "$SRC_NAME.$1" "$url" 160 | #;; 161 | *) 162 | build_die "$THIS: invalid fetch method -> $SRC_NAME: $SRC_METHOD" 163 | ;; 164 | esac 165 | if [ $status -eq 0 ] 166 | then 167 | build_message BM_MAGENTA "$SRC_NAME: fetch success -> $SRC_METHOD $url $revision" 168 | else 169 | build_die "$THIS: fetch stage failed -> $SRC_NAME: $SRC_METHOD $url" 170 | fi 171 | } 172 | 173 | get_hint() { 174 | 175 | local status=1 176 | if [ -r "$HINTS_FILE" ] 177 | then 178 | #$1 name 179 | #$2 hint 180 | local name=$1 181 | shift 182 | local hint=$1 183 | shift 184 | 185 | awk -F'\t' -v name=$name -v hint=$hint \ 186 | '!($0 ~ /^[[:space:]]*#/) && !($0 ~ /^[[:space:]]*$/) && $1 == name && $2 == hint \ 187 | {printf "%s", $3; found=1; exit} \ 188 | END { if (found) {exit 0} else {exit 1}}' "$HINTS_FILE" 189 | 190 | status=$? 191 | fi 192 | return $status 193 | } 194 | 195 | get_NCC_hints() { 196 | 197 | local h 198 | local val 199 | local var 200 | 201 | #initialize enabled builds based on enable/disable default 202 | for h in "${NCC_SOURCE_LIST[@]}" 203 | do 204 | var="NCC_ENABLE_$h" 205 | var="${var//[^A-Za-z0-9]/_}" 206 | var="${var^^}" 207 | #echo "$var" 208 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 209 | then 210 | val=1 211 | else 212 | val=0 213 | fi 214 | eval "$var=\$val" 215 | done 216 | 217 | #check for values from the hints file 218 | if [ -r "$HINTS_FILE" ] 219 | then 220 | for h in "${NCC_OPTION_LIST[@]}" 221 | do 222 | val="$(get_hint "NCC" "$h")" 223 | if [ $? -eq 0 ] 224 | then 225 | var="NCC_$h" 226 | eval "$var=\$val" 227 | fi 228 | done 229 | 230 | for h in "${NCC_SOURCE_LIST[@]}" 231 | do 232 | var="NCC_ENABLE_$h" 233 | var="${var//[^A-Za-z0-9]/_}" 234 | var="${var^^}" 235 | #echo "$var" 236 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 237 | then 238 | val="$(get_hint "$h" "disable")" 239 | if [ $? -eq 0 ] 240 | then 241 | val=0 242 | else 243 | val=1 244 | fi 245 | else 246 | val="$(get_hint "$h" "enable")" 247 | if [ $? -eq 0 ] 248 | then 249 | val=1 250 | else 251 | val=0 252 | fi 253 | fi 254 | eval "$var=\$val" 255 | done 256 | fi 257 | } 258 | 259 | set_source() { 260 | 261 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 262 | then 263 | cd "$ROOT_PATH/$SRC_PATH" 264 | fi 265 | SRC_NAME="$1" 266 | shift 267 | SRC_ENABLE="NCC_ENABLE_$SRC_NAME" 268 | SRC_ENABLE="${SRC_ENABLE//[^A-Za-z0-9]/_}" 269 | SRC_ENABLE="${SRC_ENABLE^^}" 270 | SRC_URL=$(get_hint "$SRC_NAME" "url") 271 | SRC_METHOD="$1" 272 | shift 273 | SRC_URL="${SRC_URL:-$1}" 274 | shift 275 | 276 | if [ "${!SRC_ENABLE}" -ne 0 ] 277 | then 278 | for arg in "$@" 279 | do 280 | NCC_FFMPEG_LIB_OPTIONS="$NCC_FFMPEG_LIB_OPTIONS --enable-$arg" 281 | done 282 | build_message BM_CYAN "$SRC_NAME" 283 | fi 284 | 285 | } 286 | 287 | cd_source() { 288 | 289 | cd $SRC_NAME 290 | } 291 | 292 | #startup banner 293 | build_message BM_WHITE "$THIS: Version $SCRIPT_VERSION" 294 | 295 | #load NCC hints 296 | get_NCC_hints 297 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 298 | then 299 | for i in "${NCC_PATH_LIST[@]}" 300 | do 301 | echo "$i: ${!i}" 302 | done 303 | for i in "${NCC_OPTION_LIST[@]}" 304 | do 305 | var="NCC_$i" 306 | echo "$var: ${!var}" 307 | done 308 | for i in "${NCC_SOURCE_LIST[@]}" 309 | do 310 | var="NCC_ENABLE_$i" 311 | var="${var//[^A-Za-z0-9]/_}" 312 | var="${var^^}" 313 | echo "$var: ${!var} ($i)" 314 | done 315 | fi 316 | 317 | if [ "$NCC_FETCH_ONLY" -eq 0 ] && [ "$NCC_SHOW_ONLY" -eq 0 ] 318 | then 319 | BUILD=1 320 | else 321 | BUILD=0 322 | fi 323 | 324 | #ensure clean build 325 | if [ "$BUILD" -ne 0 ] 326 | then 327 | rm -rf "$ROOT_PATH/$OUT_PATH" 328 | [ -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to remove build directory -> $ROOT_PATH/$OUT_PATH" 329 | fi 330 | 331 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 332 | then 333 | rm -rf "$ROOT_PATH/$SRC_PATH" 334 | [ -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to remove source directory -> $ROOT_PATH/$SRC_PATH" 335 | fi 336 | 337 | if [ "$BUILD" -ne 0 ] 338 | then 339 | mkdir "$ROOT_PATH/$OUT_PATH" 340 | [ ! -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to create build directory -> $ROOT_PATH/$OUT_PATH" 341 | fi 342 | 343 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 344 | then 345 | mkdir "$ROOT_PATH/$SRC_PATH" 346 | [ ! -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to create source directory -> $ROOT_PATH/$SRC_PATH" 347 | fi 348 | 349 | if [ "$BUILD" -ne 0 ] 350 | then 351 | #cmake toolchain settings 352 | touch $ROOT_PATH/$SRC_PATH/native.make 353 | echo "SET(CMAKE_SYSTEM_NAME Darwin)" >> $ROOT_PATH/$SRC_PATH/native.make 354 | echo "SET(CMAKE_SYSTEM_PROCESSOR x86_64)" >> $ROOT_PATH/$SRC_PATH/native.make 355 | echo "SET(CMAKE_C_COMPILER gcc)" >> $ROOT_PATH/$SRC_PATH/native.make 356 | echo "SET(CMAKE_CXX_COMPILER g++)" >> $ROOT_PATH/$SRC_PATH/native.make 357 | echo "SET(CMAKE_ASM_YASM_COMPILER yasm)" >> $ROOT_PATH/$SRC_PATH/native.make 358 | echo "SET(CMAKE_ASM_NASM_COMPILER nasm)" >> $ROOT_PATH/$SRC_PATH/native.make 359 | echo "SET(CMAKE_CXX_FLAGS \"$NCC_OPTIM $NCC_CFLAGS\")" >> $ROOT_PATH/$SRC_PATH/native.make 360 | echo "SET(CMAKE_C_FLAGS \"$NCC_OPTIM $NCC_CFLAGS\")" >> $ROOT_PATH/$SRC_PATH/native.make 361 | fi 362 | 363 | #build the sources 364 | #fdk-aac 365 | set_source "fdk-aac" "git" "https://github.com/mstorsjo/fdk-aac.git" "libfdk-aac" 366 | if [ "${!SRC_ENABLE}" -ne 0 ] 367 | then 368 | fetch_source 369 | if [ "$BUILD" -ne 0 ] 370 | then 371 | cd_source 372 | autoreconf -fiv 373 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared 374 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 375 | build_make $NCC_JOBS 376 | fi 377 | fi 378 | 379 | #lame 380 | set_source "lame" "svn" "https://svn.code.sf.net/p/lame/svn/trunk/lame" "libmp3lame" 381 | if [ "${!SRC_ENABLE}" -ne 0 ] 382 | then 383 | fetch_source 384 | if [ "$BUILD" -ne 0 ] 385 | then 386 | cd_source 387 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-nasm --disable-shared --disable-frontend 388 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 389 | build_make $NCC_JOBS 390 | fi 391 | fi 392 | 393 | #ogg 394 | set_source "ogg" "git" "https://github.com/xiph/ogg.git" 395 | if [ "${!SRC_ENABLE}" -ne 0 ] 396 | then 397 | fetch_source 398 | if [ "$BUILD" -ne 0 ] 399 | then 400 | cd_source 401 | ./autogen.sh 402 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared 403 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 404 | build_make $NCC_JOBS 405 | fi 406 | fi 407 | 408 | #opus 409 | set_source "opus" "git" "https://github.com/xiph/opus.git" "libopus" 410 | if [ "${!SRC_ENABLE}" -ne 0 ] 411 | then 412 | fetch_source 413 | if [ "$BUILD" -ne 0 ] 414 | then 415 | cd_source 416 | ./autogen.sh 417 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared --disable-doc --disable-examples 418 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 419 | build_make $NCC_JOBS 420 | fi 421 | fi 422 | 423 | #theora 424 | set_source "theora" "git" "https://github.com/xiph/theora.git" "libtheora" 425 | if [ "${!SRC_ENABLE}" -ne 0 ] 426 | then 427 | fetch_source 428 | if [ "$BUILD" -ne 0 ] 429 | then 430 | cd_source 431 | ./autogen.sh 432 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared --disable-doc --disable-oggtest --disable-vorbistest --disable-examples 433 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 434 | build_make $NCC_JOBS 435 | fi 436 | fi 437 | 438 | #vorbis 439 | set_source "vorbis" "git" "https://github.com/xiph/vorbis.git" "libvorbis" 440 | if [ "${!SRC_ENABLE}" -ne 0 ] 441 | then 442 | fetch_source 443 | if [ "$BUILD" -ne 0 ] 444 | then 445 | cd_source 446 | ./autogen.sh 447 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --enable-static --disable-shared -disable-docs --disable-examples 448 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 449 | build_make $NCC_JOBS 450 | fi 451 | fi 452 | 453 | #aom AV1 454 | set_source "aom" "git" "https://aomedia.googlesource.com/aom" "libaom" 455 | if [ "${!SRC_ENABLE}" -ne 0 ] 456 | then 457 | fetch_source 458 | if [ "$BUILD" -ne 0 ] 459 | then 460 | mkdir "$SRC_NAME"_build 461 | cd "$SRC_NAME"_build 462 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.make" -DAOM_TARGET_CPU="x86_64" -DENABLE_SHARED=0 -DENABLE_NASM=1 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 ../aom 463 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 464 | build_make $NCC_JOBS 465 | fi 466 | fi 467 | 468 | #vpx 469 | set_source "vpx" "git" "https://chromium.googlesource.com/webm/libvpx.git" "libvpx" 470 | if [ "${!SRC_ENABLE}" -ne 0 ] 471 | then 472 | fetch_source 473 | if [ "$BUILD" -ne 0 ] 474 | then 475 | cd_source 476 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_CFLAGS" --target=x86_64-darwin$NCC_DARWIN_VERSION-gcc --as=yasm --enable-static --disable-shared --disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-vp9 --enable-vp8 --enable-postproc --enable-vp9-postproc --enable-vp9-highbitdepth 477 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 478 | build_make $NCC_JOBS 479 | fi 480 | fi 481 | 482 | #x264 483 | set_source "x264" "git" "https://git.videolan.org/git/x264" "libx264" 484 | if [ "${!SRC_ENABLE}" -ne 0 ] 485 | then 486 | fetch_source 487 | if [ "$BUILD" -ne 0 ] 488 | then 489 | cd_source 490 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_CFLAGS" --bindir="$BIN_PATH" --enable-static --disable-cli 491 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 492 | build_make $NCC_JOBS 493 | fi 494 | fi 495 | 496 | #x265 497 | set_source "x265" "hg" "https://bitbucket.org/multicoreware/x265" "libx265" 498 | if [ "${!SRC_ENABLE}" -ne 0 ] 499 | then 500 | fetch_source 501 | if [ "$BUILD" -ne 0 ] 502 | then 503 | cd_source 504 | cd build/linux 505 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.make" -DENABLE_SHARED=0 -DENABLE_CLI=0 ../../source 506 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 507 | build_make $NCC_JOBS 508 | fi 509 | fi 510 | 511 | #sdl 512 | set_source "sdl" "hg" "http://hg.libsdl.org/SDL" 513 | if [ "${!SRC_ENABLE}" -ne 0 ] 514 | then 515 | fetch_source 516 | if [ "$BUILD" -ne 0 ] 517 | then 518 | cd_source 519 | mv .hg .temp_hg 520 | CFLAGS=-DDECLSPEC= ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --bindir="$BIN_PATH" --enable-static --disable-shared 521 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 522 | build_make $NCC_JOBS 523 | rm -f "$BIN_PATH"/sdl* 524 | mv .temp_hg .hg 525 | fi 526 | fi 527 | 528 | #nvenc 529 | set_source "nv-codec-headers" "git" "https://github.com/FFmpeg/nv-codec-headers.git" "nvenc" "nvdec" 530 | if [ "${!SRC_ENABLE}" -ne 0 ] 531 | then 532 | fetch_source 533 | if [ "$BUILD" -ne 0 ] 534 | then 535 | cd_source 536 | make PREFIX="$ROOT_PATH/$OUT_PATH" install 537 | [ $? -eq 0 ] || build_die "install stage failed for $SRC_NAME" 538 | build_message BM_GREEN "$SRC_NAME: built" 539 | fi 540 | fi 541 | 542 | #ffmpeg 543 | set_source "ffmpeg" "git" "https://git.ffmpeg.org/ffmpeg.git" "gpl" "version3" "nonfree" "avresample" 544 | if [ "${!SRC_ENABLE}" -ne 0 ] 545 | then 546 | fetch_source 547 | if [ "$BUILD" -ne 0 ] 548 | then 549 | cd_source 550 | ./configure \ 551 | --enable-static \ 552 | --prefix="$ROOT_PATH/$OUT_PATH" \ 553 | --pkg-config="pkg-config" \ 554 | --pkg-config-flags="--static" \ 555 | --extra-cflags="$NCC_OPTIM $NCC_CFLAGS" \ 556 | --extra-cflags="-I$ROOT_PATH/$OUT_PATH/include -I/opt/local/include" \ 557 | --extra-ldflags="-L$ROOT_PATH/$OUT_PATH/lib -L/opt/local/lib" \ 558 | --extra-libs="-lpthread -lm" \ 559 | --bindir="$BIN_PATH"\ 560 | $NCC_FFMPEG_LIB_OPTIONS 561 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 562 | build_make $NCC_JOBS 563 | fi 564 | fi 565 | -------------------------------------------------------------------------------- /ffmpeg-native-pi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_VERSION="1.5.9" 4 | THIS="ffmpeg-native-pi" 5 | 6 | #build paths 7 | ROOT_PATH="${ROOT_PATH:-$HOME}" 8 | SRC_PATH="${SRC_PATH:-ffmpeg_sources}" 9 | OUT_PATH="${OUT_PATH:-ffmpeg_build}" 10 | BIN_PATH="${BIN_PATH:-$ROOT_PATH/$OUT_PATH/bin}" 11 | HINTS_FILE="${HINTS_FILE:-$ROOT_PATH/ffmpeg-pi-build-hints}" 12 | NCC_PATH_LIST=\ 13 | ( \ 14 | "ROOT_PATH" "SRC_PATH" "OUT_PATH" "BIN_PATH" "HINTS_FILE" \ 15 | ) 16 | 17 | #compiler settings 18 | NCC_OPTIM="-O2" 19 | NCC_CFLAGS="-pipe" 20 | NCC_CPPFLAGS="-DNDEBUG -I$ROOT_PATH/$OUT_PATH/include" 21 | NCC_MACHINE="$(uname -m | tr '[:upper:]' '[:lower:]')" 22 | NCC_OS="$(uname -o | tr '[:upper:]' '[:lower:]')" 23 | #make settings 24 | NCC_JOBS=$(getconf _NPROCESSORS_ONLN) 25 | NCC_FETCH_ONLY="${NCC_FETCH_ONLY:-0}" 26 | NCC_SHOW_ONLY="${NCC_SHOW_ONLY:-0}" 27 | NCC_DISABLE_DEFAULT="${NCC_DISABLE_DEFAULT:-0}" 28 | NCC_OPTION_LIST=\ 29 | ( \ 30 | "HOST" "OPTIM" "CFLAGS" "JOBS" "FETCH_ONLY" "SHOW_ONLY" "DISABLE_DEFAULT" \ 31 | ) 32 | 33 | NCC_SYSTEM_LIST=\ 34 | ( \ 35 | "MACHINE" "OS" \ 36 | ) 37 | 38 | NCC_SOURCE_LIST=\ 39 | ( \ 40 | "fdk-aac" "ffmpeg" "lame" "ogg" "opus" "openssl" \ 41 | "theora" "vorbis" "vpx" "x264" "x265" "userland" "zlib" \ 42 | ) 43 | 44 | #lib options 45 | NCC_FFMPEG_EXTRA_LIBS="-lpthread -lm" 46 | 47 | #fix pkg-config paths 48 | export PKG_CONFIG_DIR= 49 | export PKG_CONFIG_PATH= 50 | export PKG_CONFIG_SYSROOT_PATH="$ROOT_PATH" 51 | export PKG_CONFIG_LIBDIR="$ROOT_PATH/$OUT_PATH/lib/pkgconfig:$ROOT_PATH/$OUT_PATH/share/pkgconfig" 52 | 53 | build_message() { 54 | 55 | local BM_WHITE=15 56 | local BM_GREEN=10 57 | local BM_CYAN=14 58 | local BM_MAGENTA=200 59 | local BM_YELLOW=11 60 | local BM_RED=9 61 | local color=$1 62 | 63 | shift 64 | printf "\e[38;5;${!color}m====> $@ <====\e[0m\n" 1>&2 65 | } 66 | 67 | build_die() { 68 | 69 | build_message BM_RED "$@" 70 | exit 1 71 | } 72 | 73 | build_make() { 74 | 75 | local jobs="${1:-1}" 76 | shift 77 | local hint=$(get_hint "$SRC_NAME" "make") 78 | jobs="${hint:-$jobs}" 79 | 80 | make -j $jobs "$@" 81 | [ $? -eq 0 ] || build_die "$THIS: make stage failed (jobs = $jobs) -> $SRC_NAME" 82 | 83 | grep -E '((^[ ]*)|([ ]*))[^ ]*install[^ ]*[ ]*$' <<< "$@" &> /dev/null 84 | [ $? -eq 0 ] || make install 85 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 86 | 87 | build_message BM_GREEN "$SRC_NAME: built successfully (jobs = $jobs)" 88 | } 89 | 90 | fetch_source() { 91 | 92 | local revision=$(get_hint "$SRC_NAME" "$SRC_METHOD") 93 | local url=$(get_hint "$SRC_NAME" "url") 94 | local status=1 95 | local scheme; 96 | local path; 97 | 98 | if [ -z "$url" ] 99 | then 100 | url="$SRC_URL" 101 | fi 102 | 103 | [[ "$url" =~ ^(file://)(.+)$ ]] 104 | scheme="${BASH_REMATCH[1]}" 105 | path="${BASH_REMATCH[2]}" 106 | 107 | if [ "$scheme" == "file://" ] 108 | then 109 | build_message BM_YELLOW "rsync $path/ ./$SRC_NAME/" 110 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 111 | then 112 | mkdir "$SRC_NAME" 113 | eval "rsync -ritl --stats $path/ ./$SRC_NAME/" 114 | status=$? 115 | fi 116 | fi 117 | 118 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 119 | then 120 | build_message BM_MAGENTA "$SRC_NAME: fetch -> $SRC_METHOD $url $revision" 121 | return 0 122 | fi 123 | 124 | case "$SRC_METHOD" in 125 | git) 126 | if [ "$scheme" != "file://" ] 127 | then 128 | git clone "$url" "$SRC_NAME" 129 | status=$? 130 | fi 131 | 132 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 133 | then 134 | cd_source 135 | git reset --hard "$revision" 136 | status=$? 137 | cd .. 138 | fi 139 | ;; 140 | svn) 141 | if [ "$scheme" != "file://" ] 142 | then 143 | svn checkout "$url" "$SRC_NAME" 144 | status=$? 145 | fi 146 | 147 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 148 | then 149 | cd_source 150 | svn up -r"$revision" 151 | status=$? 152 | cd .. 153 | fi 154 | ;; 155 | hg) 156 | if [ "$scheme" != "file://" ] 157 | then 158 | hg clone "$url" "$SRC_NAME" 159 | status=$? 160 | fi 161 | 162 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 163 | then 164 | cd_source 165 | hg revert -r "$revision" --all 166 | status=$? 167 | cd .. 168 | fi 169 | ;; 170 | #wget) 171 | #wget -O "$SRC_NAME.$1" "$url" 172 | #;; 173 | *) 174 | build_die "$THIS: invalid fetch method -> $SRC_NAME: $SRC_METHOD" 175 | ;; 176 | esac 177 | if [ $status -eq 0 ] 178 | then 179 | build_message BM_MAGENTA "$SRC_NAME: fetch success -> $SRC_METHOD $url $revision" 180 | else 181 | build_die "$THIS: fetch stage failed -> $SRC_NAME: $SRC_METHOD $url" 182 | fi 183 | } 184 | 185 | get_hint() { 186 | 187 | local status=1 188 | if [ -r "$HINTS_FILE" ] 189 | then 190 | #$1 name 191 | #$2 hint 192 | local name=$1 193 | shift 194 | local hint=$1 195 | shift 196 | 197 | awk -F'\t' -v name=$name -v hint=$hint \ 198 | '!($0 ~ /^[[:space:]]*#/) && !($0 ~ /^[[:space:]]*$/) && $1 == name && $2 == hint \ 199 | {printf "%s", $3; found=1; exit} \ 200 | END { if (found) {exit 0} else {exit 1}}' "$HINTS_FILE" 201 | 202 | status=$? 203 | fi 204 | return $status 205 | } 206 | 207 | get_NCC_hints() { 208 | 209 | local h 210 | local val 211 | local var 212 | 213 | #initialize enabled builds based on enable/disable default 214 | for h in "${NCC_SOURCE_LIST[@]}" 215 | do 216 | var="NCC_ENABLE_$h" 217 | var="${var//[^A-Za-z0-9]/_}" 218 | var="${var^^}" 219 | #echo "$var" 220 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 221 | then 222 | val=1 223 | else 224 | val=0 225 | fi 226 | eval "$var=\$val" 227 | done 228 | 229 | #check for values from the hints file 230 | if [ -r "$HINTS_FILE" ] 231 | then 232 | for h in "${NCC_OPTION_LIST[@]}" 233 | do 234 | val="$(get_hint "NCC" "$h")" 235 | if [ $? -eq 0 ] 236 | then 237 | var="NCC_$h" 238 | eval "$var=\$val" 239 | fi 240 | done 241 | 242 | for h in "${NCC_SOURCE_LIST[@]}" 243 | do 244 | var="NCC_ENABLE_$h" 245 | var="${var//[^A-Za-z0-9]/_}" 246 | var="${var^^}" 247 | #echo "$var" 248 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 249 | then 250 | val="$(get_hint "$h" "disable")" 251 | if [ $? -eq 0 ] 252 | then 253 | val=0 254 | else 255 | val=1 256 | fi 257 | else 258 | val="$(get_hint "$h" "enable")" 259 | if [ $? -eq 0 ] 260 | then 261 | val=1 262 | else 263 | val=0 264 | fi 265 | fi 266 | eval "$var=\$val" 267 | done 268 | fi 269 | } 270 | 271 | set_source() { 272 | 273 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 274 | then 275 | cd "$ROOT_PATH/$SRC_PATH" 276 | fi 277 | 278 | SRC_NAME="$1" 279 | if [ "$#" -eq 1 ] 280 | then 281 | return 282 | fi 283 | 284 | shift 285 | SRC_ENABLE="NCC_ENABLE_$SRC_NAME" 286 | SRC_ENABLE="${SRC_ENABLE//[^A-Za-z0-9]/_}" 287 | SRC_ENABLE="${SRC_ENABLE^^}" 288 | SRC_URL=$(get_hint "$SRC_NAME" "url") 289 | SRC_METHOD="$1" 290 | shift 291 | SRC_URL="${SRC_URL:-$1}" 292 | shift 293 | 294 | if [ "${!SRC_ENABLE}" -ne 0 ] 295 | then 296 | for arg in "$@" 297 | do 298 | NCC_FFMPEG_LIB_OPTIONS="$NCC_FFMPEG_LIB_OPTIONS --enable-$arg" 299 | done 300 | build_message BM_CYAN "$SRC_NAME" 301 | fi 302 | } 303 | 304 | cd_source() { 305 | 306 | cd $SRC_NAME 307 | } 308 | 309 | #startup banner 310 | build_message BM_WHITE "$THIS: Version $SCRIPT_VERSION" 311 | build_message BM_WHITE "$THIS: $(gcc -v 2>&1 | grep '^gcc version')" 312 | 313 | #load NCC hints 314 | get_NCC_hints 315 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 316 | then 317 | for i in "${NCC_PATH_LIST[@]}" 318 | do 319 | echo "$i: ${!i}" 320 | done 321 | for i in "${NCC_OPTION_LIST[@]}" 322 | do 323 | var="NCC_$i" 324 | echo "$var: ${!var}" 325 | done 326 | for i in "${NCC_SOURCE_LIST[@]}" 327 | do 328 | var="NCC_ENABLE_$i" 329 | var="${var//[^A-Za-z0-9]/_}" 330 | var="${var^^}" 331 | echo "$var: ${!var} ($i)" 332 | done 333 | fi 334 | 335 | if [ "$NCC_FETCH_ONLY" -eq 0 ] && [ "$NCC_SHOW_ONLY" -eq 0 ] 336 | then 337 | BUILD=1 338 | else 339 | BUILD=0 340 | fi 341 | 342 | #ensure clean build 343 | if [ "$BUILD" -ne 0 ] 344 | then 345 | rm -rf "$ROOT_PATH/$OUT_PATH" 346 | [ -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to remove build directory -> $ROOT_PATH/$OUT_PATH" 347 | fi 348 | 349 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 350 | then 351 | rm -rf "$ROOT_PATH/$SRC_PATH" 352 | [ -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to remove source directory -> $ROOT_PATH/$SRC_PATH" 353 | fi 354 | 355 | if [ "$BUILD" -ne 0 ] 356 | then 357 | mkdir "$ROOT_PATH/$OUT_PATH" 358 | [ ! -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to create build directory -> $ROOT_PATH/$OUT_PATH" 359 | fi 360 | 361 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 362 | then 363 | mkdir "$ROOT_PATH/$SRC_PATH" 364 | [ ! -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to create source directory -> $ROOT_PATH/$SRC_PATH" 365 | fi 366 | 367 | if [ "$BUILD" -ne 0 ] 368 | then 369 | #cmake toolchain settings 370 | touch $ROOT_PATH/$SRC_PATH/native.cmake 371 | echo "SET(CMAKE_SYSTEM_NAME Linux)" >> $ROOT_PATH/$SRC_PATH/native.cmake 372 | echo "SET(CMAKE_BUILD_TYPE Release)" >> $ROOT_PATH/$SRC_PATH/native.cmake 373 | echo "SET(CMAKE_SYSTEM_PROCESSOR arm)" >> $ROOT_PATH/$SRC_PATH/native.cmake 374 | echo "SET(CMAKE_C_COMPILER gcc)" >> $ROOT_PATH/$SRC_PATH/native.cmake 375 | echo "SET(CMAKE_CXX_COMPILER g++)" >> $ROOT_PATH/$SRC_PATH/native.cmake 376 | echo "SET(CMAKE_C_FLAGS \"$NCC_OPTIM $NCC_CFLAGS\")" >> $ROOT_PATH/$SRC_PATH/native.cmake 377 | echo "SET(CMAKE_CXX_FLAGS \"$NCC_OPTIM $NCC_CFLAGS\")" >> $ROOT_PATH/$SRC_PATH/native.cmake 378 | echo "SET(CMAKE_CPP_FLAGS \"$NCC_CPPFLAGS\")" >> $ROOT_PATH/$SRC_PATH/native.cmake 379 | echo "SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)" >> $ROOT_PATH/$SRC_PATH/native.cmake 380 | echo 'SET(CMAKE_STATIC_LIBRARY_LINK_C_FLAGS "-static-libgcc -static-libstdc++ -static -s")' >> $ROOT_PATH/$SRC_PATH/native.cmake 381 | echo 'SET(CMAKE_STATIC_LIBRARY_LINK_CXX_FLAGS "-static-libgcc -static-libstdc++ -static -s")' >> $ROOT_PATH/$SRC_PATH/native.cmake 382 | echo 'SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static -s")' >> $ROOT_PATH/$SRC_PATH/native.cmake 383 | fi 384 | 385 | #display the detected system type and hints file in use 386 | if [ "$BUILD" -ne 0 ] 387 | then 388 | for i in "${NCC_SYSTEM_LIST[@]}" 389 | do 390 | var="NCC_$i" 391 | echo "$var: ${!var}" 392 | done 393 | echo -n "HINTS_FILE: $HINTS_FILE" 394 | if [ ! -e "$HINTS_FILE" ] || [ ! -r "$HINTS_FILE" ] 395 | then 396 | echo " (unreadable)" 397 | else 398 | echo " (readable)" 399 | fi 400 | fi 401 | 402 | #build the sources 403 | 404 | #zlib 405 | set_source "zlib" "git" "https://github.com/madler/zlib.git" "zlib" 406 | if [ "${!SRC_ENABLE}" -ne 0 ] 407 | then 408 | fetch_source 409 | if [ "$BUILD" -ne 0 ] 410 | then 411 | cd_source 412 | CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" LDFLAGS="-L$ROOT_PATH/$OUT_PATH/lib -l:libz.a" ./configure --prefix="$ROOT_PATH/$OUT_PATH" --static 413 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 414 | build_make $NCC_JOBS 415 | cp $ROOT_PATH/$OUT_PATH/lib/libzlibstatic.a $ROOT_PATH/$OUT_PATH/lib/libz.a 416 | fi 417 | fi 418 | 419 | #fdk-aac 420 | set_source "fdk-aac" "git" "https://github.com/mstorsjo/fdk-aac.git" "libfdk-aac" 421 | if [ "${!SRC_ENABLE}" -ne 0 ] 422 | then 423 | fetch_source 424 | if [ "$BUILD" -ne 0 ] 425 | then 426 | cd_source 427 | autoreconf -fiv 428 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared 429 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 430 | build_make $NCC_JOBS 431 | fi 432 | fi 433 | 434 | #lame 435 | set_source "lame" "svn" "https://svn.code.sf.net/p/lame/svn/trunk/lame" "libmp3lame" 436 | if [ "${!SRC_ENABLE}" -ne 0 ] 437 | then 438 | fetch_source 439 | if [ "$BUILD" -ne 0 ] 440 | then 441 | cd_source 442 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --disable-shared --disable-frontend 443 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 444 | build_make $NCC_JOBS 445 | fi 446 | fi 447 | 448 | #ogg 449 | set_source "ogg" "git" "https://github.com/xiph/ogg.git" 450 | if [ "${!SRC_ENABLE}" -ne 0 ] 451 | then 452 | fetch_source 453 | if [ "$BUILD" -ne 0 ] 454 | then 455 | cd_source 456 | ./autogen.sh 457 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared 458 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 459 | build_make $NCC_JOBS 460 | fi 461 | fi 462 | 463 | #opus 464 | set_source "opus" "git" "https://github.com/xiph/opus.git" "libopus" 465 | if [ "${!SRC_ENABLE}" -ne 0 ] 466 | then 467 | fetch_source 468 | if [ "$BUILD" -ne 0 ] 469 | then 470 | cd_source 471 | ./autogen.sh 472 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared --disable-doc --disable-examples 473 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 474 | build_make $NCC_JOBS 475 | fi 476 | fi 477 | 478 | #theora 479 | set_source "theora" "git" "https://github.com/xiph/theora.git" "libtheora" 480 | if [ "${!SRC_ENABLE}" -ne 0 ] 481 | then 482 | fetch_source 483 | if [ "$BUILD" -ne 0 ] 484 | then 485 | cd_source 486 | ./autogen.sh 487 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared --disable-doc --disable-oggtest --disable-vorbistest --disable-examples 488 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 489 | build_make $NCC_JOBS 490 | fi 491 | fi 492 | 493 | #vorbis 494 | set_source "vorbis" "git" "https://github.com/xiph/vorbis.git" "libvorbis" 495 | if [ "${!SRC_ENABLE}" -ne 0 ] 496 | then 497 | fetch_source 498 | if [ "$BUILD" -ne 0 ] 499 | then 500 | cd_source 501 | ./autogen.sh 502 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CPPFLAGS="$NCC_CPPFLAGS" --enable-static --disable-shared -disable-docs --disable-examples 503 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 504 | build_make $NCC_JOBS 505 | fi 506 | fi 507 | 508 | #aom AV1 509 | #set_source "aom" "git" "https://aomedia.googlesource.com/aom" "libaom" 510 | #if [ "${!SRC_ENABLE}" -ne 0 ] 511 | #then 512 | # fetch_source 513 | # if [ "$BUILD" -ne 0 ] 514 | # then 515 | # mkdir "$SRC_NAME"_build 516 | # cd "$SRC_NAME"_build 517 | # cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.make" -DAOM_TARGET_CPU="arm" -DBUILD_SHARED_LIBS=0 -DENABLE_NASM=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TOOLS=0 ../aom 518 | # [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 519 | # build_make $NCC_JOBS 520 | # fi 521 | #fi 522 | 523 | #vpx 524 | set_source "vpx" "git" "https://chromium.googlesource.com/webm/libvpx.git" "libvpx" 525 | if [ "${!SRC_ENABLE}" -ne 0 ] 526 | then 527 | fetch_source 528 | if [ "$BUILD" -ne 0 ] 529 | then 530 | cd_source 531 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_CFLAGS" --disable-debug --target=armv8-linux-gcc --enable-static --disable-shared --disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-vp9 --enable-vp8 --enable-postproc --enable-vp9-postproc --enable-vp9-highbitdepth 532 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 533 | build_make $NCC_JOBS 534 | fi 535 | fi 536 | 537 | #x264 538 | set_source "x264" "git" "https://code.videolan.org/videolan/x264.git" "libx264" 539 | if [ "${!SRC_ENABLE}" -ne 0 ] 540 | then 541 | fetch_source 542 | if [ "$BUILD" -ne 0 ] 543 | then 544 | cd_source 545 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_CFLAGS" --bindir="$BIN_PATH" --enable-static --disable-cli 546 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 547 | build_make $NCC_JOBS 548 | fi 549 | fi 550 | 551 | #x265 552 | set_source "x265" "git" "https://bitbucket.org/multicoreware/x265_git.git" "libx265" 553 | if [ "${!SRC_ENABLE}" -ne 0 ] 554 | then 555 | fetch_source 556 | if [ "$BUILD" -ne 0 ] 557 | then 558 | cd_source 559 | cd build/linux 560 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.cmake" -DENABLE_SHARED=0 -DENABLE_CLI=0 ../../source 561 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 562 | build_make $NCC_JOBS 563 | fi 564 | fi 565 | 566 | #rpi userland 567 | set_source "userland" "git" "https://github.com/raspberrypi/userland.git" "mmal" "omx" "omx-rpi" 568 | if [ "${!SRC_ENABLE}" -ne 0 ] 569 | then 570 | fetch_source 571 | if [ "$BUILD" -ne 0 ] 572 | then 573 | cd_source 574 | ./buildme "$ROOT_PATH/$OUT_PATH" 575 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 576 | NCC_CPPFLAGS="$NCC_CPPFLAGS -I$ROOT_PATH/$OUT_PATH/opt/vc/include/IL" 577 | fi 578 | fi 579 | 580 | #openssl 581 | set_source "openssl" "git" "https://github.com/openssl/openssl.git" "openssl" 582 | if [ "${!SRC_ENABLE}" -ne 0 ] 583 | then 584 | fetch_source 585 | if [ "$BUILD" -ne 0 ] 586 | then 587 | cd_source 588 | ./config no-ssl2 no-ssl3 no-weak-ssl-ciphers no-shared no-hw no-engine no-dso no-err no-tests zlib --prefix="$ROOT_PATH/$OUT_PATH" --openssldir="$ROOT_PATH/$OUT_PATH" "$NCC_OPTIM $NCC_CFLAGS" --with-zlib-include="$ROOT_PATH/$OUT_PATH/include" --with-zlib-lib="$ROOT_PATH/$OUT_PATH/lib" 589 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 590 | build_make $NCC_JOBS install_sw 591 | fi 592 | fi 593 | 594 | #ffmpeg 595 | set_source "ffmpeg" "git" "https://git.ffmpeg.org/ffmpeg.git" "gpl" "version3" "nonfree" "avresample" 596 | if [ "${!SRC_ENABLE}" -ne 0 ] 597 | then 598 | fetch_source 599 | if [ "$BUILD" -ne 0 ] 600 | then 601 | cd_source 602 | CPPFLAGS="$NCC_CPPFLAGS" ./configure \ 603 | --arch=armel \ 604 | --target-os=linux \ 605 | --disable-debug \ 606 | --disable-shared \ 607 | --enable-static \ 608 | --prefix="$ROOT_PATH/$OUT_PATH" \ 609 | --pkg-config="pkg-config" \ 610 | --pkg-config-flags="--static" \ 611 | --extra-cflags="$NCC_OPTIM $NCC_CFLAGS" \ 612 | --extra-ldflags="-no-pie" \ 613 | --extra-ldflags="-L$ROOT_PATH/$OUT_PATH/lib -L$ROOT_PATH/$OUT_PATH/opt/vc/lib" \ 614 | --extra-libs="$NCC_FFMPEG_EXTRA_LIBS" \ 615 | --bindir="$BIN_PATH"\ 616 | $NCC_FFMPEG_LIB_OPTIONS 617 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 618 | build_make $NCC_JOBS 619 | fi 620 | fi 621 | -------------------------------------------------------------------------------- /ffmpeg-native-x86: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_VERSION="1.4.0" 4 | THIS="ffmpeg-native-x86" 5 | 6 | #build paths 7 | ROOT_PATH="${ROOT_PATH:-$HOME}" 8 | SRC_PATH="${SRC_PATH:-ffmpeg_sources}" 9 | OUT_PATH="${OUT_PATH:-ffmpeg_build}" 10 | BIN_PATH="${BIN_PATH:-$ROOT_PATH/$OUT_PATH/bin}" 11 | HINTS_FILE="${HINTS_FILE:-$ROOT_PATH/ffmpeg-native-build-hints}" 12 | NCC_PATH_LIST=\ 13 | ( \ 14 | "ROOT_PATH" "SRC_PATH" "OUT_PATH" "BIN_PATH" "HINTS_FILE" \ 15 | ) 16 | 17 | #compiler settings 18 | NCC_OPTIM="-O2" 19 | NCC_CFLAGS="-mtune=native -pipe" 20 | #make settings 21 | NCC_JOBS=$(getconf _NPROCESSORS_ONLN) 22 | NCC_FETCH_ONLY="${NCC_FETCH_ONLY:-0}" 23 | NCC_SHOW_ONLY="${NCC_SHOW_ONLY:-0}" 24 | NCC_DISABLE_DEFAULT="${NCC_DISABLE_DEFAULT:-0}" 25 | NCC_OPTION_LIST=\ 26 | ( \ 27 | "HOST" "OPTIM" "CFLAGS" "JOBS" "FETCH_ONLY" "SHOW_ONLY" "DISABLE_DEFAULT" \ 28 | ) 29 | NCC_SOURCE_LIST=\ 30 | ( \ 31 | "aom" "fdk-aac" "ffmpeg" "lame" \ 32 | "nv-codec-headers" "ogg" "opus" "sdl" \ 33 | "theora" "vorbis" "vpx" "x264" "x265" \ 34 | ) 35 | 36 | #fix pkg-config paths for cross 37 | export PKG_CONFIG_DIR= 38 | export PKG_CONFIG_PATH= 39 | export PKG_CONFIG_SYSROOT_PATH="$ROOT_PATH" 40 | export PKG_CONFIG_LIBDIR="$ROOT_PATH/$OUT_PATH/lib/pkgconfig" 41 | 42 | build_message() { 43 | 44 | local BM_WHITE=15 45 | local BM_GREEN=10 46 | local BM_CYAN=14 47 | local BM_MAGENTA=200 48 | local BM_YELLOW=11 49 | local BM_RED=9 50 | local color=$1 51 | 52 | shift 53 | printf "\e[38;5;${!color}m====> $@ <====\e[0m\n" 1>&2 54 | } 55 | 56 | build_die() { 57 | 58 | build_message BM_RED "$@" 59 | exit 1 60 | } 61 | 62 | build_make() { 63 | 64 | local jobs="${1:-1}" 65 | local hint=$(get_hint "$SRC_NAME" "make") 66 | jobs="${hint:-$jobs}" 67 | 68 | make -j $jobs 69 | [ $? -eq 0 ] || build_die "$THIS: make stage failed (jobs = $jobs) -> $SRC_NAME" 70 | 71 | make install 72 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 73 | 74 | build_message BM_GREEN "$SRC_NAME: built successfully (jobs = $jobs)" 75 | } 76 | 77 | fetch_source() { 78 | 79 | local revision=$(get_hint "$SRC_NAME" "$SRC_METHOD") 80 | local url=$(get_hint "$SRC_NAME" "url") 81 | local status=1 82 | local scheme; 83 | local path; 84 | 85 | if [ -z "$url" ] 86 | then 87 | url="$SRC_URL" 88 | fi 89 | 90 | [[ "$url" =~ ^(file://)(.+)$ ]] 91 | scheme="${BASH_REMATCH[1]}" 92 | path="${BASH_REMATCH[2]}" 93 | 94 | if [ "$scheme" == "file://" ] 95 | then 96 | build_message BM_YELLOW "rsync $path/ ./$SRC_NAME/" 97 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 98 | then 99 | mkdir "$SRC_NAME" 100 | eval "rsync -rit --stats $path/ ./$SRC_NAME/" 101 | status=$? 102 | fi 103 | fi 104 | 105 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 106 | then 107 | build_message BM_MAGENTA "$SRC_NAME: fetch -> $SRC_METHOD $url $revision" 108 | return 0 109 | fi 110 | 111 | case "$SRC_METHOD" in 112 | git) 113 | if [ "$scheme" != "file://" ] 114 | then 115 | git clone "$url" "$SRC_NAME" 116 | status=$? 117 | fi 118 | 119 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 120 | then 121 | cd_source 122 | git reset --hard "$revision" 123 | status=$? 124 | cd .. 125 | fi 126 | ;; 127 | svn) 128 | if [ "$scheme" != "file://" ] 129 | then 130 | svn checkout "$url" "$SRC_NAME" 131 | status=$? 132 | fi 133 | 134 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 135 | then 136 | cd_source 137 | svn up -r"$revision" 138 | status=$? 139 | cd .. 140 | fi 141 | ;; 142 | hg) 143 | if [ "$scheme" != "file://" ] 144 | then 145 | hg clone "$url" "$SRC_NAME" 146 | status=$? 147 | fi 148 | 149 | if [ ! -z "$revision" ] && [ "$status" -eq 0 ] 150 | then 151 | cd_source 152 | hg revert -r "$revision" --all 153 | status=$? 154 | cd .. 155 | fi 156 | ;; 157 | #wget) 158 | #wget -O "$SRC_NAME.$1" "$url" 159 | #;; 160 | *) 161 | build_die "$THIS: invalid fetch method -> $SRC_NAME: $SRC_METHOD" 162 | ;; 163 | esac 164 | if [ $status -eq 0 ] 165 | then 166 | build_message BM_MAGENTA "$SRC_NAME: fetch success -> $SRC_METHOD $url $revision" 167 | else 168 | build_die "$THIS: fetch stage failed -> $SRC_NAME: $SRC_METHOD $url" 169 | fi 170 | } 171 | 172 | get_hint() { 173 | 174 | local status=1 175 | if [ -r "$HINTS_FILE" ] 176 | then 177 | #$1 name 178 | #$2 hint 179 | local name=$1 180 | shift 181 | local hint=$1 182 | shift 183 | 184 | awk -F'\t' -v name=$name -v hint=$hint \ 185 | '!($0 ~ /^[[:space:]]*#/) && !($0 ~ /^[[:space:]]*$/) && $1 == name && $2 == hint \ 186 | {printf "%s", $3; found=1; exit} \ 187 | END { if (found) {exit 0} else {exit 1}}' "$HINTS_FILE" 188 | 189 | status=$? 190 | fi 191 | return $status 192 | } 193 | 194 | get_NCC_hints() { 195 | 196 | local h 197 | local val 198 | local var 199 | 200 | #initialize enabled builds based on enable/disable default 201 | for h in "${NCC_SOURCE_LIST[@]}" 202 | do 203 | var="NCC_ENABLE_$h" 204 | var="${var//[^A-Za-z0-9]/_}" 205 | var="${var^^}" 206 | #echo "$var" 207 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 208 | then 209 | val=1 210 | else 211 | val=0 212 | fi 213 | eval "$var=\$val" 214 | done 215 | 216 | #check for values from the hints file 217 | if [ -r "$HINTS_FILE" ] 218 | then 219 | for h in "${NCC_OPTION_LIST[@]}" 220 | do 221 | val="$(get_hint "NCC" "$h")" 222 | if [ $? -eq 0 ] 223 | then 224 | var="NCC_$h" 225 | eval "$var=\$val" 226 | fi 227 | done 228 | 229 | for h in "${NCC_SOURCE_LIST[@]}" 230 | do 231 | var="NCC_ENABLE_$h" 232 | var="${var//[^A-Za-z0-9]/_}" 233 | var="${var^^}" 234 | #echo "$var" 235 | if [ $NCC_DISABLE_DEFAULT -eq 0 ] 236 | then 237 | val="$(get_hint "$h" "disable")" 238 | if [ $? -eq 0 ] 239 | then 240 | val=0 241 | else 242 | val=1 243 | fi 244 | else 245 | val="$(get_hint "$h" "enable")" 246 | if [ $? -eq 0 ] 247 | then 248 | val=1 249 | else 250 | val=0 251 | fi 252 | fi 253 | eval "$var=\$val" 254 | done 255 | fi 256 | } 257 | 258 | set_source() { 259 | 260 | if [ "$NCC_SHOW_ONLY" -eq 0 ] 261 | then 262 | cd "$ROOT_PATH/$SRC_PATH" 263 | fi 264 | SRC_NAME="$1" 265 | shift 266 | SRC_ENABLE="NCC_ENABLE_$SRC_NAME" 267 | SRC_ENABLE="${SRC_ENABLE//[^A-Za-z0-9]/_}" 268 | SRC_ENABLE="${SRC_ENABLE^^}" 269 | SRC_URL=$(get_hint "$SRC_NAME" "url") 270 | SRC_METHOD="$1" 271 | shift 272 | SRC_URL="${SRC_URL:-$1}" 273 | shift 274 | 275 | if [ "${!SRC_ENABLE}" -ne 0 ] 276 | then 277 | for arg in "$@" 278 | do 279 | NCC_FFMPEG_LIB_OPTIONS="$NCC_FFMPEG_LIB_OPTIONS --enable-$arg" 280 | done 281 | build_message BM_CYAN "$SRC_NAME" 282 | fi 283 | 284 | } 285 | 286 | cd_source() { 287 | 288 | cd $SRC_NAME 289 | } 290 | 291 | #startup banner 292 | build_message BM_WHITE "$THIS: Version $SCRIPT_VERSION" 293 | 294 | #load NCC hints 295 | get_NCC_hints 296 | if [ "$NCC_SHOW_ONLY" -ne 0 ] 297 | then 298 | for i in "${NCC_PATH_LIST[@]}" 299 | do 300 | echo "$i: ${!i}" 301 | done 302 | for i in "${NCC_OPTION_LIST[@]}" 303 | do 304 | var="NCC_$i" 305 | echo "$var: ${!var}" 306 | done 307 | for i in "${NCC_SOURCE_LIST[@]}" 308 | do 309 | var="NCC_ENABLE_$i" 310 | var="${var//[^A-Za-z0-9]/_}" 311 | var="${var^^}" 312 | echo "$var: ${!var} ($i)" 313 | done 314 | fi 315 | 316 | if [ "$NCC_FETCH_ONLY" -eq 0 ] && [ "$NCC_SHOW_ONLY" -eq 0 ] 317 | then 318 | BUILD=1 319 | else 320 | BUILD=0 321 | fi 322 | 323 | #ensure clean build 324 | if [ "$BUILD" -ne 0 ] 325 | then 326 | rm -rf "$ROOT_PATH/$OUT_PATH" 327 | [ -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to remove build directory -> $ROOT_PATH/$OUT_PATH" 328 | fi 329 | 330 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 331 | then 332 | rm -rf "$ROOT_PATH/$SRC_PATH" 333 | [ -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to remove source directory -> $ROOT_PATH/$SRC_PATH" 334 | fi 335 | 336 | if [ "$BUILD" -ne 0 ] 337 | then 338 | mkdir "$ROOT_PATH/$OUT_PATH" 339 | [ ! -d "$ROOT_PATH/$OUT_PATH" ] && build_die "$THIS: unable to create build directory -> $ROOT_PATH/$OUT_PATH" 340 | fi 341 | 342 | if [ "$BUILD" -ne 0 ] || [ "$NCC_FETCH_ONLY" -ne 0 ] 343 | then 344 | mkdir "$ROOT_PATH/$SRC_PATH" 345 | [ ! -d "$ROOT_PATH/$SRC_PATH" ] && build_die "$THIS: unable to create source directory -> $ROOT_PATH/$SRC_PATH" 346 | fi 347 | 348 | if [ "$BUILD" -ne 0 ] 349 | then 350 | #cmake toolchain settings 351 | touch $ROOT_PATH/$SRC_PATH/native.make 352 | echo "SET(CMAKE_SYSTEM_NAME Linux)" >> $ROOT_PATH/$SRC_PATH/native.make 353 | echo "SET(CMAKE_SYSTEM_PROCESSOR i686)" >> $ROOT_PATH/$SRC_PATH/native.make 354 | echo "SET(CMAKE_C_COMPILER gcc)" >> $ROOT_PATH/$SRC_PATH/native.make 355 | echo "SET(CMAKE_CXX_COMPILER g++)" >> $ROOT_PATH/$SRC_PATH/native.make 356 | echo "SET(CMAKE_ASM_YASM_COMPILER yasm)" >> $ROOT_PATH/$SRC_PATH/native.make 357 | echo "SET(CMAKE_ASM_NASM_COMPILER nasm)" >> $ROOT_PATH/$SRC_PATH/native.make 358 | echo "SET(CMAKE_CXX_FLAGS \"$NCC_OPTIM $NCC_CFLAGS\")" >> $ROOT_PATH/$SRC_PATH/native.make 359 | echo "SET(CMAKE_C_FLAGS \"$NCC_OPTIM $NCC_CFLAGS\")" >> $ROOT_PATH/$SRC_PATH/native.make 360 | fi 361 | 362 | #build the sources 363 | #fdk-aac 364 | set_source "fdk-aac" "git" "https://github.com/mstorsjo/fdk-aac.git" "libfdk-aac" 365 | if [ "${!SRC_ENABLE}" -ne 0 ] 366 | then 367 | fetch_source 368 | if [ "$BUILD" -ne 0 ] 369 | then 370 | cd_source 371 | autoreconf -fiv 372 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared 373 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 374 | build_make $NCC_JOBS 375 | fi 376 | fi 377 | 378 | #lame 379 | set_source "lame" "svn" "https://svn.code.sf.net/p/lame/svn/trunk/lame" "libmp3lame" 380 | if [ "${!SRC_ENABLE}" -ne 0 ] 381 | then 382 | fetch_source 383 | if [ "$BUILD" -ne 0 ] 384 | then 385 | cd_source 386 | #--enable-nasm x86 broken? 387 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --disable-shared --disable-frontend 388 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 389 | build_make $NCC_JOBS 390 | fi 391 | fi 392 | 393 | #ogg 394 | set_source "ogg" "git" "https://github.com/xiph/ogg.git" 395 | if [ "${!SRC_ENABLE}" -ne 0 ] 396 | then 397 | fetch_source 398 | if [ "$BUILD" -ne 0 ] 399 | then 400 | cd_source 401 | ./autogen.sh 402 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared 403 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 404 | build_make $NCC_JOBS 405 | fi 406 | fi 407 | 408 | #opus 409 | set_source "opus" "git" "https://github.com/xiph/opus.git" "libopus" 410 | if [ "${!SRC_ENABLE}" -ne 0 ] 411 | then 412 | fetch_source 413 | if [ "$BUILD" -ne 0 ] 414 | then 415 | cd_source 416 | ./autogen.sh 417 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared --disable-doc --disable-examples 418 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 419 | build_make $NCC_JOBS 420 | fi 421 | fi 422 | 423 | #theora 424 | set_source "theora" "git" "https://github.com/xiph/theora.git" "libtheora" 425 | if [ "${!SRC_ENABLE}" -ne 0 ] 426 | then 427 | fetch_source 428 | if [ "$BUILD" -ne 0 ] 429 | then 430 | cd_source 431 | ./autogen.sh 432 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM $NCC_CFLAGS" --enable-static --disable-shared --disable-doc --disable-oggtest --disable-vorbistest --disable-examples 433 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 434 | build_make $NCC_JOBS 435 | fi 436 | fi 437 | 438 | #vorbis 439 | set_source "vorbis" "git" "https://github.com/xiph/vorbis.git" "libvorbis" 440 | if [ "${!SRC_ENABLE}" -ne 0 ] 441 | then 442 | fetch_source 443 | if [ "$BUILD" -ne 0 ] 444 | then 445 | cd_source 446 | ./autogen.sh 447 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --enable-static --disable-shared -disable-docs --disable-examples 448 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 449 | build_make $NCC_JOBS 450 | fi 451 | fi 452 | 453 | #aom AV1 454 | set_source "aom" "git" "https://aomedia.googlesource.com/aom" "libaom" 455 | if [ "${!SRC_ENABLE}" -ne 0 ] 456 | then 457 | fetch_source 458 | if [ "$BUILD" -ne 0 ] 459 | then 460 | mkdir "$SRC_NAME"_build 461 | cd "$SRC_NAME"_build 462 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.make" -DAOM_TARGET_CPU="x86" -DENABLE_SHARED=0 -DENABLE_NASM=1 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 ../aom 463 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 464 | build_make $NCC_JOBS 465 | fi 466 | fi 467 | 468 | #vpx 469 | set_source "vpx" "git" "https://chromium.googlesource.com/webm/libvpx.git" "libvpx" 470 | if [ "${!SRC_ENABLE}" -ne 0 ] 471 | then 472 | fetch_source 473 | if [ "$BUILD" -ne 0 ] 474 | then 475 | cd_source 476 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_CFLAGS" --target=x86-linux-gcc --as=yasm --enable-static --disable-shared --disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-vp9 --enable-vp8 --enable-postproc --enable-vp9-postproc --enable-vp9-highbitdepth 477 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 478 | build_make $NCC_JOBS 479 | fi 480 | fi 481 | 482 | #x264 483 | set_source "x264" "git" "https://git.videolan.org/git/x264" "libx264" 484 | if [ "${!SRC_ENABLE}" -ne 0 ] 485 | then 486 | fetch_source 487 | if [ "$BUILD" -ne 0 ] 488 | then 489 | cd_source 490 | ./configure --prefix="$ROOT_PATH/$OUT_PATH" --extra-cflags="$NCC_CFLAGS" --bindir="$BIN_PATH" --enable-static --disable-cli 491 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 492 | build_make $NCC_JOBS 493 | fi 494 | fi 495 | 496 | #x265 497 | set_source "x265" "hg" "https://bitbucket.org/multicoreware/x265" "libx265" 498 | if [ "${!SRC_ENABLE}" -ne 0 ] 499 | then 500 | fetch_source 501 | if [ "$BUILD" -ne 0 ] 502 | then 503 | cd_source 504 | cd build/linux 505 | cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$ROOT_PATH/$OUT_PATH" -DCMAKE_TOOLCHAIN_FILE="$ROOT_PATH/$SRC_PATH/native.make" -DENABLE_SHARED=0 -DENABLE_CLI=0 ../../source 506 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 507 | build_make $NCC_JOBS 508 | fi 509 | fi 510 | 511 | #sdl 512 | set_source "sdl" "hg" "http://hg.libsdl.org/SDL" 513 | if [ "${!SRC_ENABLE}" -ne 0 ] 514 | then 515 | fetch_source 516 | if [ "$BUILD" -ne 0 ] 517 | then 518 | cd_source 519 | mv .hg .temp_hg 520 | CFLAGS=-DDECLSPEC= ./configure --prefix="$ROOT_PATH/$OUT_PATH" CFLAGS="$NCC_OPTIM $NCC_CFLAGS" CXXFLAGS="$NCC_OPTIM$NCC_CFLAGS" --bindir="$BIN_PATH" --enable-static --disable-shared 521 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 522 | build_make $NCC_JOBS 523 | rm -f "$BIN_PATH"/sdl* 524 | mv .temp_hg .hg 525 | fi 526 | fi 527 | 528 | #nvenc 529 | set_source "nv-codec-headers" "git" "https://github.com/FFmpeg/nv-codec-headers.git" "nvenc" "nvdec" 530 | if [ "${!SRC_ENABLE}" -ne 0 ] 531 | then 532 | fetch_source 533 | if [ "$BUILD" -ne 0 ] 534 | then 535 | cd_source 536 | make PREFIX="$ROOT_PATH/$OUT_PATH" install 537 | [ $? -eq 0 ] || build_die "install stage failed for $SRC_NAME" 538 | build_message BM_GREEN "$SRC_NAME: built" 539 | fi 540 | fi 541 | 542 | #ffmpeg 543 | set_source "ffmpeg" "git" "https://git.ffmpeg.org/ffmpeg.git" "gpl" "version3" "nonfree" "avresample" 544 | if [ "${!SRC_ENABLE}" -ne 0 ] 545 | then 546 | fetch_source 547 | if [ "$BUILD" -ne 0 ] 548 | then 549 | cd_source 550 | ./configure \ 551 | --enable-static \ 552 | --prefix="$ROOT_PATH/$OUT_PATH" \ 553 | --pkg-config="pkg-config" \ 554 | --pkg-config-flags="--static" \ 555 | --extra-cflags="$NCC_OPTIM $NCC_CFLAGS -no-pie" \ 556 | --extra-cflags="-I$ROOT_PATH/$OUT_PATH/include" \ 557 | --extra-ldflags="-L$ROOT_PATH/$OUT_PATH/lib -no-pie" \ 558 | --extra-libs="-lpthread -lm" \ 559 | --bindir="$BIN_PATH"\ 560 | $NCC_FFMPEG_LIB_OPTIONS 561 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 562 | build_make $NCC_JOBS 563 | fi 564 | fi 565 | -------------------------------------------------------------------------------- /ffmpeg-osx-build-hints: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | #ffmpeg-osx-build-hints 3 | #------------------------------------------------- 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH 6 | #fields are TAB delimited triplets enabling control of the build 7 | 8 | #source key value 9 | 10 | #------------ 11 | #NCC options 12 | #------------ 13 | NCC CFLAGS -mtune=native -pipe 14 | NCC OPTIM -O2 15 | #NCC JOBS 6 16 | #use FETCH_ONLY to clone all the repositories without a build 17 | #NCC FETCH_ONLY 1 18 | #display the config only - no fetch/build 19 | #NCC SHOW_ONLY 1 20 | NCC DARWIN_VERSION 17 21 | 22 | #----------------------- 23 | #constrain parallel make 24 | #----------------------- 25 | #source make job_count 26 | sdl disable 27 | nv-codec-headers disable 28 | #aom disable 29 | 30 | #--------------------------- 31 | #set override URL for source 32 | #--------------------------- 33 | #source url url_string 34 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 35 | 36 | ffmpeg url file://~/src/ffmpeg 37 | aom url file://~/src/aom 38 | fdk-aac url file://~/src/fdk-aac 39 | lame url file://~/src/lame 40 | #nv-codec-headers url file://~/src/nv-codec-headers 41 | ogg url file://~/src/ogg 42 | opus url file://~/src/opus 43 | sdl url file://~/src/sdl 44 | theora url file://~/src/theora 45 | vorbis url file://~/src/vorbis 46 | vpx url file://~/src/vpx 47 | x264 url file://~/src/x264 48 | x265 url file://~/src/x265 49 | 50 | #------------------------ 51 | #fetch specified revision 52 | #------------------------ 53 | #source fetch_method revision_id 54 | ffmpeg git 55 | aom git 56 | fdk-aac git 57 | lame svn 58 | #nv-codec-headers git 59 | ogg git 60 | opus git 61 | sdl hg 62 | theora git 63 | vorbis git 64 | vpx git 65 | x264 git 66 | x265 hg 67 | 68 | -------------------------------------------------------------------------------- /ffmpeg-pi-build-hints: -------------------------------------------------------------------------------- 1 | #------------------------------------------------ 2 | #ffmpeg-pi-build-hints - 2020-06-14 working build 3 | #------------------------------------------------ 4 | 5 | #place this file in the directory specified by the script's ROOT_PATH 6 | #fields are TAB delimited triplets enabling control of the build 7 | 8 | #source key value 9 | 10 | #------------ 11 | #NCC options 12 | #------------ 13 | NCC CFLAGS -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -mlittle-endian -munaligned-access 14 | NCC OPTIM -O3 15 | NCC JOBS 3 16 | #use FETCH_ONLY to clone all the repositories without a build 17 | #NCC FETCH_ONLY 0 18 | #display the config only - no fetch/build 19 | #NCC SHOW_ONLY 1 20 | 21 | #----------------------- 22 | #constrain parallel make 23 | #----------------------- 24 | #source make job_count 25 | openssl make 1 26 | 27 | #--------------------------- 28 | #set override URL for source 29 | #--------------------------- 30 | #source url url_string 31 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 32 | 33 | #ffmpeg url file://~/src/ffmpeg 34 | #userland url file://~/src/userland 35 | #fdk-aac url file://~/src/fdk-aac 36 | #lame url file://~/src/lame 37 | #ogg url file://~/src/ogg 38 | #openssl url file://~/src/openssl 39 | #opus url file://~/src/opus 40 | #theora url file://~/src/theora 41 | #vorbis url file://~/src/vorbis 42 | #vpx url file://~/src/vpx 43 | #x264 url file://~/src/x264 44 | #x265 url file://~/src/x265 45 | #zlib url file://~/src/zlib 46 | 47 | #------------------------ 48 | #fetch specified revision 49 | #------------------------ 50 | #source fetch_method revision_id 51 | fdk-aac git 845febbb4aa8b81914a8d759536ec48f496d46a3 52 | ffmpeg git 318a1a383dc0312ad5b4afec0ddf0d8d231f5c79 53 | lame svn 6461 54 | ogg git 0bbcba4e7cf32324170470569c4527ffd0002870 55 | openssl git 894da2fb7ed5d314ee5c2fc9fd2d9b8b74111596 56 | opus git b69bfb2a30df65e7f267dd6998276fa3986bd14b 57 | theora git 31e885eac7c23d2f312f49cd5138c0175008e2c9 58 | userland git f97b1af1b3e653f9da2c1a3643479bfd469e3b74 59 | vorbis git f1c1e4451c650008cc5549b08c10fe9ad8ddb1fa 60 | vpx git e753d4930f3b2859968068ffb77f6a6159b2f3c6 61 | x264 git 235ce6130168f4deee55c88ecda5ab84d81d125b 62 | x265 hg 73ca1d7be377 63 | zlib git cacf7f1d4e3d44d871b605da3b647f07d718623f 64 | 65 | -------------------------------------------------------------------------------- /get-repo-cur-rev: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | THIS="get-repo-cur-rev" 4 | 5 | exiterr() { 6 | echo -e "$THIS: $@" 1>&2; 7 | exit 1 8 | } 9 | 10 | if [ "$1" == "-h" ] || [ "$1" == "--h" ] 11 | then 12 | exiterr "Get the current repository revisions below a base directory.\n\nUSAGE: $THIS [base dir]\n" 13 | fi 14 | 15 | fpath="${1:-.}" 16 | 17 | while IFS=$'\n' read -r rdir 18 | do 19 | [[ "$rdir" =~ ^(.+/(.+)/)\.(git|hg|svn)$ ]] 20 | tool="${BASH_REMATCH[3]}" 21 | dir="${BASH_REMATCH[1]}" 22 | name="${BASH_REMATCH[2]}" 23 | 24 | printf "%s\t%s\t" "$name" "$tool" 25 | 26 | case "$tool" in 27 | git) 28 | cd "$dir" 29 | 30 | git rev-parse HEAD 31 | cd .. 32 | ;; 33 | hg) 34 | cd "$dir" 35 | hg id -i | grep -Eo '[a-f0-9]+' 36 | cd .. 37 | 38 | ;; 39 | svn) 40 | cd "$dir" 41 | svn info --show-item revision 42 | cd .. 43 | ;; 44 | *) 45 | echo "unknown" 46 | ;; 47 | esac 48 | 49 | done < <(find "$fpath" -mindepth 2 -maxdepth 2 -type d -name ".git" -o -name ".svn" -o -name ".hg" | sort) 50 | -------------------------------------------------------------------------------- /update-repo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | THIS="update-repo" 4 | 5 | exiterr() { 6 | echo -e "$THIS: $@" 1>&2; 7 | exit 1 8 | } 9 | 10 | if [ "$1" == "-h" ] || [ "$1" == "--h" ] 11 | then 12 | exiterr "Updates all repositories below a base directory.\n\nUSAGE: $THIS [base dir]\n" 13 | fi 14 | 15 | fpath="${1:-.}" 16 | 17 | while IFS=$'\n' read -r rdir 18 | do 19 | [[ "$rdir" =~ ^(.+/(.+)/)\.(git|hg|svn)$ ]] 20 | tool="${BASH_REMATCH[3]}" 21 | dir="${BASH_REMATCH[1]}" 22 | name="${BASH_REMATCH[2]}" 23 | 24 | printf "%s\n%s\t%s:\n" "===============================================================================" "$name" "$tool" 25 | 26 | case "$tool" in 27 | git) 28 | cd "$dir" 29 | git fetch --all 30 | #git reset --hard HEAD 31 | git reset --hard origin/HEAD 32 | #git rev-parse HEAD 33 | git show -s --format="%n%ci%n%cN (%ce)" 34 | git log -n 1 --oneline --decorate origin/HEAD 35 | cd .. 36 | ;; 37 | hg) 38 | cd "$dir" 39 | hg pull 40 | hg update --clean 41 | hg id -i | grep -Eo '[a-f0-9]+' 42 | hg log --limit 1 43 | cd .. 44 | 45 | ;; 46 | svn) 47 | cd "$dir" 48 | svn revert -R . 49 | svn update 50 | #svn log -r $(svn info --show-item revision) 51 | svn log --limit 1 52 | cd .. 53 | ;; 54 | *) 55 | echo "unknown" 56 | ;; 57 | esac 58 | 59 | done < <(find "$fpath" -mindepth 2 -maxdepth 2 -type d -name ".git" -o -name ".svn" -o -name ".hg" | sort) 60 | --------------------------------------------------------------------------------