diff options
author | Kaiden Fey <kookie@spacekookie.de> | 2020-09-06 18:55:39 +0200 |
---|---|---|
committer | Kaiden Fey <kookie@spacekookie.de> | 2020-09-27 22:31:35 +0200 |
commit | af7f36b3e8ddce86872a3599101ac68bbab74439 (patch) | |
tree | 84693294eebc75602bb99bd50c2d66a9a2c6e84b | |
parent | 41f17e23e5518f366a1750131efbfab4370cad08 (diff) |
Implementing initial stage1 builder
-rw-r--r-- | stage1/README | 15 | ||||
-rw-r--r-- | stage1/default.nix | 14 | ||||
-rw-r--r-- | stage1/lib/root.h | 36 | ||||
-rw-r--r-- | stage1/main.cpp | 13 | ||||
-rw-r--r-- | stage1/meson.build | 7 |
5 files changed, 85 insertions, 0 deletions
diff --git a/stage1/README b/stage1/README new file mode 100644 index 00000000000..ccf38e66e0d --- /dev/null +++ b/stage1/README @@ -0,0 +1,15 @@ + + + ~~~~~~~~~~~~~~~~~~~~~~~ + + libkookie stage 1 tools + + ~~~~~~~~~~~~~~~~~~~~~~~ + +This is the libkookie stage 1 toolchain documentation. In order to +build a system with libkookie you need the stage 2 toolchain (namely +`builder`, the build root/ install wrapper). This derivation builds +this tool. + +You need to have a running nix installation to download the required +C++ environment.
\ No newline at end of file diff --git a/stage1/default.nix b/stage1/default.nix new file mode 100644 index 00000000000..8dcfc1ed060 --- /dev/null +++ b/stage1/default.nix @@ -0,0 +1,14 @@ +with (import <nixpkgs> {}); + +llvmPackages_latest.stdenv.mkDerivation { + pname = "libkookie-stage1-tools"; + version = "0.0.0"; + src = ./.; + + nativeBuildInputs = with pkgs; [ meson ninja pkg-config ]; + + installPhase = '' + mkdir -p $out/bin + cp builder $out/bin/builder + ''; +} diff --git a/stage1/lib/root.h b/stage1/lib/root.h new file mode 100644 index 00000000000..3fbca0c5367 --- /dev/null +++ b/stage1/lib/root.h @@ -0,0 +1,36 @@ +#include <string> +#include <fstream> +#include <iostream> +#include <filesystem> + +using std::string; +namespace fs = std::filesystem; + +/** Root build type */ +enum r_type { + FULL_NIXOS, + FULL_DARWIN, + PARTIAL, + COLLECTION, +}; + +/** Root metadata */ +struct root_t { + string name; + string path; + enum r_type type; +}; + + +root_t get_root(string path) +{ + for(auto &entry: fs::recursive_directory_iterator(path)) { + std::cout << entry.path() << std::endl; + } + + return root_t { + "hyperion", + "roots/hyperion/default.nix", + FULL_NIXOS, + }; +} diff --git a/stage1/main.cpp b/stage1/main.cpp new file mode 100644 index 00000000000..6f2cd57fae8 --- /dev/null +++ b/stage1/main.cpp @@ -0,0 +1,13 @@ +#include <iostream> +#include "root.h" + +int main(int argn, char **argv) +{ + std::cout << "I am a builder!" << std::endl; + + get_root("/Users/spacekookie/Projects/code/libkookie/roots"); + + std::cout << "uwu!" << std::endl; + return 0; +} + diff --git a/stage1/meson.build b/stage1/meson.build new file mode 100644 index 00000000000..df9b342b863 --- /dev/null +++ b/stage1/meson.build @@ -0,0 +1,7 @@ +project('libkookie-stage1-tools', 'cpp', + default_options : ['cpp_std=c++17']) + +executable('builder', + 'main.cpp', + link_args : '-lc++fs', + include_directories: include_directories('lib')) |