]> Kevux Git Server - fll/commitdiff
Bugfix: featureless make should not attempt to link to non-existent library.
authorKevin Day <thekevinday@gmail.com>
Sat, 5 Sep 2020 03:01:06 +0000 (22:01 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 5 Sep 2020 03:01:06 +0000 (22:01 -0500)
When the no library sources are specified then the library is not built.
The problem is that the code is still trying to link against this library that was not built when compiling the static program.

build/scripts/bootstrap.sh
level_3/fake/c/private-build.c
level_3/fake/data/build/settings-example-bzip2
level_3/fake/data/build/settings-example-bzip2recover

index 613b2668c5af044e610a86d67c6ddfd21e849627..6341a178484bc2ede6c4354a85bf5cd1b5481aed 100644 (file)
@@ -893,7 +893,7 @@ bootstrap_operation_build() {
         fi
       done
 
-      if [[ $failure == "" ]] ; then
+      if [[ $failure == "" && $sources_library != "" ]] ; then
         if [[ $verbosity == "verbose" ]] ; then
           echo $linker rcs ${path_build}libraries/static/lib$name.a $sources
         fi
index 67b518d1942f78f75bebac5acecd469c5e82cb1b..fe720f047b8dd6fb6d4b2dcc85a9005c03c414c1 100644 (file)
@@ -2458,17 +2458,20 @@ extern "C" {
 
       source_library_length = 0;
 
-      memcpy(source_library, data.path_build_libraries_static.string, data.path_build_libraries_static.used);
-      source_library_length += data.path_build_libraries_static.used;
+      // only include the library if there are sources that would result in it being built.
+      if (data_build.setting.build_sources_library.used) {
+        memcpy(source_library, data.path_build_libraries_static.string, data.path_build_libraries_static.used);
+        source_library_length += data.path_build_libraries_static.used;
 
-      memcpy(source_library + source_library_length, fake_build_parameter_library_name_prefix, fake_build_parameter_library_name_prefix_length);
-      source_library_length += fake_build_parameter_library_name_prefix_length;
+        memcpy(source_library + source_library_length, fake_build_parameter_library_name_prefix, fake_build_parameter_library_name_prefix_length);
+        source_library_length += fake_build_parameter_library_name_prefix_length;
 
-      memcpy(source_library + source_library_length, data_build.setting.project_name.string, data_build.setting.project_name.used);
-      source_library_length += data_build.setting.project_name.used;
+        memcpy(source_library + source_library_length, data_build.setting.project_name.string, data_build.setting.project_name.used);
+        source_library_length += data_build.setting.project_name.used;
 
-      memcpy(source_library + source_library_length, fake_build_parameter_library_name_suffix_static, fake_build_parameter_library_name_suffix_static_length);
-      source_library_length += fake_build_parameter_library_name_suffix_static_length;
+        memcpy(source_library + source_library_length, fake_build_parameter_library_name_suffix_static, fake_build_parameter_library_name_suffix_static_length);
+        source_library_length += fake_build_parameter_library_name_suffix_static_length;
+      }
 
       source_library[source_library_length] = 0;
 
index d11ca78f4c0a9ab790e9d74d4be91321870b7042..a4e6f4d55719cfc5440032331e329afde730936f 100644 (file)
@@ -3,7 +3,6 @@
 # @fixme: this reveals some shortcomings and problems:
 # 1) need to be able to build -m bzip2recover without libbzip2.a.
 # 2) need to provide a way to designate path prefixes (instead of just hardcoded sources/c/, etc...
-# 3) need to be able to build shared program without library (add a 'build_library' setting).
 
 project_name bzip2
 
@@ -24,8 +23,8 @@ build_compiler gcc
 build_language c
 build_linker ar
 build_libraries -lc
-build_sources_library blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c
-build_sources_program bzip2.c
+build_sources_library
+build_sources_program blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c bzip2.c
 build_sources_headers bzlib.h
 build_sources_script
 build_sources_setting
index 95e831e5367a79a375810bc9d0e85c44b4f9dc0d..5004eb2063b155cfa88d16543e16236629c4c866 100644 (file)
@@ -3,7 +3,6 @@
 # @fixme: this reveals some shortcomings and problems:
 # 1) need to be able to build -m bzip2recover without libbzip2.a.
 # 2) need to provide a way to designate path prefixes (instead of just hardcoded sources/c/, etc...
-# 3) need to be able to build shared program without library (add a 'build_library' setting).
 
 project_name bzip2recover
 
@@ -17,8 +16,8 @@ environment
 process_pre
 process_post
 
-modes 
-modes_default 
+modes
+modes_default
 
 build_compiler gcc
 build_language c