X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpkgconfiggenerator.cpp;fp=source%2Fpkgconfiggenerator.cpp;h=bd807d4581ba3e173367f8b040c63d30b4cc608b;hb=64d69068586a764b8a8ee35b0efd98cd5a5bbf32;hp=811fa5d2ef68e9e6bfdb9ef3d04a6c88ac2f4950;hpb=592fa2bca4e973678cbdc86802fe1c151b40e04d;p=builder.git diff --git a/source/pkgconfiggenerator.cpp b/source/pkgconfiggenerator.cpp index 811fa5d..bd807d4 100644 --- a/source/pkgconfiggenerator.cpp +++ b/source/pkgconfiggenerator.cpp @@ -53,7 +53,7 @@ void PkgConfigGenerator::Worker::main() const BuildInfo &binfo = spkg.get_exported_build_info(); IO::print(out, "Libs:"); for(BuildInfo::PathList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i) - IO::print(out, " -L%s", FS::relative(*i, builder.get_prefix()).str()); + IO::print(out, " -L%s", prefixify(*i, builder.get_prefix())); for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i) IO::print(out, " -l%s", *i); if(binfo.threads) @@ -62,7 +62,7 @@ void PkgConfigGenerator::Worker::main() IO::print(out, "Cflags:"); for(BuildInfo::PathList::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i) - IO::print(out, " -I%s", FS::relative(*i, builder.get_prefix()).str()); + IO::print(out, " -I%s", prefixify(*i, builder.get_prefix())); for(BuildInfo::DefineMap::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i) if(i->second.empty()) IO::print(out, " -D%s", i->first); @@ -72,3 +72,14 @@ void PkgConfigGenerator::Worker::main() status = Task::SUCCESS; } + +string PkgConfigGenerator::Worker::prefixify(const FS::Path &path, const FS::Path &prefix) +{ + if(FS::descendant_depth(path, prefix)>=0) + { + FS::Path rel_path = FS::relative(path, prefix); + return "${prefix}"+rel_path.str().substr(1); + } + else + return path.str(); +}