Exemplo n.º 1
0
 def build_arch(self, arch, *extra_args):
     super(Sqlite3Recipe, self).build_arch(arch)
     # Copy the shared library
     shutil.copyfile(
         join(self.get_build_dir(arch.arch), 'libs', arch.arch,
              'libsqlite3.so'),
         join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.so'))
Exemplo n.º 2
0
 def build_arch(self, arch):
     super(LibxsltRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # If the build is done with /bin/sh things blow up,
         # try really hard to use bash
         env['CC'] += " -I%s" % self.get_build_dir(arch.arch)
         libxml = dirname(dirname(self.get_build_container_dir(
             arch.arch))) + "/libxml2/%s/libxml2" % arch.arch
         shprint(sh.Command('./configure'),
                 '--build=i686-pc-linux-gnu',
                 '--host=arm-linux-eabi',
                 '--without-plugins',
                 '--without-debug',
                 '--without-python',
                 '--without-crypto',
                 '--with-libxml-src=%s' % libxml,
                 _env=env)
         shprint(sh.make, "V=1", _env=env)
         shutil.copyfile(
             'libxslt/.libs/libxslt.a',
             join(self.ctx.get_libs_dir(arch.arch), 'libxslt.a'))
         shutil.copyfile(
             'libexslt/.libs/libexslt.a',
             join(self.ctx.get_libs_dir(arch.arch), 'libexslt.a'))
Exemplo n.º 3
0
    def build_arch(self, arch):
        super(Libxml2Recipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        with current_directory(self.get_build_dir(arch.arch)):

            if not exists('configure'):
                shprint(sh.Command('./autogen.sh'), _env=env)
            shprint(sh.Command('autoreconf'), '-vif', _env=env)
            build_arch = shprint(
                sh.gcc, '-dumpmachine').stdout.decode('utf-8').split('\n')[0]
            shprint(sh.Command('./configure'),
                    '--build=' + build_arch,
                    '--host=' + arch.command_prefix,
                    '--target=' + arch.command_prefix,
                    '--without-modules',
                    '--without-legacy',
                    '--without-history',
                    '--without-debug',
                    '--without-docbook',
                    '--without-python',
                    '--without-threads',
                    '--without-iconv',
                    '--disable-shared',
                    '--enable-static',
                    _env=env)

            # Ensure we only build libxml2.la as if we do everything
            # we'll need the glob dependency which is a big headache
            shprint(sh.make, "libxml2.la", _env=env)

            shutil.copyfile('.libs/libxml2.a',
                            join(self.ctx.libs_dir, 'libxml2.a'))
Exemplo n.º 4
0
    def build_arch(self, arch):
        super(LXMLRecipe, self).build_arch(arch)

        def get_lib_build_dir_name():
            for f in listdir(join(self.get_build_dir(arch.arch), "build")):
                if f.startswith("lib.linux-x86_64"):
                    return f
            return None

        def get_so_name(so_target, dirpath):
            for f in listdir(dirpath):
                if f.startswith(so_target.partition(".")[0] + ".") and \
                        f.endswith(".so"):
                    return join(dirpath, f)
            return None

        so_origin_dir = "%s/build/%s/lxml/" % (self.get_build_dir(arch.arch),
                                               get_lib_build_dir_name())
        shutil.copyfile(
            join(so_origin_dir, get_so_name("etree.so", so_origin_dir)),
            join(self.ctx.get_libs_dir(arch.arch), "etree.so"),
        )
        shutil.copyfile(
            join(so_origin_dir, get_so_name("objectify.so", so_origin_dir)),
            join(self.ctx.get_libs_dir(arch.arch), "objectify.so"),
        )
Exemplo n.º 5
0
 def build_arch(self, arch):
     super(LibtorrentRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(join(self.get_build_dir(arch.arch), 'bindings/python')):
         # Compile libtorrent with boost libraries and python bindings
         b2 = sh.Command(join(env['BOOST_ROOT'], 'b2'))
         shprint(b2,
                 '-q',
                 '-j5',
                 'toolset=gcc-' + env['ARCH'],
                 'target-os=android',
                 'threading=multi',
                 'link=shared',
                 'boost-link=shared',
                 'boost=source',
                 'encryption=openssl' if 'openssl' in recipe.ctx.recipe_build_order else '',
                 '--prefix=' + env['CROSSHOME'],
                 'release', _env=env)
     # Common build directories
     build_subdirs = 'gcc-arm/release/boost-link-shared/boost-source'
     if 'openssl' in recipe.ctx.recipe_build_order:
         build_subdirs += '/encryption-openssl'
     build_subdirs += '/libtorrent-python-pic-on/target-os-android/threading-multi/visibility-hidden'
     # Copy the shared libraries into the libs folder
     shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/python/build', build_subdirs, 'libboost_python.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libboost_python.so'))
     shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/system/build', build_subdirs, 'libboost_system.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libboost_system.so'))
     if 'openssl' in recipe.ctx.recipe_build_order:
         shutil.copyfile(join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/date_time/build', build_subdirs, 'libboost_date_time.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libboost_date_time.so'))
     shutil.copyfile(join(self.get_build_dir(arch.arch), 'bin', build_subdirs, 'libtorrent_rasterbar.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libtorrent_rasterbar.so'))
     shutil.copyfile(join(self.get_build_dir(arch.arch), 'bindings/python/bin', build_subdirs, 'libtorrent.so'),
                     join(self.ctx.get_site_packages_dir(arch.arch), 'libtorrent.so'))
Exemplo n.º 6
0
    def build_arch(self, arch):
        super(LibxsltRecipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        build_dir = self.get_build_dir(arch.arch)
        with current_directory(build_dir):
            # If the build is done with /bin/sh things blow up,
            # try really hard to use bash
            libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
            libxml2_build_dir = libxml2_recipe.get_build_dir(arch.arch)
            build_arch = shprint(sh.gcc, '-dumpmachine').stdout.decode(
                'utf-8').split('\n')[0]

            if not exists('configure'):
                shprint(sh.Command('./autogen.sh'), _env=env)
            shprint(sh.Command('autoreconf'), '-vif', _env=env)
            shprint(sh.Command('./configure'),
                    '--build=' + build_arch,
                    '--host=' + arch.command_prefix,
                    '--target=' + arch.command_prefix,
                    '--without-plugins',
                    '--without-debug',
                    '--without-python',
                    '--without-crypto',
                    '--with-libxml-src=' + libxml2_build_dir,
                    '--disable-shared',
                    _env=env)
            shprint(sh.make, "V=1", _env=env)

            shutil.copyfile('libxslt/.libs/libxslt.a',
                            join(self.ctx.libs_dir, 'libxslt.a'))
            shutil.copyfile('libexslt/.libs/libexslt.a',
                            join(self.ctx.libs_dir, 'libexslt.a'))
Exemplo n.º 7
0
 def build_arch(self, arch):
     super(LibxsltRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # If the build is done with /bin/sh things blow up,
         # try really hard to use bash
         env["CC"] += " -I%s" % self.get_build_dir(arch.arch)
         libxml = Recipe.get_recipe(
             'libxml2', self.ctx).get_build_dir(arch.arch)
         shprint(
             sh.Command("./configure"),
             "--build=i686-pc-linux-gnu",
             "--host=arm-linux-eabi",
             "--without-plugins",
             "--without-debug",
             "--without-python",
             "--without-crypto",
             "--with-libxml-src=%s" % libxml,
             _env=env,
         )
         shprint(sh.make, "V=1", _env=env)
         shutil.copyfile(
             "libxslt/.libs/libxslt.a",
             join(self.ctx.get_libs_dir(arch.arch), "libxslt.a"),
         )
         shutil.copyfile(
             "libexslt/.libs/libexslt.a",
             join(self.ctx.get_libs_dir(arch.arch), "libexslt.a"),
         )
Exemplo n.º 8
0
    def build_arch(self, arch):
        super(LXMLRecipe, self).build_arch(arch)

        def get_lib_build_dir_name():
            for f in listdir(join(self.get_build_dir(arch.arch), "build")):
                if f.startswith("lib.linux-x86_64"):
                    return f
            return None

        def get_so_name(so_target, dirpath):
            for f in listdir(dirpath):
                if f.startswith(so_target.partition(".")[0] + ".") and \
                        f.endswith(".so"):
                    return join(dirpath, f)
            return None

        so_origin_dir = "%s/build/%s/lxml/" % (self.get_build_dir(
            arch.arch), get_lib_build_dir_name())
        shutil.copyfile(
            join(so_origin_dir, get_so_name("etree.so", so_origin_dir)),
            join(self.ctx.get_libs_dir(arch.arch), "etree.so"),
        )
        shutil.copyfile(
            join(so_origin_dir, get_so_name("objectify.so", so_origin_dir)),
            join(self.ctx.get_libs_dir(arch.arch), "objectify.so"),
        )
Exemplo n.º 9
0
    def build_arch(self, arch):
        super(LibZMQRecipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        #
        # libsodium_recipe = Recipe.get_recipe('libsodium', self.ctx)
        # libsodium_dir = libsodium_recipe.get_build_dir(arch.arch)
        # env['sodium_CFLAGS'] = '-I{}'.format(join(
        #     libsodium_dir, 'src'))
        # env['sodium_LDLAGS'] = '-L{}'.format(join(
        #     libsodium_dir, 'src', 'libsodium', '.libs'))

        curdir = self.get_build_dir(arch.arch)
        prefix = join(curdir, "install")
        with current_directory(curdir):
            bash = sh.Command('sh')
            shprint(
                bash, './configure',
                '--host=arm-linux-androideabi',
                '--without-documentation',
                '--prefix={}'.format(prefix),
                '--with-libsodium=no',
                _env=env)
            shprint(sh.make, _env=env)
            shprint(sh.make, 'install', _env=env)
            shutil.copyfile('.libs/libzmq.so', join(
                self.ctx.get_libs_dir(arch.arch), 'libzmq.so'))

            bootstrap_obj_dir = join(self.ctx.bootstrap.build_dir, 'obj', 'local', arch.arch)
            ensure_dir(bootstrap_obj_dir)
            shutil.copyfile(
                '{}/sources/cxx-stl/gnu-libstdc++/{}/libs/{}/libgnustl_shared.so'.format(
                    self.ctx.ndk_dir, self.ctx.toolchain_version, arch),
                join(bootstrap_obj_dir, 'libgnustl_shared.so'))
Exemplo n.º 10
0
    def prebuild_arch(self, arch):
        super(Sqlite3Recipe, self).prebuild_arch(arch)
        # Copy the Android make file

        sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
        shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'),
                        join(self.get_build_dir(arch.arch), 'jni/Android.mk'))
Exemplo n.º 11
0
    def build_arch(self, arch):
        super(LibZMQRecipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        #
        # libsodium_recipe = Recipe.get_recipe('libsodium', self.ctx)
        # libsodium_dir = libsodium_recipe.get_build_dir(arch.arch)
        # env['sodium_CFLAGS'] = '-I{}'.format(join(
        #     libsodium_dir, 'src'))
        # env['sodium_LDLAGS'] = '-L{}'.format(join(
        #     libsodium_dir, 'src', 'libsodium', '.libs'))

        curdir = self.get_build_dir(arch.arch)
        prefix = join(curdir, "install")
        with current_directory(curdir):
            bash = sh.Command('sh')
            shprint(bash,
                    './configure',
                    '--host=arm-linux-androideabi',
                    '--without-documentation',
                    '--prefix={}'.format(prefix),
                    '--with-libsodium=no',
                    _env=env)
            shprint(sh.make, _env=env)
            shprint(sh.make, 'install', _env=env)
            shutil.copyfile(
                '.libs/libzmq.so',
                join(self.ctx.get_libs_dir(arch.arch), 'libzmq.so'))

            bootstrap_obj_dir = join(self.ctx.bootstrap.build_dir, 'obj',
                                     'local', arch.arch)
            ensure_dir(bootstrap_obj_dir)
            shutil.copyfile(
                '{}/sources/cxx-stl/gnu-libstdc++/4.8/libs/{}/libgnustl_shared.so'
                .format(self.ctx.ndk_dir, arch),
                join(bootstrap_obj_dir, 'libgnustl_shared.so'))
Exemplo n.º 12
0
    def build_arch(self, arch):  # build_compiled_components(self, arch)
        info("Building compiled components for my_lib")
        env = self.get_recipe_env(arch)
        info(json.dumps(env, indent=2))

        target = self.get_target(arch)
        platform = self.ctx.android_api
        build_dir = self.get_build_dir(arch.arch)
        lib_dir = join(build_dir, "target", target, "debug")
        with current_directory(build_dir):
            cargo = sh.Command("cargo")
            shprint(
                cargo,
                "ndk",
                "--platform",
                str(platform),
                "--target",
                target,
                "build",
                # "--release",
                _env=env,
            )
            shutil.copyfile(
                join(lib_dir, "libmy_lib.so"),
                join(self.ctx.get_site_packages_dir(arch.arch), "my_lib.so"),
            )
Exemplo n.º 13
0
    def build_arch(self, arch):
        super(LibxsltRecipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        build_dir = self.get_build_dir(arch.arch)
        with current_directory(build_dir):
            # If the build is done with /bin/sh things blow up,
            # try really hard to use bash
            libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
            libxml2_build_dir = libxml2_recipe.get_build_dir(arch.arch)
            build_arch = shprint(
                sh.gcc, '-dumpmachine').stdout.decode('utf-8').split('\n')[0]

            if not exists('configure'):
                shprint(sh.Command('./autogen.sh'), _env=env)
            shprint(sh.Command('autoreconf'), '-vif', _env=env)
            shprint(sh.Command('./configure'),
                    '--build=' + build_arch,
                    '--host=' + arch.command_prefix,
                    '--target=' + arch.command_prefix,
                    '--without-plugins',
                    '--without-debug',
                    '--without-python',
                    '--without-crypto',
                    '--with-libxml-src=' + libxml2_build_dir,
                    '--disable-shared',
                    _env=env)
            shprint(sh.make, "V=1", _env=env)

            shutil.copyfile('libxslt/.libs/libxslt.a',
                            join(self.ctx.libs_dir, 'libxslt.a'))
            shutil.copyfile('libexslt/.libs/libexslt.a',
                            join(self.ctx.libs_dir, 'libexslt.a'))
Exemplo n.º 14
0
    def build_arch(self, arch):
        super(Libxml2Recipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        with current_directory(self.get_build_dir(arch.arch)):

            if not exists('configure'):
                shprint(sh.Command('./autogen.sh'), _env=env)
            shprint(sh.Command('autoreconf'), '-vif', _env=env)
            build_arch = shprint(
                sh.gcc, '-dumpmachine').stdout.decode('utf-8').split('\n')[0]
            shprint(sh.Command('./configure'),
                    '--build=' + build_arch,
                    '--host=' + arch.command_prefix,
                    '--target=' + arch.command_prefix,
                    '--without-modules',
                    '--without-legacy',
                    '--without-history',
                    '--without-debug',
                    '--without-docbook',
                    '--without-python',
                    '--without-threads',
                    '--without-iconv',
                    '--without-lzma',
                    '--disable-shared',
                    '--enable-static',
                    _env=env)

            # Ensure we only build libxml2.la as if we do everything
            # we'll need the glob dependency which is a big headache
            shprint(sh.make, "libxml2.la", _env=env)

            shutil.copyfile('.libs/libxml2.a',
                            join(self.ctx.libs_dir, 'libxml2.a'))
Exemplo n.º 15
0
    def build_arch(self, arch):
        super(Libxml2Recipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        with current_directory(self.get_build_dir(arch.arch)):
            env["CC"] += " -I%s" % self.get_build_dir(arch.arch)
            shprint(
                sh.Command("./configure"),
                "--host=arm-linux-eabi",
                "--without-modules",
                "--without-legacy",
                "--without-history",
                "--without-debug",
                "--without-docbook",
                "--without-python",
                "--without-threads",
                "--without-iconv",
                _env=env,
            )

            # Ensure we only build libxml2.la as if we do everything
            # we'll need the glob dependency which is a big headache
            shprint(sh.make, "libxml2.la", _env=env)
            shutil.copyfile(
                ".libs/libxml2.a", join(self.ctx.get_libs_dir(arch.arch), "libxml2.a")
            )
Exemplo n.º 16
0
 def build_arch(self, arch):
     super(LibsodiumRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         bash = sh.Command('bash')
         shprint(bash, 'configure', '--disable-soname-versions', '--host=arm-linux-androideabi', '--enable-shared', _env=env)
         shprint(sh.make, _env=env)
         shutil.copyfile('src/libsodium/.libs/libsodium.so', join(self.ctx.get_libs_dir(arch.arch), 'libsodium.so'))
Exemplo n.º 17
0
 def build_arch(self, arch):
     # copy gmp.h from libgmp/dist/include to extmod/bls_py
     self_build_dir = self.get_build_dir(arch.arch)
     libgmp_build_dir = self_build_dir.replace('bls_py', 'libgmp')
     libgmp_build_dir = libgmp_build_dir.replace('-python3', '')
     local_path = join(self_build_dir, 'extmod', 'bls_py', 'gmp.h')
     libgmp_path = join(libgmp_build_dir, 'dist', 'include', 'gmp.h')
     shutil.copyfile(libgmp_path, local_path)
     super(BlsPyRecipe, self).build_arch(arch)
Exemplo n.º 18
0
    def build_arch(self, arch):
        super(LibgeosRecipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)

        with current_directory(self.get_build_dir(arch.arch)):
            dst_dir = join(self.get_build_dir(arch.arch), 'dist')
            bash = sh.Command('bash')
            print("If this fails make sure you have autoconf and libtool installed")
            shprint(bash, 'autogen.sh')  # Requires autoconf and libtool
            shprint(bash, 'configure',  '--host=arm-linux-androideabi', '--enable-shared', '--prefix={}'.format(dst_dir), _env=env)
            shprint(sh.make, '-j', str(cpu_count()), _env=env)
            shprint(sh.make, 'install', _env=env)
            shutil.copyfile('{}/lib/libgeos_c.so'.format(dst_dir), join(self.ctx.get_libs_dir(arch.arch), 'libgeos_c.so'))
Exemplo n.º 19
0
    def build_arch(self, arch):
        super(Libxml2Recipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)
        with current_directory(self.get_build_dir(arch.arch)):
            env['CC'] += " -I%s" % self.get_build_dir(arch.arch)
            shprint(sh.Command('./configure'),  '--host=arm-linux-eabi',
                    '--without-modules',  '--without-legacy', '--without-hfinistory',  '--without-debug',  '--without-docbook', '--without-python', '--without-threads', '--without-iconv',
                    _env=env)

            # Ensure we only build libxml2.la as if we do everything
            # we'll need the glob dependency which is a big headache
            shprint(sh.make, "libxml2.la", _env=env)
            shutil.copyfile('.libs/libxml2.a', join(self.ctx.get_libs_dir(arch.arch), 'libxml2.a'))
Exemplo n.º 20
0
 def build_arch(self, arch):
     super(BoostRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Compile Boost.Build engine with this custom toolchain
         bash = sh.Command('bash')
         shprint(bash, 'bootstrap.sh',
                 '--with-python=' + join(env['PYTHON_ROOT'], 'bin/python.host'),
                 '--with-python-version=2.7',
                 '--with-python-root=' + env['PYTHON_ROOT']
         )  # Do not pass env
         shutil.copyfile(join(self.get_recipe_dir(), 'user-config.jam'),
                         join(env['BOOST_BUILD_PATH'], 'user-config.jam'))
Exemplo n.º 21
0
 def build_arch(self, arch):
     super(BoostRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     env['PYTHON_HOST'] = self.ctx.hostpython
     with current_directory(self.get_build_dir(arch.arch)):
         # Compile Boost.Build engine with this custom toolchain
         bash = sh.Command('bash')
         shprint(bash, 'bootstrap.sh')  # Do not pass env
     # Install app stl
     shutil.copyfile(
         join(self.ctx.ndk_dir, 'sources/cxx-stl/llvm-libc++/libs/'
                                'armeabi-v7a/libc++_shared.so'),
         join(self.ctx.get_libs_dir(arch.arch), 'libc++_shared.so'))
Exemplo n.º 22
0
 def build_arch(self, arch):
     super(LevelDBRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         if 'snappy' in recipe.ctx.recipe_build_order:
             # Copy source from snappy recipe
             sh.cp('-rf', self.get_recipe('snappy', self.ctx).get_build_dir(arch.arch), 'snappy')
         # Build
         shprint(sh.make, _env=env)
         # Copy the shared library
         shutil.copyfile('libleveldb.so', join(self.ctx.get_libs_dir(arch.arch), 'libleveldb.so'))
     # Copy stl
     shutil.copyfile(self.ctx.ndk_dir + '/sources/cxx-stl/gnu-libstdc++/' + self.ctx.toolchain_version + '/libs/' + arch.arch + '/libgnustl_shared.so',
                     join(self.ctx.get_libs_dir(arch.arch), 'libgnustl_shared.so'))
Exemplo n.º 23
0
 def build_arch(self, arch):
     super(BoostRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Compile Boost.Build engine with this custom toolchain
         bash = sh.Command('bash')
         shprint(bash, 'bootstrap.sh',
                 '--with-python=' + join(env['PYTHON_ROOT'], 'bin/python.host'),
                 '--with-python-version=2.7',
                 '--with-python-root=' + env['PYTHON_ROOT']
         )  # Do not pass env
     # Install app stl
     shutil.copyfile(join(env['CROSSHOME'], env['CROSSHOST'], 'lib/libgnustl_shared.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libgnustl_shared.so'))
Exemplo n.º 24
0
 def build_arch(self, arch):
     super(BoostRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Compile Boost.Build engine with this custom toolchain
         bash = sh.Command('bash')
         shprint(bash, 'bootstrap.sh',
                 '--with-python=' + join(env['PYTHON_ROOT'], 'bin/python.host'),
                 '--with-python-version=2.7',
                 '--with-python-root=' + env['PYTHON_ROOT']
         )  # Do not pass env
     # Install app stl
     shutil.copyfile(join(env['CROSSHOME'], env['CROSSHOST'], 'lib/libgnustl_shared.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libgnustl_shared.so'))
 def build_arch(self, arch):
     super(LibtorrentRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(
             join(self.get_build_dir(arch.arch), 'bindings/python')):
         # Compile libtorrent with boost libraries and python bindings
         b2 = sh.Command(join(env['BOOST_ROOT'], 'b2'))
         shprint(b2,
                 '-q',
                 '-j5',
                 'toolset=gcc-' + env['ARCH'],
                 'target-os=android',
                 'threading=multi',
                 'link=shared',
                 'boost-link=shared',
                 'boost=source',
                 'encryption=openssl'
                 if 'openssl' in recipe.ctx.recipe_build_order else '',
                 '--prefix=' + env['CROSSHOME'],
                 'release',
                 _env=env)
     # Common build directories
     build_subdirs = 'gcc-arm/release/boost-link-shared/boost-source'
     if 'openssl' in recipe.ctx.recipe_build_order:
         build_subdirs += '/encryption-openssl'
     build_subdirs += '/libtorrent-python-pic-on/target-os-android/threading-multi/visibility-hidden'
     # Copy the shared libraries into the libs folder
     shutil.copyfile(
         join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/python/build',
              build_subdirs, 'libboost_python.so'),
         join(self.ctx.get_libs_dir(arch.arch), 'libboost_python.so'))
     shutil.copyfile(
         join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/system/build',
              build_subdirs, 'libboost_system.so'),
         join(self.ctx.get_libs_dir(arch.arch), 'libboost_system.so'))
     if 'openssl' in recipe.ctx.recipe_build_order:
         shutil.copyfile(
             join(env['BOOST_BUILD_PATH'], 'bin.v2/libs/date_time/build',
                  build_subdirs, 'libboost_date_time.so'),
             join(self.ctx.get_libs_dir(arch.arch),
                  'libboost_date_time.so'))
     shutil.copyfile(
         join(self.get_build_dir(arch.arch), 'bin', build_subdirs,
              'libtorrent_rasterbar.so'),
         join(self.ctx.get_libs_dir(arch.arch), 'libtorrent_rasterbar.so'))
     shutil.copyfile(
         join(self.get_build_dir(arch.arch), 'bindings/python/bin',
              build_subdirs, 'libtorrent.so'),
         join(self.ctx.get_site_packages_dir(arch.arch), 'libtorrent.so'))
Exemplo n.º 26
0
 def prebuild_arch(self, arch):
     super(BoostRecipe, self).prebuild_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         if not exists(env['CROSSHOME']):
             # Make custom toolchain
             bash = sh.Command('bash')
             shprint(bash, join(self.ctx.ndk_dir, 'build/tools/make-standalone-toolchain.sh'),
                     '--arch=' + env['ARCH'],
                     '--platform=android-' + str(self.ctx.android_api),
                     '--toolchain=' + env['CROSSHOST'] + '-' + env['TOOLCHAIN_VERSION'],
                     '--install-dir=' + env['CROSSHOME']
             )
         # Set custom configuration
         shutil.copyfile(join(self.get_recipe_dir(), 'user-config.jam'),
                         join(env['BOOST_BUILD_PATH'], 'user-config.jam'))
Exemplo n.º 27
0
 def build_arch(self, arch):
     super(LibxsltRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # If the build is done with /bin/sh things blow up,
         # try really hard to use bash
         env['CC'] += " -I%s" % self.get_build_dir(arch.arch)
         libxml = dirname(dirname(self.get_build_container_dir(arch.arch))) + "/libxml2/%s/libxml2" % arch.arch
         shprint(sh.Command('./configure'),
                 '--build=i686-pc-linux-gnu', '--host=arm-linux-eabi',
                 '--without-plugins', '--without-debug', '--without-python', '--without-crypto',
                 '--with-libxml-src=%s' % libxml,
                 _env=env)
         shprint(sh.make, "V=1", _env=env)
         shutil.copyfile('libxslt/.libs/libxslt.a', join(self.ctx.get_libs_dir(arch.arch), 'libxslt.a'))
         shutil.copyfile('libexslt/.libs/libexslt.a', join(self.ctx.get_libs_dir(arch.arch), 'libexslt.a'))
Exemplo n.º 28
0
 def build_arch(self, arch):
     super(BoostRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Compile Boost.Build engine with this custom toolchain
         bash = sh.Command("bash")
         shprint(
             bash,
             "bootstrap.sh",
             "--with-python=" + join(env["PYTHON_ROOT"], "bin/python.host"),
             "--with-python-version=2.7",
             "--with-python-root=" + env["PYTHON_ROOT"],
         )  # Do not pass env
         shutil.copyfile(
             join(self.get_recipe_dir(), "user-config.jam"), join(env["BOOST_BUILD_PATH"], "user-config.jam")
         )
Exemplo n.º 29
0
 def build_arch(self, arch):
     super(LibexpatRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(join(self.get_build_dir(arch.arch), 'expat')):
         dst_dir = join(self.get_build_dir(arch.arch), 'dist')
         shprint(sh.Command('./buildconf.sh'), _env=env)
         shprint(sh.Command('./configure'),
                 '--host=arm-linux-androideabi',
                 '--enable-shared',
                 '--without-xmlwf',
                 '--prefix={}'.format(dst_dir),
                 _env=env)
         shprint(sh.make, '-j', str(cpu_count()), _env=env)
         shprint(sh.make, 'install', _env=env)
         shutil.copyfile(
             '{}/lib/libexpat.so'.format(dst_dir),
             join(self.ctx.get_libs_dir(arch.arch), 'libexpat.so'))
Exemplo n.º 30
0
 def prebuild_arch(self, arch):
     super(BoostRecipe, self).prebuild_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Make custom toolchain
         bash = sh.Command('bash')
         shprint(bash, join(self.ctx.ndk_dir, 'build/tools/make-standalone-toolchain.sh'),
                 '--ndk-dir=' + self.ctx.ndk_dir,
                 '--arch=' + env['ARCH'],
                 '--platform=android-' + str(self.ctx.android_api),
                 '--toolchain=' + env['CROSSHOST'] + '-' + env['TOOLCHAIN_VERSION'],
                 '--install-dir=' + env['CROSSHOME'],
                 '--system=' + 'linux-x86_64'
         )
         # Install app stl
         shutil.copyfile(join(env['CROSSHOME'], env['CROSSHOST'], 'lib/libgnustl_shared.so'),
                         join(self.ctx.get_libs_dir(arch.arch), 'libgnustl_shared.so'))
Exemplo n.º 31
0
 def prebuild_arch(self, arch):
     super(BoostRecipe, self).prebuild_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Make custom toolchain
         bash = sh.Command('bash')
         shprint(bash, join(self.ctx.ndk_dir, 'build/tools/make-standalone-toolchain.sh'),
                 '--ndk-dir=' + self.ctx.ndk_dir,
                 '--arch=' + env['ARCH'],
                 '--platform=android-' + str(self.ctx.android_api),
                 '--toolchain=' + env['CROSSHOST'] + '-' + env['TOOLCHAIN_VERSION'],
                 '--install-dir=' + env['CROSSHOME'],
                 '--system=' + 'linux-x86_64'
         )
         # Set custom configuration
         shutil.copyfile(join(self.get_recipe_dir(), 'user-config.jam'),
                         join(env['BOOST_BUILD_PATH'], 'user-config.jam'))
Exemplo n.º 32
0
 def build_arch(self, arch):
     super(BoostRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Compile Boost.Build engine with this custom toolchain
         bash = sh.Command("bash")
         shprint(
             bash,
             "bootstrap.sh",
             "--with-python=" + join(env["PYTHON_ROOT"], "bin/python.host"),
             "--with-python-version=2.7",
             "--with-python-root=" + env["PYTHON_ROOT"],
         )  # Do not pass env
     # Install app stl
     shutil.copyfile(
         join(env["CROSSHOME"], env["CROSSHOST"], "lib/libgnustl_shared.so"),
         join(self.ctx.get_libs_dir(arch.arch), "libgnustl_shared.so"),
     )
Exemplo n.º 33
0
 def prebuild_arch(self, arch):
     super(BoostRecipe, self).prebuild_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         if not exists(env['CROSSHOME']):
             # Make custom toolchain
             bash = sh.Command('bash')
             shprint(bash, join(self.ctx.ndk_dir, 'build/tools/make-standalone-toolchain.sh'),
                     '--arch=' + env['ARCH'],
                     '--platform=android-' + str(self.ctx.android_api),
                     '--toolchain=' + env['CROSSHOST'] + '-' + self.ctx.toolchain_version + ':-llvm',
                     '--use-llvm',
                     '--stl=libc++',
                     '--install-dir=' + env['CROSSHOME']
                     )
         # Set custom configuration
         shutil.copyfile(join(self.get_recipe_dir(), 'user-config.jam'),
                         join(env['BOOST_BUILD_PATH'], 'user-config.jam'))
Exemplo n.º 34
0
    def prebuild_arch(self, arch):
        super(MultiprocessingRecipe, self).prebuild_arch(arch)
        # Copy the Android make file
        sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
        shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'),
                        join(self.get_build_dir(arch.arch), 'jni/Android.mk'))
        # Copy the native source from python2
        r = self.get_recipe('python2', self.ctx)

        shutil.rmtree(join(self.get_build_dir(arch.arch), 'src'), ignore_errors=True)

        shutil.copytree(join(r.get_build_dir(arch.arch), 'Modules/_multiprocessing'),
                        join(self.get_build_dir(arch.arch), 'src'))

        shutil.rmtree(join(self.get_build_dir(arch.arch), 'Include'), ignore_errors=True)

        shutil.copytree(join(r.get_build_dir(arch.arch), 'Include'),
                        join(self.get_build_dir(arch.arch), 'Include'))
Exemplo n.º 35
0
 def prebuild_arch(self, arch):
     super(BoostRecipe, self).prebuild_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Make custom toolchain
         bash = sh.Command("bash")
         shprint(
             bash,
             join(self.ctx.ndk_dir, "build/tools/make-standalone-toolchain.sh"),
             "--ndk-dir=" + self.ctx.ndk_dir,
             "--arch=" + env["ARCH"],
             "--platform=android-" + str(self.ctx.android_api),
             "--toolchain=" + env["CROSSHOST"] + "-" + env["TOOLCHAIN_VERSION"],
             "--install-dir=" + env["CROSSHOME"],
             "--system=" + "linux-x86_64",
         )
         # Set custom configuration
         shutil.copyfile(
             join(self.get_recipe_dir(), "user-config.jam"), join(env["BOOST_BUILD_PATH"], "user-config.jam")
         )
Exemplo n.º 36
0
 def prebuild_arch(self, arch):
     super(BoostRecipe, self).prebuild_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         # Make custom toolchain
         bash = sh.Command("bash")
         shprint(
             bash,
             join(self.ctx.ndk_dir, "build/tools/make-standalone-toolchain.sh"),
             "--ndk-dir=" + self.ctx.ndk_dir,
             "--arch=" + env["ARCH"],
             "--platform=android-" + str(self.ctx.android_api),
             "--toolchain=" + env["CROSSHOST"] + "-" + env["TOOLCHAIN_VERSION"],
             "--install-dir=" + env["CROSSHOME"],
             "--system=" + "linux-x86_64",
         )
         # Install app stl
         shutil.copyfile(
             join(env["CROSSHOME"], env["CROSSHOST"], "lib/libgnustl_shared.so"),
             join(self.ctx.get_libs_dir(arch.arch), "libgnustl_shared.so"),
         )
Exemplo n.º 37
0
    def build_arch(self, arch):
        super(LibcurlRecipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)

        r = self.get_recipe('openssl', self.ctx)
        openssl_dir = r.get_build_dir(arch.arch)

        with current_directory(self.get_build_dir(arch.arch)):
            dst_dir = join(self.get_build_dir(arch.arch), 'dist')
            shprint(
                sh.Command('./configure'),
                '--host=arm-linux-androideabi',
                '--enable-shared',
                '--with-ssl={}'.format(openssl_dir),
                '--prefix={}'.format(dst_dir),
                _env=env)
            shprint(sh.make, '-j', str(cpu_count()), _env=env)
            shprint(sh.make, 'install', _env=env)
            shutil.copyfile('{}/lib/libcurl.so'.format(dst_dir),
                            join(
                                self.ctx.get_libs_dir(arch.arch),
                                'libcurl.so'))
Exemplo n.º 38
0
 def build_arch(self, arch):
     super(LevelDBRecipe, self).build_arch(arch)
     env = self.get_recipe_env(arch)
     with current_directory(self.get_build_dir(arch.arch)):
         if 'snappy' in recipe.ctx.recipe_build_order:
             # Copy source from snappy recipe
             sh.cp(
                 '-rf',
                 self.get_recipe('snappy',
                                 self.ctx).get_build_dir(arch.arch),
                 'snappy')
         # Build
         shprint(sh.make, _env=env)
         # Copy the shared library
         shutil.copyfile(
             'libleveldb.so',
             join(self.ctx.get_libs_dir(arch.arch), 'libleveldb.so'))
     # Copy stl
     shutil.copyfile(
         self.ctx.ndk_dir + '/sources/cxx-stl/gnu-libstdc++/' +
         self.ctx.toolchain_version + '/libs/' + arch.arch +
         '/libgnustl_shared.so',
         join(self.ctx.get_libs_dir(arch.arch), 'libgnustl_shared.so'))
Exemplo n.º 39
0
    def build_arch(self, arch):
        super(LibcurlRecipe, self).build_arch(arch)
        env = self.get_recipe_env(arch)

        r = self.get_recipe('openssl', self.ctx)
        openssl_dir = r.get_build_dir(arch.arch)

        # with-ssl assume the libcrypto is in lib/ subdirectory
        # but it will be within the openssl_dir directory directly.
        env["LDFLAGS"] += " -L{}".format(openssl_dir)

        with current_directory(self.get_build_dir(arch.arch)):
            dst_dir = join(self.get_build_dir(arch.arch), 'dist')
            shprint(sh.Command('./configure'),
                    '--host=arm-linux-androideabi',
                    '--enable-shared',
                    '--with-ssl={}'.format(openssl_dir),
                    '--prefix={}'.format(dst_dir),
                    _env=env)
            shprint(sh.make, '-j', str(cpu_count()), _env=env)
            shprint(sh.make, 'install', _env=env)
            shutil.copyfile(
                '{}/lib/libcurl.so'.format(dst_dir),
                join(self.ctx.get_libs_dir(arch.arch), 'libcurl.so'))
Exemplo n.º 40
0
 def build_arch(self, arch, *extra_args):
     super(MultiprocessingRecipe, self).build_arch(arch)
     # Copy the shared library
     shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libmultiprocessing.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libmultiprocessing.so'))
Exemplo n.º 41
0
    def build_arch(self, arch):
        super().build_arch(arch)
        env = self.get_recipe_env(arch)
        env['PYTHON_HOST'] = self.ctx.hostpython

        # Define build variables
        build_dir = self.get_build_dir(arch.arch)
        ctx_libs_dir = self.ctx.get_libs_dir(arch.arch)
        encryption = 'openssl' if 'openssl' in recipe.ctx.recipe_build_order else 'built-in'
        build_args = [
            '-q',
            # '-a',  # force build, useful to debug the build
            '-j' + str(cpu_count()),
            '--debug-configuration',  # so we know if our python is detected
            # '--deprecated-functions=off',
            'toolset=clang-{arch}'.format(arch=env['ARCH']),
            'abi=aapcs',
            'binary-format=elf',
            'cxxflags=-std=c++11',
            'target-os=android',
            'threading=multi',
            'link=shared',
            'boost-link=shared',
            'libtorrent-link=shared',
            'runtime-link=shared',
            'encryption={}'.format('on' if encryption == 'openssl' else 'off'),
            'crypto=' + encryption
        ]
        crypto_folder = 'encryption-off'
        if encryption == 'openssl':
            crypto_folder = 'crypto-openssl'
            build_args.extend(['openssl-lib=' + env['OPENSSL_BUILD_PATH'],
                               'openssl-include=' + env['OPENSSL_INCLUDE']
                               ])
        build_args.append('release')

        # Compile libtorrent with boost libraries and python bindings
        with current_directory(join(build_dir, 'bindings/python')):
            b2 = sh.Command(join(env['BOOST_ROOT'], 'b2'))
            shprint(b2, *build_args, _env=env)

        # Copy only the boost shared libraries into the libs folder. Because
        # boost build two boost_python libraries, we force to search the lib
        # into the corresponding build path.
        b2_build_dir = (
            'build/clang-linux-{arch}/release/{encryption}/'
            'lt-visibility-hidden/'.format(
                arch=env['ARCH'], encryption=crypto_folder
            )
        )
        boost_libs_dir = join(env['BOOST_BUILD_PATH'], 'bin.v2/libs')
        for boost_lib in listdir(boost_libs_dir):
            lib_path = get_lib_from(join(boost_libs_dir, boost_lib, b2_build_dir))
            if lib_path:
                lib_name = basename(lib_path)
                shutil.copyfile(lib_path, join(ctx_libs_dir, lib_name))

        # Copy libtorrent shared libraries into the right places
        system_libtorrent = get_lib_from(join(build_dir, 'bin'))
        if system_libtorrent:
            shutil.copyfile(system_libtorrent,
                            join(ctx_libs_dir, 'libtorrent_rasterbar.so'))

        python_libtorrent = get_lib_from(join(build_dir, 'bindings/python/bin'))
        shutil.copyfile(python_libtorrent,
                        join(self.ctx.get_site_packages_dir(arch.arch), 'libtorrent.so'))
Exemplo n.º 42
0
 def build_arch(self, arch):
     super(LXMLRecipe, self).build_arch(arch)
     shutil.copyfile('%s/build/lib.linux-x86_64-2.7/lxml/etree.so' % self.get_build_dir(arch.arch), join(self.ctx.get_libs_dir(arch.arch), 'etree.so'))
     shutil.copyfile('%s/build/lib.linux-x86_64-2.7/lxml/objectify.so' % self.get_build_dir(arch.arch), join(self.ctx.get_libs_dir(arch.arch), 'objectify.so'))
Exemplo n.º 43
0
 def prebuild_arch(self, arch):
     super(Sqlite3Recipe, self).prebuild_arch(arch)
     # Copy the Android make file
     sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
     shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'),
                     join(self.get_build_dir(arch.arch), 'jni/Android.mk'))
Exemplo n.º 44
0
 def build_arch(self, arch, *extra_args):
     super(Sqlite3Recipe, self).build_arch(arch)
     # Copy the shared library
     shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.so'),
                     join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.so'))