&data.path_build_programs_shared,
&data.path_build_programs_static,
&data.path_build_settings,
+ &data.path_build_stage,
};
if (data.verbosity != fake_verbosity_quiet) {
printf("%cCreating base build directories.%c", f_string_eol[0], f_string_eol[0]);
}
- for (uint8_t i = 0; i < 14; i++) {
+ for (uint8_t i = 0; i < 15; i++) {
if (directorys[i]->used == 0) continue;
status = f_directory_create(directorys[i]->string, mode);
}
f_status status = F_none;
+ f_mode mode = f_mode_initialize;
+
fake_build_setting setting = fake_build_setting_initialize;
+ fake_build_stage stage = fake_build_stage_initialize;
+
+ f_macro_mode_set_default_umask(mode, data.umask);
status = fake_build_setting_load(data, &setting);
- if (F_status_is_error(status)) {
- fake_macro_build_settings_delete_simple(setting);
- return status;
+ if (F_status_is_fine(status)) {
+ status = fake_build_stage_load(data, &stage);
}
- status = fake_build_execute_process_script(data, setting, setting.process_pre);
- if (F_status_is_error(status)) {
- fake_macro_build_settings_delete_simple(setting);
- return status;
- }
+ if (F_status_is_fine(status) && f_file_exists(stage.file_skeleton.string) != F_true) {
+ status = fake_build_skeleton(data, setting, mode.directory);
- f_mode mode = f_mode_initialize;
+ fake_build_touch(data, stage.file_skeleton, mode, &status);
+ }
- f_macro_mode_set_default_umask(mode, data.umask);
+ if (F_status_is_fine(status) && f_file_exists(stage.file_process_pre.string) != F_true) {
+ status = fake_build_execute_process_script(data, setting, setting.process_pre);
- status = fake_build_skeleton(data, setting, mode.directory);
- if (F_status_is_error(status)) {
- fake_macro_build_settings_delete_simple(setting);
- return status;
+ fake_build_touch(data, stage.file_process_pre, mode, &status);
}
- status = fake_build_copy(data, setting, mode, "source setting", data.path_data_settings, data.path_build_settings, setting.build_sources_setting);
- if (F_status_is_error(status)) {
- fake_macro_build_settings_delete_simple(setting);
- return status;
+ if (F_status_is_fine(status) && f_file_exists(stage.file_sources_settings.string) != F_true) {
+ status = fake_build_copy(data, setting, mode, "setting files", data.path_data_settings, data.path_build_settings, setting.build_sources_setting);
+
+ fake_build_touch(data, stage.file_sources_settings, mode, &status);
}
if (setting.build_language == fake_build_language_type_bash) {
// @todo
}
- else if (setting.build_language == fake_build_language_type_c) {
- status = fake_build_copy(data, setting, mode, "header files", data.path_sources_c, data.path_build_includes, setting.build_sources_headers);
- if (F_status_is_error(status)) {
- fake_macro_build_settings_delete_simple(setting);
- return status;
+ else {
+ const f_string_dynamic *path_sources = 0;
+
+ if (setting.build_language == fake_build_language_type_c) {
+ path_sources = &data.path_sources_c;
}
- }
- else if (setting.build_language == fake_build_language_type_cpp) {
- status = fake_build_copy(data, setting, mode, "header files", data.path_sources_cpp, data.path_build_includes, setting.build_sources_headers);
- if (F_status_is_error(status)) {
- fake_macro_build_settings_delete_simple(setting);
- return status;
+ else if (setting.build_language == fake_build_language_type_cpp) {
+ path_sources = &data.path_sources_cpp;
+ }
+
+ if (F_status_is_fine(status) && f_file_exists(stage.file_sources_headers.string) != F_true) {
+ status = fake_build_copy(data, setting, mode, "header files", *path_sources, data.path_build_includes, setting.build_sources_headers);
+
+ fake_build_touch(data, stage.file_sources_headers, mode, &status);
+ }
+
+ if (setting.build_shared) {
+ if (F_status_is_fine(status) && f_file_exists(stage.file_libraries_shared.string) != F_true) {
+ // @todo
+ //status = fake_build_libraries_shared();
+
+ fake_build_touch(data, stage.file_libraries_shared, mode, &status);
+ }
+
+ if (F_status_is_fine(status) && f_file_exists(stage.file_programs_shared.string) != F_true) {
+ // @todo
+ //status = fake_build_programs_shared();
+
+ fake_build_touch(data, stage.file_programs_shared, mode, &status);
+ }
+ }
+
+ if (setting.build_static) {
+ if (F_status_is_fine(status) && f_file_exists(stage.file_objects_static.string) != F_true) {
+ // @todo
+ //status = fake_build_objects_static();
+
+ fake_build_touch(data, stage.file_objects_static, mode, &status);
+ }
+
+ if (F_status_is_fine(status) && f_file_exists(stage.file_libraries_static.string) != F_true) {
+ // @todo
+ //status = fake_build_libraries_static();
+
+ fake_build_touch(data, stage.file_libraries_static, mode, &status);
+ }
+
+ if (F_status_is_fine(status) && f_file_exists(stage.file_programs_static.string) != F_true) {
+ // @todo
+ //status = fake_build_programs_static();
+
+ fake_build_touch(data, stage.file_programs_static, mode, &status);
+ }
}
}
- // @todo: may have to process all data intended to be used in parameters, exploding them into console parameters.
- // Steps:
- // 1) copy sources setting to build setting. done.
- // 2) copy sources headers to build headers. done.
- // 3) if shared=yes and library sources exist, compile shared libraries and make links.
- // 4) if shared=yes and program sources exist, compile shared programs.
- // 5) if static=yes and library sources exist, compile static objects.
- // 6) if static=yes and library sources exist, link static objects into static library (appending objects to path for static programs to compile against).
- // 7) if static=yes and program sources exist, compile static programs (include any static objects).
- // 8) touch build file designating that build fully completed.
+ if (F_status_is_fine(status) && f_file_exists(stage.file_process_post.string) != F_true) {
+ status = fake_build_execute_process_script(data, setting, setting.process_post);
- status = fake_build_execute_process_script(data, setting, setting.process_post);
+ fake_build_touch(data, stage.file_process_post, mode, &status);
+ }
fake_macro_build_settings_delete_simple(setting);
+ fake_macro_build_stage_delete_simple(stage);
return status;
}
}
#endif // _di_fake_build_setting_load_
+#ifndef _di_fake_build_stage_load_
+ f_return_status fake_build_stage_load(const fake_data data, fake_build_stage *stage) {
+ f_status status = F_none;
+
+ const f_string names[] = {
+ fake_build_stage_libraries_shared,
+ fake_build_stage_libraries_static,
+ fake_build_stage_objects_static,
+ fake_build_stage_process_post,
+ fake_build_stage_process_pre,
+ fake_build_stage_programs_shared,
+ fake_build_stage_programs_static,
+ fake_build_stage_skeleton,
+ fake_build_stage_sources_headers,
+ fake_build_stage_sources_settings,
+ };
+
+ const f_string_length lengths[] = {
+ fake_build_stage_libraries_shared_length,
+ fake_build_stage_libraries_static_length,
+ fake_build_stage_objects_static_length,
+ fake_build_stage_process_post_length,
+ fake_build_stage_process_pre_length,
+ fake_build_stage_programs_shared_length,
+ fake_build_stage_programs_static_length,
+ fake_build_stage_skeleton_length,
+ fake_build_stage_sources_headers_length,
+ fake_build_stage_sources_settings_length,
+ };
+
+ f_string_dynamic *values[] = {
+ &stage->file_libraries_shared,
+ &stage->file_libraries_static,
+ &stage->file_objects_static,
+ &stage->file_process_post,
+ &stage->file_process_pre,
+ &stage->file_programs_shared,
+ &stage->file_programs_static,
+ &stage->file_skeleton,
+ &stage->file_sources_headers,
+ &stage->file_sources_settings,
+ };
+
+ for (uint8_t i = 0; i < fake_build_stage_total; i++) {
+ status = fl_string_dynamic_append_nulless(data.path_build_stage, values[i]);
+ if (F_status_is_error(status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true);
+ break;
+ }
+
+ status = fl_string_append_nulless(names[i], lengths[i], values[i]);
+ if (F_status_is_error(status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true);
+ break;
+ }
+
+ status = fl_string_dynamic_terminate(values[i]);
+ if (F_status_is_error(status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_terminate", F_true);
+ break;
+ }
+ } // for
+
+ return status;
+ }
+#endif // _di_fake_build_stage_load_
+
+#ifndef _di_fake_build_touch_
+ void fake_build_touch(const fake_data data, const f_string_dynamic file, const f_mode mode, f_status *status) {
+ if (F_status_is_fine(*status)) {
+ *status = f_file_touch(file.string, mode.regular, F_false);
+
+ if (F_status_is_error(*status)) {
+ fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_file_touch", F_true);
+ }
+ }
+ }
+#endif // _di_fake_build_touch_
+
#ifdef __cplusplus
} // extern "C"
#endif
#define fake_build_setting_bool_no_length 2
#endif // _di_fake_build_setting_
+#ifndef _di_fake_build_stage_
+ typedef struct {
+ f_string_dynamic file_libraries_shared;
+ f_string_dynamic file_libraries_static;
+ f_string_dynamic file_objects_static;
+ f_string_dynamic file_process_post;
+ f_string_dynamic file_process_pre;
+ f_string_dynamic file_programs_shared;
+ f_string_dynamic file_programs_static;
+ f_string_dynamic file_skeleton;
+ f_string_dynamic file_sources_headers;
+ f_string_dynamic file_sources_settings;
+ } fake_build_stage;
+
+ #define fake_build_stage_initialize { \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ f_string_dynamic_initialize, \
+ }
+
+ #define fake_build_stage_total 10
+
+ #define fake_macro_build_stage_delete_simple(stage) \
+ f_macro_string_dynamic_delete_simple(stage.file_libraries_shared) \
+ f_macro_string_dynamic_delete_simple(stage.file_libraries_static) \
+ f_macro_string_dynamic_delete_simple(stage.file_objects_static) \
+ f_macro_string_dynamic_delete_simple(stage.file_process_post) \
+ f_macro_string_dynamic_delete_simple(stage.file_process_pre) \
+ f_macro_string_dynamic_delete_simple(stage.file_programs_shared) \
+ f_macro_string_dynamic_delete_simple(stage.file_programs_static) \
+ f_macro_string_dynamic_delete_simple(stage.file_skeleton) \
+ f_macro_string_dynamic_delete_simple(stage.file_sources_headers) \
+ f_macro_string_dynamic_delete_simple(stage.file_sources_settings)
+
+ #define fake_build_stage_libraries_shared "libraries_shared.built"
+ #define fake_build_stage_libraries_static "libraries_static.built"
+ #define fake_build_stage_objects_static "objects_static.built"
+ #define fake_build_stage_process_post "process_post.built"
+ #define fake_build_stage_process_pre "process_pre.built"
+ #define fake_build_stage_programs_shared "programs_shared.built"
+ #define fake_build_stage_programs_static "programs_static.built"
+ #define fake_build_stage_skeleton "skeleton.built"
+ #define fake_build_stage_sources_headers "sources_headers.built"
+ #define fake_build_stage_sources_settings "sources_settings.built"
+
+ #define fake_build_stage_libraries_shared_length 22
+ #define fake_build_stage_libraries_static_length 22
+ #define fake_build_stage_objects_static_length 20
+ #define fake_build_stage_process_post_length 18
+ #define fake_build_stage_process_pre_length 17
+ #define fake_build_stage_programs_shared_length 21
+ #define fake_build_stage_programs_static_length 21
+ #define fake_build_stage_skeleton_length 14
+ #define fake_build_stage_sources_headers_length 21
+ #define fake_build_stage_sources_settings_length 22
+#endif // _di_fake_build_stage_
+
/**
* Copy over the data settings files.
*
extern f_return_status fake_build_setting_load(const fake_data data, fake_build_setting *settings) f_gcc_attribute_visibility_internal;
#endif // _di_fake_build_setting_load_
+/**
+ * Load the stage file paths.
+ *
+ * @param data
+ * The program data.
+ * @param stage
+ * All stage file paths.
+ *
+ * @return
+ * F_none on success.
+ * Status codes (with error bit) are returned on any problem.
+ */
+#ifndef _di_fake_build_stage_load_
+ extern f_return_status fake_build_stage_load(const fake_data data, fake_build_stage *stage) f_gcc_attribute_visibility_internal;
+#endif // _di_fake_build_stage_load_
+
+/**
+ * Touch the given build stage file, but only if there are no current errors in status.
+ *
+ * @param data
+ * The program data.
+ * @param file
+ * The file path to touch.
+ * @param mode
+ * The file mode to use.
+ * @param status
+ * The return status.
+ * This gets updated if f_file_touch() is executed.
+ *
+ * @see f_file_touch()
+ */
+#ifndef _di_fake_build_touch_
+ extern void fake_build_touch(const fake_data data, const f_string_dynamic file, const f_mode mode, f_status *status) f_gcc_attribute_visibility_internal;
+#endif // _di_fake_build_touch_
+
#ifdef __cplusplus
} // extern "C"
#endif
};
const uint8_t parameters_length[] = {
- 7,
+ 8,
2,
3,
};
&data->path_build_process,
&data->path_build_programs,
&data->path_build_settings,
+ &data->path_build_stage,
};
f_string_dynamic *parameters_value_1[] = {
fake_path_part_process,
fake_path_part_programs,
fake_path_part_settings,
+ fake_path_part_stage,
fake_path_part_build,
fake_path_part_settings,
fake_path_part_documents,
fake_path_part_process_length,
fake_path_part_programs_length,
fake_path_part_settings_length,
+ fake_path_part_stage_length,
fake_path_part_build_length,
fake_path_part_settings_length,
fake_path_part_documents_length,
&data->path_build_process,
&data->path_build_programs,
&data->path_build_settings,
+ &data->path_build_stage,
&data->path_data_build,
&data->path_data_settings,
&data->path_documents,
&data->path_sources_cpp,
};
- for (i = 0; i < 14; i++) {
+ for (i = 0; i < 15; i++) {
status = fl_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]);
if (F_status_is_error(status)) {
&data->path_build_programs_shared,
&data->path_build_programs_static,
&data->path_build_settings,
+ &data->path_build_stage,
&data->path_data_build,
&data->path_data_settings,
&data->path_licenses,
&data->file_documents_readme,
};
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < 33; i++) {
if (parameters_value[i]->used == 0) continue;
status = fl_string_dynamic_terminate(parameters_value[i]);