Added support for 0.38

This commit is contained in:
Allan Amstadt 2019-04-30 14:31:41 +02:00
parent fa7c5d17b0
commit 7a4f303292
9 changed files with 54 additions and 162 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"python.pythonPath": "/usr/local/bin/python"
}

View File

@ -4,10 +4,10 @@
FFMpeg prebuilt binaries with proprietary codecs and build instructions for window, linux and macos. FFMpeg prebuilt binaries with proprietary codecs and build instructions for window, linux and macos.
### Downloads (v0.37.4) ### Downloads (v0.38.1)
- Linux: [32bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.37.4/0.37.4-linux-ia32.zip) / [64bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.37.4/0.37.4-linux-x64.zip) - Linux: [32bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.38.1/0.38.1-linux-ia32.zip) / [64bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.38.1/0.38.1-linux-x64.zip)
- Windows: [32bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.37.4/0.37.4-win-ia32.zip) / [64bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.37.4/0.37.4-win-x64.zip) - Windows: [32bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.38.1/0.38.1-win-ia32.zip) / [64bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.38.1/0.38.1-win-x64.zip)
- Mac: [64bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.37.4/0.37.4-osx-x64.zip) - Mac: [64bit](https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.38.1/0.38.1-osx-x64.zip)
### Build ### Build

1
build/.cipd/pkgs/0/_current Symbolic link
View File

@ -0,0 +1 @@
kykIT8m8YzNqqLP2xFGBTuo0ZtU9lom3BwiStWleyWkC

View File

@ -0,0 +1,4 @@
{
"subdir": "src/tools/clang/dsymutil",
"package_name": "chromium/llvm-build-tools/dsymutil"
}

View File

@ -0,0 +1,12 @@
{
"format_version": "1.1",
"package_name": "chromium/llvm-build-tools/dsymutil",
"install_mode": "copy",
"files": [
{
"name": "bin/dsymutil",
"size": 38635964,
"executable": true
}
]
}

View File

@ -42,8 +42,6 @@ COLOR_WARNING_WINDOWS = 14
def main(): def main():
proprietary_codecs = False
nw_version = get_latest_stable_nwjs() nw_version = get_latest_stable_nwjs()
host_platform = get_host_platform() host_platform = get_host_platform()
target_arch = get_host_architecture() target_arch = get_host_architecture()
@ -73,12 +71,8 @@ def main():
if target_arch == 'ia32': if target_arch == 'ia32':
target_cpu = 'x86' target_cpu = 'x86'
proprietary_codecs = args.proprietary_codecs
if proprietary_codecs and platform.system() == 'Windows' and not 'CYGWIN_NT' in platform.system():
print_warning('Script needs to be executed under CygWin to build FFmpeg \nwith proprietary codecs on Windows environments, \nread https://github.com/nwjs/nwjs-ffmpeg-prebuilt/blob/master/guides/build_windows.md\nExiting...')
sys.exit(1)
print_info('Building ffmpeg for {0} on {1} for {2}, proprietary_codecs = {3}'.format(nw_version, host_platform, target_cpu, proprietary_codecs)) print_info('Building ffmpeg for {0} on {1} for {2}'.format(nw_version, host_platform, target_cpu))
isVersion = bool(re.match(r"\d+\.\d+\.\d+", nw_version)) isVersion = bool(re.match(r"\d+\.\d+\.\d+", nw_version))
@ -98,13 +92,11 @@ def main():
gclient_sync() gclient_sync()
check_build_with_proprietary_codecs(proprietary_codecs, host_platform, target_arch)
patch_linux_sanitizer_ia32(target_cpu) patch_linux_sanitizer_ia32(target_cpu)
build(target_cpu) build(target_cpu)
zip_release_output_library(nw_version, platform_release_name, target_arch, proprietary_codecs, get_out_library_path(host_platform), PATH_RELEASES) zip_release_output_library(nw_version, platform_release_name, target_arch, get_out_library_path(host_platform), PATH_RELEASES)
print_ok('DONE!!') print_ok('DONE!!')
@ -130,9 +122,8 @@ def patch_linux_sanitizer_ia32(target_cpu):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser(description='ffmpeg builder script.') parser = argparse.ArgumentParser(description='ffmpeg builder script.')
parser.add_argument('-c', '--clean', help='Clean the workspace, removes downloaded source code', required=False, action='store_true') parser.add_argument('-c', '--clean', help='Clean the workspace, removes downloaded source code', required=False, action='store_true')
parser.add_argument('-nw', '--nw_version', help='Build ffmpeg for the specified Nw.js version', required=False) parser.add_argument('-nw', '--nw_version', help='Build ffmpeg for the specified Nw.js version or Branche', required=False)
parser.add_argument('-ta', '--target_arch', help='Target architecture, ia32, x64', required=False) parser.add_argument('-ta', '--target_arch', help='Target architecture, ia32, x64', required=False)
parser.add_argument('-pc', '--proprietary_codecs', help='Build ffmpeg with proprietary codecs', required=False, action='store_true')
return parser.parse_args() return parser.parse_args()
@ -263,12 +254,6 @@ def reset_chromium_src_to_nw_version(nw_version, isVersion = True):
def get_min_deps(deps_str): def get_min_deps(deps_str):
# deps # deps
deps_list = { deps_list = {
'buildtools': {
'reg': ur"buildtools_revision':\s*'(.+)'",
'repo': '/chromium/buildtools.git',
'path': 'src/buildtools',
'opts': re.IGNORECASE
},
'gyp': { 'gyp': {
'reg': ur"gyp.git.+@'.+'(.+)'", 'reg': ur"gyp.git.+@'.+'(.+)'",
'repo': '/external/gyp.git', 'repo': '/external/gyp.git',
@ -310,6 +295,18 @@ def get_min_deps(deps_str):
'repo': '/chromium/deps/xz.git', 'repo': '/chromium/deps/xz.git',
'path': 'src/chrome/installer/mac/third_party/xz/xz', 'path': 'src/chrome/installer/mac/third_party/xz/xz',
'opts': re.IGNORECASE 'opts': re.IGNORECASE
},
'libcxx': {
'reg': ur"libcxx_revision.*\"(.+)\"",
'repo': '/chromium/llvm-project/libcxx.git',
'path': 'src/buildtools/third_party/libc++/trunk',
'opts': re.IGNORECASE
},
'libcxxabi': {
'reg': ur"libcxxabi_revision.*\"(.+)\"",
'repo': '/chromium/llvm-project/libcxxabi.git',
'path': 'src/buildtools/third_party/libc++abi/trunk',
'opts': re.IGNORECASE
} }
} }
min_deps_list = [] min_deps_list = []
@ -576,81 +573,11 @@ def generate_build_and_deps_files():
f.write(BUILD_gn) f.write(BUILD_gn)
def cygwin_linking_setup(): def zip_release_output_library(nw_version, platform_release_name, target_arch, out_library_path, output_release_path):
if 'CYGWIN_NT' in platform.system():
if os.path.isfile('/usr/bin/link.exe'):
print_info('Overriding CygWin linker with MSVC linker...')
shutil.move('/usr/bin/link.exe', '/usr/bin/link.exe.1')
if not os.path.isfile('/usr/local/bin/cygwin-wrapper'):
print_info('Copying Cygwin wrapper...')
shutil.copy(os.getcwd() + '/chromium/scripts/cygwin-wrapper', '/usr/local/bin/cygwin-wrapper')
def check_build_with_proprietary_codecs(proprietary_codecs, host_platform, target_arch):
# going to ffmpeg folder
os.chdir(PATH_THIRD_PARTY_FFMPEG)
if proprietary_codecs:
print_info('Building ffmpeg with proprietary codecs...')
if not os.path.isfile('build_ffmpeg_proprietary_codecs.patch'):
print_info('Applying codecs patch with ac3 for {0}...'.format(host_platform))
# os.path.join
shutil.copy(os.path.join(PATH_BASE, 'patch', host_platform, 'build_ffmpeg_proprietary_codecs.patch'), os.getcwd())
# apply codecs patch
os.system('git apply --ignore-space-change --ignore-whitespace build_ffmpeg_proprietary_codecs.patch')
cygwin_linking_setup()
print_info('Starting build...')
# build ffmpeg
subprocess.check_call('./chromium/scripts/build_ffmpeg.py {0} {1}'.format(host_platform, target_arch), shell=True)
# copy the new generated ffmpeg config
print_info('Copying new ffmpeg configuration...')
subprocess.call('./chromium/scripts/copy_config.sh', shell=True)
print_info('Creating a GYP include file for building FFmpeg from source...')
# generate the ffmpeg configuration
subprocess.check_call('./chromium/scripts/generate_gn.py', shell=True)
if 'CYGWIN_NT' in platform.system():
print_info('Applying fix for error LNK2001: unresolved external symbol _ff_w64_guid_data')
fix_external_symbol_ff_w64_guid_data()
else:
if os.path.isfile('build_ffmpeg_proprietary_codecs.patch'):
print_info('Restoring ffmpeg configuration to defaults...')
os.system('git clean -df')
os.system('git checkout -- .')
def replace_in_file(file_name, search_string, replace_string):
filedata = None
with open(file_name, 'r') as file :
filedata = file.read()
filedata = filedata.replace(search_string, replace_string)
with open(file_name, 'w') as file :
file.write(filedata)
def fix_external_symbol_ff_w64_guid_data():
# https://bugs.chromium.org/p/chromium/issues/detail?id=264459
shutil.copyfile('ffmpeg_generated.gni', 'ffmpeg_generated.gni.bak')
replace = '''"libavformat/vorbiscomment.c",
"libavformat/w64.c",'''
replace_in_file('ffmpeg_generated.gni', '"libavformat/vorbiscomment.c",', replace)
def zip_release_output_library(nw_version, platform_release_name, target_arch, proprietary_codecs, out_library_path, output_release_path):
create_directory(output_release_path) create_directory(output_release_path)
print_info('Creating release zip...') print_info('Creating release zip...')
pc = ''
if proprietary_codecs:
pc = '-custom'
if os.path.isfile(out_library_path): if os.path.isfile(out_library_path):
with zipfile.ZipFile(os.path.join(output_release_path, '{0}-{1}-{2}{3}.zip'.format(nw_version, platform_release_name, target_arch, pc)), 'w', zipfile.ZIP_DEFLATED) as release_zip: with zipfile.ZipFile(os.path.join(output_release_path, '{0}-{1}-{2}{3}.zip'.format(nw_version, platform_release_name, target_arch, '')), 'w', zipfile.ZIP_DEFLATED) as release_zip:
release_zip.write(out_library_path, os.path.basename(out_library_path)) release_zip.write(out_library_path, os.path.basename(out_library_path))
release_zip.close() release_zip.close()
else: else:

View File

@ -2,7 +2,7 @@
## Requirements ## Requirements
- 3GB of free space - 10GB of free space
- Ubuntu 16.04.5 or higher - Ubuntu 16.04.5 or higher
## Install deps ## Install deps

View File

@ -2,7 +2,7 @@
## Requirements ## Requirements
- 3GB of free space - 10GB of free space
- OSX 10.11.x - OSX 10.11.x
## Install deps ## Install deps

View File

@ -2,8 +2,10 @@
## Requirements ## Requirements
- 3GB of free space - 10GB of free space.
- Windows 7/8.1/10 - A 64-bit Intel machine with at least 8GB of RAM.
- An appropriate version of Visual Studio, as described below.
- Windows 7 or newer.
## Install deps ## Install deps
### Open a **cmd** as Admin ### Open a **cmd** as Admin
@ -20,14 +22,15 @@
#### Install VisualStudio 2017 #### Install VisualStudio 2017
[Download Visualstudio 2017](https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio) [Download Visualstudio 2017](https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio)
> As of September, 2017 (R503915) Chromium requires Visual Studio 2017 update 3.x to build. > Chromium requires Visual Studio 2017 (>=15.7.2) or 2019 (>=16.0.0) to build. The clang-cl compiler is used but Visual Studio's header files, libraries, and some tools are required. Visual Studio Community Edition should work if its license is appropriate for you. You must install the “Desktop development with C++” component and the “MFC/ATL support” sub-components. This can be done from the command line by passing these arguments to the Visual Studio installer
The clang-cl compiler is used but Visual Studio's header files, libraries, and some tools are required.
Visual Studio Community Edition should work if its license is appropriate for you.
You must install the “**Desktop development with C++**” component and the “**MFC and ATL support***” sub-component.
> You must have the version **10.0.17134 Windows 10 SDK** installed. This can be installed separately or by checking the appropriate box in the Visual Studio Installer. PATH_TO_INSTALLER.EXE --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended
## Build ffmpeg.dll (WITHOUT proprietary codecs) > You must have the version **10.0.17763** or higher Windows 10 SDK installed. This can be installed separately or by checking the appropriate box in the Visual Studio Installer.
> The SDK Debugging Tools must also be installed. If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going to: Control Panel → Programs → Programs and Features → Select the “Windows Software Development Kit” → Change → Change → Check “Debugging Tools For Windows” → Change. Or, you can download the standalone SDK installer and use it to install the Debugging Tools
## Build ffmpeg.dll
This is the default behaviour, does not require additional steps, just run it and tadaaaa :tada:... This is the default behaviour, does not require additional steps, just run it and tadaaaa :tada:...
@ -39,61 +42,3 @@ This is the default behaviour, does not require additional steps, just run it an
//Build ffmpeg x64 //Build ffmpeg x64
python build_ffmpeg.py --target_arch=x64 python build_ffmpeg.py --target_arch=x64
## Build ffmpeg.dll (WITH proprietary codecs)
The build procedure for Windows is a little bit complex and require additional steps to generate the FFmpeg library. Unfortunately we can not generate the library natively, we need to use a CygWin environment and do a few tricks:
* Clone the script
```
git clone https://github.com/iteufel/nwjs-ffmpeg-prebuilt.git
```
* Download and install the latest CygWin with the following packages :
```yasm, make, diffutils, pkg-config, git```.
You can do it with the typical CygWin installation package manager.
* Setup the building environment: assuming you have installed VS2015 with choco in the previous steps, open a Windows console (CMD.exe) and type
```
C:\>cd %VS140COMNTOOLS%
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools>cd ..\..\VC
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>vcvarsall.bat [amd64, amd64_x86]
```
Don't close the console.
* Start CygWin sharing the previous environment variables:
```
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>cd C:\cygwin64\bin
C:\cygwin64\bin>START mintty.exe -i /Cygwin-Terminal.ico -
```
The CygWin console will be shown.
* From the CygWin console:
```
$ cd /cygdrive/drive/path-to-nwjs-ffmpeg-prebuilt
```
where ```drive``` is your main drive and ```path-to-nwjs-ffmpeg-prebuilt``` is the path where you cloned the nwjs-ffmpeg-prebuilt script, an example
```
$ cd /cygdrive/c/dev/nwjs-ffmpeg-prebuilt
```
then run the script with
```
$ python build_ffmpeg.py -pc (default host architecture)
```
or
```
$ python build_ffmpeg.py -ta [ia32|x64] -pc
```
If you want to build for different architectures you must close CygWin and close the Windows CMD console, and repeat the above process in order to setup the building environment values for the desired architecture.