]> 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 0b71dfb6c5c3b219cc4b0406898340f648c3720b..00f7d65eb1a41db968d388fe2293465444a9044b 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 421c2f7192d437058e4b643e810618e54b2c120b..35302957f0d9c7e260c37adcedd1e1ab4455ee9f 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 9aca52ca07b69448194bc1d0e689c35332a4eac6..d6c04fcb898bf32b812332248a19bebf12ea9202 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 2d1f4a29ecc08d37358cf90f7e490e1aff511246..2ae883a8740e58c4020723e63e368e381652e64e 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 9a6ae00043d72209773dc388509cb2bb60a32d51..792b43e8068bd9be1e37bb1f334153f333bcacaf 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 667135cb84e3502f0cba44beb466401ed2f849a6..8813f2dd2ccfd110623f2e453714507c7ead1a8e 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 7ed5f0c8ded5ea959c425cf04601a0db4b0ff2bf..3ad9dd7f1aa35f7f329089a6157cafdf38b62029 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 0b740593e4422033db70e828499ba3a603aaecf1..3519b3dfedaaf054a82df208eec1ecd5d86b1ac3 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 af2b4c2bac4ade69721508d101e66ecda69d5f22..42317c62c2d8a051ea2f98f769d3065693253693 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 8d8af5a542d3c33a55652dd699c61a3d30479e38..5d9863a79832f5ef929d90204457d328e29aea6f 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 c53f36e8d02707f621c9594cb5cbec164afd9bdd..de1c56d409d1b8f9b9b569d488533741b6303ea6 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 7d25b5359dceb25340badd14579aa35ea0992d71..bf8362bca5ed38af13a0245cea07f0cbe682ae9f 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 8d7f12583a8d6ab4555cd8a5e008005d84403866..bb457991ad82bb42532b34a9a653be5f5e365d1a 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 15844d0d264082346678de9b53867f15cee5316e..b126df58884737f3b8f5270919b3daa72821f4d8 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 67731ddcc7fe076802bf4ba3f5f5fbe8244fd9ef..17aab4ebdc640320c263f7c26eaf5a6a645da52d 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 0ed3d6ecbd362613c711947c08df15bbc5def8c4..35a58ec628644b8792f372032754278f2093f955 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 86780d42c0a01e59d4f8313b071d2e984a6172f7..b1018923a31ac82e7fb4358d3aa075a075594496 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 d5227b2a42685cd9ddd03b6f9c24c348a4ada21c..e719414e52b989ff9fa8139c690876745337d3c3 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 b2599bf0ee2ebcd26c262d8e299c2dce48517221..8b767749cb58ba99c50195805f6ae18676afcf45 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 7f405be1f5d37b0c3f37c0087256158ebcd636ae..22514cb4a9120e4be3b84916d27faa7915e3512f 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 2f98ab7351da0b1752c44da2f2c3cda3efc42aab..ac713d126757f2e82ab6e5881272fc37d558fb07 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 0010e5210f1fce923f6c946e01958e90dd6a7503..280f6f5a9af8eb4f8d91dc67a96b5ed53b84ddf3 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 ea9140bcd27cb7c06148158ff20cb6f5a4695ba3..1e91f5deecae95aba8949b8b9461d2a011c79913 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 07d5ed72589736881708b007334dbe25e82adc4b..358b08cc9dd8c572674972cd3e44ea6ef3383f74 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 d7f82d4d530bb399ccb834dc2afdd1d6a9b4526c..4e9894b0b3c97af04d67bd66d92e8b2ba9e767c0 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 df814a463584f6b22228f0d74e547a53299a5abd..700d1127ba5dec62518af25d935fee7d72aeaaf2 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 009d2fbec14e86fc63ac05e6abd70ac22affc79d..d328a275a78708bc4b1467fd721115dfd07de456 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 35b3266fd336a00197373e5c917c699c6b31324d..ffa7202e8d839b7311e1a628336bae861841dd84 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 916ffc1cee49d1e92e4569ac47a6fb2797c21e67..a77ee62e0b86f032a80c99174b43147f64697949 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 c42df556c3248cdf661b537664b0cf127d174bbe..e5a7a3ec57d81ca6c51baf2e3f650d2990cbd3da 100644 (file)
@@ -87,6 +87,45 @@ extern "C" {
 #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.
  *
  * The paths must not contain NULL except for the terminating NULL.
index 4b2a5775a36d348e8a39542ede50419a6e3e31ea..67d09a8966c96c6b8d2d891a638d7b64b1ec1d1f 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 fe254d03aa6d6b089b423bb5cec7c427929bb1a1..7449c3e2a7950f691fbdb58be87aa534c89ab5ac 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 594af8627541793d9dd46844be04c70e86078133..3910c9068e2580369ccda708b06d4c2402ed8320 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 ff1dbf2d030546f92be6050a88647958ccab4f4c..9870d7cfe0a9a8c80a1623e93190e9bdd0a0c85b 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 5d1b1ffb5fdc5a90c1ea1a89bdacb18c4ee264f6..a9bad593c7d6126b48bc8ed8c9b1dd3d833ef52a 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 3553e5d5e134d1029dbdff9d7e0182e59cfd24e5..b6d9a5fce5cfebadd73e212c32cacfdb98637e03 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 aa8397dac7b764a3810d1fff62ad90bdabec9679..27b62173baf5fcc18873ba7a9bfa36473a2af2bb 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 40b5d5a2716739fa90435e5e9e58d43b09786a5b..bfdc9706ca702f0e778fa208d72b267b21f6fa33 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 e22ef885e01dc5eff4ad545d7d77b80dad509811..194b7313e7758d6cc0e4174d2d176fe6795b37fc 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 5975a30de1639eded52af78c7c61d65c6e026c8c..f6dac976a13cae5b3a146f9c86886c9bc2fc7b40 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 bee83285b352711683783d1c47cbcb25fb911d3b..aec09665b5af16819d4558118869489a03068e96 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 9f2a17e506dc78d13206e40722cb21d2cd185bbd..2aea06bcc2ad15b7093525d3e4b61414a86f7881 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 7a8f602da97631828d9889e24c6f74ee836df33a..c98f4e253cf754ed06dc9f4394190f4dbcffbca8 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 f5292c6b5945483263e65619203d6fc36f882dca..0a6a78660452098f7d6416490754816ee270298a 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 0443978b2c76521c5f84a481fd8d5ecc9e56cf4d..8d9f95702fed250eed56d011f496df49f72100a3 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 3263070f5941fcbd90602e40b4d3c79e6f34721f..046342397edeffed5b2ee1a55278aafe7b9ad2df 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 982858cefc40ea416ec86acc74a4c2ab3249eeef..bfa8914593ca922e964952973453905316cd82e2 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 92c7e2eae1272003a491e79002920614232419b5..24b64fe8e7e83f239719a2b04bbdf3e508dd6fa9 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 f0d86db2138a4818bb33e047906589ddbbfcb2da..309bfafca341357b90026780bfc2ae2061b302e3 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 1060e1e84a37ae27d63a911c82c867264446919e..c88a2b451d3c38ad04e055b2e2d87e201b68f870 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 ad955d7af74941f9f6481fc7956a11e679bcd1fd..062134d489175f61df52997fc6af60a133aff54e 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 e01a332e9cc8b3822148cf87d9864282da4243f5..12603ca2e586bdc326c638bac968d167c9dc2a5b 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 a3a7d69b096fa956ca449018dcbe1775518d4663..87dd4dcf4cd0879eebe406ac17742506e973c95d 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 8b7e63d3ac8d224d992750da03421b012dc683d4..906aa1f57be1c527aae140e939bf2b3773640081 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 adb4ea271de7e349b46e52fc94d8930fe6641509..a9bb147ce6c4ff30a3cc015f2179ef2183af4939 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 851c9394323099f99b3d8947859a5c1293d7f9d9..6635285e39fe58a4a26c9f87d6c78196cbe8fb79 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 f351f90d68f439ad501af015bb91ca51996d9ccd..f2ed02020f8e91866a8f8ddfcb78f5ed244c3065 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 bd370229aaf662948307aa3175cfeec78a82288e..08f0016a4813bc2ae15eb50cf62ae041a331718a 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 9c03d08f853080dac6d0d38fb5f5ede00c278ae4..3af122f688f6cd6e6ba8e37f2bdbb11e2ff95c42 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 5050311246c1ed87725c983a42aaac942fc92b59..810c1ac3626f61c8ffd28360d9ad92476732a753 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 aaed02be982499845284b16414f6dd4cae42fc41..01e1b2041caa3b6f25c9bcbc33d4b77a3a48d49a 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 d55a35ad3be50d82fce04b81f8f4c148e4bfcfa2..f177e53f166d90fc796932d797fc760f2098a5c3 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 c04f8e7f1dea6c3d9058b5388696f6bd740ad58a..b56c5faebcfef09b79c71b82b19f60c230dc986b 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 39f8c8ee6f682fa21058d4391a940114dd0304ca..8118e46b5ca8e4e34273b7ab06c03d85c5e316de 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 875584fb31cf6086ba814e26a87a8681f093a105..8dd1161a9bad4b4fe847f3277bd29b48ab15fd49 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