Exemple #1
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 #2
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 #3
0
def main(args):
    if iswindows:
        windows_cmake_build(
            PNG_SHARED='1', ZLIB_INCLUDE_DIR=os.path.join(PREFIX, 'include'), ZLIB_LIBRARY=os.path.join(PREFIX, 'lib', 'zdll.lib'),
            binaries='libpng*.dll', libraries='libpng*.lib', headers='pnglibconf.h ../png.h ../pngconf.h'
        )
    else:
        simple_build('--disable-dependency-tracking --disable-static')
Exemple #4
0
def main(args):
    cmake_args = dict(BUILD_CODEC='OFF')
    if iswindows:
        windows_cmake_build(**cmake_args)
        install_binaries('build/bin/*.dll', 'bin')
        install_binaries('build/bin/*.lib', 'lib')
        copy_headers('src/lib/openjp2/opj_*.h', 'include/openjpeg')
        copy_headers('build/src/lib/openjp2/opj_*.h', 'include/openjpeg')
        copy_headers('src/lib/openjp2/openjpeg.h', 'include/openjpeg')
    else:
        cmake_build(**cmake_args)
Exemple #5
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 #6
0
def main(args):
    if iswindows:
        windows_cmake_build(PNG_SHARED='1',
                            ZLIB_INCLUDE_DIR=os.path.join(PREFIX, 'include'),
                            ZLIB_LIBRARY=os.path.join(PREFIX, 'lib',
                                                      'zdll.lib'),
                            binaries='libpng*.dll',
                            libraries='libpng*.lib',
                            headers='pnglibconf.h ../png.h ../pngconf.h')
    else:
        configure_args = ['--disable-dependency-tracking', '--disable-static']
        if 'arm' in (current_build_arch() or ''):
            # does not build with it set to on, or not set
            # https://github.com/glennrp/libpng/issues/257
            configure_args.append('--enable-arm-neon=off')
        simple_build(configure_args)
Exemple #7
0
def main(args):
    if iswindows:
        windows_cmake_build(ENABLE_SHARED='FALSE')
        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:
        kw = {}
        if ismacos:
            kw['PNG_SUPPORTED'] = 'FALSE'
        cmake_build(ENABLE_SHARED='FALSE',
                    override_prefix=os.path.join(build_dir(), 'private',
                                                 'mozjpeg'),
                    **kw)
Exemple #8
0
def main(args):
    kw = {
        'BUILD_BINARY': '0',
        'BUILD_STATIC': '0',
    }
    if iswindows:
        return windows_cmake_build(headers='../src/uchardet.h',
                                   libraries='src/*.lib src/*.exp',
                                   binaries='src/*.dll',
                                   **kw)
    return cmake_build(**kw)
Exemple #9
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',
    )
Exemple #10
0
def main(args):
    if iswindows:
        # cmake cannot find openssl
        replace_in_file('CMakeLists.txt', 'FIND_PACKAGE(LIBCRYPTO)',
                        ('SET(LIBCRYPTO_FOUND "1")\n'
                         'SET(LIBCRYPTO_INCLUDE_DIR "{0}/include")\n'
                         'SET(LIBCRYPTO_LIBRARIES "{0}/lib/libcrypto.lib")\n'
                         'SET(PODOFO_HAVE_OPENSSL_1_1 "1")\n').format(
                             PREFIX.replace(os.sep, '/')))
        windows_cmake_build(WANT_LIB64='FALSE',
                            PODOFO_BUILD_SHARED='TRUE',
                            PODOFO_BUILD_STATIC='False',
                            FREETYPE_INCLUDE_DIR=f"{PREFIX}/include/freetype2",
                            nmake_target='podofo_shared')
        copy_headers('build/podofo_config.h', 'include/podofo')
        copy_headers('src/podofo/*', 'include/podofo')
        for f in walk():
            if f.endswith('.dll'):
                install_binaries(f, 'bin')
            elif f.endswith('.lib'):
                install_binaries(f, 'lib')
    else:
        if ismacos:
            replace_in_file(
                'CMakeLists.txt', 'FIND_PACKAGE(FREETYPE REQUIRED)',
                ('SET(FREETYPE_FOUND "1")\n'
                 'SET(FREETYPE_INCLUDE_DIR "{0}/include/freetype2")\n'
                 'SET(FREETYPE_LIBRARIES "{0}/lib/libfreetype.dylib")'
                 ).format(PREFIX))
            replace_in_file('src/podofo/base/PdfDate.cpp', 'struct tm _tm{}',
                            'struct tm _tm = {0}')

        cmake_build(
            make_args='podofo_shared',
            PODOFO_BUILD_LIB_ONLY='TRUE',
            PODOFO_BUILD_SHARED='TRUE',
            PODOFO_BUILD_STATIC='FALSE',
        )
Exemple #11
0
def main(args):
    windows_cmake_build(binaries='*/lib/*.dll */bin/*.exe',
                        libraries='*/lib/*.lib */lib/*.exp',
                        headers='*/include/easylzma')
Exemple #12
0
 def main(args):
     windows_cmake_build(binaries='libexpat.dll',
                         libraries='libexpat.lib',
                         headers='../lib/expat.h ../lib/expat_external.h')