mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
81 lines
1.3 KiB
C++
81 lines
1.3 KiB
C++
#include "pch.h"
|
|
#include "tasks.h"
|
|
|
|
namespace mob::tasks
|
|
{
|
|
|
|
libbsarch::libbsarch()
|
|
: basic_task("libbsarch")
|
|
{
|
|
}
|
|
|
|
std::string libbsarch::version()
|
|
{
|
|
return conf::version_by_name("libbsarch");
|
|
}
|
|
|
|
bool libbsarch::prebuilt()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
fs::path libbsarch::source_path()
|
|
{
|
|
return conf().paths().build() / dir_name();
|
|
}
|
|
|
|
void libbsarch::do_clean(clean c)
|
|
{
|
|
instrument<times::clean>([&]
|
|
{
|
|
if (is_set(c, clean::redownload))
|
|
run_tool(downloader(source_url(), downloader::clean));
|
|
|
|
if (is_set(c, clean::reextract))
|
|
{
|
|
cx().trace(context::reextract, "deleting {}", source_path());
|
|
op::delete_directory(cx(), source_path(), op::optional);
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
void libbsarch::do_fetch()
|
|
{
|
|
const auto file = instrument<times::fetch>([&]
|
|
{
|
|
return run_tool(downloader(source_url()));
|
|
});
|
|
|
|
instrument<times::extract>([&]
|
|
{
|
|
run_tool(extractor()
|
|
.file(file)
|
|
.output(source_path()));
|
|
});
|
|
}
|
|
|
|
void libbsarch::do_build_and_install()
|
|
{
|
|
instrument<times::install>([&]
|
|
{
|
|
op::copy_file_to_dir_if_better(cx(),
|
|
source_path() / "libbsarch.dll",
|
|
conf().paths().install_dlls());
|
|
});
|
|
}
|
|
|
|
std::string libbsarch::dir_name()
|
|
{
|
|
return "libbsarch-" + version() + "-release-x64";
|
|
}
|
|
|
|
url libbsarch::source_url()
|
|
{
|
|
return
|
|
"https://github.com/ModOrganizer2/libbsarch/releases/download/" +
|
|
version() + "/" + dir_name() + ".7z";
|
|
}
|
|
|
|
} // namespace
|