1 #ifndef PACKAGEMANAGER_H_
2 #define PACKAGEMANAGER_H_
7 #include <msp/fs/path.h>
13 Keeps track of packages. Also responsible for locating previously unknown
19 typedef std::map<std::string, Package *> PackageMap;
22 typedef std::list<Msp::FS::Path> SearchPath;
27 SearchPath binpkg_path;
28 SearchPath binpkg_files;
34 PackageManager(Builder &);
37 /// Adds a location to look for source packages from.
38 void append_package_path(const Msp::FS::Path &);
40 /// Adds a location to look for binary packages from.
41 void append_binary_package_path(const Msp::FS::Path &);
43 /** Prevent creation of source packages. */
44 void set_no_externals(bool);
46 /** Adds a package to the manager. Called from Package constructor. */
47 void add_package(Package *);
49 /** Returns a package from the cache. */
50 Package *get_package(const std::string &);
52 const PackageMap &get_packages() const { return packages; }
54 /** Locates a package and creates it if necessary. */
55 Package *find_package(const std::string &);
58 std::string run_pkgconfig(const std::string &, const std::string &);
60 /** Determines the source directory of a package. Pkg-config is consulted
61 first, and if it fails, the package path is searched for matches. */
62 Msp::FS::Path get_package_location(const std::string &);
64 /** Determines the file containing a binary package. The file is expected
65 to be named after the package. */
66 Msp::FS::Path get_binary_package_file(const std::string &);