From 6779ea02fb07ba39d162300dd18297ba2027846a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sun, 24 Sep 2017 02:29:13 +0300 Subject: Get rid of pkgconfig module --- build2/pkgconfig/init.cxx | 175 -------------------------------------------- build2/pkgconfig/init.hxx | 37 ---------- build2/pkgconfig/target.cxx | 54 -------------- build2/pkgconfig/target.hxx | 48 ------------ 4 files changed, 314 deletions(-) delete mode 100644 build2/pkgconfig/init.cxx delete mode 100644 build2/pkgconfig/init.hxx delete mode 100644 build2/pkgconfig/target.cxx delete mode 100644 build2/pkgconfig/target.hxx (limited to 'build2/pkgconfig') diff --git a/build2/pkgconfig/init.cxx b/build2/pkgconfig/init.cxx deleted file mode 100644 index 9526aa7..0000000 --- a/build2/pkgconfig/init.cxx +++ /dev/null @@ -1,175 +0,0 @@ -// file : build2/pkgconfig/init.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include - -#include -#include -#include -#include - -#include -#include - -#include - -using namespace std; -using namespace butl; - -namespace build2 -{ - namespace pkgconfig - { - bool - config_init (scope& rs, - scope& bs, - const location& l, - unique_ptr&, - bool, - bool optional, - const variable_map& hints) - { - tracer trace ("pkgconfig::config_init"); - l5 ([&]{trace << "for " << bs.out_path ();}); - - // We only support root loading (which means there can only be one). - // - if (&rs != &bs) - fail (l) << "pkgconfig.config module must be loaded in project root"; - - // Enter variables. - // - // config.pkgconfig.target is a hint. - // - auto& vp (var_pool.rw (rs)); - - const variable& c_x (vp.insert ("config.pkgconfig", true)); - const variable& x_path (vp.insert ("pkgconfig.path")); - - const variable& c_x_tgt ( - vp.insert ("config.pkgconfig.target")); - - // Configure. - // - - // Adjust module priority (between compilers and binutils). - // - config::save_module (rs, "pkgconfig", 325); - - process_path pp; - bool new_val (false); // Set any new values? - - auto p (config::omitted (rs, c_x)); - - if (p.first) - { - const path& x (cast (p.first)); - - try - { - // If this is a user-specified value, then it's non-optional. - // - pp = process::path_search (x, true); - new_val = p.second; - } - catch (const process_error& e) - { - fail << "unable to execute " << x << ": " << e; - } - } - - string d; // Default name (pp.initial may be its shallow copy). - - // If we have a target hint, then next try -pkg-config. - // - if (pp.empty ()) - { - if (const auto* t = cast_null (hints[c_x_tgt])) - { - d = t->string (); - d += "-pkg-config"; - - l5 ([&]{trace << "trying " << d;}); - pp = process::try_path_search (d, true); - } - } - - // Finallly, try just pkg-config. - // - if (pp.empty ()) - { - d = "pkg-config"; - - l5 ([&]{trace << "trying " << d;}); - pp = process::try_path_search (d, true); - } - - bool conf (!pp.empty ()); - - if (!conf && !optional) - fail (l) << "unable to find pkg-config program"; - - // Config report. - // - if (verb >= (new_val ? 2 : 3)) - { - diag_record dr (text); - dr << "pkgconfig " << project (rs) << '@' << rs.out_path () << '\n'; - - if (conf) - dr << " pkg-config " << pp; - else - dr << " pkg-config " << "not found, leaving unconfigured"; - } - - if (conf) - rs.assign (x_path) = move (pp); - - return conf; - } - - bool - init (scope& rs, - scope&, - const location& loc, - unique_ptr&, - bool, - bool optional, - const variable_map& hints) - { - tracer trace ("pkgconfig::init"); - l5 ([&]{trace << "for " << rs.out_path ();}); - - // Load pkgconfig.config. - // - bool conf (true); - if (!cast_false (rs["pkgconfig.config.loaded"])) - { - if (!load_module (rs, rs, "pkgconfig.config", loc, optional, hints)) - conf = false; - } - else if (!cast_false (rs["pkgconfig.config.configured"])) - { - if (!optional) - fail << "pkgconfig module could not be configured" << - info << "re-run with -V option for more information"; - - conf = false; - } - - // Register the target type and configure its default "installability". - // - // Note that we do it whether we found pkg-config or not since these are - // used to produce .pc files which we do regardless. - // - rs.target_types.insert (); - rs.target_types.insert (); - - if (cast_false (rs["install.loaded"])) - install::install_path (rs, dir_path ("pkgconfig")); - - return conf; - } - } -} diff --git a/build2/pkgconfig/init.hxx b/build2/pkgconfig/init.hxx deleted file mode 100644 index eed224f..0000000 --- a/build2/pkgconfig/init.hxx +++ /dev/null @@ -1,37 +0,0 @@ -// file : build2/pkgconfig/init.hxx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#ifndef BUILD2_PKGCONFIG_INIT_HXX -#define BUILD2_PKGCONFIG_INIT_HXX - -#include -#include - -#include - -namespace build2 -{ - namespace pkgconfig - { - bool - config_init (scope&, - scope&, - const location&, - unique_ptr&, - bool, - bool, - const variable_map&); - - bool - init (scope&, - scope&, - const location&, - unique_ptr&, - bool, - bool, - const variable_map&); - } -} - -#endif // BUILD2_PKGCONFIG_INIT_HXX diff --git a/build2/pkgconfig/target.cxx b/build2/pkgconfig/target.cxx deleted file mode 100644 index 7752f58..0000000 --- a/build2/pkgconfig/target.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// file : build2/pkgconfig/target.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include - -using namespace std; -using namespace butl; - -namespace build2 -{ - namespace pkgconfig - { - const target_type pc::static_type - { - "pc", - &file::static_type, - nullptr, - nullptr, - nullptr, - nullptr, - &target_search, - false - }; - - extern const char pca_ext[] = "static.pc"; // VC14 rejects constexpr. - - const target_type pca::static_type - { - "pca", - &pc::static_type, - &file_factory, - &target_extension_fix, - &target_pattern_fix, - &target_print_0_ext_verb, // Fixed extension, no use printing. - &file_search, - false - }; - - extern const char pcs_ext[] = "shared.pc"; // VC14 rejects constexpr. - - const target_type pcs::static_type - { - "pcs", - &pc::static_type, - &file_factory, - &target_extension_fix, - &target_pattern_fix, - &target_print_0_ext_verb, // Fixed extension, no use printing. - &file_search, - false - }; - } -} diff --git a/build2/pkgconfig/target.hxx b/build2/pkgconfig/target.hxx deleted file mode 100644 index feb8d80..0000000 --- a/build2/pkgconfig/target.hxx +++ /dev/null @@ -1,48 +0,0 @@ -// file : build2/pkgconfig/target.hxx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#ifndef BUILD2_PKGCONFIG_TARGET_HXX -#define BUILD2_PKGCONFIG_TARGET_HXX - -#include -#include - -#include - -namespace build2 -{ - namespace pkgconfig - { - class pc: public file - { - public: - using file::file; - - public: - static const target_type static_type; - }; - - class pca: public pc // .static.pc - { - public: - using pc::pc; - - public: - static const target_type static_type; - virtual const target_type& dynamic_type () const {return static_type;} - }; - - class pcs: public pc // .shared.pc - { - public: - using pc::pc; - - public: - static const target_type static_type; - virtual const target_type& dynamic_type () const {return static_type;} - }; - } -} - -#endif // BUILD2_PKGCONFIG_TARGET_HXX -- cgit v1.1