Exemple #1
0
def main(args):
    os.chdir('source')

    if iswindows:
        solution_build()
    else:
        build_loc = os.getcwd()
        conf = ('--prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man'
                ' --sbindir=/usr/bin')
        if 'first_build_dir' in lipo_data:
            conf += ' --with-cross-build=' + lipo_data['first_build_dir']

        simple_build(conf,
                     install_args='DESTDIR=' + build_dir(),
                     relocate_pkgconfig=False)
        usr = os.path.join(build_dir(), 'usr')
        os.rename(os.path.join(usr, 'include'),
                  os.path.join(build_dir(), 'include'))
        os.rename(os.path.join(usr, 'lib'), os.path.join(build_dir(), 'lib'))
        for path in walk(build_dir()):
            if path.endswith('.pc'):
                replace_in_file(path,
                                re.compile(br'^prefix\s*=\s*/usr', flags=re.M),
                                f'prefix={PREFIX}')
        shutil.rmtree(usr)

        if 'first_build_dir' not in lipo_data:
            lipo_data['first_build_dir'] = build_loc
Exemple #2
0
def main(args):
    if iswindows:
        windows_cmake_build()
        install_binaries('build/jpegtran-static.exe',
                         'bin',
                         fname_map=lambda x: 'jpegtran-calibre.exe')
        install_binaries('build/cjpeg-static.exe',
                         'bin',
                         fname_map=lambda x: 'cjpeg-calibre.exe')
    else:
        env = {}
        if ismacos:
            env['PATH'] = BIN + os.pathsep + os.environ['PATH']
            env['LIBTOOLIZE'] = 'glibtoolize'
            env['LIBTOOL'] = 'glibtool'
        with ModifiedEnv(**env):
            run('autoreconf -fiv')
        conf = ('--disable-dependency-tracking --disable-shared --with-jpeg8'
                ' --without-turbojpeg')
        env = {}
        if ismacos:
            conf += f' --host x86_64-apple-darwin NASM={BIN}/nasm'
            replace_in_file(
                'configure',
                re.compile(br'^PKG_CHECK_MODULES.libpng.+?\bfi\b',
                           re.M | re.DOTALL),
                'HAVE_LIBPNG=1\nHAVE_LIBPNG_TRUE="#"\n')
        simple_build(conf,
                     override_prefix=os.path.join(build_dir(), 'private',
                                                  'mozjpeg'))
Exemple #3
0
def main(args):
    os.chdir('source')

    if iswindows:
        solution_build()
    elif ismacos:
        run('./runConfigureICU MacOSX --disable-samples --prefix=' +
            build_dir())
        run('make ' + MAKEOPTS)
        run('make install')
    else:
        simple_build(
            '--prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man'
            ' --sbindir=/usr/bin',
            install_args='DESTDIR=' + build_dir(),
            relocate_pkgconfig=False)
        usr = os.path.join(build_dir(), 'usr')
        os.rename(os.path.join(usr, 'include'),
                  os.path.join(build_dir(), 'include'))
        os.rename(os.path.join(usr, 'lib'), os.path.join(build_dir(), 'lib'))
        for path in walk(build_dir()):
            if path.endswith('.pc'):
                replace_in_file(path,
                                re.compile(br'^prefix\s*=\s*/usr', flags=re.M),
                                f'prefix={PREFIX}')
        shutil.rmtree(usr)
Exemple #4
0
def add_dll_exports():
    exp = '__declspec(dllexport)' if iswindows else \
        '__attribute__ ((visibility ("default")))'
    replace_in_file(
        'include/libstemmer.h',
        re.compile(r'^(.+)\(', re.M), fr'{exp} \1('
    )
Exemple #5
0
def run_sip_install(for_webengine=False):
    qt_bin = f'{PREFIX}/qt/bin'
    qmake = 'qmake' + ('.exe' if iswindows else '')
    args = ('--no-docstrings --no-make'
            f' --qmake={qt_bin}/{qmake} --concatenate=5 --verbose').split()
    if iswindows:
        args.append('--link-full-dll')
    if for_webengine:
        args.extend('--disable QtWebEngineQuick'.split())
    else:
        args.extend('--qt-shared --confirm-license --no-designer-plugin'
                    ' --no-qml-plugin'.split())
    run(f'{PREFIX}/bin/sip-build', *args, library_path=True)
    if iswindows:
        # disable distinfo as installing it fails when using INSTALL_ROOT
        replace_in_file('build/Makefile', 'install_distinfo ', ' ')
        run(NMAKE, cwd='build')
        run(NMAKE,
            'install',
            cwd='build',
            env={'INSTALL_ROOT': build_dir()[2:]})
    else:
        run('make ' + MAKEOPTS, cwd='build')
        run(f'make INSTALL_ROOT="{build_dir()}" install',
            cwd='build',
            library_path=True)
    python_install()
Exemple #6
0
def unix_python2(args):
    env = {'CFLAGS': CFLAGS + ' -DHAVE_LOAD_EXTENSION'}
    replace_in_file('setup.py', re.compile(b'def detect_tkinter.+:'),
                    lambda m: m.group() + b'\n' + b' ' * 8 + b'return 0')
    conf = ('--prefix={} --with-threads --enable-ipv6 --enable-unicode={}'
            ' --with-system-expat --with-pymalloc --without-ensurepip').format(
                build_dir(), ('ucs2' if ismacos or iswindows else 'ucs4'))
    if islinux:
        conf += ' --with-system-ffi --enable-shared'
        # Needed as the system openssl is too old, causing the _ssl module
        # to fail
        env['LD_LIBRARY_PATH'] = LIBDIR
    elif ismacos:
        conf += (f' --enable-framework={build_dir()}/python'
                 ' --with-signal-module')
        # Needed for readline detection
        env['MACOSX_DEPLOYMENT_TARGET'] = '10.9'

    with ModifiedEnv(**env):
        simple_build(conf, relocate_pkgconfig=False)

    bindir = os.path.join(build_dir(), 'bin')
    P = os.path.join(bindir, 'python')
    replace_in_file(P + '-config', re.compile(br'^#!.+/bin/', re.MULTILINE),
                    '#!' + PREFIX + '/bin/')
    if ismacos:
        bindir = os.path.join(build_dir(), 'bin')
        for f in os.listdir(bindir):
            link = os.path.join(bindir, f)
            if os.path.islink(link):
                fp = os.readlink(link)
                nfp = fp.replace(build_dir(), PREFIX)
                if nfp != fp:
                    os.unlink(link)
                    os.symlink(nfp, link)
Exemple #7
0
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)
Exemple #8
0
def main(args):
    if iswindows:
        for f in ('./devel/ftoption.h ./include/freetype/config/ftoption.h'.
                  split()):
            replace_in_file(
                f,
                'FT_BEGIN_HEADER',
                'FT_BEGIN_HEADER\n#define FT_EXPORT(x) __declspec(dllexport) x\n#define FT_EXPORT_DEF(x) __declspec(dllexport) x\n'  # noqa
            )

        def build(static=False):
            conf = 'Release'
            if static:
                conf += ' Static'
            msbuild('builds/windows/vc2010/freetype.sln', configuration=conf)

        # Build the static library
        # build(static=True)
        # install_binaries('objs/freetype.lib')
        # Build the dynamic library
        build()
        install_binaries('objs/freetype.dll', 'bin')
        install_binaries('objs/*/Release/*.lib')
        for f in glob.glob('objs/vc2010/*/freetype*MT.lib'):
            shutil.copy2(f, os.path.join(build_dir(), 'lib', 'freetype.lib'))
        shutil.copytree('include',
                        os.path.join(build_dir(), 'include', 'freetype2'))
        shutil.rmtree(
            os.path.join(build_dir(), 'include', 'freetype2', 'freetype',
                         'internal'))
    else:
        simple_build('--disable-dependency-tracking --disable-static')
Exemple #9
0
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)
Exemple #10
0
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)
Exemple #11
0
def main(args):
    simple_build()
    for path in walk(os.path.join(build_dir(), 'bin')):
        replace_in_file(path, build_dir(), PREFIX)
    for path in walk(build_dir()):
        if path.endswith('/autom4te.cfg'):
            replace_in_file(path, build_dir(), PREFIX)
Exemple #12
0
def main(args):
    if iswindows:
        run(*('cscript.exe configure.js include={0}/include'
              ' include={0}/include/libxml2 lib={0}/lib prefix={0}'
              ' zlib=yes iconv=no'.format(PREFIX.replace(os.sep,
                                                         '/')).split()),
            cwd='win32')
        for f in walk('.'):
            bname = os.path.basename(f)
            if bname.startswith('Makefile'):
                replace_in_file(f, '/OPT:NOWIN98', '', missing_ok=True)
            elif bname == 'xsltconfig.h':
                replace_in_file(f, '@WITH_PROFILER@', '1')
        run(f'"{NMAKE}" /f Makefile.msvc', cwd='win32')
        install_tree('libxslt', 'include')
        install_tree('libexslt', 'include')
        for f in walk('.'):
            if f.endswith('.dll'):
                install_binaries(f, 'bin')
            elif f.endswith('.lib'):
                install_binaries(f)
    else:
        env = {}
        if ismacos:
            env['PATH'] = BIN + os.pathsep + os.environ['PATH']
        with ModifiedEnv(**env):
            simple_build('--disable-dependency-tracking --disable-static'
                         ' --enable-shared --without-python --without-debug')
Exemple #13
0
def main(args):
    pyver = python_major_minor_version()
    b = build_dir()
    if ismacos:
        b = os.path.join(
            b, 'python/Python.framework/Versions/{}.{}'.format(*pyver))
    elif iswindows:
        b = os.path.join(b, 'private', 'python')
    cmd = [
        PYTHON, 'configure.py', '--no-pyi', '--sip-module=PyQt5.sip',
        '--bindir=%s/bin' % build_dir()
    ]
    sp = 'Lib' if iswindows else 'lib/python{}.{}'.format(*pyver)
    inc = 'include' if iswindows else 'include/python{}.{}'.format(*pyver)
    cmd += [
        '--destdir=%s/%s/site-packages' % (b, sp),
        '--sipdir=%s/share/sip' % b,
        '--incdir=%s/%s' % (b, inc)
    ]
    run(*cmd, library_path=True)
    if iswindows:
        run(f'"{NMAKE}"'), run(f'"{NMAKE}" install')
    else:
        run('make ' + MAKEOPTS)
        run('make install', library_path=True)
    q, r = build_dir(), PREFIX
    if iswindows:
        q = q.replace(os.sep, os.sep + os.sep)
        r = r.replace(os.sep, os.sep + os.sep)
    p = 'Lib' if iswindows else 'lib/python{}.{}'.format(*pyver)
    replace_in_file(os.path.join(b, p, 'site-packages/sipconfig.py'), q, r)
Exemple #14
0
def windows_python(args):
    with open('PCbuild/msbuild.rsp', 'w') as f:
        print(f'/p:PlatformToolset={get_platform_toolset()}', file=f)
        print(f'/p:WindowsTargetPlatformVersion={get_windows_sdk()}', file=f)

    # dont need python 3 to get externals, use git instead
    replace_in_file('PCbuild\\get_externals.bat',
                    re.compile(br'^call.+find_python.bat.+$', re.MULTILINE),
                    '')
    env = {}
    if is64bit:
        env['PROCESSOR_ARCHITECTURE'] = env['PROCESSOR_ARCHITEW6432'] = 'AMD64'
    try:
        run(
            'PCbuild\\build.bat', '-e', '--no-tkinter', '-c',
            'Release', '-m', '-p', ('x64' if is64bit else 'Win32'), '-v',
            '-t', 'Build',
            '--pgo',
            env=env
        )
        # Run the tests
        # run('PCbuild\\amd64\\python.exe', 'Lib/test/regrtest.py', '-u',
        #     'network,cpu,subprocess,urlfetch')

        # Do not read mimetypes from the registry
        replace_in_file(
            'Lib\\mimetypes.py',
            re.compile(br'try:.*?import\s+winreg.*?None', re.DOTALL),
            r'_winreg = None')

        bindir = 'PCbuild\\amd64' if is64bit else 'PCbuild\\win32'
        install_binaries(bindir + os.sep + '*.exe', 'private\\python')
        install_binaries(bindir + os.sep + 'python*.dll', 'private\\python')
        install_binaries(bindir + os.sep + '*.pyd', 'private\\python\\DLLs')
        install_binaries(bindir + os.sep + '*.dll', 'private\\python\\DLLs')
        for x in glob.glob(
                os.path.join(build_dir(),
                             'private\\python\\DLLs\\python*.dll')):
            os.remove(x)
        install_binaries(bindir + os.sep + '*.lib', 'private\\python\\libs')
        copy_headers('PC\\pyconfig.h', 'private\\python\\include')
        copy_headers('Include\\*.h', 'private\\python\\include')
        copy_headers('Include\\cpython', 'private\\python\\include')
        with open('Lib/sitecustomize.py', 'w') as f:
            f.write('''
import os
for path in ('{p}/bin', '{p}/qt/bin'):
    if os.path.exists(path):
        os.add_dll_directory(path)
'''.format(p=PREFIX.replace('\\', '/')))

        shutil.copytree('Lib', os.path.join(build_dir(),
                                            'private\\python\\Lib'))
    finally:
        # bloody git creates files with no write permission
        import stat
        for path in walk('externals'):
            os.chmod(path, stat.S_IWRITE)
            os.remove(path)
Exemple #15
0
 def main(args):
     configure_args = []
     if len(UNIVERSAL_ARCHES) > 1:
         replace_in_file(
             'configure', 'CFLAGS="${CFLAGS} ${ARCHS}"',
             'CFLAGS="${CFLAGS} ${ARCHS}"\n  SFLAGS="${SFLAGS} ${ARCHS}"')
         archs = ' '.join(f'-arch {x}' for x in UNIVERSAL_ARCHES)
         configure_args.append(f'--archs={archs}')
     simple_build(configure_args)
Exemple #16
0
def main(args):
    with ModifiedEnv(PATH=BIN + os.pathsep + os.environ['PATH']):
        simple_build()
    files = set()
    for path in walk(os.path.join(build_dir(), 'bin')):
        files.add(os.path.abspath(os.path.realpath(path)))
    for path in walk(build_dir()):
        if path.endswith('/Config.pm'):
            files.add(os.path.abspath(os.path.realpath(path)))
    for path in files:
        replace_in_file(path, build_dir(), PREFIX, missing_ok=True)
Exemple #17
0
def main(args):
    run_sip_install()
    if iswindows:
        for x in walk(build_dir()):
            parts = x.replace(os.sep, '/').split('/')
            if parts[-2:] == ['PyQt6', '__init__.py']:
                replace_in_file(x, re.compile(r'^find_qt\(\)', re.M), '')
                break
        else:
            raise ValueError(
                f'Failed to find PyQt6 __init__.py to patch in {build_dir()}')
Exemple #18
0
def main(args):
    env = {}
    p = PREFIX.replace(os.sep, '/')
    env = dict(
        UNRAR_INCLUDE='{}/include'.format(p),
        UNRAR_LIBDIRS='{0}/lib'.format(p),
    )
    if iswindows:
        replace_in_file('src/unrardll/wrapper.cpp', ' ssize_t written',
                        ' Py_ssize_t written')
    with ModifiedEnv(**env):
        python_build()
    python_install()
Exemple #19
0
def main(args):
    cmake_args = dict(ENABLE_CPP='0',
                      ENABLE_GLIB='OFF',
                      ENABLE_GOBJECT_INTROSPECTION='OFF',
                      ENABLE_CMS='none',
                      ENABLE_QT5='OFF',
                      ENABLE_LIBCURL='OFF',
                      BUILD_GTK_TESTS='OFF',
                      BUILD_QT5_TESTS='OFF',
                      BUILD_CPP_TESTS='OFF')
    # poppler unconditionally searches for cairo which we dont want
    replace_in_file('CMakeLists.txt',
                    'macro_optional_find_package(Cairo ${CAIRO_VERSION})',
                    'set(CAIRO_FOUND false)')
    if ismacos:
        replace_in_file('CMakeLists.txt', 'macro_optional_find_package(NSS3)',
                        'set(NSS3_FOUND false)')
    if iswindows:
        opjinc = f'{PREFIX}/include/openjpeg'.replace('\\', '/')
        opjlib = f'{PREFIX}/lib/openjp2.lib'.replace('\\', '/')
        replace_in_file(
            'CMakeLists.txt', 'find_package(OpenJPEG)',
            'set(OpenJPEG_FOUND true)\n'
            'set(OPENJPEG_MAJOR_VERSION 2)\n'
            f'set(OPENJPEG_INCLUDE_DIRS {opjinc})\n')
        replace_in_file('CMakeLists.txt',
                        'set(poppler_LIBS ${poppler_LIBS} openjp2)',
                        'set(poppler_LIBS ${poppler_LIBS} %s)' % opjlib)
        windows_cmake_build(**cmake_args)
        install_binaries('build/utils/*.exe', 'bin')
    else:
        cmake_build(**cmake_args)
Exemple #20
0
def main(args):
    if islinux:
        # 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
        getenv = '_wgetenv' if iswindows else 'getenv'
        ff = 'fromWCharArray' if iswindows else 'fromUtf8'
        ev = 'L"CALIBRE_QT_PREFIX"' if iswindows else '"CALIBRE_QT_PREFIX"'
        replace_in_file(
            'src/corelib/global/qlibraryinfo.cpp', '= getPrefix',
            f'= {getenv}({ev}) ?'
            f' QString::{ff}({getenv}({ev})) : getPrefix')
    if iswindows:
        # 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\\"));')
    cmake(args)
    relocate_pkgconfig_files()
Exemple #21
0
 def main(args):
     p = PREFIX.replace('\\', '/')
     shutil.copy(os.path.join(PREFIX, 'src', 'chm_lib.c'), 'chm')
     shutil.copy(os.path.join(PREFIX, 'src', 'lzx.c'), 'chm')
     shutil.copy(os.path.join(PREFIX, 'src', 'lzx.h'), 'chm')
     shutil.copy(os.path.join(PREFIX, 'include', 'chm_lib.h'), 'chm')
     replace_in_file('setup.py', 'search.c"',
                     'search.c", "chm/chm_lib.c", "chm/lzx.c"')
     replace_in_file(
         'setup.py', 'libraries=["chm"]', f'include_dirs=["{p}/include"],'
         'define_macros=[("strcasecmp", "_stricmp"),'
         '("strncasecmp", "_strnicmp"), ("WIN32", "1")],')
     python_build()
     python_install()
Exemple #22
0
def main(args):
    if iswindows:
        # libxml2 does not depend on iconv in our windows build
        replace_in_file('setupinfo.py', ", 'iconv'", '')
        run(
            PYTHON,
            *('setup.py build_ext -I {0}/include;{0}/include/libxml2 -L {0}/lib'
              .format(PREFIX.replace(os.sep, '/')).split()))
    else:
        run(PYTHON,
            *('setup.py build_ext -I {0}/include/libxml2 -L {0}/lib'.format(
                PREFIX).split()),
            library_path=True)
    python_build()
    python_install()
Exemple #23
0
    def main(args):
        root = (
            os.path.join(PREFIX, 'lib').replace('\\', '/'),
            os.path.join(PREFIX, 'include').replace('\\', '/')
        )
        replace_in_file(
            'setup.py',
            re.compile(r'^(JPEG|ZLIB|FREETYPE)_ROOT = None', re.M),
            fr'\1_ROOT = {root}')
        # dont link against static zlib
        replace_in_file(
            'setup.py', 'feature.zlib = "zlib"', 'feature.zlib = "zdll"')

        python_build()
        python_install()
Exemple #24
0
def main(args):
    if not iswindows:
        return cmake_build(WITH_JPEG8='1', ENABLE_STATIC='0')
    cpu = 'x86_64' if is64bit else 'i386'
    replace_in_file(
        'CMakeLists.txt',
        'string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC)',
        f'set(CMAKE_SYSTEM_PROCESSOR_LC "{cpu}")')
    windows_cmake_build(
        WITH_JPEG8='1',
        ENABLE_STATIC='0',
        binaries='jpeg8.dll',
        libraries='jpeg.lib',
        headers='jconfig.h ../jerror.h ../jpeglib.h ../jmorecfg.h',
    )
Exemple #25
0
    def main(args):
        # the Makefile has a circular dependency that breaks building under VS
        # 2019, see
        # https://webcache.googleusercontent.com/search?q=cache:s-p9ts472EoJ:https://forum.nasm.us/index.php%3Ftopic%3D2746.0+&cd=6&hl=en&ct=clnk&gl=in
        replace_in_file(
            'Mkfiles/msvc.mak',
            re.compile(rb'\s+\$\(MAKE\) asm\\warnings.time.+?WARNFILES\)',
                       re.DOTALL), '')
        open('asm/warnings.time', 'w').close()

        run(NMAKE,
            '/f',
            'Mkfiles/msvc.mak',
            append_to_path=os.path.dirname(PERL))
        install_binaries('./nasm.exe', 'bin')
Exemple #26
0
def main(args):
    # dbus chooses where to look for config files based on values fed to
    # ./configure, so we cannot configure to install it to prefix
    run('./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var'
        ' --disable-dependency-tracking --disable-static'
        ' --disable-doxygen-docs --disable-xml-docs --disable-systemd'
        ' --without-systemdsystemunitdir'
        ' --with-console-auth-dir=/run/console/ --disable-tests --without-x')
    run('make ' + MAKEOPTS)
    run(f'make install', env={'DESTDIR': build_dir()})
    for x in ('include', 'lib'):
        os.rename(os.path.join(build_dir(), 'usr', x),
                  os.path.join(build_dir(), x))
    shutil.rmtree(os.path.join(build_dir(), 'usr'))
    for path in walk(build_dir()):
        if path.endswith('.pc'):
            replace_in_file(path, 'prefix=/usr', f'prefix={PREFIX}')
Exemple #27
0
def main(args):
    # the makefile stupidly uses a comma as a separator for sed which breaks when there
    # are multiple entries being substituted
    replace_in_file('Makefile.am', re.compile(rb"'s,.+?'"),
                    lambda m: m.group().replace(b',', b'`'))
    replace_in_file('Makefile.in', re.compile(rb"'s,.+?'"),
                    lambda m: m.group().replace(b',', b'`'))
    with ModifiedEnv(FREETYPE_CFLAGS='-I%s/include/freetype2' % PREFIX,
                     FREETYPE_LIBS='-L%s/lib -lfreetype -lz -lbz2' % PREFIX):
        simple_build(
            '--disable-dependency-tracking --disable-static --disable-docs'
            f' --with-expat={PREFIX} --with-add-fonts=/usr/share/fonts',
            library_path=True)
    for f in walk(os.path.join(build_dir(), 'etc')):
        if os.path.islink(f):
            x = os.path.realpath(f)
            os.unlink(f)
            shutil.copy2(x, f)
Exemple #28
0
def main(args):
    if iswindows:
        sln = r'jxrencoderdecoder\JXRDecApp_vc14.vcxproj'
        msbuild(sln)

        def fname_map(x):
            return os.path.basename(x).rpartition('.')[0] + '-calibre.exe'

        for f in walk():
            if f.endswith('.exe'):
                install_binaries(f, 'bin', fname_map=fname_map)
    else:
        if ismacos:
            flags = ''
            if current_build_arch():
                flags += f'-arch {current_build_arch()} '
            replace_in_file('Makefile', 'CFLAGS=', f'CFLAGS={flags}')
            replace_in_file('Makefile', 'CXXFLAGS=', f'CXXFLAGS={flags}')
        run('make', os.path.join(os.getcwd(), 'build/JxrDecApp'))
        install_binaries('build/JxrDecApp', 'bin')
Exemple #29
0
def main(args):
    conf = '-spellchecker'
    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')
    qt_build(conf, for_webengine=True)
Exemple #30
0
def main(args):
    if not iswindows:
        kw = {
            'WITH_JPEG8': '1',
            'ENABLE_STATIC': '0',
        }
        if ismacos:
            kw['CMAKE_ASM_NASM_COMPILER'] = f'{PREFIX}/bin/nasm'
        return cmake_build(**kw)
    cpu = 'x86_64' if is64bit else 'i386'
    replace_in_file(
        'CMakeLists.txt',
        'string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC)',
        f'set(CMAKE_SYSTEM_PROCESSOR_LC "{cpu}")')
    windows_cmake_build(
        WITH_JPEG8='1',
        ENABLE_STATIC='0',
        binaries='jpeg8.dll',
        libraries='jpeg.lib',
        headers='jconfig.h ../jerror.h ../jpeglib.h ../jmorecfg.h',
    )