diff --git a/docs/Build-instructions.md b/docs/Build-instructions.md index b1f26569..6b54497b 100644 --- a/docs/Build-instructions.md +++ b/docs/Build-instructions.md @@ -18,6 +18,7 @@ listed on this page. Table of contents: +* [Build CEF Python 51 BETA](#build-cef-python-51-beta) * [Requirements](#requirements) * [Build CEF Python using prebuilt CEF binaries](#build-cef-python-using-prebuilt-cef-binaries) * [Build both CEF Python and CEF from sources](#build-both-cef-python-and-cef-from-sources) @@ -28,38 +29,55 @@ Table of contents: ## Build CEF Python 51 BETA -1. Works fine on Ubuntu 14.04 64-bit (cmake 2.8.12 and g++ 4.8.4) -2. Download 64-bit Linux standard distribution from Spotify builds: +Complete steps for building CEF Python 51 using prebuilt +binaries from Spotify Automated Builds. + +1) Tested and works fine on Ubuntu 14.04 64-bit (cmake 2.8.12 and g++ 4.8.4) + +2) Download 64-bit Linux standard distribution from Spotify builds: http://opensource.spotify.com/cefbuilds/index.html - * As of writing the proper file is: - "cef_binary_3.2704.1432.g60b3718_linux64.tar.bz2" - * Check CEF version in "cefpython/src/version/cef_version_linux.h" - to make sure you're downloading the right file -3. Download [ninja](http://martine.github.io/ninja/) 1.7.1 or later + + * As of writing the proper file is: + "cef_binary_3.2704.1432.g60b3718_linux64.tar.bz2" + * Check CEF version in "cefpython/src/version/cef_version_linux.h" + to make sure you're downloading the right file + +3) Download [ninja](http://martine.github.io/ninja/) 1.7.1 or later and copy it to /usr/bin and chmod 755. -4. Install packages: `sudo apt-get install python-dev cmake g++` -5. Create projects to build: + +4) Install packages: `sudo apt-get install python-dev cmake g++` + +5) Configure projects in the build/ directory: ``` cd cef_binary/ mkdir build cd build/ cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release .. ``` -6. To build type: `ninja libcef_dll_wrapper`. You may also build cefclient - by typing `nincja cefclient`, but this will require installing - additional packages, read Requirements further on this page. -7. Copy "cef_binary/Resources/*" to "cefpython/src/linux/binaries_64bit/" -8. Copy "cef_binary/Release/*" to "cefpython/src/linux/binaries_64bit/" -9. Copy "cef_binary/build/libcef_dll_wrapper/*" + +6) To build type: `ninja libcef_dll_wrapper`. + + You may also build cefclient by typing `nincja cefclient`, but + this will require installing additional packages - see Requirements + further down on this page. + +7) Copy "cef_binary/Resources/*" to "cefpython/src/linux/binaries_64bit/" + +8) Copy "cef_binary/Release/*" to "cefpython/src/linux/binaries_64bit/" + +9) Copy "cef_binary/build/libcef_dll_wrapper/*" to "cefpython/src/linux/setup/lib_64bit/" (create dir) -10. Temporary fix for Isue #231 - copy icudtl.dat and natives_blob.bin + +10) Temporary fix for Isue #231 - copy icudtl.dat and natives_blob.bin to /usr/bin (where the python executable resides) -11. Build cefpython: + +11) Build cefpython: ``` cd cefpython/src/linux/ python compile.py 51.0 ``` -12. As of writing only "pygtk_.py" and "kivy_.py" examples work. + +12) As of writing only "pygtk_.py" and "kivy_.py" examples work. ## Requirements @@ -94,24 +112,27 @@ __Windows__ __Linux__ * Install packages: `sudo apt-get install python-dev cmake g++` -* To build upstream cefclient/cefsimple you need to install these packages: - `sudo apt-get install libgtk2.0-dev libgtkglext1-dev` * If building CEF from sources: * Official binaries are built on Ubuntu 14.04 (cmake 2.8.12, g++ 4.8.4) * Download [ninja](http://martine.github.io/ninja/) 1.7.1 or later and copy it to /usr/bin and chmod 755. - * Install required packages using one of the methods below: - 1. See Linux configuration for CEF automated - builds on the [cef/AutomatedBuildSetup.md](https://bitbucket.org/chromiumembedded/cef/wiki/AutomatedBuildSetup.md#markdown-header-linux-configuration) - wiki page. - 2. Run the install-build-deps.sh script - instructions provided - further down on this page. -* To build on Debian 7 see - [cef/BuildingOnDebian7.md](https://bitbucket.org/chromiumembedded/cef/wiki/BuildingOnDebian7.md) and - [cef/#1575](https://bitbucket.org/chromiumembedded/cef/issues/1575), - and [cef/#1697](https://bitbucket.org/chromiumembedded/cef/issues/1697) -* To perform a 32-bit Linux build on a 64-bit Linux system see - [cef/#1804](https://bitbucket.org/chromiumembedded/cef/issues/1804) + * Install required packages using one of the three methods below: + 1. Type command: `sudo apt-get install bison build-essential cdbs curl devscripts dpkg-dev elfutils fakeroot flex g++ git-core git-svn gperf libapache2-mod-php5 libasound2-dev libav-tools libbrlapi-dev libbz2-dev libcairo2-dev libcap-dev libcups2-dev libcurl4-gnutls-dev libdrm-dev libelf-dev libexif-dev libffi-dev libgconf2-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev libgnome-keyring-dev libgtk2.0-dev libkrb5-dev libnspr4-dev libnss3-dev libpam0g-dev libpci-dev libpulse-dev libsctp-dev libspeechd-dev libsqlite3-dev libssl-dev libudev-dev libwww-perl libxslt1-dev libxss-dev libxt-dev libxtst-dev mesa-common-dev openbox patch perl php5-cgi pkg-config python python-cherrypy3 python-crypto python-dev python-psutil python-numpy python-opencv python-openssl python-yaml rpm ruby subversion ttf-dejavu-core ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho fonts-thai-tlwg wdiff zip` + 2. See the list of packages on the + [cef/AutomatedBuildSetup.md](https://bitbucket.org/chromiumembedded/cef/wiki/AutomatedBuildSetup.md#markdown-header-linux-configuration) + wiki page. + 2. Run the install-build-deps.sh script - + instructions provided further down on this page. + * To build on Debian 7 see + [cef/BuildingOnDebian7.md](https://bitbucket.org/chromiumembedded/cef/wiki/BuildingOnDebian7.md) and + [cef/#1575](https://bitbucket.org/chromiumembedded/cef/issues/1575), + and [cef/#1697](https://bitbucket.org/chromiumembedded/cef/issues/1697) + * To perform a 32-bit Linux build on a 64-bit Linux system see + Linux configuration in upstream cef/AutomatedBuildSetup.md. See also + [cef/#1804](https://bitbucket.org/chromiumembedded/cef/issues/1804). +* If using prebuilt binaries from Spotify automated builds and want to + build cefclient/cefsimple you need to install these packages: + `sudo apt-get install libgtk2.0-dev libgtkglext1-dev` __All platforms__ @@ -124,15 +145,16 @@ __All platforms__ ## Build CEF Python using prebuilt CEF binaries +__NOT WORKING YET__ + Prebuilt binaries are available on [GitHub Releases](https://github.com/cztomczak/cefpython/releases) -and tagged eg. 'v47-upstream'. +and tagged eg. 'v51-upstream'. Run the automate.py tool using the --prebuilt-cef flag that will download prebuilt binaries from GitHub Releases using version information from -src/version/. +the "src/version/" directory. -__NOTE__: The --prebuilt-cef flag is not implemented yet. ``` cd tools/ python automate.py --prebuilt-cef @@ -144,32 +166,49 @@ need to customize the build then use the --help flag to see more. ## Build both CEF Python and CEF from sources -Run the automate.py tool using the --build-cef flag. Specify cef branch -and optionally how many parallel ninja jobs to run (by default cores/2). -If building on Linux see the Important note futher down. +Run the automate.py tool using the --build-cef flag. You can optionally +set how many parallel ninja jobs to run (by default cores/2) with +the --ninja-jobs flag. + +The automate script will use version information from the "src/version/" +directory. If you would like to use a custom CEF branch then you can +use the --cef-branch flag - but note that this is only for advanced +users as this will require updating cefpython's C++/Cython code. + +If building on Linux and there are errors, see the MISSING PACKAGES +note futher down. + +You should be fine by running automate.py with the default options, but if you +need to customize the build then use the --help flag to see more. ``` -cd tools/ -python automate.py --build-cef --cef-branch 2526 --ninja-jobs 6 +cd ~/cefpython/ +mkdir build/ && cd build +python ../tools/automate.py --build-cef --ninja-jobs 6 +cd cef*_*_linux64/ +cp bin/* ../../../src/linux/binaries_64bit/ +mkdir ../../../src/linux/setup/lib_64bit/ +cp lib/* ../../../src/linux/setup/lib_64bit/ +cd ../../../src/linux/ +python compile.py 51.0 ``` -__IMPORTANT NOTE (Linux)__: On Linux it will fail on first run. After the chromium -sources are downloaded, it will try to build cef projects and fail -due to missing packages. You will need to run the install-build-deps.sh -script (intended for Ubuntu systems). When the "ttf-mscorefonts-installer" +__MISSING PACKAGES (Linux)__: After the chromium sources are downloaded, +it will try to build cef projects and if it fails due to missing packages +make sure you've installed all the required packages listed in the +Requirements section further up on this page. If it still fails, you +can fix it by running the install-build-deps.sh script (intended for +Ubuntu systems, but you could edit it). When the "ttf-mscorefonts-installer" graphical installer pops up don't install it - deny EULA. ``` cd build/chromium/src/build/ chmod 755 install-build-deps.sh -sudo ./install-build-deps.sh --no-arm --no-chromeos-fonts --no-nacl +sudo ./install-build-deps.sh --no-lib32 --no-arm --no-chromeos-fonts --no-nacl ``` After dependencies are satisifed re-run automate.py. -You should be fine by running automate.py with the default options, but if you -need to customize the build then use the --help flag to see more. - ## Build CEF manually @@ -195,19 +234,30 @@ directory, not in the "download_dir/cef/" directory. There are two sites that provide latest builds of CEF: * Spotify - http://opensource.spotify.com/cefbuilds/index.html - * This is a new build system - * Since 07/06/2016 all builds are without tcmalloc, see + * This is the new build system + * Since June 2016 all builds are without tcmalloc, see [cefpython/#73](https://github.com/cztomczak/cefpython/issues/73) and [cef/#1827](https://bitbucket.org/chromiumembedded/cef/issues/1827) * Adobe - https://cefbuilds.com/ - * This is an old build system. It probably still builds with tcmalloc - (see above) + * This is the old build system. Not tested whether it builds without + tcmalloc. + +To build the "libcef_dll_wrapper" library type these commands: +``` +cd cef_binary/ +mkdir build +cd build/ +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release .. +ninja libcef_dll_wrapper +``` + +To build CEF sample applications type `ninja cefclient cefsimple`. Official CEF Python binaries come with additional patches to CEF/Chromium, see the [patches/](../../../tree/master/patches) directory. Whether you need these patches depends on your use case, they may not be required and thus you could use the Spotify binaries. Spotify builds have the -issue73 patch (tcmalloc) applied. +issue73 patch (no tcmalloc) applied. ## How to patch diff --git a/patches/issue125.patch b/patches/issue125.patch index 508e891e..5db9c3fb 100644 --- a/patches/issue125.patch +++ b/patches/issue125.patch @@ -1,8 +1,8 @@ diff --git http_cache_transaction.cc http_cache_transaction.cc -index 9dd8458..e61f1f0 100644 +index 178df98..85dc6d1 100644 --- http_cache_transaction.cc +++ http_cache_transaction.cc -@@ -2661,7 +2661,8 @@ int HttpCache::Transaction::WriteResponseInfoToEntry(bool truncated) { +@@ -2489,7 +2489,8 @@ int HttpCache::Transaction::WriteResponseInfoToEntry(bool truncated) { // blocking page is shown. An alternative would be to reverse-map the cert // status to a net error and replay the net error. if ((response_.headers->HasHeaderValue("cache-control", "no-store")) || diff --git a/patches/issue218_linux b/patches/issue218_linux deleted file mode 100644 index 6687effb..00000000 --- a/patches/issue218_linux +++ /dev/null @@ -1,5 +0,0 @@ -Patch to CEF. Fixes GTK/wxPython issues on Linux: -https://github.com/cztomczak/cefpython/issues/218 - -Apply the patch in the `cef/libcef/browser/` directory. It modifies -the PlatformCreateWindow() method. diff --git a/patches/issue231.patch b/patches/issue231.patch new file mode 100644 index 00000000..bbf9dfae --- /dev/null +++ b/patches/issue231.patch @@ -0,0 +1,140 @@ +diff --git include/capi/cef_path_util_capi.h include/capi/cef_path_util_capi.h +index 23befac..de31b3d 100644 +--- include/capi/cef_path_util_capi.h ++++ include/capi/cef_path_util_capi.h +@@ -51,6 +51,16 @@ extern "C" { + /// + CEF_EXPORT int cef_get_path(cef_path_key_t key, cef_string_t* path); + ++/// ++// Override the path associated with the specified |key|. This cannot be used to ++// change the value of PK_DIR_CURRENT, but that should be obvious. Also, if the ++// path specifies a directory that does not exist, the directory will be created ++// by this function. This function returns true (1) if successful. WARNING: ++// Consumers of CefGetPath may expect paths to be constant over the lifetime of ++// the app, so this function should be used with caution. ++/// ++CEF_EXPORT int cef_override_path(cef_path_key_t key, const cef_string_t* path); ++ + #ifdef __cplusplus + } + #endif +diff --git include/cef_path_util.h include/cef_path_util.h +index 552f4ba..95af66e 100644 +--- include/cef_path_util.h ++++ include/cef_path_util.h +@@ -49,4 +49,15 @@ typedef cef_path_key_t PathKey; + /*--cef()--*/ + bool CefGetPath(PathKey key, CefString& path); + ++/// ++// Override the path associated with the specified |key|. This cannot ++// be used to change the value of PK_DIR_CURRENT, but that should be obvious. ++// Also, if the path specifies a directory that does not exist, the directory ++// will be created by this method. This method returns true if successful. ++// WARNING: Consumers of CefGetPath may expect paths to be constant ++// over the lifetime of the app, so this method should be used with caution. ++/// ++/*--cef()--*/ ++bool CefOverridePath(PathKey key, const CefString& path); ++ + #endif // CEF_INCLUDE_CEF_PATH_UTIL_H_ +diff --git libcef/browser/path_util_impl.cc libcef/browser/path_util_impl.cc +index 6a75930..ad620d7 100644 +--- libcef/browser/path_util_impl.cc ++++ libcef/browser/path_util_impl.cc +@@ -51,3 +51,38 @@ bool CefGetPath(PathKey key, CefString& path) { + + return false; + } ++ ++bool CefOverridePath(PathKey key, const CefString& path) { ++ int pref_key = base::PATH_START; ++ switch(key) { ++ case PK_DIR_EXE: ++ pref_key = base::DIR_EXE; ++ break; ++ case PK_DIR_MODULE: ++ pref_key = base::DIR_MODULE; ++ break; ++ case PK_DIR_TEMP: ++ pref_key = base::DIR_TEMP; ++ break; ++ case PK_FILE_EXE: ++ pref_key = base::FILE_EXE; ++ break; ++ case PK_FILE_MODULE: ++ pref_key = base::FILE_MODULE; ++ break; ++#if defined(OS_WIN) ++ case PK_LOCAL_APP_DATA: ++ pref_key = base::DIR_LOCAL_APP_DATA; ++ break; ++#endif ++ case PK_USER_DATA: ++ pref_key = chrome::DIR_USER_DATA; ++ break; ++ default: ++ NOTREACHED() << "invalid argument"; ++ return false; ++ } ++ ++ base::FilePath file_path = base::FilePath(path); ++ return PathService::Override(pref_key, file_path); ++} +diff --git libcef_dll/libcef_dll.cc libcef_dll/libcef_dll.cc +index cde4fde..7a5b13a 100644 +--- libcef_dll/libcef_dll.cc ++++ libcef_dll/libcef_dll.cc +@@ -739,6 +739,23 @@ CEF_EXPORT int cef_get_path(cef_path_key_t key, cef_string_t* path) { + return _retval; + } + ++CEF_EXPORT int cef_override_path(cef_path_key_t key, const cef_string_t* path) { ++ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING ++ ++ // Verify param: path; type: string_byref_const ++ DCHECK(path); ++ if (!path) ++ return 0; ++ ++ // Execute ++ bool _retval = CefOverridePath( ++ key, ++ CefString(path)); ++ ++ // Return type: bool ++ return _retval; ++} ++ + CEF_EXPORT int cef_launch_process(struct _cef_command_line_t* command_line) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + +diff --git libcef_dll/wrapper/libcef_dll_wrapper.cc libcef_dll/wrapper/libcef_dll_wrapper.cc +index 74827e3..cf35e11 100644 +--- libcef_dll/wrapper/libcef_dll_wrapper.cc ++++ libcef_dll/wrapper/libcef_dll_wrapper.cc +@@ -683,6 +683,23 @@ CEF_GLOBAL bool CefGetPath(PathKey key, CefString& path) { + return _retval?true:false; + } + ++CEF_GLOBAL bool CefOverridePath(PathKey key, const CefString& path) { ++ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING ++ ++ // Verify param: path; type: string_byref_const ++ DCHECK(!path.empty()); ++ if (path.empty()) ++ return false; ++ ++ // Execute ++ int _retval = cef_override_path( ++ key, ++ path.GetStruct()); ++ ++ // Return type: bool ++ return _retval?true:false; ++} ++ + CEF_GLOBAL bool CefLaunchProcess(CefRefPtr command_line) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + diff --git a/patches/patch.py b/patches/patch.py index 71286f69..1bd054ff 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -10,13 +10,19 @@ "mac" if platform.system() == "Darwin" else "unknown") # ALL PLATFORMS -patches.append( +# noinspection PyUnresolvedReferences +patches.extend([ { # Fixes HTTPS cache problems with private certificates 'name': 'issue125', - 'path': '../net/http/', + 'path': '../net/http/' }, -) + { + # Expose CefOverridePath to override PathService path keys + 'name': 'issue231', + 'path': './' + }, +]) # LINUX if OS_POSTFIX == "linux": diff --git a/src/cefpython.pyx b/src/cefpython.pyx index 0c7dc085..8b878596 100644 --- a/src/cefpython.pyx +++ b/src/cefpython.pyx @@ -387,6 +387,7 @@ from cef_types cimport ( CefSettings, CefBrowserSettings, CefRect, CefPoint, CefRequestContextSettings, CefKeyEvent, CefMouseEvent, CefScreenInfo, + PathKey, PK_DIR_EXE, PK_DIR_MODULE ) from cef_task cimport * @@ -423,6 +424,7 @@ from cef_request_context cimport * from cef_request_context_handler cimport * from request_context_handler cimport * from cef_jsdialog_handler cimport * +from cef_path_util cimport * # ----------------------------------------------------------------------------- @@ -556,9 +558,19 @@ cdef public int CommandLineSwitches_GetInt(const char* key) except * with gil: # If you've built custom binaries with tcmalloc hook enabled on # Linux, then do not to run any of the CEF code until Initialize() -# is called. See Issue 73 in the CEF Python Issue Tracker. +# is called. See Issue #73 in the CEF Python Issue Tracker. def Initialize(applicationSettings=None, commandLineSwitches=None): + + # Fix Issue #231 - Discovery of the "icudtl.dat" file fails + cdef str py_module_dir = GetModuleDirectory() + cdef CefString module_dir + PyToCefString(py_module_dir, module_dir) + CefOverridePath(PK_DIR_EXE, module_dir)\ + or Debug("ERROR: CefOverridePath failed") + CefOverridePath(PK_DIR_MODULE, module_dir)\ + or Debug("ERROR: CefOverridePath failed") + if not applicationSettings: applicationSettings = {} # Debug settings need to be set before Debug() is called diff --git a/src/cython_includes/cef_path_util.pxd b/src/cython_includes/cef_path_util.pxd new file mode 100644 index 00000000..4a75f16b --- /dev/null +++ b/src/cython_includes/cef_path_util.pxd @@ -0,0 +1,9 @@ +# Copyright (c) 2016 The CEF Python Authors. All rights reserved. + +from cef_types cimport PathKey +from cef_string cimport CefString +from libcpp cimport bool as cpp_bool + +cdef extern from "include/cef_path_util.h" nogil: + cpp_bool CefGetPath(PathKey key, CefString& path) + cpp_bool CefOverridePath(PathKey key, const CefString& path) diff --git a/src/cython_includes/cef_types.pxd b/src/cython_includes/cef_types.pxd index 045854c4..a1959f2f 100644 --- a/src/cython_includes/cef_types.pxd +++ b/src/cython_includes/cef_types.pxd @@ -316,4 +316,15 @@ cdef extern from "include/internal/cef_types.h": WOD_SAVE_TO_DISK, WOD_OFF_THE_RECORD, WOD_IGNORE_ACTION - ctypedef cef_window_open_disposition_t WindowOpenDisposition \ No newline at end of file + ctypedef cef_window_open_disposition_t WindowOpenDisposition + + ctypedef enum cef_path_key_t: + PK_DIR_CURRENT, + PK_DIR_EXE, + PK_DIR_MODULE, + PK_DIR_TEMP, + PK_FILE_EXE, + PK_FILE_MODULE, + PK_LOCAL_APP_DATA, + PK_USER_DATA, + ctypedef cef_path_key_t PathKey diff --git a/src/include/cef_path_util.h b/src/include/cef_path_util.h index 552f4ba5..95af66ef 100644 --- a/src/include/cef_path_util.h +++ b/src/include/cef_path_util.h @@ -49,4 +49,15 @@ typedef cef_path_key_t PathKey; /*--cef()--*/ bool CefGetPath(PathKey key, CefString& path); +/// +// Override the path associated with the specified |key|. This cannot +// be used to change the value of PK_DIR_CURRENT, but that should be obvious. +// Also, if the path specifies a directory that does not exist, the directory +// will be created by this method. This method returns true if successful. +// WARNING: Consumers of CefGetPath may expect paths to be constant +// over the lifetime of the app, so this method should be used with caution. +/// +/*--cef()--*/ +bool CefOverridePath(PathKey key, const CefString& path); + #endif // CEF_INCLUDE_CEF_PATH_UTIL_H_ diff --git a/src/utils.pyx b/src/utils.pyx index 14614be3..d30e93f2 100644 --- a/src/utils.pyx +++ b/src/utils.pyx @@ -115,11 +115,9 @@ cpdef str GetModuleDirectory(): else: path = os.getcwd() if platform.system() == "Windows": - # On linux this regexp would give: - # "\/home\/czarek\/cefpython\/cefpython\/cef1\/linux\/binaries" path = re.sub(r"[/\\]+", re.escape(os.sep), path) path = re.sub(r"[/\\]+$", "", path) - return str(path) + return os.path.abspath(path) cpdef py_bool IsFunctionOrMethod(object valueType): if (valueType == types.FunctionType diff --git a/tools/automate-git.py b/tools/automate-git.py index f17a2208..b7a59d97 100644 --- a/tools/automate-git.py +++ b/tools/automate-git.py @@ -551,13 +551,6 @@ def onerror(func, path, exc_info): parser.print_help(sys.stderr) sys.exit() -if (options.clientdistrib or options.clientdistribonly) and \ - options.buildtarget.find('cefclient') == -1: - print "A client distribution cannot be generated if --build-target "+\ - "excludes cefclient." - parser.print_help(sys.stderr) - sys.exit() - # Operating system. if options.dryrun and options.dryrunplatform is not None: platform = options.dryrunplatform @@ -580,6 +573,17 @@ def onerror(func, path, exc_info): else: script_ext = '.sh' +if options.clientdistrib or options.clientdistribonly: + if platform == 'linux': + client_app = 'cefsimple' + else: + client_app = 'cefclient' + if options.buildtarget.find(client_app) == -1: + print 'A client distribution cannot be generated if --build-target '+\ + 'excludes %s.' % client_app + parser.print_help(sys.stderr) + sys.exit() + if options.x64build and platform != 'windows' and platform != 'macosx': print 'The x64 build option is only used on Windows and Mac OS X.' sys.exit() diff --git a/tools/automate-git.py.patch b/tools/automate-git.py.patch index fcc93e7d..144abf69 100644 --- a/tools/automate-git.py.patch +++ b/tools/automate-git.py.patch @@ -1,14 +1,18 @@ diff --git automate-git.py automate-git.py -index 1f0be0b..4b8da90 100644 +index 5c67e17..b7a59d9 100644 --- automate-git.py +++ automate-git.py -@@ -1,3 +1,87 @@ -+""" This is a modified copy of automate-git.py from upstream CEF. +@@ -1,3 +1,91 @@ ++""" See automate.py. This script is for internal usage only, don't ++call it directly. This is a modified copy of automate-git.py from ++upstream CEF. + +Some modifications were applied for CEF Python specific use case. +There is a patch file with the same name as this script that contains +differences from the original file. + ++-------- ++ +Usage: automate-git.py [options] + + This utility implements automation for the download, update, build and @@ -90,7 +94,16 @@ index 1f0be0b..4b8da90 100644 # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights # reserved. Use of this source code is governed by a BSD-style license that # can be found in the LICENSE file. -@@ -888,6 +972,12 @@ if not options.nobuild and (chromium_checkout_changed or \ +@@ -789,7 +877,7 @@ else: + # Delete the existing src/cef directory. It will be re-copied from the download + # directory later. + if cef_checkout_changed and os.path.exists(cef_src_dir): +- delete_directory(cef_src_dir) ++ delete_directory(cef_src_dir) + + # Delete the existing src/out directory if requested. + if options.forceclean and os.path.exists(out_src_dir): +@@ -892,6 +980,12 @@ if not options.nobuild and (chromium_checkout_changed or \ command = 'ninja -C ' if options.verbosebuild: command = 'ninja -v -C' diff --git a/tools/automate.py b/tools/automate.py index 25396648..86aa25dd 100644 --- a/tools/automate.py +++ b/tools/automate.py @@ -209,8 +209,8 @@ def create_cef_directories(): # Clone cef repo and checkout branch if os.path.exists(cef_dir): rmdir(cef_dir) - run_git("clone %s cef" % CEF_GIT_URL, Options.cef_build_dir) - run_git("checkout %s" % Options.cef_branch, cef_dir) + run_git("clone -b %s %s cef" % (Options.cef_branch, CEF_GIT_URL), + Options.cef_build_dir) if Options.cef_commit: run_git("checkout %s" % Options.cef_commit, cef_dir) # Update cef patches @@ -306,10 +306,14 @@ def build_cef_projects(): print("[automate.py] OK") if platform.system() == "Windows": assert(os.path.exists(os.path.join(build_cefclient, - "cefclient", "cefclient.exe"))) + "cefclient", + Options.build_type, + "cefclient.exe"))) else: assert (os.path.exists(os.path.join(build_cefclient, - "cefclient", "cefclient"))) + "cefclient", + Options.build_type, + "cefclient"))) # Build libcef_dll_wrapper libs if platform.system() == "Windows": @@ -385,11 +389,13 @@ def create_prebuilt_binaries(): cpdir(os.path.join(src, "Resources"), bindir) # Copy cefclient, cefsimple - cefclient = os.path.join(src, "build_cefclient", "cefclient", "cefclient") + cefclient = os.path.join(src, "build_cefclient", "cefclient", + Options.build_type, "cefclient") cefclient_files = os.path.join(src, "build_cefclient", "cefclient", - "files") + Options.build_type, "files") cpdir(cefclient_files, os.path.join(bindir, "files")) - cefsimple = os.path.join(src, "build_cefclient", "cefsimple", "cefsimple") + cefsimple = os.path.join(src, "build_cefclient", "cefsimple", + Options.build_type, "cefsimple") if platform.system() == "Windows": cefclient += ".exe" cefsimple += ".exe" @@ -411,7 +417,8 @@ def create_prebuilt_binaries(): libdst = os.path.join(libdir, "licef_dll_wrapper_md.lib") shutil.copy(libsrc, libdst) elif platform.system() == "Linux": - cpdir(os.path.join(src, "build_cefclient", "libcef_dll"), libdir) + cpdir(os.path.join(src, "build_cefclient", "libcef_dll_wrapper"), + libdir) # Copy README.txt and LICENSE.txt shutil.copy(os.path.join(src, "README.txt"), dst) @@ -509,6 +516,11 @@ def run_automate_git(): # so don't fetch/update CEF repo. args.append("--no-cef-update") args.append("--no-distrib-archive") + if platform.system() == "Linux": + # Building cefclient target isn't supported on Linux when + # using sysroot (cef/#1916). However building cefclient + # later in cef_binary/ with cmake/ninja do works fine. + args.append("--build-target=cefsimple") args = " ".join(args) return run_python(script+" "+args, Options.cef_build_dir)