diff options
Diffstat (limited to 'include')
50 files changed, 299 insertions, 289 deletions
diff --git a/include/add_repo.h b/include/add_repo.h new file mode 100644 index 0000000..1f41e4b --- /dev/null +++ b/include/add_repo.h @@ -0,0 +1,6 @@ +#ifndef ADD_REPO_H +#define ADD_REPO_H + +void add_repo(const char *repo, const char *repo_name); + +#endif
\ No newline at end of file diff --git a/include/add_repo.hh b/include/add_repo.hh deleted file mode 100644 index ddc1fee..0000000 --- a/include/add_repo.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef ADD_REPO -#define ADD_REPO - -#include <string> -void add_repo(std::string repo, std::string repo_name); - -#endif diff --git a/include/build.h b/include/build.h new file mode 100644 index 0000000..18b92e2 --- /dev/null +++ b/include/build.h @@ -0,0 +1,8 @@ +#ifndef BUILD_H +#define BUILD_H + +#include "vars.h" + +void build(Pkg pkg); + +#endif
\ No newline at end of file diff --git a/include/build.hh b/include/build.hh deleted file mode 100644 index fb42ef1..0000000 --- a/include/build.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef BUILD -#define BUILD - -#include "vars.hh" -void build(Pkg pkg); - -#endif diff --git a/include/cla_parse.h b/include/cla_parse.h new file mode 100644 index 0000000..68f1c49 --- /dev/null +++ b/include/cla_parse.h @@ -0,0 +1,6 @@ +#ifndef CLA_PARSE_H +#define CLA_PARSE_H + +void cla_parse(int argc, char **argv); + +#endif
\ No newline at end of file diff --git a/include/cla_parse.hh b/include/cla_parse.hh deleted file mode 100644 index 893c887..0000000 --- a/include/cla_parse.hh +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef CLA_PARSE -#define CLA_PARSE -void cla_parse(int argc, char** argv); -#endif diff --git a/include/cmd_out.h b/include/cmd_out.h new file mode 100644 index 0000000..ff4e882 --- /dev/null +++ b/include/cmd_out.h @@ -0,0 +1,6 @@ +#ifndef CMD_OUT_H +#define CMD_OUT_H + +char* cmd_out(const char *cmd); + +#endif
\ No newline at end of file diff --git a/include/cmd_out.hh b/include/cmd_out.hh deleted file mode 100644 index ee1f3c9..0000000 --- a/include/cmd_out.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CMD_OUT -#define CMD_OUT - -#include <string> -std::string cmd_out(const char* cmd); - -#endif diff --git a/include/copy_install.h b/include/copy_install.h new file mode 100644 index 0000000..d0750b6 --- /dev/null +++ b/include/copy_install.h @@ -0,0 +1,6 @@ +#ifndef COPY_INSTALL_H +#define COPY_INSTALL_H + +void copy_install(const char *build_dir); + +#endif
\ No newline at end of file diff --git a/include/copy_install.hh b/include/copy_install.hh deleted file mode 100644 index ce20009..0000000 --- a/include/copy_install.hh +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef COPY_INSTALL -#define COPY_INSTALL - -#include <filesystem> -#include <unistd.h> -void copy_install(std::filesystem::path build_dir); - -#endif diff --git a/include/create_pkg.h b/include/create_pkg.h new file mode 100644 index 0000000..dbd5bec --- /dev/null +++ b/include/create_pkg.h @@ -0,0 +1,8 @@ +#ifndef CREATE_PKG_H +#define CREATE_PKG_H + +#include "vars.h" + +Pkg create_pkg(const char *arg, const char *target); + +#endif
\ No newline at end of file diff --git a/include/create_pkg.hh b/include/create_pkg.hh deleted file mode 100644 index d7589f9..0000000 --- a/include/create_pkg.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CREATE_PKG -#define CREATE_PKG - -#include "vars.hh" -Pkg create_pkg(std::string arg, const char* target = "default"); - -#endif diff --git a/include/ensure_repo.hh b/include/ensure_repo.hh deleted file mode 100644 index 6061e9c..0000000 --- a/include/ensure_repo.hh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ENSURE_REPO -#define ENSURE_REPO - -void ensure_repo(); - -#endif diff --git a/include/fetch_git.h b/include/fetch_git.h new file mode 100644 index 0000000..9b9af46 --- /dev/null +++ b/include/fetch_git.h @@ -0,0 +1,8 @@ +#ifndef FETCH_GIT_H +#define FETCH_GIT_H + +#include "vars.h" + +int fetch_git(Pkg pkg); + +#endif
\ No newline at end of file diff --git a/include/fetch_git.hh b/include/fetch_git.hh deleted file mode 100644 index 9f27013..0000000 --- a/include/fetch_git.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef FETCH_GIT -#define FETCH_GIT - -#include "vars.hh" -int fetch_git(Pkg pkg); - -#endif diff --git a/include/fetch_pwd.h b/include/fetch_pwd.h new file mode 100644 index 0000000..242d520 --- /dev/null +++ b/include/fetch_pwd.h @@ -0,0 +1,8 @@ +#ifndef FETCH_PWD_H +#define FETCH_PWD_H + +#include "vars.h" + +void fetch_pwd(Pkg pkg); + +#endif
\ No newline at end of file diff --git a/include/fetch_pwd.hh b/include/fetch_pwd.hh deleted file mode 100644 index 44143e7..0000000 --- a/include/fetch_pwd.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef FETCH_PWD -#define FETCH_PWD - -#include "vars.hh" -void fetch_pwd(Pkg pkg); - -#endif diff --git a/include/fetch_src.h b/include/fetch_src.h new file mode 100644 index 0000000..089776c --- /dev/null +++ b/include/fetch_src.h @@ -0,0 +1,8 @@ +#ifndef FETCH_SRC_H +#define FETCH_SRC_H + +#include "vars.h" + +void fetch_src(Pkg pkg); + +#endif
\ No newline at end of file diff --git a/include/fetch_src.hh b/include/fetch_src.hh deleted file mode 100644 index e2d4c56..0000000 --- a/include/fetch_src.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef FETCH_SRC -#define FETCH_SRC - -#include "vars.hh" -void fetch_src(Pkg pkg); - -#endif diff --git a/include/help.h b/include/help.h new file mode 100644 index 0000000..dc2c7a3 --- /dev/null +++ b/include/help.h @@ -0,0 +1,6 @@ +#ifndef HELP_H +#define HELP_H + +void help(void); + +#endif
\ No newline at end of file diff --git a/include/help.hh b/include/help.hh deleted file mode 100644 index 3ea4aef..0000000 --- a/include/help.hh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef HELP -#define HELP - -void help(); - -#endif diff --git a/include/install_pkg.h b/include/install_pkg.h new file mode 100644 index 0000000..52ce9c0 --- /dev/null +++ b/include/install_pkg.h @@ -0,0 +1,8 @@ +#ifndef INSTALL_PKG_H +#define INSTALL_PKG_H + +#include "vars.h" + +void install_pkg(Pkg pkg); + +#endif
\ No newline at end of file diff --git a/include/install_pkg.hh b/include/install_pkg.hh deleted file mode 100644 index 76382d2..0000000 --- a/include/install_pkg.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef INSTALL_PKG -#define INSTALL_PKG - -#include "vars.hh" -void install_pkg(Pkg pkg); - -#endif diff --git a/include/is_updated.h b/include/is_updated.h new file mode 100644 index 0000000..7532b32 --- /dev/null +++ b/include/is_updated.h @@ -0,0 +1,6 @@ +#ifndef IS_UPDATED_H +#define IS_UPDATED_H + +bool is_updated(const char *src); + +#endif
\ No newline at end of file diff --git a/include/is_updated.hh b/include/is_updated.hh deleted file mode 100644 index 5d33804..0000000 --- a/include/is_updated.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef IS_UPDATED -#define IS_UPDATED - -#include <string> -bool is_updated(std::string src); - -#endif diff --git a/include/link_install.h b/include/link_install.h new file mode 100644 index 0000000..a9528bb --- /dev/null +++ b/include/link_install.h @@ -0,0 +1,6 @@ +#ifndef LINK_INSTALL_H +#define LINK_INSTALL_H + +void link_install(const char *build_dir); + +#endif
\ No newline at end of file diff --git a/include/link_install.hh b/include/link_install.hh deleted file mode 100644 index fabae0a..0000000 --- a/include/link_install.hh +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef LINK_INSTALL -#define LINK_INSTALL - -#include <filesystem> -#include <unistd.h> -void link_install(std::filesystem::path build_dir); - -#endif diff --git a/include/list_pkgs.h b/include/list_pkgs.h new file mode 100644 index 0000000..6a00ad6 --- /dev/null +++ b/include/list_pkgs.h @@ -0,0 +1,6 @@ +#ifndef LIST_PKGS_H +#define LIST_PKGS_H + +void list_pkgs(void); + +#endif
\ No newline at end of file diff --git a/include/list_pkgs.hh b/include/list_pkgs.hh deleted file mode 100644 index 0d3ecb9..0000000 --- a/include/list_pkgs.hh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LIST_PKGS -#define LIST_PKGS - -void list_pkgs(); - -#endif diff --git a/include/lua_build.h b/include/lua_build.h new file mode 100644 index 0000000..401a591 --- /dev/null +++ b/include/lua_build.h @@ -0,0 +1,6 @@ +#ifndef LUA_BUILD_H +#define LUA_BUILD_H + +bool lua_build(const char *repository, const char *target, const char *path); + +#endif
\ No newline at end of file diff --git a/include/lua_build.hh b/include/lua_build.hh deleted file mode 100644 index 473d80e..0000000 --- a/include/lua_build.hh +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef LUA_BUILD -#define LUA_BUILD - -#include <lua.h> -#include <lauxlib.h> -#include <lualib.h> - -bool lua_build(const char* repository, const char* target, const char* path); - -#endif diff --git a/include/lua_state.h b/include/lua_state.h new file mode 100644 index 0000000..26a14f8 --- /dev/null +++ b/include/lua_state.h @@ -0,0 +1,27 @@ +#ifndef LUA_STATE_H +#define LUA_STATE_H + +#include <lua.h> +#include <lauxlib.h> +#include <lualib.h> + +#include "vars.h" + +extern Map cached_install_directories; +extern Repo cached_repos[MAX_REPOS]; +extern size_t cached_repos_count; +extern Map cached_build_systems; + +void push_lua_path(lua_State *L, const char *new_path); +void init_lua_state(void); +void free_lua_state(void); +lua_State* get_lua_state(void); + +void cache_install_directories(void); +bool repo_build(const char *repository); +bool bldit(const char *target); +bool config_build(const char *path); +void cache_repos(void); +void cache_build_systems(void); + +#endif
\ No newline at end of file diff --git a/include/lua_state.hh b/include/lua_state.hh deleted file mode 100644 index 0261e13..0000000 --- a/include/lua_state.hh +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef LUA_STATE -#define LUA_STATE - -#include <unordered_map> -#include <string> -extern "C" { -#include <luajit-2.1/lua.h> -#include <luajit-2.1/lauxlib.h> -#include <luajit-2.1/lualib.h> -} - -typedef struct { - std::string key; - std::string value; -} url; - -typedef struct { - std::string url; - std::string version; -} dependency; - -typedef struct { - url source; - std::unordered_map<std::string, dependency> dependencies; - int build; - int pre_install; - int install; - int post_install; -} repo; - -extern std::unordered_map<std::string, std::string> cached_install_directories; -extern std::unordered_map<std::string, repo> cached_repos; -extern std::unordered_map<std::string, int> cached_build_systems; - - -void push_lua_path(lua_State *L, const char *new_path); -void init_lua_state(); -void free_lua_state(); -lua_State* get_lua_state(); - -void cache_install_directories(); -bool repo_build(const char* repoository); -bool bldit(const char* target); -bool config_build(const char* path); -void cache_repos(); -void cache_build_systems(); - -#endif
\ No newline at end of file diff --git a/include/name_from_url.h b/include/name_from_url.h new file mode 100644 index 0000000..fc80b45 --- /dev/null +++ b/include/name_from_url.h @@ -0,0 +1,6 @@ +#ifndef NAME_FROM_URL_H +#define NAME_FROM_URL_H + +char* name_from_url(const char *url); + +#endif
\ No newline at end of file diff --git a/include/name_from_url.hh b/include/name_from_url.hh deleted file mode 100644 index 6f8723b..0000000 --- a/include/name_from_url.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef NAME_FROM_URL -#define NAME_FROM_URL - -#include <string> -std::string name_from_url(std::string url); - -#endif diff --git a/include/remove_pkg.h b/include/remove_pkg.h new file mode 100644 index 0000000..66ee5aa --- /dev/null +++ b/include/remove_pkg.h @@ -0,0 +1,8 @@ +#ifndef REMOVE_PKG_H +#define REMOVE_PKG_H + +#include "vars.h" + +void remove_pkg(Pkg pkg); + +#endif
\ No newline at end of file diff --git a/include/remove_pkg.hh b/include/remove_pkg.hh deleted file mode 100644 index fc9ed9d..0000000 --- a/include/remove_pkg.hh +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef REMOVE_PKG -#define REMOVE_PKG - -#include <unistd.h> -#include "vars.hh" -void remove_pkg(Pkg pkg); - -#endif diff --git a/include/resolve_deps.h b/include/resolve_deps.h new file mode 100644 index 0000000..3874932 --- /dev/null +++ b/include/resolve_deps.h @@ -0,0 +1,4 @@ +#ifndef RESOLVE_DEPS_H +#define RESOLVE_DEPS_H +void resolve_deps(void); +#endif diff --git a/include/set_install_directories.h b/include/set_install_directories.h new file mode 100644 index 0000000..b89330b --- /dev/null +++ b/include/set_install_directories.h @@ -0,0 +1,6 @@ +#ifndef SET_INSTALL_DIRECTORIES_H +#define SET_INSTALL_DIRECTORIES_H + +void set_install_directories(void); + +#endif
\ No newline at end of file diff --git a/include/set_install_directories.hh b/include/set_install_directories.hh deleted file mode 100644 index 2de9dd1..0000000 --- a/include/set_install_directories.hh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SET_INSTALL_DIRECTORIES -#define SET_INSTALL_DIRECTORIES - -void set_install_directories(); - -#endif diff --git a/include/setup_dirs.h b/include/setup_dirs.h new file mode 100644 index 0000000..8d07748 --- /dev/null +++ b/include/setup_dirs.h @@ -0,0 +1,6 @@ +#ifndef SETUP_DIRS_H +#define SETUP_DIRS_H + +void setup_dirs(void); + +#endif
\ No newline at end of file diff --git a/include/setup_dirs.hh b/include/setup_dirs.hh deleted file mode 100644 index 391dd96..0000000 --- a/include/setup_dirs.hh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SETUP_DIRS -#define SETUP_DIRS - -void setup_dirs(); - -#endif diff --git a/include/setup_pkgit.h b/include/setup_pkgit.h new file mode 100644 index 0000000..3c32fd1 --- /dev/null +++ b/include/setup_pkgit.h @@ -0,0 +1,6 @@ +#ifndef SETUP_PKGIT_H +#define SETUP_PKGIT_H + +void setup_pkgit(void); + +#endif
\ No newline at end of file diff --git a/include/setup_pkgit.hh b/include/setup_pkgit.hh deleted file mode 100644 index 3b400de..0000000 --- a/include/setup_pkgit.hh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SETUP_PKGIT -#define SETUP_PKGIT - -void setup_pkgit(); - -#endif diff --git a/include/update_all.h b/include/update_all.h new file mode 100644 index 0000000..3d40e75 --- /dev/null +++ b/include/update_all.h @@ -0,0 +1,6 @@ +#ifndef UPDATE_ALL_H +#define UPDATE_ALL_H + +void update_all(void); + +#endif
\ No newline at end of file diff --git a/include/update_all.hh b/include/update_all.hh deleted file mode 100644 index a5bb304..0000000 --- a/include/update_all.hh +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef UPDATE_ALL -#define UPDATE_ALL - -void update_all(); - -#endif diff --git a/include/update_pkg.h b/include/update_pkg.h new file mode 100644 index 0000000..95d9aa8 --- /dev/null +++ b/include/update_pkg.h @@ -0,0 +1,8 @@ +#ifndef UPDATE_PKG_H +#define UPDATE_PKG_H + +#include "vars.h" + +void update_pkg(Pkg pkg); + +#endif
\ No newline at end of file diff --git a/include/update_pkg.hh b/include/update_pkg.hh deleted file mode 100644 index 0c6bf62..0000000 --- a/include/update_pkg.hh +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef UPDATE_PKG -#define UPDATE_PKG - -#include "vars.hh" -void update_pkg(Pkg pkg); - -#endif diff --git a/include/vars.h b/include/vars.h new file mode 100644 index 0000000..7bb44d3 --- /dev/null +++ b/include/vars.h @@ -0,0 +1,120 @@ +#ifndef VARS_H +#define VARS_H + +#include <stdbool.h> +#include <stddef.h> + +#define MAX_REPOS 100 +#define MAX_DIRS 10 +#define MAX_PATH_LEN 1024 + +typedef struct { + char *key; + char *value; +} KeyValue; + +typedef struct { + char *key; + char *value; +} MapItem; + +typedef struct { + MapItem *items; + size_t size; + size_t capacity; +} Map; + +typedef struct { + char *url; + char *version; +} Dependency; + +typedef struct { + char *source_key; + char *source_value; + Dependency *dependencies; + size_t dep_count; + int build_ref; + int pre_install_ref; + int install_ref; + int post_install_ref; +} Repo; + +typedef struct { + char *url; + char *name; + const char *target; + char *ver; + char src[MAX_PATH_LEN]; + bool is_local; +} Pkg; + +extern bool is_symlink_install; +extern bool is_verbose; +extern bool config_exists; + +extern char home_dir[MAX_PATH_LEN]; + +extern char root_config[MAX_PATH_LEN]; +extern bool is_root_config; +extern char config_dir[MAX_PATH_LEN]; +extern char config_file[MAX_PATH_LEN]; +extern char repo_file[MAX_PATH_LEN]; + +extern char bin[MAX_PATH_LEN]; +extern char lib[MAX_PATH_LEN]; +extern char inc[MAX_PATH_LEN]; +extern char pkgblds[MAX_PATH_LEN]; + +extern char *install_directories[5]; + +extern const char *version; + +extern const char *red; +extern const char *green; +extern const char *yellow; +extern const char *blue; +extern const char *magenta; +extern const char *cyan; +extern const char *gray; +extern const char *bright_red; +extern const char *bright_green; +extern const char *bright_yellow; +extern const char *bright_blue; +extern const char *bright_magenta; +extern const char *bright_cyan; +extern const char *bright_gray; +extern const char *bold_red; +extern const char *bold_green; +extern const char *bold_yellow; +extern const char *bold_blue; +extern const char *bold_magenta; +extern const char *bold_cyan; +extern const char *bold_gray; +extern const char *bold_white; +extern const char *bold_bright_red; +extern const char *bold_bright_green; +extern const char *bold_bright_yellow; +extern const char *bold_bright_blue; +extern const char *bold_bright_magenta; +extern const char *bold_bright_cyan; +extern const char *bold_bright_gray; +extern const char *italic; +extern const char *color_reset; + +extern const char *print_pkgit; +extern const char *print_skipped; +extern const char *print_warning; +extern const char *print_error; + +void init_vars(); +const char* get_install_dir(const char *key); +bool file_exists(const char *path); +bool is_directory(const char *path); +int mkdir_p(const char *path); + +void map_init(Map *map); +void map_put(Map *map, char *key, char *value); +char* map_get(Map *map, const char *key); + +#endif
\ No newline at end of file diff --git a/include/vars.hh b/include/vars.hh deleted file mode 100644 index 1d516ea..0000000 --- a/include/vars.hh +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef VARS -#define VARS - -#include <string> -#include <filesystem> -#include <unordered_map> - -extern std::unordered_map<std::string, std::string> repos; -extern std::unordered_map<std::string, std::string> install_directories; - -extern bool is_symlink_install; -extern bool is_verbose; -extern bool config_exists; - -struct Pkg { - std::string url; - std::string name; - const char* target; - std::string ver; - std::filesystem::path src; - bool is_local; -}; - -extern const std::string home_dir; - -extern const std::string root_config; -extern bool is_root_config; -extern const std::string config_dir; -extern const std::string config_file; -extern const std::string repo_file; - -extern const std::string bin; -extern const std::string lib; -extern const std::string include; -extern const std::string pkgblds; -extern const std::string all_dirs[5]; - -// version -extern const std::string version; - -// colors -extern const std::string red; -extern const std::string green; -extern const std::string yellow; -extern const std::string blue; -extern const std::string magenta; -extern const std::string cyan; -extern const std::string gray; -// bright -extern const std::string bright_red; -extern const std::string bright_green; -extern const std::string bright_yellow; -extern const std::string bright_blue; -extern const std::string bright_magenta; -extern const std::string bright_cyan; -extern const std::string bright_gray; -// bold -extern const std::string bold_red; -extern const std::string bold_green; -extern const std::string bold_yellow; -extern const std::string bold_blue; -extern const std::string bold_magenta; -extern const std::string bold_cyan; -extern const std::string bold_gray; -extern const std::string bold_white; -// bold bright -extern const std::string bold_bright_red; -extern const std::string bold_bright_green; -extern const std::string bold_bright_yellow; -extern const std::string bold_bright_blue; -extern const std::string bold_bright_magenta; -extern const std::string bold_bright_cyan; -extern const std::string bold_bright_gray; -// italic -extern const std::string italic; -// reset -extern const std::string color_reset; - -extern const std::string print_pkgit; -extern const std::string print_skipped; -extern const std::string print_warning; -extern const std::string print_error; - -#endif |
