]> Kevux Git Server - fll/commitdiff
Update: support copying documents, licenses, and specifications per project and do...
authorKevin Day <thekevinday@gmail.com>
Sun, 7 Jun 2020 14:07:06 +0000 (09:07 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 7 Jun 2020 14:07:06 +0000 (09:07 -0500)
Individual projects, specifically programs (level_3), may have custom documentation, licenses, and specifications.
(With custom licenses being least likely because this project in its entirety is under lgpl.)

Add support to all projects just for good practice.

Cleanup ordering of function names and add spaces before function instantiation open brace.

build/scripts/package.sh

index 339be160bd00ab331cc6009abdac563ceea4b4c6..6e04b0390d74a08ad32a3b7367699bf5954d2c53 100644 (file)
@@ -6,7 +6,7 @@
 # These release directories can then be used to compile the project or to package the project.
 # The dependencies of this script are: basename, bash, chmod, grep, and sed.
 
-package_main(){
+package_main() {
   local public_name="Simple FLL Project Package Script"
   local system_name=package
   local called_name=$(basename $0)
@@ -206,7 +206,7 @@ package_main(){
   return 0
 }
 
-package_handle_colors(){
+package_handle_colors() {
   if [[ $do_color == "light" ]] ; then
     c_error="\\033[1;31m"
     c_warning="\\033[0;31m"
@@ -227,7 +227,7 @@ package_handle_colors(){
   fi
 }
 
-package_help(){
+package_help() {
   echo
   echo -e "${c_title}$public_name$c_reset"
   echo -e " ${c_notice}Version $version$c_reset"
@@ -354,55 +354,23 @@ package_create_base_files() {
     fi
   fi
 
-  if [[ $failure != "" ]] ; then
-    package_cleanup
-    exit $failure
-  fi
-}
-
-package_operation_individual(){
-  local failure=
-  local name=
-  local directory=
-  local package=
-
-  if [[ ! -d ${path_destination}individual ]] ; then
-    mkdir -vp ${path_destination}individual
+  if [[ $failure != "" && ! -d ${package}documents ]] ; then
+    mkdir -vp ${package}documents
 
     if [[ $? -ne 0 ]] ; then
-      echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}individual$c_error.$c_reset"
-      package_cleanup
-      exit $failure
+      echo -e "${c_error}ERROR: failed to create directory $c_notice${package}documents$c_error.$c_reset"
+      failure=1
     fi
   fi
 
-  for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ; do
-    name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")"
-    package="${path_destination}individual/${name}-${version}/"
-
-    echo
-    echo -e "${c_highlight}Processing Package$c_reset (individual) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
-
-    package_create_base_files
-
-    cp -vR $directory ${package}sources/
+  if [[ $failure != "" && ! -d ${package}licenses ]] ; then
+    mkdir -vp ${package}licenses
 
     if [[ $? -ne 0 ]] ; then
-      echo -e "${c_error}ERROR: failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset"
+      echo -e "${c_error}ERROR: failed to create directory $c_notice${package}licenses$c_error.$c_reset"
       failure=1
-      break
-    fi
-
-    if [[ -d ${package}sources/data/ ]] ; then
-      mv -v ${package}sources/data/ ${package}
-
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to move sources data directory $c_notice${path_sources}sources/data$c_error to $c_notice$package$c_error.$c_reset"
-        failure=1
-        break
-      fi
     fi
-  done
+  fi
 
   if [[ $failure != "" ]] ; then
     package_cleanup
@@ -410,268 +378,475 @@ package_operation_individual(){
   fi
 }
 
-package_operation_level(){
-  local failure=
-  local name=
+package_dependencies_append() {
+  local level="$1"
+  local dependency="$2"
+  local settings=
+  local libraries=
+
+  settings=${path_sources}${level}/${dependency}/data/build/settings
+  if [[ ! -f $settings ]] ; then
+    echo -e "${c_error}ERROR: failed to find dependency settings file $c_notice$settings$c_error.$c_reset"
+    failure=1
+    return
+  fi
+
+  libraries=$(grep -o '^build_sources_library\>.*$' $settings | sed -e 's|^build_sources_library\>||' -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+  if [[ $libraries != "" ]] ; then
+    if [[ $(echo $individual_dependencies | grep -o "\-l$dependency\>") == "" ]] ; then
+      individual_dependencies="-l$dependency $individual_dependencies"
+    fi
+  fi
+}
+
+package_dependencies_individual() {
   local level=
   local directory=
-  local package=
+  local settings=
+  local name=
+  local dependencies=
+  local dependency=
+  local sub_level=
+  local sub_dependencies=
+  local sub_dependency=
+  local sub_sub_level=
+  local sub_sub_dependencies=
+  local sub_sub_dependency=
+  local individual_dependencies=
 
-  for level in level_0 level_1 level_2 ; do
-    name="fll-$level"
-    package="${path_destination}level/${name}-${version}/"
+  for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ${path_sources}level_3/* ; do
+    name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||" -e "s|${path_sources}level_3/||")"
 
     echo
-    echo -e "${c_highlight}Processing Package$c_reset (level) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
+    echo -e "${c_highlight}Building Dependencies For $c_reset$c_notice${name}$c_reset${c_highlight}.$c_reset"
 
-    if [[ ! -d $path_build$level ]] ; then
-      echo -e "${c_error}ERROR: build settings directory $c_notice$path_build$level$c_error is invalid or missing.$c_reset"
+    if [[ ! -f ${directory}/data/build/dependencies ]] ; then
+      echo -e "${c_error}ERROR: cannot build dependencies, failed to find $c_notice${directory}/data/build/dependencies$c_error.$c_reset"
       failure=1
-      break
+      return
+    fi
+    if [[ ! -f ${directory}/data/build/settings ]] ; then
+      echo -e "${c_error}ERROR: cannot build dependencies for $c_reset$c_notice${name}$c_reset${c_error}, failed to find $c_notice${directory}/data/build/settings$c_error.$c_reset"
+      failure=1
+      return
     fi
 
-    package_create_base_files
+    dependencies=
+    if [[ -f ${directory}/data/build/dependencies ]] ; then
+      dependencies=$(cat ${directory}/data/build/dependencies)
+    fi
 
-    if [[ ! -d ${package}data/ ]] ; then
-      mkdir -v ${package}data/
+    individual_dependencies=
+    for dependency in $dependencies ; do
+      if [[ $(echo "$dependency" | grep -o "^f_") != "" ]] ; then
+        level=level_0
+      elif [[ $(echo "$dependency" | grep -o "^fl_") != "" ]] ; then
+        level=level_1
+      elif [[ $(echo "$dependency" | grep -o "^fll_") != "" ]] ; then
+        level=level_2
+      else
+        echo -e "${c_warning}WARNING: failed to detect level for dependency $c_notice$dependency$c_warning.$c_reset"
+        continue
+      fi
 
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset"
+      if [[ ! -d ${path_sources}${level}/${dependency}/data/build/ ]] ; then
+        echo -e "${c_error}ERROR: failed to find dependency data directory $c_notice${path_sources}${level}/${dependency}/data/build/$c_error.$c_reset"
         failure=1
-        break
+        return
       fi
-    fi
 
-    if [[ -d $path_build${level}/build ]] ; then
-      cp -vR $path_build${level}/build ${package}data/
-    else
-      cp -vR $path_build$level ${package}data/build
-    fi
+      sub_dependencies=
+      if [[ -f ${path_sources}${level}/${dependency}/data/build/dependencies ]] ; then
+        sub_dependencies=$(cat ${path_sources}${level}/${dependency}/data/build/dependencies)
+      fi
 
-    if [[ $? -ne 0 ]] ; then
-      echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset"
-      failure=1
-      break
-    fi
+      for sub_dependency in $sub_dependencies ; do
+        if [[ $(echo "$sub_dependency" | grep -o "^f_") != "" ]] ; then
+          sub_level=level_0
+        elif [[ $(echo "$sub_dependency" | grep -o "^fl_") != "" ]] ; then
+          sub_level=level_1
+        else
+          echo -e "${c_warning}WARNING: failed to detect level for sub-dependency $c_notice$sub_dependency$c_warning.$c_reset"
+          continue
+        fi
 
-    if [[ ! -d ${package}sources/ ]] ; then
-      mkdir -v ${package}sources/
+        if [[ ! -d ${path_sources}${sub_level}/${sub_dependency}/data/build/ ]] ; then
+          echo -e "${c_error}ERROR: failed to find dependency data directory $c_notice${path_sources}${sub_level}/${sub_dependency}/data/build/$c_error.$c_reset"
+          failure=1
+          return
+        fi
 
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset"
-        failure=1
-        break
-      fi
-    fi
+        sub_sub_dependencies=
+        if [[ -f ${path_sources}${sub_level}/${sub_dependency}/data/build/dependencies ]] ; then
+          sub_sub_dependencies=$(cat ${path_sources}${sub_level}/${sub_dependency}/data/build/dependencies)
+        fi
 
-    for directory in $path_sources${level}/* ; do
-      cp -vR $directory/* ${package}sources/
+        for sub_sub_dependency in $sub_sub_dependencies ; do
+          if [[ $(echo "$sub_sub_dependency" | grep -o "^f_") != "" ]] ; then
+            sub_sub_level=level_0
+          else
+            echo -e "${c_warning}WARNING: failed to detect level for sub-sub-dependency $c_notice$sub_sub_dependency$c_warning.$c_reset"
+            continue
+          fi
 
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset"
-        failure=1
-        break
-      fi
+          package_dependencies_append "$sub_sub_level" "$sub_sub_dependency"
+        done
 
-      rm -vRf ${package}sources/data/build/
+        if [[ $failure != "" ]] ; then
+          break;
+        fi
 
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset"
-        failure=1
-        break
-      fi
+        package_dependencies_append "$sub_level" "$sub_dependency"
 
-      cp -vR ${package}sources/data $package
+        if [[ $failure != "" ]] ; then
+          break;
+        fi
+      done
 
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data$c_error to $c_notice$package$c_error.$c_reset"
-        failure=1
-        break
+      if [[ $failure != "" ]] ; then
+        break;
       fi
 
-      rm -vRf ${package}sources/data
+      package_dependencies_append "$level" "$dependency"
 
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset"
-        failure=1
-        break
+      if [[ $failure != "" ]] ; then
+        break;
       fi
     done
 
     if [[ $failure != "" ]] ; then
       break;
     fi
-  done
 
-  if [[ $failure != "" ]] ; then
-    package_cleanup
-    exit $failure
-  fi
+    individual_dependencies=$(echo "$individual_dependencies" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+    if [[ $individual_dependencies != "" ]] ; then
+      echo -e "  $individual_dependencies"
+      individual_dependencies=" $individual_dependencies"
+    fi
+
+    settings=${directory}/data/build/settings
+    sed -i -e "s|^build_libraries_fll\>.*\$|build_libraries_fll$individual_dependencies|" $settings
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset"
+      failure=1
+      return
+    fi
+  done
 }
 
-package_operation_monolithic(){
-  local failure=
-  local name=
-  local level=
+package_dependencies_level() {
   local directory=
-  local package=
-  local subdirectory=
-  local pathname=
-
-  name="fll"
-  package="${path_destination}monolithic/${name}-${version}/"
+  local name=
+  local settings=
+  local library=
+  local libraries=
+  local header=
+  local headers=
 
-  echo
-  echo -e "${c_highlight}Processing Package$c_reset (monolithic) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
+  package_dependencies_level_update "level_0"
 
-  if [[ ! -d ${path_build}monolithic ]] ; then
-    echo -e "${c_error}ERROR: build settings directory $c_notice${path_build}monolithic$c_error is invalid or missing.$c_reset"
-    package_cleanup
-    return 1
+  if [[ $failure != "" ]] ; then
+    return;
   fi
 
-  package_create_base_files
-
-  if [[ ! -d ${package}data/ ]] ; then
-    mkdir -v ${package}data/
+  package_dependencies_level_update "level_1"
 
-    if [[ $? -ne 0 ]] ; then
-      echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset"
-      package_cleanup
-      return 1
-    fi
+  if [[ $failure != "" ]] ; then
+    return;
   fi
 
-  if [[ -d ${path_build}monolithic/build ]] ; then
-    cp -vR ${path_build}monolithic/build ${package}data
-  else
-    cp -vR ${path_build}monolithic ${package}data/build
+  package_dependencies_level_update "level_2"
+}
+
+package_dependencies_level_update() {
+  local level="$1"
+  local level_libraries=
+  local level_headers=
+  local monolithic_libraries=
+  local monolithic_headers=
+
+  echo
+  echo -e "${c_highlight}Building Dependencies: $c_notice$level${c_highlight}.$c_reset"
+
+  for directory in $path_sources${level}/* ; do
+    name="$(echo $directory | sed -e "s|$path_sources${level}/||")"
+
+    settings=${directory}/data/build/settings
+    if [[ ! -f $settings ]] ; then
+      echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset"
+      failure=1
+      return
+    fi
+
+    libraries=$(grep -o '^build_sources_library\>.*$' $settings | sed -e 's|^build_sources_library\>||' -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+    for library in $libraries ; do
+      level_libraries="$level_libraries $library"
+      monolithic_libraries="$monolithic_libraries $level/$library"
+    done
+
+    headers=$(grep -o '^build_sources_headers\>.*$' $settings | sed -e 's|^build_sources_headers\>||' -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+    for header in $headers ; do
+      level_headers="$level_headers $header"
+      monolithic_headers="$monolithic_headers $level/$header"
+    done
+  done
+
+  settings=${path_sources}/build/${level}/settings
+
+  if [[ ! -f $settings ]] ; then
+    echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset"
+    failure=1
+    return
   fi
 
+  level_libraries=$(echo "$level_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+  if [[ $level_libraries != "" ]] ; then
+    echo "  $level_libraries"
+    level_libraries=" $level_libraries"
+  fi
+
+  sed -i -e "s|^build_sources_library\>.*\$|build_sources_library$level_libraries|" $settings
+
   if [[ $? -ne 0 ]] ; then
-    echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset"
-    package_cleanup
-    return 1
+    echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset"
+    failure=1
+    return
   fi
 
-  if [[ ! -d ${package}sources/ ]] ; then
-    mkdir -v ${package}sources/
+  level_headers=$(echo "$level_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+  if [[ $level_headers != "" ]] ; then
+    echo "  $level_headers"
+    level_headers=" $level_headers"
+  fi
 
-    if [[ $? -ne 0 ]] ; then
-      echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset"
-      package_cleanup
-      return 1
-    fi
+  sed -i -e "s|^build_sources_headers\>.*\$|build_sources_headers$level_headers|" $settings
+
+  if [[ $? -ne 0 ]] ; then
+    echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset"
+    failure=1
+    return
   fi
 
-  for level in level_0 level_1 level_2 ; do
-    for directory in $path_sources${level}/* ; do
-      for subdirectory in $directory/* ; do
-        pathname="$(basename $subdirectory)"
+  if [[ $level == "level_0" ]] ; then
+    level_0_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+    level_0_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+  elif [[ $level == "level_1" ]] ; then
+    level_1_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+    level_1_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+  elif [[ $level == "level_2" ]] ; then
+    level_2_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+    level_2_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+  fi
+}
 
-        if [[ $pathname == "data" ]] ; then
-          if [[ ! -d ${package}data/$level ]] ; then
-            mkdir -vp ${package}data/$level
+package_dependencies_monolithic() {
+  local monolithic_libraries=""
+  local monolithic_headers=""
 
-            if [[ $? -ne 0 ]] ; then
-              echo -e "${c_error}ERROR: failed to create package data directory $c_notice${package}data/$level$c_error.$c_reset"
-              failure=1
-              break
-            fi
-          fi
+  echo
+  echo -e "${c_highlight}Building Dependencies: ${c_notice}monolithic${c_highlight}.$c_reset"
 
-          cp -vR $subdirectory ${package}sources/data
+  if [[ $level_0_libraries != "" ]] ; then
+    monolithic_libraries="$level_0_libraries"
+  fi
 
-          if [[ $? -ne 0 ]] ; then
-            echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/data$level$c_error.$c_reset"
-            failure=1
-            break
-          fi
+  if [[ $level_0_headers != "" ]] ; then
+    monolithic_headers="$level_0_headers"
+  fi
 
-          rm -vRf ${package}sources/data/build/
+  if [[ $level_1_libraries != "" ]] ; then
+    if [[ $monolithic_libraries == "" ]] ; then
+      monolithic_libraries="$level_1_libraries"
+    else
+      monolithic_libraries="$monolithic_libraries $level_1_libraries"
+    fi
+  fi
 
-          if [[ $? -ne 0 ]] ; then
-            echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset"
-            failure=1
-            break
-          fi
+  if [[ $level_1_headers != "" ]] ; then
+    if [[ $monolithic_libraries == "" ]] ; then
+      monolithic_headers="$level_1_headers"
+    else
+      monolithic_headers="$monolithic_headers $level_1_headers"
+    fi
+  fi
 
-          if [[ "$(ls ${package}sources/data)" != "" ]] ; then
-            cp -vR ${package}sources/data/* ${package}data/$level
+  if [[ $level_2_libraries != "" ]] ; then
+    if [[ $monolithic_libraries == "" ]] ; then
+      monolithic_libraries="$level_2_libraries"
+    else
+      monolithic_libraries="$monolithic_libraries $level_2_libraries"
+    fi
+  fi
 
-            if [[ $? -ne 0 ]] ; then
-              echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data/$level/data$c_error to $c_notice${package}data/$level$c_error.$c_reset"
-              failure=1
-              break
-            fi
-          fi
+  if [[ $level_2_headers != "" ]] ; then
+    if [[ $monolithic_libraries == "" ]] ; then
+      monolithic_headers="$level_2_headers"
+    else
+      monolithic_headers="$monolithic_headers $level_2_headers"
+    fi
+  fi
 
-          rm -vRf ${package}sources/data
+  settings=${path_sources}/build/monolithic/settings
 
-          if [[ $? -ne 0 ]] ; then
-            echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset"
-            failure=1
-            break
-          fi
-        else
-          if [[ ! -d ${package}sources/$pathname/$level ]] ; then
-            mkdir -vp ${package}sources/$pathname/$level
+  if [[ $monolithic_libraries != "" ]] ; then
+    echo "  $monolithic_libraries"
+    monolithic_libraries=" $monolithic_libraries"
+  fi
 
-            if [[ $? -ne 0 ]] ; then
-              echo -e "${c_error}ERROR: failed to create package sources directory $c_notice${package}sources/$pathname/$level$c_error.$c_reset"
-              failure=1
-              break
-            fi
-          fi
+  sed -i -e "s|^build_sources_library\>.*\$|build_sources_library$monolithic_libraries|" $settings
 
-          cp -vR $subdirectory/* ${package}sources/$pathname/$level
+  if [[ $? -ne 0 ]] ; then
+    echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset"
+    failure=1
+    return
+  fi
 
-          if [[ $? -ne 0 ]] ; then
-            echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$subdirectory$c_error to $c_notice${package}sources/$pathname/$level$c_error.$c_reset"
-            failure=1
-            break
-          fi
-        fi
-      done
 
-      if [[ $failure != "" ]] ; then
-        break;
-      fi
-    done
+  if [[ $monolithic_headers != "" ]] ; then
+    echo "  $monolithic_headers"
+    monolithic_headers=" $monolithic_headers"
+  fi
 
-    if [[ $failure != "" ]] ; then
-      break;
+  sed -i -e "s|^build_sources_headers\>.*\$|build_sources_headers$monolithic_headers|" $settings
+
+  if [[ $? -ne 0 ]] ; then
+    echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset"
+    failure=1
+    return
+  fi
+}
+
+package_operation_clean() {
+  local i=
+
+  for i in ${path_destination}{individual,level,monolithic,program} ; do
+    if [[ -d $i ]] ; then
+      rm -vRf $i
     fi
   done
+}
+
+package_operation_copy_package() {
+  if [[ -d ${package}sources/data/ ]] ; then
+    cp -vR ${package}sources/data ${package}
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data$c_error to $c_notice$package$c_error.$c_reset"
+      failure=1
+      break
+    fi
+
+    rm -vRf ${package}sources/data
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset"
+      failure=1
+      break
+    fi
+  fi
+
+  if [[ -d ${package}sources/documents/ ]] ; then
+    cp -vR ${package}sources/documents/ ${package}
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to move sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset"
+      failure=1
+      break
+    fi
+
+    rm -vRf ${package}sources/documents/
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to remove sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset"
+      failure=1
+      break
+    fi
+  fi
+
+  if [[ -d ${package}sources/licenses/ ]] ; then
+    cp -vR ${package}sources/licenses/ ${package}
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to move sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset"
+      failure=1
+      break
+    fi
+
+    rm -vRf ${package}sources/licenses/
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to remove sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset"
+      failure=1
+      break
+    fi
+  fi
+
+  if [[ -d ${package}sources/specifications/ ]] ; then
+    cp -vR ${package}sources/specifications/ ${package}
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to move sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset"
+      failure=1
+      break
+    fi
+
+    rm -vRf ${package}sources/specifications/
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to remove sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset"
+      failure=1
+      break
+    fi
+  fi
+}
+
+package_operation_dependencies() {
+  local failure=
+  local level_0_libraries=
+  local level_1_libraries=
+  local level_2_libraries=
+  local level_0_headers=
+  local level_1_headers=
+  local level_2_headers=
+
+  package_dependencies_individual
 
   if [[ $failure != "" ]] ; then
-    package_cleanup
-    exit $failure
+    return;
+  fi
+
+  package_dependencies_level
+
+  if [[ $failure != "" ]] ; then
+    return;
   fi
+
+  package_dependencies_monolithic
 }
 
-package_operation_program(){
+package_operation_individual() {
   local failure=
   local name=
   local directory=
   local package=
 
-  if [[ ! -d ${path_destination}program ]] ; then
-    mkdir -vp ${path_destination}program
+  if [[ ! -d ${path_destination}individual ]] ; then
+    mkdir -vp ${path_destination}individual
 
     if [[ $? -ne 0 ]] ; then
-      echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}program$c_error.$c_reset"
+      echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}individual$c_error.$c_reset"
       package_cleanup
       exit $failure
     fi
   fi
 
-  for directory in ${path_sources}level_3/* ; do
-    name="$(echo $directory | sed -e "s|${path_sources}level_3/||")"
-    package="${path_destination}program/${name}-${version}/"
+  for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ; do
+    name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")"
+    package="${path_destination}individual/${name}-${version}/"
 
     echo
-    echo -e "${c_highlight}Processing Package$c_reset (program) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
+    echo -e "${c_highlight}Processing Package$c_reset (individual) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
 
     package_create_base_files
 
@@ -683,15 +858,7 @@ package_operation_program(){
       break
     fi
 
-    if [[ -d ${package}sources/data/ ]] ; then
-      mv -v ${package}sources/data/ ${package}
-
-      if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to move sources data directory $c_notice${path_sources}sources/data$c_error to $c_notice$package$c_error.$c_reset"
-        failure=1
-        break
-      fi
-    fi
+    package_operation_copy_package
   done
 
   if [[ $failure != "" ]] ; then
@@ -700,396 +867,316 @@ package_operation_program(){
   fi
 }
 
-package_operation_dependencies() {
+package_operation_level() {
   local failure=
-  local level_0_libraries=
-  local level_1_libraries=
-  local level_2_libraries=
-  local level_0_headers=
-  local level_1_headers=
-  local level_2_headers=
-
-  package_dependencies_individual
-
-  if [[ $failure != "" ]] ; then
-    return;
-  fi
-
-  package_dependencies_level
-
-  if [[ $failure != "" ]] ; then
-    return;
-  fi
-
-  package_dependencies_monolithic
-}
-
-package_dependencies_individual() {
+  local name=
   local level=
   local directory=
-  local settings=
-  local name=
-  local dependencies=
-  local dependency=
-  local sub_level=
-  local sub_dependencies=
-  local sub_dependency=
-  local sub_sub_level=
-  local sub_sub_dependencies=
-  local sub_sub_dependency=
-  local individual_dependencies=
+  local package=
 
-  for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ${path_sources}level_3/* ; do
-    name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||" -e "s|${path_sources}level_3/||")"
+  for level in level_0 level_1 level_2 ; do
+    name="fll-$level"
+    package="${path_destination}level/${name}-${version}/"
 
     echo
-    echo -e "${c_highlight}Building Dependencies For $c_reset$c_notice${name}$c_reset${c_highlight}.$c_reset"
+    echo -e "${c_highlight}Processing Package$c_reset (level) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
 
-    if [[ ! -f ${directory}/data/build/dependencies ]] ; then
-      echo -e "${c_error}ERROR: cannot build dependencies, failed to find $c_notice${directory}/data/build/dependencies$c_error.$c_reset"
-      failure=1
-      return
-    fi
-    if [[ ! -f ${directory}/data/build/settings ]] ; then
-      echo -e "${c_error}ERROR: cannot build dependencies for $c_reset$c_notice${name}$c_reset${c_error}, failed to find $c_notice${directory}/data/build/settings$c_error.$c_reset"
+    if [[ ! -d $path_build$level ]] ; then
+      echo -e "${c_error}ERROR: build settings directory $c_notice$path_build$level$c_error is invalid or missing.$c_reset"
       failure=1
-      return
+      break
     fi
 
-    dependencies=
-    if [[ -f ${directory}/data/build/dependencies ]] ; then
-      dependencies=$(cat ${directory}/data/build/dependencies)
-    fi
+    package_create_base_files
 
-    individual_dependencies=
-    for dependency in $dependencies ; do
-      if [[ $(echo "$dependency" | grep -o "^f_") != "" ]] ; then
-        level=level_0
-      elif [[ $(echo "$dependency" | grep -o "^fl_") != "" ]] ; then
-        level=level_1
-      elif [[ $(echo "$dependency" | grep -o "^fll_") != "" ]] ; then
-        level=level_2
-      else
-        echo -e "${c_warning}WARNING: failed to detect level for dependency $c_notice$dependency$c_warning.$c_reset"
-        continue
-      fi
+    if [[ ! -d ${package}data/ ]] ; then
+      mkdir -v ${package}data/
 
-      if [[ ! -d ${path_sources}${level}/${dependency}/data/build/ ]] ; then
-        echo -e "${c_error}ERROR: failed to find dependency data directory $c_notice${path_sources}${level}/${dependency}/data/build/$c_error.$c_reset"
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset"
         failure=1
-        return
-      fi
-
-      sub_dependencies=
-      if [[ -f ${path_sources}${level}/${dependency}/data/build/dependencies ]] ; then
-        sub_dependencies=$(cat ${path_sources}${level}/${dependency}/data/build/dependencies)
+        break
       fi
+    fi
 
-      for sub_dependency in $sub_dependencies ; do
-        if [[ $(echo "$sub_dependency" | grep -o "^f_") != "" ]] ; then
-          sub_level=level_0
-        elif [[ $(echo "$sub_dependency" | grep -o "^fl_") != "" ]] ; then
-          sub_level=level_1
-        else
-          echo -e "${c_warning}WARNING: failed to detect level for sub-dependency $c_notice$sub_dependency$c_warning.$c_reset"
-          continue
-        fi
-
-        if [[ ! -d ${path_sources}${sub_level}/${sub_dependency}/data/build/ ]] ; then
-          echo -e "${c_error}ERROR: failed to find dependency data directory $c_notice${path_sources}${sub_level}/${sub_dependency}/data/build/$c_error.$c_reset"
-          failure=1
-          return
-        fi
-
-        sub_sub_dependencies=
-        if [[ -f ${path_sources}${sub_level}/${sub_dependency}/data/build/dependencies ]] ; then
-          sub_sub_dependencies=$(cat ${path_sources}${sub_level}/${sub_dependency}/data/build/dependencies)
-        fi
-
-        for sub_sub_dependency in $sub_sub_dependencies ; do
-          if [[ $(echo "$sub_sub_dependency" | grep -o "^f_") != "" ]] ; then
-            sub_sub_level=level_0
-          else
-            echo -e "${c_warning}WARNING: failed to detect level for sub-sub-dependency $c_notice$sub_sub_dependency$c_warning.$c_reset"
-            continue
-          fi
+    if [[ -d $path_build${level}/build ]] ; then
+      cp -vR $path_build${level}/build ${package}data/
+    else
+      cp -vR $path_build$level ${package}data/build
+    fi
 
-          package_dependencies_append "$sub_sub_level" "$sub_sub_dependency"
-        done
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset"
+      failure=1
+      break
+    fi
 
-        if [[ $failure != "" ]] ; then
-          break;
-        fi
+    if [[ ! -d ${package}sources/ ]] ; then
+      mkdir -v ${package}sources/
 
-        package_dependencies_append "$sub_level" "$sub_dependency"
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset"
+        failure=1
+        break
+      fi
+    fi
 
-        if [[ $failure != "" ]] ; then
-          break;
-        fi
-      done
+    for directory in $path_sources${level}/* ; do
+      cp -vR $directory/* ${package}sources/
 
-      if [[ $failure != "" ]] ; then
-        break;
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset"
+        failure=1
+        break
       fi
 
-      package_dependencies_append "$level" "$dependency"
+      rm -vRf ${package}sources/data/build/
 
-      if [[ $failure != "" ]] ; then
-        break;
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset"
+        failure=1
+        break
       fi
+
+      package_operation_copy_package
     done
 
     if [[ $failure != "" ]] ; then
       break;
     fi
-
-    individual_dependencies=$(echo "$individual_dependencies" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-    if [[ $individual_dependencies != "" ]] ; then
-      echo -e "  $individual_dependencies"
-      individual_dependencies=" $individual_dependencies"
-    fi
-
-    settings=${directory}/data/build/settings
-    sed -i -e "s|^build_libraries_fll\>.*\$|build_libraries_fll$individual_dependencies|" $settings
-
-    if [[ $? -ne 0 ]] ; then
-      echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset"
-      failure=1
-      return
-    fi
   done
-}
-
-package_dependencies_level() {
-  local directory=
-  local name=
-  local settings=
-  local library=
-  local libraries=
-  local header=
-  local headers=
-
-  package_dependencies_level_update "level_0"
 
   if [[ $failure != "" ]] ; then
-    return;
-  fi
-
-  package_dependencies_level_update "level_1"
-
-  if [[ $failure != "" ]] ; then
-    return;
+    package_cleanup
+    exit $failure
   fi
-
-  package_dependencies_level_update "level_2"
 }
 
-package_dependencies_level_update() {
-  local level="$1"
-  local level_libraries=
-  local level_headers=
-  local monolithic_libraries=
-  local monolithic_headers=
-
-  echo
-  echo -e "${c_highlight}Building Dependencies: $c_notice$level${c_highlight}.$c_reset"
+package_operation_monolithic() {
+  local failure=
+  local name=
+  local level=
+  local directory=
+  local package=
+  local subdirectory=
+  local pathname=
 
-  for directory in $path_sources${level}/* ; do
-    name="$(echo $directory | sed -e "s|$path_sources${level}/||")"
+  name="fll"
+  package="${path_destination}monolithic/${name}-${version}/"
 
-    settings=${directory}/data/build/settings
-    if [[ ! -f $settings ]] ; then
-      echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset"
-      failure=1
-      return
-    fi
+  echo
+  echo -e "${c_highlight}Processing Package$c_reset (monolithic) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
 
-    libraries=$(grep -o '^build_sources_library\>.*$' $settings | sed -e 's|^build_sources_library\>||' -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-    for library in $libraries ; do
-      level_libraries="$level_libraries $library"
-      monolithic_libraries="$monolithic_libraries $level/$library"
-    done
+  if [[ ! -d ${path_build}monolithic ]] ; then
+    echo -e "${c_error}ERROR: build settings directory $c_notice${path_build}monolithic$c_error is invalid or missing.$c_reset"
+    package_cleanup
+    return 1
+  fi
 
-    headers=$(grep -o '^build_sources_headers\>.*$' $settings | sed -e 's|^build_sources_headers\>||' -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-    for header in $headers ; do
-      level_headers="$level_headers $header"
-      monolithic_headers="$monolithic_headers $level/$header"
-    done
-  done
+  package_create_base_files
 
-  settings=${path_sources}/build/${level}/settings
+  if [[ ! -d ${package}data/ ]] ; then
+    mkdir -v ${package}data/
 
-  if [[ ! -f $settings ]] ; then
-    echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset"
-    failure=1
-    return
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset"
+      package_cleanup
+      return 1
+    fi
   fi
 
-  level_libraries=$(echo "$level_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-  if [[ $level_libraries != "" ]] ; then
-    echo "  $level_libraries"
-    level_libraries=" $level_libraries"
+  if [[ -d ${path_build}monolithic/build ]] ; then
+    cp -vR ${path_build}monolithic/build ${package}data
+  else
+    cp -vR ${path_build}monolithic ${package}data/build
   fi
 
-  sed -i -e "s|^build_sources_library\>.*\$|build_sources_library$level_libraries|" $settings
-
   if [[ $? -ne 0 ]] ; then
-    echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset"
-    failure=1
-    return
+    echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset"
+    package_cleanup
+    return 1
   fi
 
-  level_headers=$(echo "$level_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-  if [[ $level_headers != "" ]] ; then
-    echo "  $level_headers"
-    level_headers=" $level_headers"
+  if [[ ! -d ${package}sources/ ]] ; then
+    mkdir -v ${package}sources/
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset"
+      package_cleanup
+      return 1
+    fi
   fi
 
-  sed -i -e "s|^build_sources_headers\>.*\$|build_sources_headers$level_headers|" $settings
+  for level in level_0 level_1 level_2 ; do
+    for directory in $path_sources${level}/* ; do
+      for subdirectory in $directory/* ; do
+        pathname="$(basename $subdirectory)"
 
-  if [[ $? -ne 0 ]] ; then
-    echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset"
-    failure=1
-    return
-  fi
+        if [[ $pathname == "data" ]] ; then
+          if [[ ! -d ${package}data/$level ]] ; then
+            mkdir -vp ${package}data/$level
 
-  if [[ $level == "level_0" ]] ; then
-    level_0_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-    level_0_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-  elif [[ $level == "level_1" ]] ; then
-    level_1_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-    level_1_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-  elif [[ $level == "level_2" ]] ; then
-    level_2_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-    level_2_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-  fi
-}
+            if [[ $? -ne 0 ]] ; then
+              echo -e "${c_error}ERROR: failed to create package data directory $c_notice${package}data/$level$c_error.$c_reset"
+              failure=1
+              break
+            fi
+          fi
 
-package_dependencies_monolithic() {
-  local monolithic_libraries=""
-  local monolithic_headers=""
+          cp -vR $subdirectory ${package}sources/data
 
-  echo
-  echo -e "${c_highlight}Building Dependencies: ${c_notice}monolithic${c_highlight}.$c_reset"
+          if [[ $? -ne 0 ]] ; then
+            echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/data$level$c_error.$c_reset"
+            failure=1
+            break
+          fi
 
-  if [[ $level_0_libraries != "" ]] ; then
-    monolithic_libraries="$level_0_libraries"
-  fi
+          rm -vRf ${package}sources/data/build/
 
-  if [[ $level_0_headers != "" ]] ; then
-    monolithic_headers="$level_0_headers"
-  fi
+          if [[ $? -ne 0 ]] ; then
+            echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset"
+            failure=1
+            break
+          fi
 
-  if [[ $level_1_libraries != "" ]] ; then
-    if [[ $monolithic_libraries == "" ]] ; then
-      monolithic_libraries="$level_1_libraries"
-    else
-      monolithic_libraries="$monolithic_libraries $level_1_libraries"
-    fi
-  fi
+          if [[ "$(ls ${package}sources/data)" != "" ]] ; then
+            cp -vR ${package}sources/data/* ${package}data/$level
 
-  if [[ $level_1_headers != "" ]] ; then
-    if [[ $monolithic_libraries == "" ]] ; then
-      monolithic_headers="$level_1_headers"
-    else
-      monolithic_headers="$monolithic_headers $level_1_headers"
-    fi
-  fi
+            if [[ $? -ne 0 ]] ; then
+              echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data/$level/data$c_error to $c_notice${package}data/$level$c_error.$c_reset"
+              failure=1
+              break
+            fi
+          fi
 
-  if [[ $level_2_libraries != "" ]] ; then
-    if [[ $monolithic_libraries == "" ]] ; then
-      monolithic_libraries="$level_2_libraries"
-    else
-      monolithic_libraries="$monolithic_libraries $level_2_libraries"
-    fi
-  fi
+          rm -vRf ${package}sources/data
 
-  if [[ $level_2_headers != "" ]] ; then
-    if [[ $monolithic_libraries == "" ]] ; then
-      monolithic_headers="$level_2_headers"
-    else
-      monolithic_headers="$monolithic_headers $level_2_headers"
-    fi
-  fi
+          if [[ $? -ne 0 ]] ; then
+            echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset"
+            failure=1
+            break
+          fi
+        elif [[ $pathname == "documents" ]] ; then
+          cp -vR $subdirectory ${package}sources/
 
-  settings=${path_sources}/build/monolithic/settings
+          if [[ $? -ne 0 ]] ; then
+            echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/documents$c_error.$c_reset"
+            failure=1
+            break
+          fi
+        elif [[ $pathname == "licenses" ]] ; then
+          cp -vR $subdirectory ${package}sources/
 
-  if [[ $monolithic_libraries != "" ]] ; then
-    echo "  $monolithic_libraries"
-    monolithic_libraries=" $monolithic_libraries"
-  fi
+          if [[ $? -ne 0 ]] ; then
+            echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/licenses$c_error.$c_reset"
+            failure=1
+            break
+          fi
+        elif [[ $pathname == "specifications" ]] ; then
+          cp -vR $subdirectory ${package}sources/
 
-  sed -i -e "s|^build_sources_library\>.*\$|build_sources_library$monolithic_libraries|" $settings
+          if [[ $? -ne 0 ]] ; then
+            echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/specifications$c_error.$c_reset"
+            failure=1
+            break
+          fi
+        else
+          if [[ ! -d ${package}sources/$pathname/$level ]] ; then
+            mkdir -vp ${package}sources/$pathname/$level
 
-  if [[ $? -ne 0 ]] ; then
-    echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset"
-    failure=1
-    return
-  fi
+            if [[ $? -ne 0 ]] ; then
+              echo -e "${c_error}ERROR: failed to create package sources directory $c_notice${package}sources/$pathname/$level$c_error.$c_reset"
+              failure=1
+              break
+            fi
+          fi
 
+          cp -vR $subdirectory/* ${package}sources/$pathname/$level
 
-  if [[ $monolithic_headers != "" ]] ; then
-    echo "  $monolithic_headers"
-    monolithic_headers=" $monolithic_headers"
-  fi
+          if [[ $? -ne 0 ]] ; then
+            echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$subdirectory$c_error to $c_notice${package}sources/$pathname/$level$c_error.$c_reset"
+            failure=1
+            break
+          fi
+        fi
+      done
 
-  sed -i -e "s|^build_sources_headers\>.*\$|build_sources_headers$monolithic_headers|" $settings
+      if [[ $failure != "" ]] ; then
+        break;
+      fi
+    done
 
-  if [[ $? -ne 0 ]] ; then
-    echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset"
-    failure=1
-    return
+    if [[ $failure != "" ]] ; then
+      break;
+    fi
+  done
+
+  if [[ $failure != "" ]] ; then
+    package_cleanup
+    exit $failure
   fi
 }
 
-package_dependencies_append() {
-  local level="$1"
-  local dependency="$2"
-  local settings=
-  local libraries=
+package_operation_program() {
+  local failure=
+  local name=
+  local directory=
+  local package=
 
-  settings=${path_sources}${level}/${dependency}/data/build/settings
-  if [[ ! -f $settings ]] ; then
-    echo -e "${c_error}ERROR: failed to find dependency settings file $c_notice$settings$c_error.$c_reset"
-    failure=1
-    return
-  fi
+  if [[ ! -d ${path_destination}program ]] ; then
+    mkdir -vp ${path_destination}program
 
-  libraries=$(grep -o '^build_sources_library\>.*$' $settings | sed -e 's|^build_sources_library\>||' -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
-  if [[ $libraries != "" ]] ; then
-    if [[ $(echo $individual_dependencies | grep -o "\-l$dependency\>") == "" ]] ; then
-      individual_dependencies="-l$dependency $individual_dependencies"
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}program$c_error.$c_reset"
+      package_cleanup
+      exit $failure
     fi
   fi
-}
 
-package_operation_clean(){
-  local i=
+  for directory in ${path_sources}level_3/* ; do
+    name="$(echo $directory | sed -e "s|${path_sources}level_3/||")"
+    package="${path_destination}program/${name}-${version}/"
 
-  for i in ${path_destination}{individual,level,monolithic,program} ; do
-    if [[ -d $i ]] ; then
-      rm -vRf $i
+    echo
+    echo -e "${c_highlight}Processing Package$c_reset (program) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
+
+    package_create_base_files
+
+    cp -vR $directory ${package}sources/
+
+    if [[ $? -ne 0 ]] ; then
+      echo -e "${c_error}ERROR: failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset"
+      failure=1
+      break
     fi
+
+    package_operation_copy_package
   done
+
+  if [[ $failure != "" ]] ; then
+    package_cleanup
+    exit $failure
+  fi
 }
 
-package_cleanup(){
+package_cleanup() {
   unset package_main
   unset package_handle_colors
   unset package_help
   unset package_build
   unset package_create_base_files
+  unset package_dependencies_individual
+  unset package_dependencies_level
+  unset package_dependencies_level_update
+  unset package_dependencies_monolithic
+  unset package_dependencies_append
   unset package_operation_clean
+  unset package_operation_copy_package
   unset package_operation_individual
   unset package_operation_level
   unset package_operation_monolithic
   unset package_operation_program
   unset package_operation_dependencies
-  unset package_dependencies_individual
-  unset package_dependencies_level
-  unset package_dependencies_level_update
-  unset package_dependencies_monolithic
-  unset package_dependencies_append
   unset package_cleanup
 }