]> git.tdb.fi Git - builder.git/commitdiff
Basic support for running builder on Windows
authorMikko Rasa <tdb@tdb.fi>
Sun, 22 Aug 2021 11:28:01 +0000 (14:28 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 22 Aug 2021 11:28:01 +0000 (14:28 +0300)
source/copy.cpp
source/externaltask.cpp
source/packagemanager.cpp
source/sourcepackage.cpp

index 2d2a7ca9c023c557954e05924d9181f4280dae97..6a2de247c9ac6ba8d6365be128b81252090cc13e 100644 (file)
@@ -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;
 }
index 07ad870e6c35ec398e2885211e31fbfe890f7d28..dce0e06d6157700db2efab0ca32a27d5ba26aceb 100644 (file)
@@ -1,6 +1,5 @@
 #include <cstdlib>
 #include <unistd.h>
-#include <sys/wait.h>
 #include <msp/fs/dir.h>
 #include <msp/io/console.h>
 #include <msp/io/file.h>
@@ -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)
index 9ca11bae94e3b80dd07e94b6509da26b67403561..2ee3c30de63f67bca4f649d27326d9b97e05d4f1 100644 (file)
@@ -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)
index bb9999476d0041f3529aacc44b7a3a60b3d8b960..0a69d7aa22f058641980b03768b8ccce030babb0 100644 (file)
@@ -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));
+               }
        }
 }