+ " --max-depth NUM Maximum depth to show in analysis.\n"
+ " --prefix DIR Directory to install things to.\n"
+ " --warnings LIST Compiler warnings to use.\n";
+ }
+}
+
+/**
+Determines the source directory of a package. pkg-config is consulted first,
+and if it fails, the package path is searched for matches.
+*/
+FS::Path Builder::get_package_location(const string &name)
+{
+ // Try to get source directory with pkgconfig
+ list<string> argv;
+ argv.push_back("pkg-config");
+ argv.push_back("--variable=source");
+ argv.push_back(name);
+ if(verbose>=4)
+ cout<<"Running "<<join(argv.begin(), argv.end())<<'\n';
+ string srcdir=strip(run_command(argv));
+ if(!srcdir.empty())
+ return srcdir;
+
+ if(pkg_dirs.empty())
+ {
+ for(list<FS::Path>::const_iterator i=pkg_path.begin(); i!=pkg_path.end(); ++i)
+ {
+ list<string> files=list_files(*i);
+ for(list<string>::const_iterator j=files.begin(); j!=files.end(); ++j)
+ {
+ FS::Path full=*i / *j;
+ if(FS::exists(full/"Build"))
+ pkg_dirs.push_back(full);
+ }
+ }