Ticket #8730: HAIKU_HOST_FEATURE.patch
File HAIKU_HOST_FEATURE.patch, 6.4 KB (added by , 12 years ago) |
---|
-
configure
diff --git a/configure b/configure index 05f1e06..14e2159 100755
a b cat << EOF > "$buildOutputDir/libgccObjects" 584 584 HAIKU_GCC_LIBGCC_OBJECTS ?= ${HAIKU_GCC_LIBGCC_OBJECTS} ; 585 585 EOF 586 586 587 # Generate a boot 587 # Generate a bootstrap Jamfile in the output directory. 588 588 589 589 cat << EOF > $outputDir/Jamfile 590 590 # automatically generated Jamfile … … HAIKU_OUTPUT_DIR = ${outputDir} ; 595 595 include [ FDirName \$(HAIKU_TOP) Jamfile ] ; 596 596 597 597 EOF 598 599 600 601 # hostFeaturesFile=$outputDir/build/HostFeatures 602 # rm -f "$hostFeaturesFile" 603 # touch "$hostFeaturesFile" 604 # jam -a configure_build 605 # 606 # hostBuildConfigHeader=$outputDir/build/HaikuHostBuildConfig.h 607 # rm -f "$hostBuildConfigHeader" 608 # echo >> "$buildConfigFile" 609 # for feature in `cat $hostFeaturesFile`; do 610 # echo "#define _HAIKU_HOST_FEATURE_$feature 1" >> "$hostBuildConfigHeader" 611 # echo "HAIKU_HOST_FEATURE_$feature = 1 ;" >> "$buildConfigFile" 612 # done 613 614 615 616 hostBuildConfigHeader=$outputDir/build/HaikuHostBuildConfig.h 617 cat << EOF > "$hostBuildConfigHeader" 618 /* auto-generated by configure */ 619 #ifndef _HAIKU_BUILD_HOST_BUILD_CONFIG_H 620 #define _HAIKU_BUILD_HOST_BUILD_CONFIG_H 621 EOF 622 623 jam -a configure_build 624 625 cat << EOF >> "$hostBuildConfigHeader" 626 #endif /* _HAIKU_BUILD_HOST_BUILD_CONFIG_H */ 627 EOF 628 629 630 echo >> "$buildConfigFile" 631 cat "$hostBuildConfigHeader" | grep "#define _HAIKU_BUILD_FEATURE_" \ 632 | sed -e 's@#define _\(HAIKU_BUILD_FEATURE_[^[:space:]]*\)[[:space:]]*\(.*\)@\1 = \2 ;@' \ 633 >> "$buildConfigFile" -
headers/build/HaikuBuild.h
diff --git a/headers/build/HaikuBuild.h b/headers/build/HaikuBuild.h index d8ddfd9..73d6aad 100644
a b 6 6 #define _HAIKU_BUILD_H 7 7 8 8 9 //#include <HaikuHostBuildConfig.h>9 #include <HaikuHostBuildConfig.h> 10 10 11 11 12 12 #define _HAIKU_BUILD_STRING(string) … … 27 27 // NOTE: #8730 -- _HAIKU_BUILD_DECLARE_CONSTANT is untested. 28 28 #ifdef _HAIKU_BUILD_LIBROOT_FUNCTION_WRAPPER 29 29 # define _HAIKU_BUILD_DECLARE_CONSTANT(type, name) \ 30 extern type _haiku_build##name; \30 extern type _haiku_build##name; 31 31 #else 32 32 # define _HAIKU_BUILD_DECLARE_CONSTANT(type, name) \ 33 33 extern type _haiku_build##name; \ -
src/build/Jamfile
diff --git a/src/build/Jamfile b/src/build/Jamfile index 17634b0..3b7aa4c 100644
a b 1 1 SubDir HAIKU_TOP src build ; 2 2 3 SubInclude HAIKU_TOP src build configure ; 3 4 SubInclude HAIKU_TOP src build libbe ; 4 5 SubInclude HAIKU_TOP src build libhaikucompat ; 5 6 SubInclude HAIKU_TOP src build libpackage ; -
new file src/build/configure/Jamfile
diff --git a/src/build/configure/Jamfile b/src/build/configure/Jamfile new file mode 100644 index 0000000..3745873
- + 1 SubDir HAIKU_TOP src build configure ; 2 3 HAIKU_BUILD_HOST_FEATURES = <build!configure>HostFeatures ; 4 MakeLocate $(HAIKU_BUILD_HOST_FEATURES) : $(HAIKU_BUILD_OUTPUT_DIR) ; 5 6 HAIKU_BUILD_CONFIG_HEADER = <build!configure>HaikuHostBuildConfig.h ; 7 MakeLocate $(HAIKU_BUILD_CONFIG_HEADER) : $(HAIKU_BUILD_OUTPUT_DIR) ; 8 9 local configureTargets ; 10 11 rule ConfigureCheckExists feature : fileTarget 12 { 13 local target = $(fileTarget:G=build!configure!test) ; 14 15 FEATURE on $(target) = $(feature) ; 16 NotFile $(target) ; 17 Depends $(target) : $(HAIKU_BUILD_CONFIG_HEADER) $(fileTarget) ; 18 19 ConfigureCheckExists1 $(target) 20 : $(HAIKU_BUILD_CONFIG_HEADER) $(fileTarget) ; 21 22 configureTargets += $(target) ; 23 } 24 25 26 actions ConfigureCheckExists1 27 { 28 if [ -f "$(2[2-])" ]; then 29 echo "#define _HAIKU_BUILD_FEATURE_$(FEATURE) 1" >> $(2[1]) 30 # echo $(FEATURE) >> $(2[1]) 31 fi 32 } 33 34 35 rule ConfigureTestCompile feature : sources : libraries 36 { 37 local executable = <build!configure>test_$(feature) ; 38 39 BuildPlatformMain $(executable) : $(sources) : $(libraries) ; 40 ConfigureCheckExists $(feature) : $(executable) ; 41 } 42 43 44 rule ConfigureRunProgram name : sources : libraries 45 { 46 local program = $(name:G=build!configure) ; 47 local target = $(name:G=build!configure!test) ; 48 49 BuildPlatformMain $(program) : $(sources) : $(libraries) ; 50 51 ConfigureRunProgram1 ; 52 53 NotFile $(target) ; 54 Depends $(target) : $(HAIKU_BUILD_CONFIG_HEADER) $(program) ; 55 56 ConfigureRunProgram1 $(target) : $(HAIKU_BUILD_CONFIG_HEADER) $(program) ; 57 58 configureTargets += $(target) ; 59 } 60 61 62 actions ConfigureRunProgram1 63 { 64 $(2[2-]) >> $(2[1]) 65 } 66 67 68 ConfigureRunProgram test_int_types : test_int_types.cpp ; 69 70 71 Depends configure_build : $(configureTargets) ; 72 NotFile configure_build ; -
new file src/build/configure/test_int_types.cpp
diff --git a/src/build/configure/test_int_types.cpp b/src/build/configure/test_int_types.cpp new file mode 100644 index 0000000..6937c2b
- + 1 /* 2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <inttypes.h> 8 #include <stdio.h> 9 10 11 template<typename Type> 12 struct TypeInfo { 13 static const char* const TypeName(); 14 static const char* const Prefix(); 15 }; 16 17 18 #define DEFINE_TYPE_INFO_TEMPLATE(type, prefix) \ 19 template<> \ 20 struct TypeInfo<type> { \ 21 static const char* const TypeName() \ 22 { \ 23 return #type; \ 24 } \ 25 static const char* const Prefix() \ 26 { \ 27 return prefix; \ 28 } \ 29 }; 30 31 #define DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(type, prefix) \ 32 DEFINE_TYPE_INFO_TEMPLATE(type, prefix) \ 33 DEFINE_TYPE_INFO_TEMPLATE(unsigned type, prefix) 34 35 36 DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(char, "") 37 DEFINE_TYPE_INFO_TEMPLATE(signed char, "") 38 DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(short, "") 39 DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(int, "") 40 DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(long, "l") 41 DEFINE_TYPE_INFO_TEMPLATE_SIGNED_AND_UNSIGNED(long long, "ll") 42 43 44 template<typename Type> 45 struct PrintTypeInfo { 46 static void Print(const char* name) 47 { 48 printf("#define _HAIKU_BUILD_FEATURE_%s %s\n", name, 49 TypeInfo<Type>::TypeName()); 50 printf("#define _HAIKU_BUILD_FEATURE_FORMAT_PREFIX_%s \"%s\"\n", name, 51 TypeInfo<Type>::Prefix()); 52 } 53 }; 54 55 56 #define PRINT_TYPE_INFO(type) PrintTypeInfo<type##_t>::Print(#type) 57 58 #define PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(type) \ 59 PRINT_TYPE_INFO(type); \ 60 PRINT_TYPE_INFO(u##type) 61 62 63 int 64 main() 65 { 66 PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int8); 67 PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int16); 68 PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int32); 69 PRINT_TYPE_INFO_SIGNED_AND_UNSIGNED(int64); 70 return 0; 71 }