def _build_with_qmake(self): if not self._qmake_supported(): return tools.mkdir("qmake_folder") with tools.chdir("qmake_folder"): self.output.info("Building with qmake") with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): args = [self.source_folder, "DESTDIR=bin"] def _getenvpath(var): val = os.getenv(var) if val and tools.os_info.is_windows: val = val.replace("\\", "/") os.environ[var] = val return val value = _getenvpath('CC') if value: args.append('QMAKE_CC="%s"' % value) value = _getenvpath('CXX') if value: args.append('QMAKE_CXX="%s"' % value) value = _getenvpath('LD') if value: args.append('QMAKE_LINK_C="%s"' % value) args.append('QMAKE_LINK_C_SHLIB="%s"' % value) args.append('QMAKE_LINK="%s"' % value) args.append('QMAKE_LINK_SHLIB="%s"' % value) self.run("qmake %s" % " ".join(args), run_environment=True) if tools.os_info.is_windows: if self.settings.compiler == "Visual Studio": self.run("nmake", run_environment=True) else: self.run("mingw32-make", run_environment=True) else: self.run("make", run_environment=True)
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) if self._is_msvc: run_configure_icu_file = os.path.join(self._source_subfolder, "source", "runConfigureICU") flags = "-%s" % self.settings.compiler.runtime if self.settings.build_type in [ "Debug", "RelWithDebInfo" ] and tools.Version(self.settings.compiler.version) >= "12": flags += " -FS" tools.replace_in_file(run_configure_icu_file, "-MDd", flags) tools.replace_in_file(run_configure_icu_file, "-MD", flags) self._workaround_icu_20545() env_build = self._configure_autotools() build_dir = os.path.join(self.build_folder, self._source_subfolder, "build") os.mkdir(build_dir) with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.environment_append(env_build.vars): with tools.chdir(build_dir): # workaround for https://unicode-org.atlassian.net/browse/ICU-20531 os.makedirs(os.path.join("data", "out", "tmp")) # workaround for "No rule to make target 'out/tmp/dirs.timestamp'" tools.save( os.path.join("data", "out", "tmp", "dirs.timestamp"), "") self.run(self._build_config_cmd, win_bash=tools.os_info.is_windows) command = "{make} {silent} -j {cpu_count}".format( make=self._make_tool, silent=self._silent, cpu_count=tools.cpu_count()) self.run(command, win_bash=tools.os_info.is_windows) if self.options.with_unit_tests: command = "{make} {silent} check".format( make=self._make_tool, silent=self._silent) self.run(command, win_bash=tools.os_info.is_windows)
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): env_vars = {"PERL": self._perl} if self._full_version < "1.1.0": cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) env_vars["CC"] = "%s %s" % (self._cc, cflags) if self.settings.compiler == "apple-clang": xcrun = tools.XCRun(self.settings) env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) with tools.environment_append(env_vars): if self._full_version > "1.1.0": self._create_targets() else: self._patch_configure() self._patch_makefile_org() with self._make_context(): self._make()
def build(self): with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): env_vars = {"PERL": self._perl} if self._full_version < "1.1.0": cflags = " ".join(self._get_env_build().flags) env_vars["CC"] = "%s %s" % (self._cc, cflags) if self.settings.compiler == "apple-clang": xcrun = tools.XCRun(self.settings) env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) with tools.environment_append(env_vars): if self._full_version >= "1.1.0": if self.settings.os == "tvOS": tools.patch(patch_file=os.path.join("patches", "1.1.1-tvos.patch"), base_path=self._source_subfolder) self._create_targets() else: self._patch_configure() self._patch_makefile_org() self._make()
def package(self): with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): autotools = self._configure_autotools() autotools.install() self.copy(pattern="LICENSE", src=self._source_subfolder, dst='licenses') if self.settings.os == 'Windows' and self.settings.compiler == 'Visual Studio': name = 'vpxmt.lib' if 'MT' in str( self.settings.compiler.runtime) else 'vpxmd.lib' if self.settings.arch == 'x86_64': libdir = os.path.join(self.package_folder, 'lib', 'x64') elif self.settings.arch == 'x86': libdir = os.path.join(self.package_folder, 'lib', 'Win32') shutil.move(os.path.join(libdir, name), os.path.join(self.package_folder, 'lib', 'vpx.lib')) tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig'))
def _bootstrap(self): folder = os.path.join(self.source_folder, self.folder_name, "tools", "build") try: bootstrap = "bootstrap.bat" if tools.os_info.is_windows else "./bootstrap.sh" with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.chdir(folder): if tools.cross_building(self.settings): cmd = bootstrap else: option = "" if tools.os_info.is_windows else "-with-toolset=" cmd = "%s %s%s" % (bootstrap, option, self._get_boostrap_toolset()) self.output.info(cmd) with tools.environment_append({"CC": None, "CXX": None, "CFLAGS": None, "CXXFLAGS": None}): self.run(cmd) except Exception as exc: self.output.warn(str(exc)) if os.path.exists(os.path.join(folder, "bootstrap.log")): self.output.warn(tools.load(os.path.join(folder, "bootstrap.log"))) raise
def _bootstrap(self): """ Bootstrap the b2 building engine from boost. It is host-specific and will be used to build the boost itself """ folder = self._boost_build_dir try: bootstrap = "bootstrap.bat" if tools.os_info.is_windows else "./bootstrap.sh" with tools.vcvars( self.settings) if self._is_msvc else tools.no_op(): self.output.info( "Using %s %s" % (self.settings.compiler, self.settings.compiler.version)) with tools.chdir(folder): cmd = bootstrap self.output.info(cmd) envs_to_null = { 'AS': None, 'AR': None, 'CC': None, 'CXX': None, 'LD': None, 'RANLIB': None, 'ARFLAGS': None, 'CFLAGS': None, 'CXXFLAGS': None, 'SYSROOT': None, 'CHOST': None, 'STRIP': None, } # To avoid using the CXX env vars we clear them out for the build. with tools.environment_append(envs_to_null): self.run(cmd) except Exception as exc: self.output.warn(str(exc)) if os.path.exists(os.path.join(folder, "bootstrap.log")): self.output.warn( tools.load(os.path.join(folder, "bootstrap.log"))) raise
def build(self): # FIXME: tools.vcvars added for clang-cl. Remove once conan supports clang-cl properly. (https://github.com/conan-io/conan-center-index/pull/1453) with tools.vcvars(self.settings) if ( self.settings.os == "Windows" and self.settings.compiler == "clang") else tools.no_op(): cmake = CMake(self) cmake.definitions["HEADER_ONLY"] = self.options[ "boost"].header_only if not self.options["boost"].header_only: cmake.definitions[ "Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared cmake.definitions[ "WITH_PYTHON"] = not self.options["boost"].without_python if not self.options["boost"].without_python: pyversion = tools.Version(self.options["boost"].python_version) cmake.definitions[ "Python_ADDITIONAL_VERSIONS"] = "{}.{}".format( pyversion.major, pyversion.minor) cmake.definitions["PYTHON_COMPONENT_SUFFIX"] = "{}{}".format( pyversion.major, pyversion.minor) cmake.definitions[ "WITH_RANDOM"] = not self.options["boost"].without_random cmake.definitions[ "WITH_REGEX"] = not self.options["boost"].without_regex cmake.definitions[ "WITH_TEST"] = not self.options["boost"].without_test cmake.definitions[ "WITH_COROUTINE"] = not self.options["boost"].without_coroutine cmake.definitions[ "WITH_CHRONO"] = not self.options["boost"].without_chrono cmake.definitions[ "WITH_FIBER"] = not self.options["boost"].without_fiber cmake.definitions[ "WITH_LOCALE"] = not self.options["boost"].without_locale cmake.definitions["WITH_NOWIDE"] = not self._boost_option( "without_nowide", True) cmake.definitions["WITH_JSON"] = not self._boost_option( "without_json", True) cmake.configure() cmake.build()
def _build_context(self): env_vars = {} if self._is_msvc or self._is_clang_cl: cc = "cl" if self._is_msvc else os.environ.get("CC", "clang-cl") cxx = "cl" if self._is_msvc else os.environ.get("CXX", "clang-cl") lib = "lib" if self._is_msvc else os.environ.get("AR", "llvm-lib") build_aux_path = os.path.join(self.build_folder, self._source_subfolder, "build-aux") lt_compile = tools.unix_path( os.path.join(build_aux_path, "compile")) lt_ar = tools.unix_path(os.path.join(build_aux_path, "ar-lib")) env_vars.update({ "CC": "{} {} -nologo".format(lt_compile, cc), "CXX": "{} {} -nologo".format(lt_compile, cxx), "LD": "link", "STRIP": ":", "AR": "{} {}".format(lt_ar, lib), "RANLIB": ":", "NM": "dumpbin -symbols" }) env_vars["win32_target"] = "_WIN32_WINNT_VISTA" if not tools.cross_building( self) or self._is_msvc or self._is_clang_cl: rc = None if self.settings.arch == "x86": rc = "windres --target=pe-i386" elif self.settings.arch == "x86_64": rc = "windres --target=pe-x86-64" if rc: env_vars["RC"] = rc env_vars["WINDRES"] = rc if self._use_winbash: env_vars["RANLIB"] = ":" with tools.vcvars(self.settings) if ( self._is_msvc or self._is_clang_cl) else tools.no_op(): with tools.chdir(self._source_subfolder): with tools.environment_append(env_vars): yield
def bootstrap(self): # folder = os.path.join(self.source_folder, self.folder_name, "tools", "build") folder = os.path.join(self.source_folder, self.folder_name) if self.options.use_icu and self.use_icu and self.settings.os != "Windows": self.output.info('icu_path: %s' % (self._get_icu_path(), )) with_icu_str = '--with-icu=%s' % (self._get_icu_path(), ) else: with_icu_str = '' try: bootstrap = "bootstrap.bat" if tools.os_info.is_windows else "./bootstrap.sh" with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): self.output.info( "Using %s %s" % (self.settings.compiler, self.settings.compiler.version)) with tools.chdir(folder): # ./bootstrap.sh \ # "--prefix=$PREFIX" \ # "--with-icu=$ICU_PREFIX" # self.output.info('self._get_boostrap_toolset(): %s' % (self._get_boostrap_toolset(),)) cmd = "%s %s %s" % ( bootstrap, self._get_boostrap_toolset(), with_icu_str) self.output.info(cmd) self.run(cmd) except Exception as exc: self.output.warn(str(exc)) if os.path.join(folder, "bootstrap.log"): self.output.warn( tools.load(os.path.join(folder, "bootstrap.log"))) raise return os.path.join( folder, "b2.exe") if tools.os_info.is_windows else os.path.join( folder, "b2")
def _bootstrap(self): folder = os.path.join(self.source_folder, self.folder_name, "tools", "build") try: bootstrap = "bootstrap.bat" if tools.os_info.is_windows else "./bootstrap.sh" with tools.vcvars( self.settings) if self._is_msvc else tools.no_op(): self.output.info( "Using %s %s" % (self.settings.compiler, self.settings.compiler.version)) with tools.chdir(folder): option = "" if tools.os_info.is_windows else "-with-toolset=" cmd = "%s %s%s" % (bootstrap, option, self._get_boostrap_toolset()) self.output.info(cmd) self.run(cmd) except Exception as exc: self.output.warn(str(exc)) if os.path.exists(os.path.join(folder, "bootstrap.log")): self.output.warn( tools.load(os.path.join(folder, "bootstrap.log"))) raise
def package(self): if tools.Version(self.version) < "2.73.0": self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) else: self.copy(pattern="LGPL-2.1-or-later.txt", dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) with tools.environment_append(VisualStudioBuildEnvironment( self).vars) if is_msvc(self) else tools.no_op(): meson = self._configure_meson() meson.install() self._fix_library_names() tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) shutil.move( os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res"), ) for pdb_file in glob.glob( os.path.join(self.package_folder, "bin", "*.pdb")): os.unlink(pdb_file)
def build(self): for filename in sorted(glob.glob("patches/*.patch")): self.output.info('applying patch "%s"' % filename) tools.patch(base_path=self._source_subfolder, patch_file=filename) for package in self.deps_cpp_info.deps: self._copy_pkg_config(package) meson_build = os.path.join(self._source_subfolder, "meson.build") tools.replace_in_file(meson_build, "subdir('tests')", "") tools.replace_in_file(meson_build, "subdir('tools')", "") tools.replace_in_file(meson_build, "subdir('utils')", "") tools.replace_in_file(meson_build, "subdir('examples')", "") tools.replace_in_file( meson_build, "add_project_arguments([ '-FImsvc_recommended_pragmas.h' ], language: 'c')", "") # hack : link with private libraries for transitive deps, components feature will solve that tools.replace_in_file("cairo.pc", "Libs:", "Libs.old:") tools.replace_in_file("cairo.pc", "Libs.private:", "Libs: -lcairo") with tools.environment_append(VisualStudioBuildEnvironment( self).vars) if self._is_msvc else tools.no_op(): meson = self._configure_meson() meson.build()
def package(self): self.copy("LICENSE", dst="licenses", src=os.path.join(self.source_folder, self._source_subfolder)) env_build = self._configure_autotools() build_dir = os.path.join(self.build_folder, self._source_subfolder, "build") with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.environment_append(env_build.vars): with tools.chdir(build_dir): command = "{make} {silent} install".format( make=self._make_tool, silent=self._silent) self.run(command, win_bash=tools.os_info.is_windows) self._install_name_tool() for dll in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")): shutil.move(dll, os.path.join(self.package_folder, "bin")) if self.settings.os != "Windows" and self.options.data_packaging in [ "files", "archive" ]: tools.mkdir(os.path.join(self.package_folder, "res")) shutil.move(self._data_path, os.path.join(self.package_folder, "res")) # Copy some files required for cross-compiling self.copy("icucross.mk", src=os.path.join(build_dir, "config"), dst="config") self.copy("icucross.inc", src=os.path.join(build_dir, "config"), dst="config") tools.rmdir(os.path.join(self.package_folder, "lib", "icu")) tools.rmdir(os.path.join(self.package_folder, "lib", "man")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) tools.rmdir(os.path.join(self.package_folder, "share"))
def build(self): if self.settings.compiler == "Visual Studio": os.makedirs(os.path.join(self._source_subfolder, "sys")) tools.download( "https://raw.githubusercontent.com/win32ports/unistd_h/master/unistd.h", os.path.join(self._source_subfolder, "unistd.h")) tools.download( "https://raw.githubusercontent.com/win32ports/sys_time_h/master/sys/time.h", os.path.join(self._source_subfolder, "sys", "time.h")) with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): with tools.chdir(self._source_subfolder): env_build = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) args = ["--disable-dependency-tracking", "--disable-doc"] if self.settings.os != "Windows" and self.options.fPIC: args.append("--with-pic") if self.options.shared: args.extend(["--disable-static", "--enable-shared"]) else: args.extend(["--disable-shared", "--enable-static"]) if self.settings.compiler == "Visual Studio": runtime = str(self.settings.compiler.runtime) prefix = tools.unix_path(self.package_folder) args.extend([ 'CC=$PWD/build-aux/compile cl -nologo', 'CFLAGS=-%s' % runtime, 'CXX=$PWD/build-aux/compile cl -nologo', 'CXXFLAGS=-%s' % runtime, 'CPPFLAGS=-D_WIN32_WINNT=0x0600 -I%s/include' % prefix, 'LDFLAGS=-L%s/lib' % prefix, 'LD=link', 'NM=dumpbin -symbols', 'STRIP=:', 'AR=$PWD/build-aux/ar-lib lib', 'RANLIB=:' ]) env_build.configure(args=args) with tools.chdir("lib"): env_build.make() env_build.install()
def _msvc_build(self): msbuild = MSBuild(self) msbuild_properties = { "IncludeExternals": "true", } projects = self._solution_projects self.output.info("Building {} Visual Studio projects: {}".format( len(projects), projects)) with tools.no_op(): for project_i, project in enumerate(projects, 1): self.output.info("[{}/{}] Building project '{}'...".format( project_i, len(projects), project)) project_file = os.path.join(self._source_subfolder, "PCbuild", project + ".vcxproj") self._upgrade_single_project_file(project_file) msbuild.build(project_file, upgrade_project=False, build_type="Debug" if self.settings.build_type == "Debug" else "Release", platforms=self._msvc_archs, properties=msbuild_properties)
def package(self): self.copy("LICENSE", dst="licenses", src=self._source_subfolder) with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): cmake = self._configure_cmake() cmake.install() tools.rmdir(os.path.join(self.package_folder, "cmake")) tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) if self.options.get_safe("single_object"): tools.remove_files_by_mask( os.path.join(self.package_folder, "lib"), "*.a") shutil.move( os.path.join(self.package_folder, self._obj_name + ".o"), os.path.join(self.package_folder, "lib")) shutil.copy( os.path.join(self.package_folder, "lib", self._obj_name + ".o"), os.path.join(self.package_folder, "lib", self._obj_name)) if self.settings.os == "Windows" and self.options.shared: if self.settings.arch == "x86_64": self.copy("mimalloc-redirect.dll", src=os.path.join(self._source_subfolder, "bin"), dst="bin") elif self.settings.arch == "x86": self.copy("mimalloc-redirect32.dll", src=os.path.join(self._source_subfolder, "bin"), dst="bin") tools.rmdir(os.path.join(self.package_folder, "share")) cmake_target = "mimalloc" if self.options.shared else "mimalloc-static" self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {cmake_target: "mimalloc::mimalloc"})
def _bootstrap(self): folder = os.path.join(self.source_folder, self._folder_name, "tools", "build") try: bootstrap = "bootstrap.bat" if tools.os_info.is_windows else "./bootstrap.sh" with tools.vcvars( self.settings) if self._is_msvc else tools.no_op(): with tools.chdir(folder): if tools.cross_building(self.settings): cmd = bootstrap else: option = "" if tools.os_info.is_windows else "-with-toolset=" cmd = "%s %s%s" % (bootstrap, option, self._get_boostrap_toolset()) self.output.info(cmd) removed_environment_variables = [ "CC", "CXX", "CFLAGS", "CXXFLAGS", "SDKROOT", "IPHONEOS_DEPLOYMENT_TARGET", ] removed_environment_variables = dict( (env_var, None) for env_var in removed_environment_variables) with tools.environment_append( removed_environment_variables): self.run(cmd) except Exception as exc: self.output.warn(str(exc)) if os.path.exists(os.path.join(folder, "bootstrap.log")): self.output.warn( tools.load(os.path.join(folder, "bootstrap.log"))) raise
def build(self): for package in self.deps_cpp_info.deps: lib_path = self.deps_cpp_info[package].rootpath for dirpath, _, filenames in os.walk(lib_path): for filename in filenames: if filename.endswith('.pc'): if filename in ["cairo.pc", "fontconfig.pc"]: continue shutil.copyfile(os.path.join(dirpath, filename), filename) tools.replace_prefix_in_pc_file( filename, tools.unix_path(lib_path) if self.settings.os == 'Windows' else lib_path) meson_build = os.path.join(self._source_subfolder, "meson.build") tools.replace_in_file(meson_build, "subdir('tests')", "") tools.replace_in_file(meson_build, "subdir('tools')", "") tools.replace_in_file(meson_build, "subdir('utils')", "") tools.replace_in_file(meson_build, "subdir('examples')", "") with tools.environment_append(VisualStudioBuildEnvironment( self).vars) if self._is_msvc else tools.no_op(): meson = self._configure_meson() meson.build()
def build(self): if self.options.header_only: self.output.warn("Header only package, skipping build") return if not self.options.without_python: tools.patch(base_path=os.path.join(self.build_folder, self.folder_name), patch_file='patches/python_base_prefix.patch', strip=1) b2_exe = self.bootstrap() flags = self.get_build_flags() # Help locating bzip2 and zlib self.create_user_config_jam(self.build_folder) # JOIN ALL FLAGS b2_flags = " ".join(flags) full_command = "%s %s -j%s --abbreviate-paths -d2" % ( b2_exe, b2_flags, tools.cpu_count()) # -d2 is to print more debug info and avoid travis timing out without output sources = os.path.join(self.source_folder, self.folder_name) if self.options.toolset: full_command += ' toolset=' + self.options.toolset.value full_command += ' --debug-configuration --build-dir="%s"' % self.build_folder self.output.warn(full_command) with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): with tools.chdir(sources): # to locate user config jam (BOOST_BUILD_PATH) with tools.environment_append( {"BOOST_BUILD_PATH": self.build_folder}): # To show the libraries *1 # self.run("%s --show-libraries" % b2_exe) self.run(full_command)
def package(self): self.copy("*LICENSE*", src=self._source_subfolder, dst="licenses") with tools.vcvars(self) if self._use_nmake else tools.no_op(): self._make_install() for root, _, files in os.walk(self.package_folder): for filename in files: if fnmatch.fnmatch(filename, "*.pdb"): os.unlink(os.path.join(self.package_folder, root, filename)) if self._use_nmake: if self.settings.build_type == "Debug": with tools.chdir(os.path.join(self.package_folder, "lib")): rename(self, "libssl.lib", "libssld.lib") rename(self, "libcrypto.lib", "libcryptod.lib") if self.options.shared: libdir = os.path.join(self.package_folder, "lib") for file in os.listdir(libdir): if self._is_mingw and file.endswith(".dll.a"): continue if file.endswith(".a"): os.unlink(os.path.join(libdir, file)) if not self.options.no_fips: provdir = os.path.join(self._source_subfolder, "providers") if self.settings.os == "Macos": self.copy("fips.dylib", src=provdir,dst="lib/ossl-modules") elif self.settings.os == "Windows": self.copy("fips.dll", src=provdir,dst="lib/ossl-modules") else: self.copy("fips.so", src=provdir,dst="lib/ossl-modules") tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path) )
def build(self): if self.options.header_only: self.output.warn("Header only package, skipping build") return self._clean() self._bootstrap() if self._use_bcp: self._build_bcp() self._run_bcp() flags = self._get_build_flags() # Help locating bzip2 and zlib self._create_user_config_jam(self._boost_build_dir) # JOIN ALL FLAGS b2_flags = " ".join(flags) full_command = "%s %s -j%s --abbreviate-paths -d2" % ( self._b2_exe, b2_flags, tools.cpu_count()) # -d2 is to print more debug info and avoid travis timing out without output sources = os.path.join(self.source_folder, self._boost_dir) full_command += ' --debug-configuration --build-dir="%s"' % self.build_folder self.output.warn(full_command) with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.chdir(sources): # to locate user config jam (BOOST_BUILD_PATH) with tools.environment_append( {"BOOST_BUILD_PATH": self._boost_build_dir}): # To show the libraries *1 # self.run("%s --show-libraries" % b2_exe) self.run(full_command) arch = self.settings.get_safe("arch") if arch.startswith("asm.js"): self._create_emscripten_libs()
def run(self): context = tools.no_op() compiler = self.settings.get("compiler", None) if not self._exclude_vcvars_precommand: if compiler == "Visual Studio" and "compiler.version" in self.settings: compiler_set = namedtuple("compiler", "version")(self.settings["compiler.version"]) mock_sets = namedtuple("mock_settings", "arch compiler get_safe")(self.settings["arch"], compiler_set, lambda x: self.settings.get(x, None)) context = tools.vcvars(mock_sets) with context: self.printer.print_rule() self.printer.print_profile(tools.load(self._profile_abs_path)) with self.printer.foldable_output("conan_create"): name, version, user, channel = self._reference # print_dict # TODO: Get uploaded packages with Conan 1.3 from the ret json # FIXME: chdir Can be removed in 1.3, fixed issue about api changing curdir with tools.chdir(self._abs_folder): if self._build_policy: self._build_policy = [self._build_policy] # https://github.com/conan-io/conan-package-tools/issues/184 with tools.environment_append({"_CONAN_CREATE_COMMAND_": "1"}): params = {"name": name, "version": version, "user": user, "channel": channel, "build_modes": self._build_policy, "profile_name": self._profile_abs_path} self.printer.print_message("Calling 'conan create'") self.printer.print_dict(params) self._conan_api.create(".", name=name, version=version, user=user, channel=channel, build_modes=self._build_policy, profile_name=self._profile_abs_path) self._uploader.upload_packages(self._reference, self._upload)
def package(self): self.copy(src=self._source_subfolder, pattern="*LICENSE", dst="licenses") with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): self._make_install() for root, _, files in os.walk(self.package_folder): for filename in files: if fnmatch.fnmatch(filename, "*.pdb"): os.unlink(os.path.join(self.package_folder, root, filename)) if self._use_nmake: if self.settings.build_type == 'Debug' and self._full_version >= "1.1.0": with tools.chdir(os.path.join(self.package_folder, 'lib')): os.rename('libssl.lib', 'libssld.lib') os.rename('libcrypto.lib', 'libcryptod.lib') # Old OpenSSL version family has issues with permissions. # See https://github.com/conan-io/conan/issues/5831 if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ( "Android", "FreeBSD", "Linux"): with tools.chdir(os.path.join(self.package_folder, "lib")): os.chmod("libssl.so.1.0.0", 0o755) os.chmod("libcrypto.so.1.0.0", 0o755) if self.options.shared: libdir = os.path.join(self.package_folder, "lib") for file in os.listdir(libdir): if self._is_mingw and file.endswith(".dll.a"): continue if file.endswith(".a"): os.unlink(os.path.join(libdir, file)) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_subfolder, self._module_file))
def build(self): for filename in [ os.path.join(self._source_subfolder, "meson.build"), os.path.join(self._source_subfolder, "glib", "meson.build"), os.path.join(self._source_subfolder, "gobject", "meson.build"), os.path.join(self._source_subfolder, "gio", "meson.build") ]: tools.replace_in_file(filename, "subdir('tests')", "#subdir('tests')") # allow to find gettext tools.replace_in_file( os.path.join(self._source_subfolder, "meson.build"), "libintl = cc.find_library('intl', required : false)", "libintl = cc.find_library('gnuintl', required : false)") if self.settings.os != "Linux": tools.replace_in_file( os.path.join(self._source_subfolder, 'meson.build'), "if cc.has_function('ngettext')", "if false #cc.has_function('ngettext')") with tools.environment_append(VisualStudioBuildEnvironment( self).vars) if self._is_msvc else tools.no_op(): meson = self._configure_meson() meson.build()
def build(self): if self.options.header_only: self.output.warn("Header only package, skipping build") return src = os.path.join(self.source_folder, self.folder_name) clean_dirs = [os.path.join(self.build_folder, "bin.v2"), os.path.join(self.build_folder, "architecture"), os.path.join(src, "stage"), os.path.join(src, "tools", "build", "src", "engine", "bootstrap"), os.path.join(src, "tools", "build", "src", "engine", "bin.ntx86"), os.path.join(src, "tools", "build", "src", "engine", "bin.ntx86_64")] for d in clean_dirs: if os.path.isdir(d): shutil.rmtree(d) b2_exe = self.bootstrap() flags = self.get_build_flags() # Help locating bzip2 and zlib self.create_user_config_jam(self.build_folder) # JOIN ALL FLAGS b2_flags = " ".join(flags) full_command = "%s %s -j%s --abbreviate-paths -d2" % (b2_exe, b2_flags, tools.cpu_count()) # -d2 is to print more debug info and avoid travis timing out without output sources = os.path.join(self.source_folder, self.folder_name) full_command += ' --debug-configuration --build-dir="%s"' % self.build_folder self.output.warn(full_command) with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.chdir(sources): # to locate user config jam (BOOST_BUILD_PATH) with tools.environment_append({"BOOST_BUILD_PATH": self.build_folder}): # To show the libraries *1 # self.run("%s --show-libraries" % b2_exe) self.run(full_command)
def _run_bcp(self): with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.chdir(self.source_folder): os.mkdir(self._bcp_dir) namespace = "--namespace=%s" % self.options.namespace alias = "--namespace-alias" if self.options.namespace_alias else "" boostdir = "--boost=%s" % self.folder_name libraries = {"build", "boost-build.jam", "boostcpp.jam", "boost_install", "headers"} for d in os.listdir(os.path.join(self.folder_name, "boost")): if os.path.isdir(os.path.join(self.folder_name, "boost", d)): libraries.add(d) for d in os.listdir(os.path.join(self.folder_name, "libs")): if os.path.isdir(os.path.join(self.folder_name, "libs", d)): libraries.add(d) libraries = ' '.join(libraries) command = "{bcp} {namespace} {alias} " \ "{boostdir} {libraries} {outdir}".format(bcp=self._bcp_exe, namespace=namespace, alias=alias, libraries=libraries, boostdir=boostdir, outdir=self._bcp_dir) self.output.warn(command) self.run(command)
def package(self): self.copy("COPYING", src=self._source_subfolder, dst="licenses") with tools.vcvars(self) if self._is_clang_cl else tools.no_op(): meson = self._configure_meson() meson.install() if self._is_msvc: tools.remove_files_by_mask( os.path.join(self.package_folder, "bin"), "*.pdb") if self.options.enable_lib and not self.options.shared: os.rename( os.path.join(self.package_folder, "lib", "libpkgconf.a"), os.path.join(self.package_folder, "lib", "pkgconf.lib"), ) if not self.options.enable_lib: tools.rmdir(os.path.join(self.package_folder, "lib")) tools.rmdir(os.path.join(self.package_folder, "include")) tools.rmdir(os.path.join(self.package_folder, "share", "man")) os.rename(os.path.join(self.package_folder, "share", "aclocal"), os.path.join(self.package_folder, "bin", "aclocal")) tools.rmdir(os.path.join(self.package_folder, "share")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
def _configure_cmake(self): cmake = CMake(self) cmake.definitions["CMAKE_BUILD_TYPE"] = self.settings.build_type if tools.Version(self.version) < "1.10.1": cmake.definitions["POCO_STATIC"] = not self.options.shared for comp in self._poco_component_tree.values(): if comp.option: cmake.definitions[comp.option.upper()] = self.options.get_safe(comp.option, False) cmake.definitions["POCO_UNBUNDLED"] = True cmake.definitions["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True if self._is_msvc: cmake.definitions["POCO_MT"] = "MT" in msvc_runtime_flag(self) if self.options.get_safe("enable_data_postgresql", False): cmake.definitions["PostgreSQL_ROOT_DIR"] = self.deps_cpp_info["libpq"].rootpath cmake.definitions["PostgreSQL_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["libpq"].include_paths) cmake.definitions["PostgreSQL_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["libpq"].lib_paths) if self.options.get_safe("enable_data_mysql", False): cmake.definitions["MYSQL_ROOT_DIR"] = self.deps_cpp_info["libmysqlclient"].rootpath cmake.definitions["MYSQL_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["libmysqlclient"].include_paths) cmake.definitions["MYSQL_INCLUDE_DIR"] = ";".join(self.deps_cpp_info["libmysqlclient"].include_paths) cmake.definitions["MYSQL_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["libmysqlclient"].lib_paths) if self.options.enable_apacheconnector: cmake.definitions["APR_ROOT_DIR"] = self.deps_cpp_info["apr"].rootpath cmake.definitions["APR_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["apr"].include_paths) cmake.definitions["APR_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["apr"].lib_paths) cmake.definitions["APRUTIL_ROOT_DIR"] = self.deps_cpp_info["apr-util"].rootpath cmake.definitions["APRUTIL_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["apr-util"].include_paths) cmake.definitions["APRUTIL_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["apr-util"].lib_paths) # Disable fork if not self.options.get_safe("enable_fork", True): cmake.definitions["POCO_NO_FORK_EXEC"] = True # On Windows, Poco needs a message (MC) compiler. with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): cmake.configure(build_dir=self._build_subfolder) return cmake
def bootstrap(self): folder = os.path.join(self.source_folder, self.folder_name, "tools", "build") try: bootstrap = "bootstrap.bat" if tools.os_info.is_windows else "./bootstrap.sh" with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): self.output.info( "Using %s %s" % (self.settings.compiler, self.settings.compiler.version)) with tools.chdir(folder): cmd = bootstrap self.output.info(cmd) self.run(cmd) except Exception as exc: self.output.warn(str(exc)) if os.path.exists(os.path.join(folder, "bootstrap.log")): self.output.warn( tools.load(os.path.join(folder, "bootstrap.log"))) raise return os.path.join( folder, "b2.exe") if tools.os_info.is_windows else os.path.join( folder, "b2")