├── get-repo-cur-rev ├── LICENSE ├── update-repo ├── ffmpeg-osx-build-hints ├── ffmpeg-pi-build-hints ├── ffmpeg-native-build-hints-ffserver ├── ffmpeg-native-build-hints-file-head ├── ffmpeg-cxc-build-hints-file-head ├── ffmpeg-native-build-hints ├── ffmpeg-cxc-build-hints ├── ffmpeg-native-build-hints-slim ├── README.md ├── ffmpeg-cxc-build-hints-slim ├── ffmpeg-native-osx ├── ffmpeg-native-pi ├── ffmpeg-native-x86 ├── ffmpeg-native └── ffmpeg-cxc-mingw64 /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-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 2 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 | whisper url file://~/src/whisper 87 | x264 url file://~/src/x264 88 | x265 url file://~/src/x265 89 | xml2 url file://~/src/xml2 90 | zlib url file://~/src/zlib 91 | 92 | #------------------------ 93 | #fetch specified revision 94 | #------------------------ 95 | #source fetch_method revision_id 96 | amf git 97 | aom git 98 | ass git 99 | avisynth git 100 | bzip2 git 101 | dav1d git 102 | decklink git 103 | dlfcn git 104 | fdk-aac git 105 | ffmpeg git 106 | fftw3 wget fftw-3.3.10.tar.gz 107 | fontconfig git 108 | freetype git 109 | frei0r git 110 | fribidi git 111 | harfbuzz git 112 | ladspa git 113 | lame svn 114 | mfx git 115 | nv-codec-headers git 116 | ogg git 117 | openssl git 118 | opus git 119 | placebo git 120 | png git 121 | rav1e git 122 | rubberband hg 123 | samplerate git 124 | sdl git 125 | sofa git 126 | soxr git 127 | srt git 128 | svt-av1 git 129 | theora git 130 | vmaf git 131 | vorbis git 132 | vpl git 133 | vpx git 134 | vulkan-headers git 135 | webp git 136 | whisper git 137 | x264 git 138 | x265 git 139 | xml2 git 140 | zlib git 141 | 142 | -------------------------------------------------------------------------------- /ffmpeg-native-build-hints: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------- 2 | #ffmpeg-native-build-hints - 2025-11-27 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 1ae7ce7b12d6758a05598278f3d9bc779fa17f4a 89 | ass git e60dddb7db62cc009175843bdb0b0dfedceebedb 90 | bzip2 git af79253677ad98d6dfe11ea315ee9947d86586d3 91 | dav1d git f3a1070f25dcd95cb947c7f387e9037b7c27200c 92 | decklink-linux git 6e9b591d9a3ad7946d2f401cae9832fef722889e 93 | fdk-aac git d8e6b1a3aa606c450241632b64b703f21ea31ce3 94 | ffmpeg git 75b85675916337bc0993f02a70279b96e5903153 95 | fftw3 wget fftw-3.3.10.tar.gz 96 | fontconfig git a9fd30d226322f7f9b674a74d3782eea03c29453 97 | freetype git fe0a9649fca1a2080485f5de20f9a8774921b92b 98 | frei0r git b47c180376dc0ebfb9f57ca9373070eb8afcf9e9 99 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 100 | harfbuzz git d9e3b4efeddd4c961e3b75aae8546bf20e7f4963 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 be05b13e98b048f0b5a0f5fa8ce514d56db5f822 110 | openssl git 134f17d526a5d0a9fbd66adf85e53df8a764a2ff 111 | opus git 57a2042d359e9d83f9bf0eea421d133e9f709083 112 | png git 49363adcfaf098748d7a4c8c624ad8c45a8c3a86 113 | rav1e git b7bf39066ec4f004c9b9cdb81c91734ec2edfac7 114 | rubberband hg 6fca9f344e6d 115 | samplerate git 2ccde9568cca73c7b32c97fefca2e418c16ae5e3 116 | #commit below is for sdl release-2.32.10, head may not build/work as expected 117 | sdl git 5d249570393f7a37e037abf22cd6012a4cc56a71 118 | sofa git 6f1741aa0bd51b66c312566edd1a1b00de06bcf5 119 | soxr git 945b592b70470e29f917f4de89b4281fbbd540c0 120 | #commit below is for srt v1.5.4, head may not build/work as expected 121 | srt git a8c6b65520f814c5bd8f801be48c33ceece7c4a6 122 | svt-av1 git b63784c54ab973bcfa6531fb49494e5699f6c121 123 | theora git 23161c4a63fd9f9d09b9e972f95def2d56c777af 124 | #commit below is for vmaf v3.0.0, head may not build/work as expected 125 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 126 | vorbis git 43bbff0141028e58d476c1d5fd45dd5573db576d 127 | vpx git 1ec7b38c15d524ff1875f512e895e2d20865de8a 128 | vulkan-headers git 65586d13fb197279942581ba9c2eb2c6b664487c 129 | webp git 770ca097e7b061bf9b28ffe85622ba68165889a2 130 | x264 git 0480cb05fa188d37ae87e8f4fd8f1aea3711f7ee 131 | x265 git 9e551a994f970a24f0e49bcebe3d43ef08448b01 132 | xml2 git 22f9d730898d2dfcc03a484e65e1f8fc3675225f 133 | zlib git 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71 134 | 135 | -------------------------------------------------------------------------------- /ffmpeg-cxc-build-hints: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | #ffmpeg-cxc-build-hints - 2025-12-14 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 2 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 | #whisper url file://~/src/whisper 87 | #x264 url file://~/src/x264 88 | #x265 url file://~/src/x265 89 | #xml2 url file://~/src/xml2 90 | #zlib url file://~/src/zlib 91 | 92 | #------------------------ 93 | #fetch specified revision 94 | #------------------------ 95 | #source fetch_method revision_id 96 | amf git afed28d37aca1938da2eedc50599bb3535a987ec 97 | aom git 65f913111447994b569c75e94b3ca6ad9e8ec42e 98 | ass git e60dddb7db62cc009175843bdb0b0dfedceebedb 99 | avisynth git bc81fb7ca4d32dcccfebe5cd772682c138f84e13 100 | bzip2 git af79253677ad98d6dfe11ea315ee9947d86586d3 101 | dav1d git 43f3b8d33bae5179a134d1cd7c394063b1cebfcb 102 | decklink git 0820fac2815be07824a8422afb52c4aebe7cccd6 103 | dlfcn git 8bfddb5aa345ce10ba98e925acbc7bfb53639679 104 | fdk-aac git d8e6b1a3aa606c450241632b64b703f21ea31ce3 105 | ffmpeg git cdb14bc74dfa4d7e274df9830418fc61da0796df 106 | fftw3 wget fftw-3.3.10.tar.gz 107 | fontconfig git a9fd30d226322f7f9b674a74d3782eea03c29453 108 | freetype git 30e45abe939d7c2cbdf268f277c293400096868c 109 | frei0r git 6d272815f25baa6daafacdd132a43e36a94ff21c 110 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 111 | harfbuzz git db63939aaaccc73f94d4535e59d90588d6419d22 112 | ladspa git 0f54d2430febb4d5f02d13132dd91d7345e080b5 113 | lame svn 6531 114 | mfx git f6aac4576826ed821c81231fdfb0d24047158e7d 115 | #v11.1 116 | #nv-codec-headers git 43d91706e097565f57b311e567f0219838bcc2f6 117 | #v12.1 118 | #nv-codec-headers git 1889e62e2d35ff7aa9baca2bceb14f053785e6f1 119 | #v12.2 120 | nv-codec-headers git c69278340ab1d5559c7d7bf0edf615dc33ddbba 121 | ogg git be05b13e98b048f0b5a0f5fa8ce514d56db5f822 122 | openssl git 9fb44b527ee3717795609fb876a7a81f8898c623 123 | opus git c9a74c02f2fa3d1150ca64adb8c8980a581ec5c5 124 | placebo git 45f76a46aaf2958febff2a482a059151b480bf99 125 | png git 54c127584fe1f9b4fbfb5893cdbfc8fb5570e6bc 126 | rav1e git 564ae3b0007ae2b06893fd7166bf88c5a84c5b63 127 | rubberband hg 6fca9f344e6d 128 | samplerate git 15c392d47e71b9395a759544b3818a1235fe1a1d 129 | #commit below is for sdl release-2.32.10, head may not build/work as expected 130 | sdl git 5d249570393f7a37e037abf22cd6012a4cc56a71 131 | sofa git dd315a8ec1fee7193d40e4a59b12c5590a4a918c 132 | soxr git 945b592b70470e29f917f4de89b4281fbbd540c0 133 | #commit below is for srt v1.5.4, head may not build/work as expected 134 | srt git a8c6b65520f814c5bd8f801be48c33ceece7c4a6 135 | svt-av1 git 65d8e02c9494dd66d414ce37669ed3dae1e4daba 136 | theora git 23161c4a63fd9f9d09b9e972f95def2d56c777af 137 | #commit below is for vmaf v3.0.0, head may not build/work as expected 138 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 139 | vorbis git c2aa86b05e981c96bf381fc6aa11cdd03eccc2fb 140 | vpl git 3591aa94dfbdf4566cd19f3e976ae5b769ab4fa2 141 | vpx git d6e5cd7132d59d3cea86d06c9aae26f95fe00adb 142 | vulkan-headers git 2fa203425eb4af9dfc6b03f97ef72b0b5bcb8350 143 | webp git d67d73bf5a6421734cc08da0f568d37a1fe0d103 144 | whisper git 2551e4ce98db69027d08bd99bcc3f1a4e2ad2cef 145 | x264 git 0480cb05fa188d37ae87e8f4fd8f1aea3711f7ee 146 | x265 git 9e551a994f970a24f0e49bcebe3d43ef08448b01 147 | xml2 git 9c80a89af2fdf4f853892f84e46580f4902658ba 148 | zlib git 570720b0c24f9686c33f35a1b3165c1f568b96be 149 | 150 | -------------------------------------------------------------------------------- /ffmpeg-native-build-hints-slim: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------- 2 | #ffmpeg-native-build-hints-slim - 2025-08-26 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 | vpl enable 74 | vulkan-headers enable 75 | x264 enable 76 | x265 enable 77 | zlib enable 78 | 79 | #--------------------------- 80 | #set override URL for source 81 | #--------------------------- 82 | #source url url_string 83 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 84 | 85 | #aom url file://~/src/aom 86 | #ass url file://~/src/ass 87 | #bzip2 url file://~/src/bzip2 88 | #decklink-linux url file://~/src/decklink-linux 89 | #fftw3 url file://~/src/fftw3 90 | #fontconfig url file://~/src/fontconfig 91 | #freetype url file://~/src/freetype 92 | #frei0r url file://~/src/frei0r 93 | #fribidi url file://~/src/fribidi 94 | #harfbuzz url file://~/src/harfbuzz 95 | #ladspa url file://~/src/ladspa 96 | #nv-codec-headers url file://~/src/nv-codec-headers 97 | #png url file://~/src/png 98 | #rav1e url file://~/src/rav1e 99 | #rubberband url file://~/src/rubberband 100 | #samplerate url file://~/src/samplerate 101 | #sofa url file://~/src/sofa 102 | #srt url file://~/src/srt 103 | #svt-av1 url file://~/src/svt-av1 104 | #theora url file://~/src/theora 105 | #vmaf url file://~/src/vmaf 106 | #vpx url file://~/src/vpx 107 | #vulkan-headers url file://~/src/vulkan-headers 108 | #webp url file://~/src/webp 109 | #xml2 url file://~/src/xml2 110 | 111 | #enabled 112 | #dav1d url file://~/src/dav1d 113 | #fdk-aac url file://~/src/fdk-aac 114 | #ffmpeg url file://~/src/ffmpeg 115 | #lame url file://~/src/lame 116 | #ogg url file://~/src/ogg 117 | #openssl url file://~/src/openssl 118 | #opus url file://~/src/opus 119 | #sdl url file://~/src/sdl 120 | #soxr url file://~/src/soxr 121 | #vorbis url file://~/src/vorbis 122 | #vulkan-headers url file://~/src/vulkan-headers 123 | #x264 url file://~/src/x264 124 | #x265 url file://~/src/x265 125 | #zlib url file://~/src/zlib 126 | 127 | #------------------------ 128 | #fetch specified revision 129 | #------------------------ 130 | #source fetch_method revision_id 131 | aom git 1250a261bb8347457bd71085c3e848b3581d852a 132 | ass git 534a5f8299c5ab3c2782856fcb843bfea47b7afc 133 | bzip2 git af79253677ad98d6dfe11ea315ee9947d86586d3 134 | dav1d git af5cf2b1e7f03d6f6de84477e1ca8eed1f3eb03d 135 | decklink-linux git 6e9b591d9a3ad7946d2f401cae9832fef722889e 136 | fdk-aac git d8e6b1a3aa606c450241632b64b703f21ea31ce3 137 | ffmpeg git ef9fe0fe0bba7ecff3ed07fd53146296c1831a8f 138 | fftw3 wget fftw-3.3.10.tar.gz 139 | fontconfig git e0f610fccc81032bda9103524fc28fce22840977 140 | freetype git 8cbabc47daf970704f0faa94996d647925d81f5e 141 | frei0r git b47c180376dc0ebfb9f57ca9373070eb8afcf9e9 142 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 143 | harfbuzz git 029eb2155a74f6bb873c06cdb928b07683dc3f6b 144 | ladspa git 0f54d2430febb4d5f02d13132dd91d7345e080b5 145 | lame svn 6531 146 | #v11.1 147 | #nv-codec-headers git 43d91706e097565f57b311e567f0219838bcc2f6 148 | #v12.1 149 | #nv-codec-headers git 1889e62e2d35ff7aa9baca2bceb14f053785e6f1 150 | #v12.2 151 | nv-codec-headers git c69278340ab1d5559c7d7bf0edf615dc33ddbba 152 | ogg git be05b13e98b048f0b5a0f5fa8ce514d56db5f822 153 | openssl git 53eb2363a1e6336a40a64b3f7b9f09eca95fabef 154 | opus git d0c3972856df5c0d73b76984d34a6850b4680237 155 | png git 134ab615b617f548e822d8857f1cfc0525aefeba 156 | #commit below is for rav1e 0.8.x, head may not build/work as expected 157 | rav1e git a2f01b3e233f531c28a20b4c29fb5c9e5d29fa6d 158 | rubberband hg 6fca9f344e6d 159 | samplerate git 15c392d47e71b9395a759544b3818a1235fe1a1d 160 | #commit below is for sdl release-2.32.8, head may not build/work as expected 161 | sdl git 8236e01a9f758d15927624925c6043f84d8a261f 162 | sofa git dd315a8ec1fee7193d40e4a59b12c5590a4a918c 163 | soxr git 945b592b70470e29f917f4de89b4281fbbd540c0 164 | #commit below is for srt v1.5.4, head may not build/work as expected 165 | srt git a8c6b65520f814c5bd8f801be48c33ceece7c4a6 166 | svt-av1 git 072d5dfe6e427bcb7a769d65db0914e9029da786 167 | theora git 23161c4a63fd9f9d09b9e972f95def2d56c777af 168 | #commit below is for vmaf v3.0.0, head may not build/work as expected 169 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 170 | vorbis git 43bbff0141028e58d476c1d5fd45dd5573db576d 171 | vpx git 9272c3ec2f607b810d48866ae5eb3207cbada65d 172 | vulkan-headers git 2efaa559ff41655ece68b2e904e2bb7e7d55d265 173 | webp git 1ba05593d09bf0f9289e15970020de0b5a962eb4 174 | x264 git b35605ace3ddf7c1a5d67a2eb553f034aef41d55 175 | x265 git 8f11c33acc267ba3f1d2bde60a6aa906e494cbde 176 | xml2 git e397651a6221d95b4fde94b37c4cdfff0e23c1ac 177 | zlib git 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71 178 | -------------------------------------------------------------------------------- /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-slim: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------ 2 | #ffmpeg-cxc-build-hints-slim - 2025-12-14 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 | whisper disable 62 | xml2 disable 63 | 64 | #enabled 65 | dav1d enable 66 | fdk-aac enable 67 | ffmpeg enable 68 | lame enable 69 | #lame make 1 70 | ogg enable 71 | openssl enable 72 | openssl make 2 73 | opus enable 74 | placebo enable 75 | sdl enable 76 | soxr enable 77 | vorbis enable 78 | vpl enable 79 | vulkan-headers enable 80 | x264 enable 81 | x265 enable 82 | zlib enable 83 | 84 | #--------------------------- 85 | #set override URL for source 86 | #--------------------------- 87 | #source url url_string 88 | #ffmpeg url https://git.videolan.org/git/ffmpeg.git 89 | 90 | #amf url file://~/src/amf 91 | #aom url file://~/src/aom 92 | #ass url file://~/src/ass 93 | #avisynth url file://~/src/avisynth 94 | #bzip2 url file://~/src/bzip2 95 | #decklink url file://~/src/decklink 96 | #dlfcn url file://~/src/dlfcn 97 | #fftw3 url file://~/src/fftw3 98 | #fontconfig url file://~/src/fontconfig 99 | #freetype url file://~/src/freetype 100 | #frei0r url file://~/src/frei0r 101 | #fribidi url file://~/src/fribidi 102 | #harfbuzz url file://~/src/harfbuzz 103 | #ladspa url file://~/src/ladspa 104 | #mfx url file://~/src/mfx 105 | #nv-codec-headers url file://~/src/nv-codec-headers 106 | #png url file://~/src/png 107 | #rav1e url file://~/src/rav1e 108 | #rubberband url file://~/src/rubberband 109 | #samplerate url file://~/src/samplerate 110 | #sofa url file://~/src/sofa 111 | #srt url file://~/src/srt 112 | #svt-av1 url file://~/src/svt-av1 113 | #theora url file://~/src/theora 114 | #vmaf url file://~/src/vmaf 115 | #vpx url file://~/src/vpx 116 | #vulkan-headers url file://~/src/vulkan-headers 117 | #webp url file://~/src/webp 118 | #whisper url file://~/src/whisper 119 | #xml2 url file://~/src/xml2 120 | 121 | #enabled 122 | #dav1d url file://~/src/dav1d 123 | #fdk-aac url file://~/src/fdk-aac 124 | #ffmpeg url file://~/src/ffmpeg 125 | #lame url file://~/src/lame 126 | #ogg url file://~/src/ogg 127 | #openssl url file://~/src/openssl 128 | #opus url file://~/src/opus 129 | #placebo url file://~/src/placebo 130 | #sdl url file://~/src/sdl 131 | #soxr url file://~/src/soxr 132 | #vorbis url file://~/src/vorbis 133 | #vpl url file://~/src/vpl 134 | #vulkan-headers url file://~/src/vulkan-headers 135 | #x264 url file://~/src/x264 136 | #x265 url file://~/src/x265 137 | #zlib url file://~/src/zlib 138 | 139 | #------------------------ 140 | #fetch specified revision 141 | #------------------------ 142 | #source fetch_method revision_id 143 | amf git afed28d37aca1938da2eedc50599bb3535a987ec 144 | aom git 65f913111447994b569c75e94b3ca6ad9e8ec42e 145 | ass git e60dddb7db62cc009175843bdb0b0dfedceebedb 146 | avisynth git bc81fb7ca4d32dcccfebe5cd772682c138f84e13 147 | bzip2 git af79253677ad98d6dfe11ea315ee9947d86586d3 148 | dav1d git 43f3b8d33bae5179a134d1cd7c394063b1cebfcb 149 | decklink git 0820fac2815be07824a8422afb52c4aebe7cccd6 150 | dlfcn git 8bfddb5aa345ce10ba98e925acbc7bfb53639679 151 | fdk-aac git d8e6b1a3aa606c450241632b64b703f21ea31ce3 152 | ffmpeg git cdb14bc74dfa4d7e274df9830418fc61da0796df 153 | fftw3 wget fftw-3.3.10.tar.gz 154 | fontconfig git a9fd30d226322f7f9b674a74d3782eea03c29453 155 | freetype git 30e45abe939d7c2cbdf268f277c293400096868c 156 | frei0r git 6d272815f25baa6daafacdd132a43e36a94ff21c 157 | fribidi git b28f43bd3e8e31a5967830f721bab218c1aa114c 158 | harfbuzz git db63939aaaccc73f94d4535e59d90588d6419d22 159 | ladspa git 0f54d2430febb4d5f02d13132dd91d7345e080b5 160 | lame svn 6531 161 | mfx git f6aac4576826ed821c81231fdfb0d24047158e7d 162 | #v11.1 163 | #nv-codec-headers git 43d91706e097565f57b311e567f0219838bcc2f6 164 | #v12.1 165 | #nv-codec-headers git 1889e62e2d35ff7aa9baca2bceb14f053785e6f1 166 | #v12.2 167 | nv-codec-headers git c69278340ab1d5559c7d7bf0edf615dc33ddbba 168 | ogg git be05b13e98b048f0b5a0f5fa8ce514d56db5f822 169 | openssl git 9fb44b527ee3717795609fb876a7a81f8898c623 170 | opus git c9a74c02f2fa3d1150ca64adb8c8980a581ec5c5 171 | placebo git 45f76a46aaf2958febff2a482a059151b480bf99 172 | png git 54c127584fe1f9b4fbfb5893cdbfc8fb5570e6bc 173 | rav1e git 564ae3b0007ae2b06893fd7166bf88c5a84c5b63 174 | rubberband hg 6fca9f344e6d 175 | samplerate git 15c392d47e71b9395a759544b3818a1235fe1a1d 176 | #commit below is for sdl release-2.32.10, head may not build/work as expected 177 | sdl git 5d249570393f7a37e037abf22cd6012a4cc56a71 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 65d8e02c9494dd66d414ce37669ed3dae1e4daba 183 | theora git 23161c4a63fd9f9d09b9e972f95def2d56c777af 184 | #commit below is for vmaf v3.0.0, head may not build/work as expected 185 | vmaf git 17a67b238ce0539bdeafdc95961abac64fa16ea8 186 | vorbis git c2aa86b05e981c96bf381fc6aa11cdd03eccc2fb 187 | vpl git 3591aa94dfbdf4566cd19f3e976ae5b769ab4fa2 188 | vpx git d6e5cd7132d59d3cea86d06c9aae26f95fe00adb 189 | vulkan-headers git 2fa203425eb4af9dfc6b03f97ef72b0b5bcb8350 190 | webp git d67d73bf5a6421734cc08da0f568d37a1fe0d103 191 | whisper git 2551e4ce98db69027d08bd99bcc3f1a4e2ad2cef 192 | x264 git 0480cb05fa188d37ae87e8f4fd8f1aea3711f7ee 193 | x265 git 9e551a994f970a24f0e49bcebe3d43ef08448b01 194 | xml2 git 9c80a89af2fdf4f853892f84e46580f4902658ba 195 | zlib git 570720b0c24f9686c33f35a1b3165c1f568b96be 196 | 197 | -------------------------------------------------------------------------------- /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-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-ssl3 no-weak-ssl-ciphers no-shared no-dynamic-engine no-engine no-static-engine no-docs 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-cxc-mingw64: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_VERSION="1.10.0" 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" "whisper" "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" --with-brotli=no --with-librsvg=no --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 | sed -i -r "s/^(c_args = \[[^]]+)\]$/\1,'-std=gnu17']/" "$ROOT_PATH/$SRC_PATH/cross.meson" 592 | 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" 593 | sed -i -r "s/^(c_args = .+),'-std=gnu17'\]$/\1\]/" "$ROOT_PATH/$SRC_PATH/cross.meson" 594 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 595 | build_meson $CXC_JOBS 596 | fi 597 | fi 598 | 599 | #libxml2 600 | set_source "xml2" "git" "https://github.com/GNOME/libxml2.git" "libxml2" 601 | if [ "${!SRC_ENABLE}" -ne 0 ] 602 | then 603 | fetch_source 604 | if [ "$BUILD" -ne 0 ] 605 | then 606 | cd_source 607 | autoreconf -fiv 608 | ./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 609 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 610 | build_make $CXC_JOBS 611 | fi 612 | fi 613 | 614 | #fontconfig 615 | set_source "fontconfig" "git" "https://gitlab.freedesktop.org/fontconfig/fontconfig.git" "libfontconfig" 616 | if [ "${!SRC_ENABLE}" -ne 0 ] 617 | then 618 | fetch_source 619 | if [ "$BUILD" -ne 0 ] 620 | then 621 | cd_source 622 | #mkdir "${SRC_NAME}_build" 623 | #cd "${SRC_NAME}_build" 624 | #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" ".." 625 | autoreconf -fiv 626 | ./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 627 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 628 | build_make $CXC_JOBS 629 | fi 630 | fi 631 | 632 | #harfbuzz - handle the freetype circular dependency 633 | set_source "harfbuzz" "git" "https://github.com/harfbuzz/harfbuzz.git" 634 | if [ "${!SRC_ENABLE}" -ne 0 ] 635 | then 636 | fetch_source 637 | if [ "$BUILD" -ne 0 ] 638 | then 639 | cd_source 640 | mkdir "${SRC_NAME}_build" 641 | cd "${SRC_NAME}_build" 642 | 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" ".." 643 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 644 | build_meson $CXC_JOBS 645 | #now rebuild freetype to be harfbuzz aware 646 | set_source "freetype" 647 | cd_source 648 | make clean 649 | ./autogen.sh 650 | ./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" --with-brotli=no --with-librsvg=no --enable-static --disable-shared 651 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 652 | build_make $CXC_JOBS 653 | CXC_FFMPEG_EXTRA_LIBS="-lharfbuzz -lfreetype -lpng16 -lz $CXC_FFMPEG_EXTRA_LIBS" 654 | fi 655 | fi 656 | 657 | #whisper 658 | set_source "whisper" "git" "https://github.com/ggml-org/whisper.cpp" "whisper" 659 | if [ "${!SRC_ENABLE}" -ne 0 ] 660 | then 661 | fetch_source 662 | if [ "$BUILD" -ne 0 ] 663 | then 664 | cd_source 665 | sed -r -i 's/^(\s+#if )(_WIN32_WINNT >= 0x0602)$/\1defined(_MSC_VER) \&\& \2/' ggml/src/ggml-cpu/ggml-cpu.c 666 | mkdir "${SRC_NAME}_build" 667 | cd "${SRC_NAME}_build" 668 | 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 .. 669 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 670 | build_make $CXC_JOBS 671 | ln -s "$ROOT_PATH/$OUT_PATH/lib/ggml.a" "$ROOT_PATH/$OUT_PATH/lib/libggml.a" 672 | ln -s "$ROOT_PATH/$OUT_PATH/lib/ggml-base.a" "$ROOT_PATH/$OUT_PATH/lib/libggml-base.a" 673 | ln -s "$ROOT_PATH/$OUT_PATH/lib/ggml-cpu.a" "$ROOT_PATH/$OUT_PATH/lib/libggml-cpu.a" 674 | CXC_FFMPEG_EXTRA_LIBS="-lwhisper -lggml -lggml-base -lggml-cpu $CXC_FFMPEG_EXTRA_LIBS" 675 | fi 676 | fi 677 | 678 | #libass 679 | set_source "ass" "git" "https://github.com/libass/libass.git" "libass" 680 | if [ "${!SRC_ENABLE}" -ne 0 ] 681 | then 682 | fetch_source 683 | if [ "$BUILD" -ne 0 ] 684 | then 685 | cd_source 686 | autoreconf -fiv 687 | ./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 688 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 689 | build_make $CXC_JOBS 690 | fi 691 | fi 692 | 693 | #libsamplerate 694 | set_source "samplerate" "git" "https://github.com/erikd/libsamplerate.git" 695 | if [ "${!SRC_ENABLE}" -ne 0 ] 696 | then 697 | fetch_source 698 | if [ "$BUILD" -ne 0 ] 699 | then 700 | cd_source 701 | 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 . 702 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 703 | build_make $CXC_JOBS 704 | fi 705 | fi 706 | 707 | #fftw3 708 | set_source "fftw3" "wget" "http://fftw.org/fftw-3.3.10.tar.gz" 709 | if [ "${!SRC_ENABLE}" -ne 0 ] 710 | then 711 | fetch_source 712 | if [ "$BUILD" -ne 0 ] 713 | then 714 | cd_source "fftw-" 715 | 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 . 716 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 717 | build_make $CXC_JOBS 718 | ln -s "$ROOT_PATH/$OUT_PATH"/lib/pkgconfig/fftw*.pc "$ROOT_PATH/$OUT_PATH"/lib/pkgconfig/fftw3.pc 719 | fi 720 | fi 721 | 722 | #ladspa 723 | set_source "ladspa" "git" "https://github.com/swh/ladspa.git" 724 | if [ "${!SRC_ENABLE}" -ne 0 ] 725 | then 726 | fetch_source 727 | if [ "$BUILD" -ne 0 ] 728 | then 729 | cd_source 730 | cp -pv ladspa.h "$ROOT_PATH/$OUT_PATH/include" 731 | [ $? -eq 0 ] || build_die "$THIS: install stage failed -> $SRC_NAME" 732 | build_message BM_GREEN "$SRC_NAME: installed" 733 | fi 734 | fi 735 | 736 | #librubberband 737 | set_source "rubberband" "hg" "https://hg.sr.ht/~breakfastquay/rubberband" "librubberband" 738 | if [ "${!SRC_ENABLE}" -ne 0 ] 739 | then 740 | fetch_source 741 | if [ "$BUILD" -ne 0 ] 742 | then 743 | cd_source 744 | mkdir "${SRC_NAME}_build" 745 | sed -r -i 's/^system = build_machine\.system\(\)/system = host_machine.system()/' meson.build 746 | cd "${SRC_NAME}_build" 747 | 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" ".." 748 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 749 | build_meson $CXC_JOBS && \ 750 | cp -pv -r "../rubberband/" "$ROOT_PATH/$OUT_PATH/include" && \ 751 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 752 | build_message BM_GREEN "$SRC_NAME: installed" 753 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lsamplerate -lfftw3" 754 | fi 755 | fi 756 | 757 | #sofa 758 | set_source "sofa" "git" "https://github.com/hoene/libmysofa.git" "libmysofa" 759 | if [ "${!SRC_ENABLE}" -ne 0 ] 760 | then 761 | fetch_source 762 | if [ "$BUILD" -ne 0 ] 763 | then 764 | cd_source 765 | 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 . 766 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 767 | build_make $CXC_JOBS 768 | fi 769 | fi 770 | 771 | #soxr 772 | set_source "soxr" "git" "https://git.code.sf.net/p/soxr/code" "libsoxr" 773 | if [ "${!SRC_ENABLE}" -ne 0 ] 774 | then 775 | fetch_source 776 | if [ "$BUILD" -ne 0 ] 777 | then 778 | cd_source 779 | 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 . 780 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 781 | build_make $CXC_JOBS 782 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lgomp -lpthread" 783 | fi 784 | fi 785 | 786 | #fdk-aac 787 | set_source "fdk-aac" "git" "https://github.com/mstorsjo/fdk-aac.git" "libfdk-aac" 788 | if [ "${!SRC_ENABLE}" -ne 0 ] 789 | then 790 | fetch_source 791 | if [ "$BUILD" -ne 0 ] 792 | then 793 | cd_source 794 | autoreconf -fiv 795 | ./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 796 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 797 | build_make $CXC_JOBS 798 | fi 799 | fi 800 | 801 | #lame 802 | set_source "lame" "svn" "https://svn.code.sf.net/p/lame/svn/trunk/lame" "libmp3lame" 803 | if [ "${!SRC_ENABLE}" -ne 0 ] 804 | then 805 | fetch_source 806 | if [ "$BUILD" -ne 0 ] 807 | then 808 | cd_source 809 | ./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 810 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 811 | build_make $CXC_JOBS 812 | fi 813 | fi 814 | 815 | #ogg 816 | set_source "ogg" "git" "https://github.com/xiph/ogg.git" 817 | if [ "${!SRC_ENABLE}" -ne 0 ] 818 | then 819 | fetch_source 820 | if [ "$BUILD" -ne 0 ] 821 | then 822 | cd_source 823 | ./autogen.sh 824 | ./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 825 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 826 | build_make $CXC_JOBS 827 | fi 828 | fi 829 | 830 | #opus 831 | set_source "opus" "git" "https://github.com/xiph/opus.git" "libopus" 832 | if [ "${!SRC_ENABLE}" -ne 0 ] 833 | then 834 | fetch_source 835 | if [ "$BUILD" -ne 0 ] 836 | then 837 | cd_source 838 | ./autogen.sh 839 | ./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 840 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 841 | build_make $CXC_JOBS 842 | fi 843 | fi 844 | 845 | #vorbis 846 | set_source "vorbis" "git" "https://github.com/xiph/vorbis.git" "libvorbis" 847 | if [ "${!SRC_ENABLE}" -ne 0 ] 848 | then 849 | fetch_source 850 | if [ "$BUILD" -ne 0 ] 851 | then 852 | cd_source 853 | ./autogen.sh 854 | ./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 855 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 856 | build_make $CXC_JOBS 857 | fi 858 | fi 859 | 860 | #theora 861 | set_source "theora" "git" "https://github.com/xiph/theora.git" "libtheora" 862 | if [ "${!SRC_ENABLE}" -ne 0 ] 863 | then 864 | fetch_source 865 | if [ "$BUILD" -ne 0 ] 866 | then 867 | cd_source 868 | ./autogen.sh 869 | ./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 870 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 871 | build_make $CXC_JOBS 872 | fi 873 | fi 874 | 875 | #aom AV1 876 | set_source "aom" "git" "https://aomedia.googlesource.com/aom" "libaom" 877 | if [ "${!SRC_ENABLE}" -ne 0 ] 878 | then 879 | fetch_source 880 | if [ "$BUILD" -ne 0 ] 881 | then 882 | mkdir "${SRC_NAME}_build" 883 | cd "${SRC_NAME}_build" 884 | 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" 885 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 886 | build_make $CXC_JOBS 887 | fi 888 | fi 889 | 890 | #svtav1 891 | set_source "svt-av1" "git" "https://gitlab.com/AOMediaCodec/SVT-AV1.git" "libsvtav1" 892 | if [ "${!SRC_ENABLE}" -ne 0 ] 893 | then 894 | fetch_source 895 | if [ "$BUILD" -ne 0 ] 896 | then 897 | mkdir "${SRC_NAME}_build" 898 | cd "${SRC_NAME}_build" 899 | 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" 900 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 901 | build_make $CXC_JOBS 902 | fi 903 | fi 904 | 905 | #dav1d 906 | set_source "dav1d" "git" "https://code.videolan.org/videolan/dav1d.git" "libdav1d" 907 | if [ "${!SRC_ENABLE}" -ne 0 ] 908 | then 909 | fetch_source 910 | if [ "$BUILD" -ne 0 ] 911 | then 912 | mkdir "${SRC_NAME}_build" 913 | cd "${SRC_NAME}_build" 914 | 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" 915 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 916 | build_meson $CXC_JOBS 917 | fi 918 | fi 919 | 920 | #rav1e 921 | set_source "rav1e" "git" "https://github.com/xiph/rav1e.git" "librav1e" 922 | if [ "${!SRC_ENABLE}" -ne 0 ] 923 | then 924 | fetch_source 925 | if [ "$BUILD" -ne 0 ] 926 | then 927 | cd_source 928 | 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 929 | [ $? -eq 0 ] || build_die "$THIS: build stage failed -> $SRC_NAME" 930 | fi 931 | fi 932 | 933 | #vpx 934 | set_source "vpx" "git" "https://chromium.googlesource.com/webm/libvpx.git" "libvpx" 935 | if [ "${!SRC_ENABLE}" -ne 0 ] 936 | then 937 | fetch_source 938 | if [ "$BUILD" -ne 0 ] 939 | then 940 | cd_source 941 | export CROSS="$CXC_HOST"- 942 | ./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 943 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 944 | build_make $CXC_JOBS 945 | unset CROSS 946 | fi 947 | fi 948 | 949 | #x264 950 | set_source "x264" "git" "https://code.videolan.org/videolan/x264.git" "libx264" 951 | if [ "${!SRC_ENABLE}" -ne 0 ] 952 | then 953 | fetch_source 954 | if [ "$BUILD" -ne 0 ] 955 | then 956 | cd_source 957 | 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 958 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 959 | build_make $CXC_JOBS 960 | fi 961 | fi 962 | 963 | #x265 964 | set_source "x265" "git" "https://bitbucket.org/multicoreware/x265_git.git" "libx265" 965 | if [ "${!SRC_ENABLE}" -ne 0 ] 966 | then 967 | fetch_source 968 | if [ "$BUILD" -ne 0 ] 969 | then 970 | cd_source 971 | 972 | build_message BM_WHITE "$SRC_NAME: configuring 12-bit" 973 | mkdir "${SRC_NAME}_build_12" 974 | cd "${SRC_NAME}_build_12" 975 | 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 976 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 977 | make -j$CXC_JOBS 978 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 979 | 980 | build_message BM_WHITE "$SRC_NAME: configuring 10-bit" 981 | mkdir "../${SRC_NAME}_build_10" 982 | cd "../${SRC_NAME}_build_10" 983 | 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 984 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 985 | make -j$CXC_JOBS 986 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 987 | 988 | build_message BM_WHITE "$SRC_NAME: configuring 8-bit" 989 | mkdir "../${SRC_NAME}_build" 990 | cd "../${SRC_NAME}_build" 991 | ln -sf "../${SRC_NAME}_build_12/libx265.a" libx265_main12.a 992 | ln -sf "../${SRC_NAME}_build_10/libx265.a" libx265_main10.a 993 | 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 994 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 995 | make -j$CXC_JOBS 996 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 997 | mv libx265.a libx265_main.a 998 | ar -M <<<$(echo -e "CREATE libx265.a\nADDLIB libx265_main.a\nADDLIB libx265_main10.a\nADDLIB libx265_main12.a\nSAVE\nEND\n") 999 | [ $? -eq 0 ] || build_die "$THIS: (ar) multilib merge failed -> $SRC_NAME" 1000 | 1001 | build_make $CXC_JOBS 1002 | if [[ "$CXC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 1003 | then 1004 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lstdc++" 1005 | fi 1006 | fi 1007 | fi 1008 | 1009 | #dlfcn 1010 | set_source "dlfcn" "git" "https://github.com/dlfcn-win32/dlfcn-win32.git" 1011 | if [ "${!SRC_ENABLE}" -ne 0 ] 1012 | then 1013 | fetch_source 1014 | if [ "$BUILD" -ne 0 ] 1015 | then 1016 | cd_source 1017 | 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 . 1018 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1019 | build_make $CXC_JOBS 1020 | fi 1021 | fi 1022 | 1023 | #frei0r 1024 | set_source "frei0r" "git" "https://github.com/dyne/frei0r.git" "frei0r" 1025 | if [ "${!SRC_ENABLE}" -ne 0 ] 1026 | then 1027 | fetch_source 1028 | if [ "$BUILD" -ne 0 ] 1029 | then 1030 | cd_source 1031 | 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 . 1032 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1033 | build_make $CXC_JOBS 1034 | find "$ROOT_PATH/$OUT_PATH/lib/frei0r-1" -type f -name "*.dll" -print0 | xargs -0 strip 1035 | fi 1036 | fi 1037 | 1038 | #sdl 1039 | set_source "sdl" "git" "https://github.com/libsdl-org/SDL.git" 1040 | if [ "${!SRC_ENABLE}" -ne 0 ] 1041 | then 1042 | fetch_source 1043 | if [ "$BUILD" -ne 0 ] 1044 | then 1045 | cd_source 1046 | mkdir "${SRC_NAME}_build" 1047 | cd "${SRC_NAME}_build" 1048 | 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 .. 1049 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1050 | build_make $CXC_JOBS 1051 | rm -f "$BIN_PATH"/sdl* 1052 | fi 1053 | fi 1054 | 1055 | #amf 1056 | set_source "amf" "git" "https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git" "amf" 1057 | if [ "${!SRC_ENABLE}" -ne 0 ] 1058 | then 1059 | fetch_source 1060 | if [ "$BUILD" -ne 0 ] 1061 | then 1062 | cd_source 1063 | mkdir --parents "$ROOT_PATH/$OUT_PATH"/include/AMF && \ 1064 | cp -pv -r amf/public/include/* "$ROOT_PATH/$OUT_PATH"/include/AMF && \ 1065 | [ $? -eq 0 ] || build_die "$THIS: make stage failed -> $SRC_NAME" 1066 | build_message BM_GREEN "$SRC_NAME: installed" 1067 | fi 1068 | fi 1069 | 1070 | #mfx 1071 | set_source "mfx" "git" "https://github.com/lu-zero/mfx_dispatch.git" "libmfx" 1072 | if [ "${!SRC_ENABLE}" -ne 0 ] 1073 | then 1074 | fetch_source 1075 | if [ "$BUILD" -ne 0 ] 1076 | then 1077 | cd_source 1078 | autoreconf -fiv 1079 | ./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 1080 | build_make $CXC_JOBS 1081 | ln -s "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/libmfx.pc" "$ROOT_PATH/$OUT_PATH/lib/pkgconfig/mfx.pc" 1082 | fi 1083 | fi 1084 | 1085 | #vpl 1086 | set_source "vpl" "git" "https://github.com/intel/libvpl.git" "libvpl" 1087 | if [ "${!SRC_ENABLE}" -ne 0 ] 1088 | then 1089 | fetch_source 1090 | if [ "$BUILD" -ne 0 ] 1091 | then 1092 | cd_source 1093 | mkdir "${SRC_NAME}_build" 1094 | cd "${SRC_NAME}_build" 1095 | 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" ".." 1096 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1097 | build_make $CXC_JOBS 1098 | ln -s "$ROOT_PATH/$OUT_PATH/lib/libvpl.dll.a" "$ROOT_PATH/$OUT_PATH/lib/libvpl.a" 1099 | fi 1100 | fi 1101 | 1102 | #nvenc 1103 | set_source "nv-codec-headers" "git" "https://github.com/FFmpeg/nv-codec-headers.git" "nvenc" "nvdec" 1104 | if [ "${!SRC_ENABLE}" -ne 0 ] 1105 | then 1106 | fetch_source 1107 | if [ "$BUILD" -ne 0 ] 1108 | then 1109 | cd_source 1110 | build_make $CXC_JOBS PREFIX="$ROOT_PATH/$OUT_PATH" install 1111 | fi 1112 | fi 1113 | 1114 | #placebo 1115 | set_source "placebo" "git" "https://code.videolan.org/videolan/libplacebo.git" "libplacebo" 1116 | if [ "${!SRC_ENABLE}" -ne 0 ] 1117 | then 1118 | fetch_source 1119 | if [ "$BUILD" -ne 0 ] 1120 | then 1121 | mkdir "${SRC_NAME}_build" 1122 | cd "${SRC_NAME}_build" 1123 | 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" 1124 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1125 | build_meson $CXC_JOBS 1126 | if [[ "$CXC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 1127 | then 1128 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lstdc++" 1129 | fi 1130 | fi 1131 | fi 1132 | 1133 | #vulkan 1134 | set_source "vulkan-headers" "git" "https://github.com/KhronosGroup/Vulkan-Headers.git" "vulkan" 1135 | if [ "${!SRC_ENABLE}" -ne 0 ] 1136 | then 1137 | fetch_source 1138 | if [ "$BUILD" -ne 0 ] 1139 | then 1140 | cd_source 1141 | mkdir "${SRC_NAME}_build" 1142 | cd "${SRC_NAME}_build" 1143 | 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" ".." 1144 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1145 | build_make 1146 | fi 1147 | fi 1148 | 1149 | #avisynth 1150 | set_source "avisynth" "git" "https://github.com/AviSynth/AviSynthPlus.git" "avisynth" 1151 | if [ "${!SRC_ENABLE}" -ne 0 ] 1152 | then 1153 | fetch_source 1154 | if [ "$BUILD" -ne 0 ] 1155 | then 1156 | cd_source 1157 | mkdir "${SRC_NAME}_build" 1158 | cd "${SRC_NAME}_build" 1159 | 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 .. 1160 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1161 | build_make $CXC_JOBS VersionGen install 1162 | fi 1163 | fi 1164 | 1165 | #decklink 1166 | set_source "decklink" "git" "https://github.com/nanake/decklink-headers.git" "decklink" 1167 | if [ "${!SRC_ENABLE}" -ne 0 ] 1168 | then 1169 | fetch_source 1170 | if [ "$BUILD" -ne 0 ] 1171 | then 1172 | cd_source 1173 | build_make $CXC_JOBS PREFIX="$ROOT_PATH/$OUT_PATH" install 1174 | fi 1175 | fi 1176 | 1177 | #openssl 1178 | set_source "openssl" "git" "https://github.com/openssl/openssl.git" "openssl" 1179 | if [ "${!SRC_ENABLE}" -ne 0 ] 1180 | then 1181 | fetch_source 1182 | if [ "$BUILD" -ne 0 ] 1183 | then 1184 | cd_source 1185 | ./Configure no-ssl3 no-weak-ssl-ciphers no-shared no-dynamic-engine no-engine no-static-engine no-docs 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 1186 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1187 | build_make $CXC_JOBS -i install_sw 1188 | fi 1189 | fi 1190 | 1191 | #libsrt 1192 | set_source "srt" "git" "https://github.com/Haivision/srt.git" "libsrt" 1193 | if [ "${!SRC_ENABLE}" -ne 0 ] 1194 | then 1195 | fetch_source 1196 | if [ "$BUILD" -ne 0 ] 1197 | then 1198 | cd_source 1199 | 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 . 1200 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1201 | build_make $CXC_JOBS 1202 | fi 1203 | fi 1204 | 1205 | #vmaf 1206 | set_source "vmaf" "git" "https://github.com/Netflix/vmaf.git" "libvmaf" 1207 | if [ "${!SRC_ENABLE}" -ne 0 ] 1208 | then 1209 | fetch_source 1210 | if [ "$BUILD" -ne 0 ] 1211 | then 1212 | cd_source 1213 | mkdir "${SRC_NAME}_build" 1214 | cd "${SRC_NAME}_build" 1215 | 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" 1216 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1217 | build_meson $CXC_JOBS 1218 | if [[ "$CXC_FFMPEG_EXTRA_LIBS" != *"lstdc++"* ]] 1219 | then 1220 | CXC_FFMPEG_EXTRA_LIBS="$CXC_FFMPEG_EXTRA_LIBS -lstdc++" 1221 | fi 1222 | fi 1223 | fi 1224 | 1225 | #ffmpeg 1226 | set_source "ffmpeg" "git" "https://git.ffmpeg.org/ffmpeg.git" "gpl" "version3" "nonfree" 1227 | if [ "${!SRC_ENABLE}" -ne 0 ] 1228 | then 1229 | fetch_source 1230 | BUILD_CMD="CPPFLAGS=\"$CXC_CPPFLAGS -Wno-error=incompatible-pointer-types\" ./configure\ 1231 | --cross-prefix=\"$CXC_HOST\"-\ 1232 | --arch=\"x86_64\"\ 1233 | --target-os=\"mingw64\"\ 1234 | --disable-debug\ 1235 | --disable-w32threads\ 1236 | --disable-shared\ 1237 | --enable-static\ 1238 | --prefix=\"$ROOT_PATH/$OUT_PATH\"\ 1239 | --pkg-config=\"pkg-config\"\ 1240 | --pkg-config-flags=\"--static\"\ 1241 | --extra-cflags=\"$CXC_OPTIM $CXC_CFLAGS\"\ 1242 | --extra-cxxflags=\"-fpermissive\"\ 1243 | --extra-ldflags=\"-static-libgcc -static-libstdc++ -static -s\"\ 1244 | --extra-ldflags=\"-L$ROOT_PATH/$OUT_PATH/lib\"\ 1245 | --extra-libs=\"$CXC_FFMPEG_EXTRA_LIBS\"\ 1246 | --bindir=\"$BIN_PATH\"\ 1247 | $CXC_FFMPEG_LIB_OPTIONS" 1248 | echo $BUILD_CMD 1249 | if [ "$BUILD" -ne 0 ] 1250 | then 1251 | cd_source 1252 | eval $BUILD_CMD 1253 | [ $? -eq 0 ] || build_die "$THIS: configure stage failed -> $SRC_NAME" 1254 | build_make $CXC_JOBS 1255 | fi 1256 | fi 1257 | --------------------------------------------------------------------------------