def main(args): # Control font hinting apply_patch('webkit_control_hinting.patch') if iswindows: return windows_build() # fix detection of python2 if islinux: replace_in_file( 'Source/cmake/WebKitCommon.cmake', 'find_package(PythonInterp 2.7.0 REQUIRED)', 'set(PYTHONINTERP_FOUND "ON")\n' 'set(PYTHON_EXECUTABLE /usr/bin/python2)' ) cmake_build( PORT='Qt', CMAKE_PREFIX_PATH='{0};{0}/qt'.format(PREFIX), override_prefix=os.path.join(build_dir(), 'qt'), library_path=True, **DISABLE_DIRECTIVES ) for path in walk(build_dir()): if path.endswith('.pri'): replace_in_file(path, build_dir(), PREFIX)
def main(args): conf = '-spellchecker' apply_patch('qtbug-88976.diff', level=1) if islinux: # workaround for bug in build system, not adding include path for # libjpeg when building iccjpeg, and mjpeg_decoder jpeg_files = list(glob.glob(f'{PREFIX}/include/*jpeg*.h')) jpeg_files += [ f'{PREFIX}/include/{x}.h' for x in 'jerror jconfig jmorecfg'.split() ] for header in jpeg_files: os.symlink( header, os.path.join('src/3rdparty/chromium', os.path.basename(header))) conf += ' -webp -webengine-icu' if iswindows: # broken test for 64-bit ness needs to be disabled replace_in_file('configure.pri', 'ProgramW6432', 'PROGRAMFILES') # Needed for Qt 5.15.0 https://github.com/microsoft/vcpkg/issues/12477 replace_in_file( 'src/3rdparty/chromium/third_party/perfetto/src/trace_processor/' 'importers/systrace/systrace_trace_parser.cc', '#include <inttypes.h>', '#include <cctype>\n#include <inttypes.h>') qt_build(conf, for_webengine=True)
def main(args): apply_patch('chmlib-empty-file-not-dir.patch', level=1) # needed for aarch64 if iswindows: os.chdir('src') for f in 'chm_lib.c lzx.c'.split(): copy_headers(f, 'src') run(f'"{CL}" /c /nologo /MD /W3 /DWIN32 -c ' + f) run(f'"{LIB}" -nologo chm_lib.obj lzx.obj -OUT:chmlib.lib') install_binaries('chmlib.lib') copy_headers('chm_lib.h') copy_headers('lzx.h', 'src') else: # test for malloc breaks on macos universal. # All system we care about have malloc anyway replace_in_file('configure', 'if test $ac_cv_func_malloc_0_nonnull = yes; then', 'if test 1; then') replace_in_file('src/chm_lib.c', 'pread64', 'pread') apply_patch('chmlib-integer-types.patch', level=1) # needed for aarch64 # updated config.guess is needed for aarch64 with open('config.guess', 'wb') as dest, open(os.path.join(PATCHES, 'config.guess'), 'rb') as src: dest.write(src.read()) if ismacos and is_arm_half_of_lipo_build(): with open('config.sub', 'w') as dest: dest.write('echo arm-apple-darwin') conf = '--disable-dependency-tracking' if ismacos: conf += ' --disable-pread --disable-io64' simple_build(conf)
def main(args): conf = '-feature-qtwebengine-build -feature-qtwebengine-widgets-build' conf += ' -no-feature-qtwebengine-quick-build' if islinux: # see https://bugs.launchpad.net/calibre/+bug/1939958 apply_patch('crbug1213452.diff', level=1) # use system ICU otherwise there is 10MB duplication and we have to # make resources/icudtl.dat available in the application conf += ' -webengine-icu' qt_build(conf, for_webengine=True)
def main(args): if ismacos: # https://bugreports.qt.io/browse/QTBUG-88495 apply_patch('qtbug-88495.diff', level=1) if islinux: # Revert a Qt patch to explicitly depend on libxcb-util # this breaks on the ever-delightful Debian. # https://bugreports.qt.io/browse/QTBUG-88688 apply_patch('qt-xcb-util-dependency-remove.diff') # We disable loading of bearer plugins because many distros ship with # broken bearer plugins that cause hangs. At least, this was the case # in Qt 4.x Dont know if it is still true for Qt 5 but since we dont # need bearers anyway, it cant hurt. replace_in_file( 'src/network/bearer/qnetworkconfigmanager_p.cpp', b'/bearer"', b'/bearer-disabled-by-kovid"') # Change pointing_hand to hand2, see # https://bugreports.qt.io/browse/QTBUG-41151 replace_in_file('src/plugins/platforms/xcb/qxcbcursor.cpp', 'pointing_hand"', 'hand2"') if iswindows or islinux: # Let Qt setup its paths based on runtime location # this is needed because we want Qt to be able to # find its plugins etc before QApplication is constructed replace_in_file( 'src/corelib/global/qlibraryinfo.cpp', '= getPrefix', '= getenv("CALIBRE_QT_PREFIX") ?' ' getenv("CALIBRE_QT_PREFIX") : getPrefix') if iswindows: # https://bugreports.qt.io/browse/QTBUG-89915 replace_in_file( 'src/plugins/platforms/windows/qwindowskeymapper.cpp', 'Qt::Key_MediaPlay, // 179', 'Qt::Key_MediaTogglePlayPause, // 179', ) # Enable loading of DLLs from the bin directory replace_in_file( 'src/corelib/global/qlibraryinfo.cpp', '{ "Libraries", "lib" }', '{ "Libraries", "bin" }' ) replace_in_file( 'src/corelib/plugin/qsystemlibrary.cpp', 'searchOrder << QFileInfo(qAppFileName()).path();', 'searchOrder << (QFileInfo(qAppFileName()).path()' r".replace(QLatin1Char('/'), QLatin1Char('\\'))" r'+ QString::fromLatin1("\\app\\bin\\"));') cflags, ldflags = CFLAGS, LDFLAGS if ismacos: ldflags = '-L' + LIBDIR os.mkdir('build'), os.chdir('build') configure = os.path.abspath( '..\\configure.bat') if iswindows else '../configure' conf = configure + ( ' -v -silent -opensource -confirm-license -prefix {}/qt -release' ' -nomake examples -nomake tests -no-sql-odbc -no-sql-psql' ' -icu -qt-harfbuzz -qt-doubleconversion').format(build_dir()) if islinux: # Gold linker is needed for Qt 5.13.0 because of # https://bugreports.qt.io/browse/QTBUG-76196 conf += (' -bundled-xcb-xinput -xcb -glib -openssl -qt-pcre' ' -xkbcommon -libinput -linker gold') elif ismacos: conf += ' -no-pkg-config -framework -no-openssl -securetransport' ' -no-freetype -no-fontconfig ' elif iswindows: # Qt links incorrectly against libpng and libjpeg, so use the bundled # copy Use dynamic OpenGl, as per: # https://doc.qt.io/qt-5/windows-requirements.html#dynamically-loading-graphics-drivers conf += (' -openssl -directwrite -ltcg -mp' ' -no-plugin-manifests -no-freetype -no-fontconfig' ' -qt-libpng -qt-libjpeg ') # The following config items are not supported on windows conf = conf.replace('-v -silent ', '-v ') cflags = '-I {}/include'.format(PREFIX).replace(os.sep, '/') ldflags = '-L {}/lib'.format(PREFIX).replace(os.sep, '/') conf += ' ' + cflags + ' ' + ldflags run(conf, library_path=True) # run_shell() run_shell if iswindows: run(f'"{NMAKE}"', append_to_path=f'{PREFIX}/private/gnuwin32/bin') run(f'"{NMAKE}" install') shutil.copy2('../src/3rdparty/sqlite/sqlite3.c', os.path.join(build_dir(), 'qt')) else: run('make ' + MAKEOPTS, library_path=True) run('make install') with open(os.path.join(build_dir(), 'qt', 'bin', 'qt.conf'), 'wb') as f: f.write(b"[Paths]\nPrefix = ..\n")