From f5d23e3e6ad425075182982c1ef717cb0873bbdc Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 22 Aug 2021 14:28:01 +0300 Subject: [PATCH] Basic support for running builder on Windows --- source/copy.cpp | 2 ++ source/externaltask.cpp | 5 ++++- source/packagemanager.cpp | 6 ++++++ source/sourcepackage.cpp | 8 ++++++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/source/copy.cpp b/source/copy.cpp index 2d2a7ca..6a2de24 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -65,6 +65,7 @@ void Copy::Worker::main() return; } +#ifndef _WIN32 // Preserve file permissions struct stat st; if(stat(src_path.str().c_str(), &st)==0) @@ -78,6 +79,7 @@ void Copy::Worker::main() FS::unlink(link); symlink(relpath.str().c_str(), link.str().c_str()); } +#endif status = Task::SUCCESS; } diff --git a/source/externaltask.cpp b/source/externaltask.cpp index 07ad870..dce0e06 100644 --- a/source/externaltask.cpp +++ b/source/externaltask.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -73,7 +72,11 @@ void ExternalTask::start() if(stdin_action==IGNORE || stdout_action==IGNORE || stderr_action==IGNORE) { +#ifdef _WIN32 + devnull = new IO::File("nul", IO::M_RDWR); +#else devnull = new IO::File("/dev/null", IO::M_RDWR); +#endif if(stdin_action==IGNORE) process->redirect_cin(*devnull); if(stdout_action==IGNORE) diff --git a/source/packagemanager.cpp b/source/packagemanager.cpp index 9ca11ba..2ee3c30 100644 --- a/source/packagemanager.cpp +++ b/source/packagemanager.cpp @@ -125,6 +125,7 @@ Package *PackageManager::find_package(const string &name) string PackageManager::run_pkgconfig(const string &pkg, const string &what) { +#ifndef _WIN32 if(!env_set) { const FS::Path &prefix = builder.get_prefix(); @@ -166,6 +167,11 @@ string PackageManager::run_pkgconfig(const string &pkg, const string &what) builder.get_logger().log("auxcommands", format("Running %s", join(argv.begin(), argv.end()))); return ExternalTask::run_and_capture_output(argv); +#else + (void)pkg; + (void)what; + return string(); +#endif } FS::Path PackageManager::get_package_location(const string &name) diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index bb99994..0a69d7a 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -133,13 +133,17 @@ void SourcePackage::do_prepare() for(ComponentList::iterator i=components.begin(); i!=components.end(); ++i) (*i)->create_targets(); + const Architecture &arch = builder.get_native_arch(); if(!export_binfo.libs.empty()) { export_binfo.incpath.push_back((builder.get_prefix()/"include").str()); export_binfo.libpath.push_back((builder.get_prefix()/"lib").str()); - PkgConfigFile *pc = new PkgConfigFile(builder, *this); - builder.get_build_graph().get_target("install")->add_dependency(*builder.get_toolchain().get_tool("CP").create_target(*pc)); + if(arch.get_system()=="linux") + { + PkgConfigFile *pc = new PkgConfigFile(builder, *this); + builder.get_build_graph().get_target("install")->add_dependency(*builder.get_toolchain().get_tool("CP").create_target(*pc)); + } } } -- 2.45.2