]> Kevux Git Server - fll/commitdiff
Bugfix: Fake building monolithic FLL is not compiling due to header directory structu...
authorKevin Day <thekevinday@gmail.com>
Wed, 4 Nov 2020 06:32:04 +0000 (00:32 -0600)
committerKevin Day <thekevinday@gmail.com>
Wed, 4 Nov 2020 06:40:54 +0000 (00:40 -0600)
The header directory structure is being preserved by the bootstrap.sh but not by Fake.

Introduce a new setting, 'path_headers_preserve' as a yes/no boolean.
This designates that the path for headers should be preserved or not.
In the case of the monolithic build, path_headers_preserve must be 'yes'.

Provide a new function fl_directory_create() to make it easy to create an entire directory tree.

Fake is now aware of this new 'path_headers_preserve', setting.
When supplied, it will make sure to preserve the directory tree, such as 'level_0/' in the monolithic build header file 'level_0/color.h'.

Both Fake and the bootstrap script should now behave the same in this respect.

The changes in this commit have been quickly thrown together.
This will need additional reviewing.

65 files changed:
build/level_0/settings
build/level_1/settings
build/level_2/settings
build/monolithic/settings
build/scripts/bootstrap.sh
level_0/f_account/data/build/settings
level_0/f_color/data/build/settings
level_0/f_console/data/build/settings
level_0/f_conversion/data/build/settings
level_0/f_directory/data/build/settings
level_0/f_environment/data/build/settings
level_0/f_file/data/build/settings
level_0/f_fss/data/build/settings
level_0/f_iki/data/build/settings
level_0/f_memory/data/build/settings
level_0/f_path/data/build/settings
level_0/f_pipe/data/build/settings
level_0/f_print/data/build/settings
level_0/f_serialize/data/build/settings
level_0/f_signal/data/build/settings
level_0/f_socket/data/build/settings
level_0/f_status/data/build/settings
level_0/f_string/data/build/settings
level_0/f_type/data/build/settings
level_0/f_utf/data/build/settings
level_1/fl_color/data/build/settings
level_1/fl_console/data/build/settings
level_1/fl_conversion/data/build/settings
level_1/fl_directory/c/directory.c
level_1/fl_directory/c/directory.h
level_1/fl_directory/data/build/settings
level_1/fl_environment/data/build/settings
level_1/fl_fss/data/build/settings
level_1/fl_iki/data/build/settings
level_1/fl_print/data/build/settings
level_1/fl_status/data/build/settings
level_1/fl_string/data/build/settings
level_1/fl_utf/data/build/settings
level_1/fl_utf_file/data/build/settings
level_2/fll_error/data/build/settings
level_2/fll_execute/data/build/settings
level_2/fll_file/data/build/settings
level_2/fll_fss/data/build/settings
level_2/fll_iki/data/build/settings
level_2/fll_path/data/build/settings
level_2/fll_program/data/build/settings
level_2/fll_status/data/build/settings
level_3/byte_dump/data/build/settings
level_3/fake/c/private-build.c
level_3/fake/c/private-build.h
level_3/fake/data/build/settings
level_3/firewall/data/build/settings
level_3/fss_basic_list_read/data/build/settings
level_3/fss_basic_list_write/data/build/settings
level_3/fss_basic_read/data/build/settings
level_3/fss_basic_write/data/build/settings
level_3/fss_extended_list_read/data/build/settings
level_3/fss_extended_list_write/data/build/settings
level_3/fss_extended_read/data/build/settings
level_3/fss_extended_write/data/build/settings
level_3/fss_status_code/data/build/settings
level_3/iki_read/data/build/settings
level_3/iki_write/data/build/settings
level_3/init/data/build/settings
level_3/status_code/data/build/settings

index 0b71dfb..00f7d65 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 421c2f7..3530295 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 9aca52c..d6c04fc 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 2d1f4a2..2ae883a 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers
+path_headers_preserve yes
 path_library_script script
 path_library_shared shared
 path_library_static static
index 9a6ae00..792b43e 100644 (file)
@@ -449,40 +449,41 @@ bootstrap_id() {
     "modes_default") echo -n 22;;
     "path_language") echo -n 23;;
     "path_headers") echo -n 24;;
-    "path_library_script") echo -n 25;;
-    "path_library_shared") echo -n 26;;
-    "path_library_static") echo -n 27;;
-    "path_program_script") echo -n 28;;
-    "path_program_shared") echo -n 29;;
-    "path_program_static") echo -n 30;;
-    "path_sources") echo -n 31;;
-    "path_standard") echo -n 32;;
-    "process_post") echo -n 33;;
-    "process_pre") echo -n 34;;
-    "project_name") echo -n 35;;
-    "search_exclusive") echo -n 36;;
-    "search_shared") echo -n 37;;
-    "search_static") echo -n 38;;
-    "version_major") echo -n 39;;
-    "version_micro") echo -n 40;;
-    "version_minor") echo -n 41;;
-    "version_target") echo -n 42;;
-
-    "build_libraries-$mode") echo -n 43;;
-    "build_sources_headers-$mode") echo -n 44;;
-    "build_sources_library-$mode") echo -n 45;;
-    "build_sources_program-$mode") echo -n 46;;
-    "build_sources_setting-$mode") echo -n 47;;
-    "build_sources_script-$mode") echo -n 48;;
-    "defines_all-$mode") echo -n 49;;
-    "defines_shared-$mode") echo -n 50;;
-    "defines_static-$mode") echo -n 51;;
-    "environment-$mode") echo -n 52;;
-    "flags_all-$mode") echo -n 53;;
-    "flags_library-$mode") echo -n 54;;
-    "flags_program-$mode") echo -n 55;;
-    "flags_shared-$mode") echo -n 56;;
-    "flags_static-$mode") echo -n 57;;
+    "path_headers_preserve") echo -n 25;;
+    "path_library_script") echo -n 26;;
+    "path_library_shared") echo -n 27;;
+    "path_library_static") echo -n 28;;
+    "path_program_script") echo -n 29;;
+    "path_program_shared") echo -n 30;;
+    "path_program_static") echo -n 31;;
+    "path_sources") echo -n 32;;
+    "path_standard") echo -n 33;;
+    "process_post") echo -n 34;;
+    "process_pre") echo -n 35;;
+    "project_name") echo -n 36;;
+    "search_exclusive") echo -n 37;;
+    "search_shared") echo -n 38;;
+    "search_static") echo -n 39;;
+    "version_major") echo -n 40;;
+    "version_micro") echo -n 41;;
+    "version_minor") echo -n 42;;
+    "version_target") echo -n 43;;
+
+    "build_libraries-$mode") echo -n 44;;
+    "build_sources_headers-$mode") echo -n 45;;
+    "build_sources_library-$mode") echo -n 46;;
+    "build_sources_program-$mode") echo -n 47;;
+    "build_sources_setting-$mode") echo -n 48;;
+    "build_sources_script-$mode") echo -n 49;;
+    "defines_all-$mode") echo -n 50;;
+    "defines_shared-$mode") echo -n 51;;
+    "defines_static-$mode") echo -n 52;;
+    "environment-$mode") echo -n 53;;
+    "flags_all-$mode") echo -n 54;;
+    "flags_library-$mode") echo -n 55;;
+    "flags_program-$mode") echo -n 56;;
+    "flags_shared-$mode") echo -n 57;;
+    "flags_static-$mode") echo -n 58;;
   esac
 }
 
@@ -509,7 +510,7 @@ bootstrap_load_settings() {
     return 1
   fi
 
-  for i in build_compiler build_indexer build_language build_libraries build_script build_shared build_sources_headers build_sources_library build_sources_program build_sources_setting build_sources_script build_static defines_all defines_shared defines_static environment flags_all flags_library flags_program flags_shared flags_static modes modes_default path_language path_headers path_library_script path_library_shared path_library_static path_program_script path_program_shared path_program_static path_sources path_standard process_post process_pre project_name search_exclusive search_shared search_static version_major version_micro version_minor ; do
+  for i in build_compiler build_indexer build_language build_libraries build_script build_shared build_sources_headers build_sources_library build_sources_program build_sources_setting build_sources_script build_static defines_all defines_shared defines_static environment flags_all flags_library flags_program flags_shared flags_static modes modes_default path_language path_headers path_headers_preserve path_library_script path_library_shared path_library_static path_program_script path_program_shared path_program_static path_sources path_standard process_post process_pre project_name search_exclusive search_shared search_static version_major version_micro version_minor ; do
     variables[$(bootstrap_id $i)]=$(grep -s -o "^[[:space:]]*$i[[:space:]].*\$" $settings_file | sed -e "s|^[[:space:]]*$i\>||" -e 's|^[[:space:]]*||')
   done
 }
@@ -581,6 +582,7 @@ bootstrap_operation_build() {
   local alt=$1
   local directory=
   local path_headers=${variables[$(bootstrap_id path_headers)]}
+  local path_headers_preserve=${variables[$(bootstrap_id path_headers_preserve)]}
 
   if [[ $target == "" ]] ; then
     target="major"
@@ -831,7 +833,7 @@ bootstrap_operation_build() {
       for i in $sources_headers ; do
         directory=$(dirname $i)
 
-        if [[ $directory == "." ]] ; then
+        if [[ $directory == "." || $path_headers_preserve != "yes" ]] ; then
           cp $verbose -f $path_c$i ${path_build}includes/ || failure=1
         else
           mkdir $verbose -p ${path_build}includes/$directory || failure=1
index 667135c..8813f2d 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 7ed5f0c..3ad9dd7 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 0b74059..3519b3d 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index af2b4c2..42317c6 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 8d8af5a..5d9863a 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index c53f36e..de1c56d 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 7d25b53..bf8362b 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 8d7f125..bb45799 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 15844d0..b126df5 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 67731dd..17aab4e 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 0ed3d6e..35a58ec 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 86780d4..b101892 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index d5227b2..e719414 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index b2599bf..8b76774 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 7f405be..22514cb 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 2f98ab7..ac713d1 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 0010e52..280f6f5 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index ea9140b..1e91f5d 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 07d5ed7..358b08c 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index d7f82d4..4e9894b 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_0
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index df814a4..700d112 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 009d2fb..d328a27 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 35b3266..ffa7202 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 916ffc1..a77ee62 100644 (file)
@@ -5,6 +5,50 @@
 extern "C" {
 #endif
 
+#ifndef _di_fl_directory_create_
+  f_return_status fl_directory_create(const f_string_t path, const f_string_length_t length, const mode_t mode) {
+    #ifndef _di_level_1_parameter_checking_
+      if (!path) return F_status_set_error(F_parameter);
+    #endif // _di_level_1_parameter_checking_
+
+    if (!length) {
+      return F_data_not;
+    }
+
+    f_status_t status = f_directory_exists(path);
+
+    if (F_status_is_error(status)) return status;
+    if (status == F_true) return F_directory_found;
+
+    {
+      f_string_length_t at_tree = 0;
+      f_string_length_t at_path = 0;
+
+      char tree[length];
+
+      for (; path[at_path]; ++at_path) {
+
+        if (at_path && path[at_path] == f_path_separator[0]) {
+          memcpy(tree, path + at_tree, at_path - at_tree);
+          tree[at_path] = 0;
+
+          status = f_directory_exists(tree);
+          if (F_status_is_error(status)) return status;
+
+          if (status == F_false) {
+            status = f_directory_create(tree, mode);
+            if (F_status_is_error(status)) return status;
+          }
+
+          at_tree = at_path;
+        }
+      } // for
+    }
+
+    return f_directory_create(path, mode);
+  }
+#endif // _di_fl_directory_create_
+
 #ifndef _di_fl_directory_clone_
   f_return_status fl_directory_clone(const f_string_t source, const f_string_t destination, const f_string_length_t source_length, const f_string_length_t destination_length, const bool role, const fl_directory_recurse_t recurse) {
     #ifndef _di_level_1_parameter_checking_
index c42df55..e5a7a3e 100644 (file)
@@ -86,6 +86,45 @@ extern "C" {
   #define fl_directory_recurse_t_initialize { fl_directory_recurse_depth_max, f_file_default_read_size, F_false, f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), 0, 0 }
 #endif // _di_fl_directory_recurse_t_
 
+/**
+ * Create all directories at the given path.
+ *
+ * The paths must not contain NULL except for the terminating NULL.
+ * The paths must be NULL terminated.
+ *
+ * @param path
+ *   The file path to the directory.
+ * @param length
+ *   The length of the path string.
+ * @param mode
+ *   The directory mode to use when creating.
+ *   This is applied to all created directories.
+ *
+ * @return
+ *   F_none on success.
+ *   F_data_not on success, but there was no string to process (length is 0).
+ *   F_directory_found on success, but the directory already exists.
+ *   F_access_denied (with error bit) on access denied.
+ *   F_directory (with error bit) if a supposed directory in path is not actually a directory.
+ *   F_directory_link_max (with error bit) max links limit reached or exceeded.
+ *   F_file_found (with error bit) of a directory aleady exists at the path.
+ *   F_file_found_not (with error bit) if a file within the path is not found (such as a broken symbolic link).
+ *   F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted.
+ *   F_loop (with error bit) on loop error.
+ *   F_memory_out (with error bit) if out of memory.
+ *   F_name (with error bit) on path name error.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *   F_prohibited (with error bit) if filesystem does not allow for removing.
+ *   F_read_only (with error bit) if file is read-only.
+ *   F_space_not (with error bit) if filesystem is out of space (or filesystem quota is reached).
+ *   F_failure (with error bit) for any other error.
+ *
+ * @see f_directory_create()
+ */
+#ifndef _di_fl_directory_create_
+  extern f_return_status fl_directory_create(const f_string_t path, const f_string_length_t length, const mode_t mode);
+#endif // _di_fl_directory_create_
+
 /**
  * Copy a directory and its contents, as well as its file mode and possibly the owner and group.
  *
index 4b2a577..67d09a8 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index fe254d0..7449c3e 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 594af86..3910c90 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index ff1dbf2..9870d7c 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 5d1b1ff..a9bad59 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 3553e5d..b6d9a5f 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index aa8397d..27b6217 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 40b5d5a..bfdc970 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index e22ef88..194b731 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_1
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 5975a30..f6dac97 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index bee8328..aec0966 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 9f2a17e..2aea06b 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 7a8f602..c98f4e2 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index f5292c6..0a6a786 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 0443978..8d9f957 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 3263070..0463423 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 982858c..bfa8914 100644 (file)
@@ -30,6 +30,7 @@ build_shared yes
 build_static yes
 
 path_headers level_2
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 92c7e2e..24b64fe 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index f0d86db..309bfaf 100644 (file)
@@ -164,7 +164,7 @@ extern "C" {
 #endif // _di_fake_build_arguments_standard_add_
 
 #ifndef _di_fake_build_copy_
-  void fake_build_copy(const fake_data_t data, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, f_status_t *status) {
+  void fake_build_copy(const fake_data_t data, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_string_length_t preserve, f_status_t *status) {
     if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return;
 
     if (fake_signal_received(data)) {
@@ -175,6 +175,7 @@ extern "C" {
     f_directory_statuss_t failures = f_directory_statuss_t_initialize;
     f_string_dynamic_t path_source = f_string_dynamic_t_initialize;
     f_string_dynamic_t destination_file = f_string_dynamic_t_initialize;
+    f_string_dynamic_t destination_directory = f_string_dynamic_t_initialize;
 
     if (data.error.verbosity != f_console_verbosity_quiet) {
       fprintf(data.output.stream, "%c", f_string_eol[0]);
@@ -255,6 +256,7 @@ extern "C" {
       }
       else if (*status == F_false) {
         destination_file.used = 0;
+        destination_directory.used = 0;
 
         *status = fl_string_dynamic_append_nulless(destination, &destination_file);
 
@@ -263,11 +265,49 @@ extern "C" {
           break;
         }
 
-        *status = f_file_name_base(path_source.string, path_source.used, &destination_file);
+        if (preserve && preserve < path_source.used) {
+          *status = fl_string_dynamic_append_nulless(destination, &destination_directory);
 
-        if (F_status_is_error(*status)) {
-          fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_base", F_true);
-          break;
+          if (F_status_is_error(*status)) {
+            fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true);
+            break;
+          }
+
+          *status = f_file_name_directory(path_source.string + preserve, path_source.used - preserve, &destination_directory);
+
+          if (F_status_is_error(*status)) {
+            fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_directory", F_true);
+            break;
+          }
+
+          *status = fl_string_dynamic_terminate_after(&destination_directory);
+
+          if (F_status_is_error(*status)) {
+            fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true);
+            break;
+          }
+
+          *status = fl_directory_create(destination_directory.string, destination_directory.used, f_file_mode_all_rwx);
+
+          if (F_status_is_error(*status)) {
+            fll_error_file_print(data.error, F_status_set_fine(*status), "fl_directory_create", F_true, destination_directory.string, "create", fll_error_file_type_directory);
+            break;
+          }
+
+          *status = fl_string_append(path_source.string + preserve, path_source.used - preserve, &destination_file);
+
+          if (F_status_is_error(*status)) {
+            fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append", F_true);
+            break;
+          }
+        }
+        else {
+          *status = f_file_name_base(path_source.string, path_source.used, &destination_file);
+
+          if (F_status_is_error(*status)) {
+            fll_error_print(data.error, F_status_set_fine(*status), "f_file_name_base", F_true);
+            break;
+          }
         }
 
         *status = fl_string_dynamic_terminate_after(&destination_file);
@@ -304,6 +344,7 @@ extern "C" {
     f_macro_directory_statuss_t_delete_simple(failures);
     f_macro_string_dynamic_t_delete_simple(path_source);
     f_macro_string_dynamic_t_delete_simple(destination_file);
+    f_macro_string_dynamic_t_delete_simple(destination_directory);
 
     if (F_status_is_error_not(*status)) {
       fake_build_touch(data, file_stage, status);
@@ -1414,6 +1455,7 @@ extern "C" {
       fake_build_setting_name_modes,
       fake_build_setting_name_modes_default,
       fake_build_setting_name_path_headers,
+      fake_build_setting_name_path_headers_preserve,
       fake_build_setting_name_path_language,
       fake_build_setting_name_path_library_script,
       fake_build_setting_name_path_library_shared,
@@ -1460,6 +1502,7 @@ extern "C" {
       fake_build_setting_name_modes_length,
       fake_build_setting_name_modes_default_length,
       fake_build_setting_name_path_headers_length,
+      fake_build_setting_name_path_headers_preserve_length,
       fake_build_setting_name_path_language_length,
       fake_build_setting_name_path_library_script_length,
       fake_build_setting_name_path_library_shared_length,
@@ -1488,6 +1531,7 @@ extern "C" {
     f_string_dynamics_t build_shared = f_string_dynamics_t_initialize;
     f_string_dynamics_t build_static = f_string_dynamics_t_initialize;
     f_string_dynamics_t path_headers = f_string_dynamics_t_initialize;
+    f_string_dynamics_t path_headers_preserve = f_string_dynamics_t_initialize;
     f_string_dynamics_t path_language = f_string_dynamics_t_initialize;
     f_string_dynamics_t path_library_script = f_string_dynamics_t_initialize;
     f_string_dynamics_t path_library_shared = f_string_dynamics_t_initialize;
@@ -1533,6 +1577,7 @@ extern "C" {
       &setting->modes,
       &setting->modes_default,
       &path_headers,
+      &path_headers_preserve,
       &path_language,
       &path_library_script,
       &path_library_shared,
@@ -1661,6 +1706,7 @@ extern "C" {
         fake_build_setting_name_build_shared,
         fake_build_setting_name_build_static,
         fake_build_setting_name_path_headers,
+        fake_build_setting_name_path_headers_preserve,
         fake_build_setting_name_path_language,
         fake_build_setting_name_path_library_script,
         fake_build_setting_name_path_library_shared,
@@ -1690,6 +1736,7 @@ extern "C" {
         &build_shared,
         &build_static,
         &path_headers,
+        &path_headers_preserve,
         &path_language,
         &path_library_script,
         &path_library_shared,
@@ -1719,6 +1766,7 @@ extern "C" {
         &setting->build_shared,
         &setting->build_static,
         0,
+        &setting->path_headers_preserve,
         0,
         0,
         0,
@@ -1744,6 +1792,7 @@ extern "C" {
         0,
         0,
         &setting->path_headers,
+        0,
         &setting->path_language,
         &setting->path_library_script,
         &setting->path_library_shared,
@@ -1796,6 +1845,7 @@ extern "C" {
         0,
         0,
         0,
+        0,
         &setting->version_target,
       };
 
@@ -1808,6 +1858,7 @@ extern "C" {
         1,
         1,
         2,
+        1,
         2,
         2,
         2,
@@ -1829,7 +1880,7 @@ extern "C" {
         5,
       };
 
-      for (f_array_length_t i = 0; i < 26; i++) {
+      for (f_array_length_t i = 0; i < 27; i++) {
         if (!settings_single_source[i]->used) continue;
 
         if (settings_single_source[i]->used > 1) {
@@ -1967,6 +2018,7 @@ extern "C" {
     f_macro_string_dynamics_t_delete_simple(build_shared);
     f_macro_string_dynamics_t_delete_simple(build_static);
     f_macro_string_dynamics_t_delete_simple(path_headers);
+    f_macro_string_dynamics_t_delete_simple(path_headers_preserve);
     f_macro_string_dynamics_t_delete_simple(path_language);
     f_macro_string_dynamics_t_delete_simple(path_library_script);
     f_macro_string_dynamics_t_delete_simple(path_library_shared);
@@ -2517,7 +2569,7 @@ extern "C" {
 
     fake_build_execute_process_script(data, data_build, data_build.setting.process_pre, stage.file_process_pre, &status);
 
-    fake_build_copy(data, mode, "setting files", data.path_data_settings, data.path_build_settings, data_build.setting.build_sources_setting, stage.file_sources_settings, &status);
+    fake_build_copy(data, mode, "setting files", data.path_data_settings, data.path_build_settings, data_build.setting.build_sources_setting, stage.file_sources_settings, 0, &status);
 
     if (data_build.setting.build_language == fake_build_language_type_bash) {
       fake_build_libraries_script(data, data_build, mode, stage.file_libraries_script, &status);
@@ -2525,7 +2577,7 @@ extern "C" {
       fake_build_programs_script(data, data_build, mode, stage.file_programs_script, &status);
 
       if (data_build.setting.build_script) {
-        fake_build_copy(data, mode, "scripts", data.path_sources_script, data.path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, &status);
+        fake_build_copy(data, mode, "scripts", data.path_sources_script, data.path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
       }
     }
     else {
@@ -2543,6 +2595,8 @@ extern "C" {
           path_sources = &data_build.setting.path_sources;
         }
 
+        const f_string_length_t path_sources_base_length = path_sources->used;
+
         f_string_static_t path_headers = f_string_static_t_initialize;
         f_string_length_t directory_headers_length = data.path_build_includes.used + data_build.setting.path_headers.used;
 
@@ -2568,7 +2622,7 @@ extern "C" {
           path_headers.size = directory_headers_length + 1;
         }
 
-        fake_build_copy(data, mode, "header files", *path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, &status);
+        fake_build_copy(data, mode, "header files", *path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.path_headers_preserve ? path_sources_base_length : 0, &status);
       }
 
       if (data_build.setting.build_shared) {
@@ -2586,7 +2640,7 @@ extern "C" {
       }
 
       if (data_build.setting.build_script) {
-        fake_build_copy(data, mode, "scripts", data.path_sources_script, data.path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, &status);
+        fake_build_copy(data, mode, "scripts", data.path_sources_script, data.path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
       }
     }
 
index 1060e1e..c88a2b4 100644 (file)
@@ -23,6 +23,7 @@ extern "C" {
     bool build_static;
 
     bool path_standard;
+    bool path_headers_preserve;
 
     bool search_exclusive;
     bool search_shared;
@@ -75,6 +76,7 @@ extern "C" {
     F_true, \
     F_true, \
     F_true, \
+    F_true, \
     f_string_dynamic_t_initialize, \
     f_string_dynamic_t_initialize, \
     f_string_dynamic_t_initialize, \
@@ -171,6 +173,7 @@ extern "C" {
   #define fake_build_setting_name_modes                  "modes"
   #define fake_build_setting_name_modes_default          "modes_default"
   #define fake_build_setting_name_path_headers           "path_headers"
+  #define fake_build_setting_name_path_headers_preserve  "path_headers_preserve"
   #define fake_build_setting_name_path_language          "path_language"
   #define fake_build_setting_name_path_library_script    "path_library_script"
   #define fake_build_setting_name_path_library_shared    "path_library_shared"
@@ -215,6 +218,7 @@ extern "C" {
   #define fake_build_setting_name_modes_length                  5
   #define fake_build_setting_name_modes_default_length          13
   #define fake_build_setting_name_path_headers_length           12
+  #define fake_build_setting_name_path_headers_preserve_length  21
   #define fake_build_setting_name_path_language_length          13
   #define fake_build_setting_name_path_library_script_length    19
   #define fake_build_setting_name_path_library_shared_length    19
@@ -235,7 +239,7 @@ extern "C" {
   #define fake_build_setting_name_version_minor_length          13
   #define fake_build_setting_name_version_target_length         14
 
-  #define fake_build_setting_total 43
+  #define fake_build_setting_total 44
 
   #define fake_build_setting_default_version "0"
 
@@ -422,6 +426,15 @@ extern "C" {
  *   The files to copy from source to destination.
  * @param file_stage
  *   The specific stage file path.
+ * @param perserve
+ *   When a positive number, this represents the amount of characters at the front of each file to ignore.
+ *   Everything after that is preserved, and the directory is created if necessary.
+ *
+ *   This is always treated as 0 for any file that is a directory type.
+ *   Set to 0 to disable.
+ *
+ *   Example: 'sources/c/level_0/fss.h' with a preseve of 10, would result in the path of 'level_0/fss.h' being preserved.
+ *            Whereas a preserve of 0 would result in a path of 'fss.h' being used (the 'level_0/' directory is not preserved).
  * @param status
  *   The return status.
  *
@@ -431,7 +444,7 @@ extern "C" {
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fake_build_copy_
-  extern void fake_build_copy(const fake_data_t data, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, f_status_t *status) f_gcc_attribute_visibility_internal;
+  extern void fake_build_copy(const fake_data_t data, const f_mode_t mode, const f_string_t label, const f_string_static_t source, const f_string_static_t destination, const f_string_statics_t files, const f_string_static_t file_stage, const f_string_length_t preserve, f_status_t *status) f_gcc_attribute_visibility_internal;
 #endif // _di_fake_build_copy_
 
 /**
index ad955d7..062134d 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index e01a332..12603ca 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index a3a7d69..87dd4dc 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 8b7e63d..906aa1f 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index adb4ea2..a9bb147 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 851c939..6635285 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index f351f90..f2ed020 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index bd37022..08f0016 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 9c03d08..3af122f 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 5050311..810c1ac 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index aaed02b..01e1b20 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index d55a35a..f177e53 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index c04f8e7..b56c5fa 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 39f8c8e..8118e46 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static
index 875584f..8dd1161 100644 (file)
@@ -32,6 +32,7 @@ build_shared yes
 build_static yes
 
 path_headers level_3
+path_headers_preserve no
 path_library_script script
 path_library_shared shared
 path_library_static static