aboutsummaryrefslogtreecommitdiff
path: root/build2/pkgconfig
diff options
context:
space:
mode:
Diffstat (limited to 'build2/pkgconfig')
-rw-r--r--build2/pkgconfig/init.cxx175
-rw-r--r--build2/pkgconfig/init.hxx37
-rw-r--r--build2/pkgconfig/target.cxx54
-rw-r--r--build2/pkgconfig/target.hxx48
4 files changed, 0 insertions, 314 deletions
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 <build2/pkgconfig/init.hxx>
-
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
-
-#include <build2/config/utility.hxx>
-#include <build2/install/utility.hxx>
-
-#include <build2/pkgconfig/target.hxx>
-
-using namespace std;
-using namespace butl;
-
-namespace build2
-{
- namespace pkgconfig
- {
- bool
- config_init (scope& rs,
- scope& bs,
- const location& l,
- unique_ptr<module_base>&,
- 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<path> ("config.pkgconfig", true));
- const variable& x_path (vp.insert<process_path> ("pkgconfig.path"));
-
- const variable& c_x_tgt (
- vp.insert<target_triplet> ("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<path> (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 <triplet>-pkg-config.
- //
- if (pp.empty ())
- {
- if (const auto* t = cast_null<target_triplet> (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<module_base>&,
- 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<bool> (rs["pkgconfig.config.loaded"]))
- {
- if (!load_module (rs, rs, "pkgconfig.config", loc, optional, hints))
- conf = false;
- }
- else if (!cast_false<bool> (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<pca> ();
- rs.target_types.insert<pcs> ();
-
- if (cast_false<bool> (rs["install.loaded"]))
- install::install_path<pc> (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 <build2/types.hxx>
-#include <build2/utility.hxx>
-
-#include <build2/module.hxx>
-
-namespace build2
-{
- namespace pkgconfig
- {
- bool
- config_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- 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 <build2/pkgconfig/target.hxx>
-
-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<pca, pca_ext>,
- &target_extension_fix<pca_ext>,
- &target_pattern_fix<pca_ext>,
- &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<pcs, pcs_ext>,
- &target_extension_fix<pcs_ext>,
- &target_pattern_fix<pcs_ext>,
- &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 <build2/types.hxx>
-#include <build2/utility.hxx>
-
-#include <build2/target.hxx>
-
-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