Changeset 6e4f5e7 in rtems-source-builder
- Timestamp:
- 02/26/13 06:55:39 (10 years ago)
- Branches:
- 4.10, 4.11, 4.9, 5, master
- Children:
- 99eee0e
- Parents:
- eef48f9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/source-builder.txt
reef48f9 r6e4f5e7 198 198 ~~~~~~~~ 199 199 200 In this quick start I will build a nSPARC tool set.200 In this quick start I will build a SPARC tool set. 201 201 202 202 ------------------------------------------------------------- … … 551 551 configuration files. 552 552 553 Defining macros is performed with the +%define+ directive:553 Defining macros is performed with the +%define+ macro: 554 554 555 555 ------------------------------------------------------------- … … 560 560 referenced files or an undefined macro error is reported. 561 561 562 Inline including another file with the +%include+ directive continues563 processing with the specified file returning to carry on from just after the564 includepoint.562 Inline including another file with the +%include+ macro continues processing 563 with the specified file returning to carry on from just after the include 564 point. 565 565 566 566 ------------------------------------------------------------- … … 585 585 has finished being scanned. 586 586 587 Configuration Files 588 ~~~~~~~~~~~~~~~~~~~ 587 Configuration Control 588 ~~~~~~~~~~~~~~~~~~~~~ 589 590 The RTEMS Souce Builder is designed to fit within most verification and 591 validation processes. All of the RTEMS Source Builder is source code. The 592 Python code is source and comes with a commercial friendly license. All 593 configuration data is text and can be read or parsed with standard text based 594 tools. 595 596 File naming provides configuration management. A specific version of a package 597 is captured in a specific set of configuration files. The top level 598 configuration file referenced in a _build set_ or passed to the +sb-builder+ 599 command relates to a specific configuration of the package being built. For 600 example the RTEMS configuration file +rtems-gcc-4.7.2-newlib-2.0.0-1.cfg+ 601 creates an RTEMS GCC and Newlib package where the GCC version is 4.7.2, the 602 Newlib version is 2.0.0, plus any RTEMS specific patches that related to this 603 version. The configuration defines the version numbers of the various parts 604 that make up this package: 605 606 ------------------------------------------------------------- 607 %define gcc_version 4.7.2 608 %define newlib_version 2.0.0 609 %define mpfr_version 3.0.1 610 %define mpc_version 0.8.2 611 %define gmp_version 5.0.5 612 ------------------------------------------------------------- 613 614 The package build options, if there are any are also defined: 615 616 ------------------------------------------------------------- 617 %define with_threads 1 618 %define with_plugin 0 619 %define with_iconv 1 620 ------------------------------------------------------------- 621 622 The generic configuration may provide defaults incase options are not 623 specified. The patches this specific version of the package requires can be 624 included: 625 626 ------------------------------------------------------------- 627 Patch0: gcc-4.7.2-rtems4.11-20121026.diff 628 ------------------------------------------------------------- 629 630 Finally including the GCC 4.7 configuration script: 631 632 ------------------------------------------------------------- 633 %include %{_configdir}/gcc-4.7-1.cfg 634 ------------------------------------------------------------- 635 636 The +gcc-4.7-1.cfg+ is a generic script to build a GCC 4.7 compiler with 637 Newlib. It is not specific to RTEMS. A bare no operating system tool set can be 638 built with this file. 639 640 The +-1+ part of the file names is a revision. The GCC 4.7 script maybe revised 641 to fix a problem and if this fix effects an existing script the file is copied 642 and given a +-2+ revision number. Any dependent scripts referencing the earlier 643 revision number will not be effected by the change. This locks down a specific 644 configuration over time. 645 646 Configuration Script Language 647 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 589 648 590 649 Configuration files specify how to build a package. Configuration files are … … 594 653 format RPM needs and uses. 595 654 596 Script Language 597 ~~~~~~~~~~~~~~~ 598 599 The script language is implemented in terms of directives. The directive list is: 655 The script language is implemented in terms of macross. The builtin list is: 600 656 601 657 [horizontal] … … 605 661 +%clean+:: The package clean shell commands. 606 662 +%include+:: Inline include another configuration file. 607 +%package+:: The package being built.608 663 +%name+:: The name of the package. 609 +% description+:: Apackage description. Useful when reporting about a build.664 +%summary+:: A brief package description. Useful when reporting about a build. 610 665 +%release+:: The package release. A number that is the release as built by this tool. 611 666 +%version+:: The package's verison string. 612 667 +%buildarch+:: The build architecture. 613 668 +%setup+:: Setup a source package. 614 +%source+:: Define a source code package. This directive is number.615 +%patch+:: Define a patch. This directive is number.669 +%source+:: Define a source code package. This macro has a number appended. 670 +%patch+:: Define a patch. This macro has a is number appended. 616 671 +%warning+:: Print the following string as a warning and continue. 617 672 +%error+:: Print the following string as an error and exit. … … 633 688 ^^^^^ 634 689 635 The +%prep+ directive starts a block that continues until the next block636 directive. The _prep_ or preparation block defines the setup of the package's 637 source and is a mix of RTEMS Source Builder directives and shell scripting. The 638 sequence is typically +%setup+ directives for source, +%patch+ directives to 639 patch the source mixed with some shell commands to correct any source issues. 640 A +%prep+ section starts with a +%setup+ command. This creates the package 641 source top leveldirectory then is followed by the first source file.690 The +%prep+ macro starts a block that continues until the next block macro. The 691 _prep_ or preparation block defines the setup of the package's source and is a 692 mix of RTEMS Source Builder macros and shell scripting. The sequence is 693 typically +%setup+ macros for source, +%patch+ macros to patch the source 694 mixed with some shell commands to correct any source issues. A +%prep+ section 695 starts with a +%setup+ command. This creates the package source top level 696 directory then is followed by the first source file. 642 697 643 698 ------------------------------------------------------------- … … 650 705 <2> The version of the package. 651 706 652 The source for a package is declared with the +%source*+ directivewhere +*+ is707 The source for a package is declared with the +%source*+ macro where +*+ is 653 708 a number. For example +%source0+ is the source 0 tar file and is defined with 654 709 something similar to this: … … 666 721 option +--url+. This option accepts a comma delimited list of sites to try. 667 722 668 You can combine the source directive with connditional logic to implement a669 default that can be overriden in the top level files. This lets you reuse a 670 generic build script with different sources. This happens if you have a private671 source package with local modifications. The following example is taken from 672 the+gcc-4.8-1.cfg+ build script.723 You can combine the source macro with connditional logic to implement a default 724 that can be overriden in the top level files. This lets you reuse a generic 725 build script with different sources. This happens if you have a private source 726 package with local modifications. The following example is taken from the 727 +gcc-4.8-1.cfg+ build script. 673 728 674 729 ------------------------------------------------------------- … … 679 734 ------------------------------------------------------------- 680 735 681 <1> The version control directiveis currently not implemented.736 <1> The version control macro is currently not implemented. 682 737 683 738 You could optionally have a few source files that make up the package. For … … 724 779 directory. 725 780 <2> The conditional macro expansion checks if +%patch0+ is defined and if 726 defined issues the +%patch0" directivegiving +-p1+ to the patch command.781 defined issues the +%patch0" macro giving +-p1+ to the patch command. 727 782 <3> Return back to the top of the source tree. 728 783 … … 730 785 ^^^^^^ 731 786 732 The +%build+ directivestarts a block that continues until the next block733 directive. The build block is a series of shell commands that execute to build 734 the package. It assumes all source code has been unpacked, patch and adjusted 735 sothe build will succeed.787 The +%build+ macro starts a block that continues until the next block 788 macro. The build block is a series of shell commands that execute to build the 789 package. It assumes all source code has been unpacked, patch and adjusted so 790 the build will succeed. 736 791 737 792 The following is an example take from the GutHub STLink project [footnote: … … 772 827 <5> Various settings passed to configure to customise the build. In this 773 828 example an include path is being set to the install point of _libusb_. This 774 package requires _libusb_ is buil dbefore it.829 package requires _libusb_ is built before it. 775 830 <6> The +configure+ command. The RTEMS Source Builder provides all the needed 776 831 paths as macro variables. You just need to provide them to +configure+. … … 785 840 ^^^^^^^^ 786 841 787 The +%install+ directivestarts a block that continues until the next block788 directive. The install block is a series of shell commands that execute to 789 install the package. You can assumes the package has build correctly when this 790 s hell script executes.842 The +%install+ macro starts a block that continues until the next block 843 macro. The install block is a series of shell commands that execute to install 844 the package. You can assume the package has build correctly when this block 845 starts executing. 791 846 792 847 Never install the package to the actual _prefix_ the package was built 793 848 with. Always install to the RTEMS Source Builder's temporary path defined in 794 the macro variable + __tmpdir+. The RTEMS Source Builder sets up a shell849 the macro variable +\__tmpdir+. The RTEMS Source Builder sets up a shell 795 850 environment variable called +SB_BUILD_ROOT+ as the standard install point. Most 796 851 packages support adding +DESTDIR=+ to the _make install_ command. … … 815 870 <3> Enter the build directory. In this example it just happens to be the source 816 871 directory. 817 <4> Run +make install _to install the package overriding the +DESTDIR+ make872 <4> Run +make install+ to install the package overriding the +DESTDIR+ make 818 873 variable. 819 874 … … 821 876 ^^^^^^ 822 877 878 The +%clean+ macro starts a block that continues until the next block 879 macro. The clean block is a series of shell commands that execute to clean up 880 after a package has been built and install. This macro is currenly not been 881 used because the RTEMS Source Builder automatically cleans up. 882 823 883 %include 824 884 ^^^^^^^^ 825 885 826 %package 827 ^^^^^^^^ 886 The +%include+ macro inline includes the specific file. The +\__confdir+ 887 path is searched. Any relative path component of the include file is appended 888 to each part of the +\__configdir+. Adding an extension is optional as files 889 with +.bset+ and +.cfg+ are automatically searched for. 890 891 Inline including means the file is processed as part of the configuration at 892 the point it is included. Parsing continues from the next line in the 893 configuration file that contains the +%include+ macro. 894 895 Including files allow a kind of configuration file reuse. The outter 896 configuration files provide specific information such as package version 897 numbers and patches and then include a generic configuration script which 898 builds the package. 899 900 ------------------------------------------------------------- 901 %include %{_configdir}/gcc-4.7-1.cfg 902 ------------------------------------------------------------- 828 903 829 904 %name 830 905 ^^^^^ 831 906 832 %description 833 ^^^^^^^^^^^^ 907 The name of the package being built. The name typically contains the components 908 of the package and their version number plus a revision number. For the GCC 909 with Newlib configuration the name is typically: 910 911 ------------------------------------------------------------- 912 Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release} 913 ------------------------------------------------------------- 914 915 %summary 916 ^^^^^^^^ 917 918 The +%summary+ is a brief description of the package. It is useful when 919 reporting. This information is not capture in the package anywhere. For the GCC 920 with Newlib configuration the summary is typically: 921 922 ------------------------------------------------------------- 923 Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host} 924 ------------------------------------------------------------- 834 925 835 926 %release 836 927 ^^^^^^^^ 837 928 929 The +%release+ is packaging number that allows revisions of a package to happen 930 where none package versions change. This value typically increases when the 931 configuration building the package changes. 932 933 ------------------------------------------------------------- 934 %define release 1 935 ------------------------------------------------------------- 936 838 937 %version 839 938 ^^^^^^^^ 840 939 940 The +%version% macro sets the version the package. If the package is a single 941 component it tracks that component's version number. For example in the 942 _libusb_ configuration the +%version+ is the same as +%libusb_version+, 943 how-ever in a GCC with Newlib configuration there is no single version 944 number. In this case the GCC version is used. 945 946 ------------------------------------------------------------- 947 Version: %{gcc_version} 948 ------------------------------------------------------------- 949 841 950 %buildarch 842 951 ^^^^^^^^^^ 843 952 953 The +%buildarch+ macro is set to the architecture the package contains. This is 954 currently not used in the RTEMS Source Builder and may go away. This macro is 955 more important in a real packaging system where the package could end up on the 956 wrong architecture. 957 844 958 %setup 845 959 ^^^^^^ 846 960 961 The +%setup+ macro sets up the source code tree and is used in the +%prep+ 962 section of the script. The options are: 963 964 [horizontal] 965 *Switch*:: *Description* 966 +-n+:: The -n option is used to set the name of the software's build 967 directory. This is necessary only when the source archive unpacks into a 968 directory named other than +<name>-<version>+. 969 +-c+:: The -c option is used to direct %setup to create the top-level build 970 directory before unpacking the sources. 971 +-D+:: The -D option is used to direct %setup to not delete the build directory 972 prior to unpacking the sources. This option is used when more than one source 973 archive is to be unpacked into the build directory, normally with the +-b+ or 974 +-a+ options. 975 +-T+:: The -T option is used to direct %setup to not perform the default 976 unpacking of the source archive specified by the first Source: macro. It is used 977 with the +-a+ or +-b+ options. 978 +-b <n>+:: The -b option is used to direct %setup to unpack the source archive 979 specified on the nth Source: macro line before changing directory into the build 980 directory. 981 +-a <n>+:: The -a option is used to direct %setup to unpack the source archive 982 specified on the nth Source: macro line after changing directory into the build 983 directory. 984 847 985 %source 848 986 ^^^^^^^ 849 987 988 The +%source+ macro is numbered and defines a source tar file used in the 989 package. The +%setup+ macro references the packages defined here. A macro is 990 defined as: 991 992 ------------------------------------------------------------- 993 Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2 994 ------------------------------------------------------------- 995 996 The setup script is: 997 998 ------------------------------------------------------------- 999 %setup -q -T -D -n %{name}-%{version} -a0 1000 ------------------------------------------------------------- 1001 1002 The +-a0+ means use +%source0+. 1003 850 1004 %patch 851 1005 ^^^^^^ 852 1006 1007 The +%patch+ macro is numbered and can define a patch and in the +%prep+ 1008 section applies the patch. To define a patch append a +:+ followed by the patch 1009 filename: 1010 1011 ------------------------------------------------------------- 1012 Patch0: gcc-4.7.2-rtems4.11-20121026.diff 1013 ------------------------------------------------------------- 1014 1015 The +__patchdir+ path is search. 1016 1017 Placing +%patch+ in the +%prep+ section will apply it with any trailing options 1018 passed to the +patch+ command. This allows the +-p+ option to be passed to 1019 strip any leading path components from the patch contents. 1020 1021 ------------------------------------------------------------- 1022 %patch0 -p1 1023 ------------------------------------------------------------- 1024 1025 You will typically see the patch conditionally used as: 1026 1027 ------------------------------------------------------------- 1028 %{patch0:%patch0 -p1} 1029 ------------------------------------------------------------- 1030 1031 In this case the patch will only be applied if it is defined. 1032 853 1033 %warning 854 1034 ^^^^^^^^ 855 1035 1036 The +%warning+ macro outputs the following string as a warning. 1037 856 1038 %error 857 1039 ^^^^^^ 858 1040 1041 The +%error+ macro outputs the follow string as an error and exits the RTEMS 1042 Source Builder. 1043 859 1044 %define 860 1045 ^^^^^^^ 861 1046 1047 The +%define+ macro defines a new macro. If the macro being defined already 1048 exists a warning is raised. If you value is given it is assumed to be 1. 1049 1050 ------------------------------------------------------------- 1051 %define foo bar 1052 %define one_plus_one 2 1053 %define one <1> 1054 ------------------------------------------------------------- 1055 1056 <1> The macro _one_ is set to 1. 1057 862 1058 %undefine 863 1059 ^^^^^^^^^ 864 1060 1061 The +%undefine+ macro removes a macro if it exists. Any further references to 1062 it will result in an undefine macro error. 1063 865 1064 %if 866 1065 ^^^ 867 1066 1067 The +%if+ macro starts a conditional logic block that can optionally have a 1068 _else_ section. A test follows this macro and can have the following operators: 1069 1070 [horizontal] 1071 *Operator*:: *Description* 1072 +%{}+:: Check the macro is set or _true_, ie non-zero. 1073 + 1074 ------------------------------------------------------------- 1075 %if ${foo} 1076 %warning The test passes, must not be empty or is non-zero 1077 %else 1078 %error The test fails, must be empty or zero 1079 %endif 1080 ------------------------------------------------------------- 1081 +!+:: The _not_ operator inverts the test of the macro. 1082 + 1083 ------------------------------------------------------------- 1084 %if ! ${foo} 1085 %warning The test passes, must be empty or zero 1086 %else 1087 %error The test fails, must not be empty or is non-zero 1088 %endif 1089 ------------------------------------------------------------- 1090 +==+:: The left hand size must equal the right hand side. For example: 1091 + 1092 ------------------------------------------------------------- 1093 %define one 1 1094 %if ${one} == 1 1095 %warning The test passes 1096 %else 1097 %error The test fails 1098 %endif 1099 ------------------------------------------------------------- 1100 + 1101 You can also check to see if a macro is empty: 1102 + 1103 ------------------------------------------------------------- 1104 %if ${nothing} == %{nil} 1105 %warning The test passes 1106 %else 1107 %error The test fails 1108 %endif 1109 ------------------------------------------------------------- 1110 +!=+:: The left hand size does not equal the right hand side. For example: 1111 + 1112 ------------------------------------------------------------- 1113 %define one 1 1114 %if ${one} != 2 1115 %warning The test passes 1116 %else 1117 %error The test fails 1118 %endif 1119 ------------------------------------------------------------- 1120 + 1121 You can also check to see if something is set: 1122 + 1123 ------------------------------------------------------------- 1124 %if ${something} != %{nil} 1125 %warning The test passes 1126 %else 1127 %error The test fails 1128 %endif 1129 ------------------------------------------------------------- 1130 +>+:: The left hand side is numerically greater than the right hand side. 1131 +>=+:: The left hand side is numerically greater than or equal to the right 1132 hand side. 1133 +<+:: The left hand side is numerically less than the right hand side. 1134 +\<=+:: The left hand side is numerically less than or equal to the right hand 1135 side. 1136 868 1137 %ifn 869 1138 ^^^^ 870 1139 1140 The +%ifn+ macro inverts the normal +%if+ logic. It avoids needing to provide 1141 empty _if_ blocks followed by _else_ blocks. It is useful when checking if a 1142 macro is defined: 1143 1144 ------------------------------------------------------------- 1145 %ifn %{defined foo} 1146 %define foo bar 1147 %endif 1148 ------------------------------------------------------------- 1149 871 1150 %ifarch 872 1151 ^^^^^^^ 873 1152 1153 The +%ifarch+ is a short cut for "+%if %{\_arch} == i386+". Currently not used. 1154 874 1155 %ifnarch 875 1156 ^^^^^^^^ 876 1157 1158 The +%ifnarch+ is a short cut for "+%if %{\_arch} != i386+". Currently not 1159 used. 1160 877 1161 %ifos 878 1162 ^^^^^ 879 1163 1164 The +%ifos+ is a short cut for "+%if %{\_os} != mingw32+". It allows 1165 conditional support for various operating system differences when building 1166 packages. 1167 880 1168 %else 881 1169 ^^^^^ 882 1170 1171 The +%else+ macro starts the conditional _else_ block. 1172 883 1173 %endfi 884 1174 ^^^^^^ 885 1175 1176 The +%endif+ macro ends a conditional logic block. 1177 886 1178 %bconf_with 887 1179 ^^^^^^^^^^^ 888 1180 1181 The +%bconf_with+ macro provides a way to test if the user has passed a 1182 specific option on the command line with the +--with-<label>+ option. This 1183 option is only available with the +sb-builder+ command. 1184 889 1185 %bconf_without 890 1186 ^^^^^^^^^^^^^^ 891 1187 892 893 RTEMS Build Sets 894 ---------------- 895 896 Configuration files are typically structured as outer files that are specific 897 to a version of the package being built and become more generic as you move 898 deeper. The outter layers are required to define various macro. 899 900 901 Set Builder and the Builder 902 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 903 904 The RTEMS Source Builder provides two commands, the +sb-set-builder+ to build sets of 905 packages and the +sb-builder+ to build a specific package. The set builder uses 906 the builder to build a set of packages. You could write a shell script that did 907 the same thing so the set builder is a convenience command that allows you to 908 define and control specific features of the packages you are building. The set 909 builder looks for files with the +.bset" extension in the +config+ 910 directories. The builder command uses configuration files which have the +.cfg+ 911 file extension to control the build. The configuration files are written in a 912 script language based on the _spec_ format the RPM builder uses. They also 913 live in the +config+ directories. 914 915 The build set files for the RTEMS 4.11 can be found in +rtems/4.11/+. There is 916 one per architecture RTEMS supports. This allows variation between 917 architectures is bugs or patches are needed. Sometimes a specific version of a 918 tool may needed to resolve an issue in an architecture, how-ever that version 919 may have a bug in another architecture. We also want to limit architecture 920 specific patches to the architecture it relates to. This avoids any crosstalk a 921 patch may have with another architecture. An example of this is the NIOS2 922 tools. They are built using a version of GCC released by Altera currently not 923 in the Free Software Foundation's GCC project. 924 925 This is the build set for the Blackfin processor or +bfin+. 926 927 ------------------------------------------------------------- 928 # 929 # Tools Set for RTEMS 4.10 930 # 931 932 %define rtems_version 4.10 <1> 933 934 %define release 1 <2> 935 936 package: rtems-%{rtems_version}-%{_target}-%{release} <3> 937 938 # 939 # Project custom message 940 # 941 %define gcc_version_message RTEMS %{rtems_version}-%{release},gcc-%{gcc_version}/newlib-%{newlib_version} <4> 942 943 # 944 # Tools configuration. 945 # 946 rtems-binutils-2.20.1-1 <5> 947 rtems-gcc-4.4.7-newlib-1.18.0-1 948 rtems-gdb-7.3.1-1 949 ------------------------------------------------------------- 950 951 <1> Define the version of RTEMS. 952 <2> Define the release. This allows us to number the tool releases. 953 <3> The top level name of the package. The finaly tar file name. 954 <4> The GCC configuration allow a custom message to be embedded into GCC. 955 <5> The list of packages this build set contains. 956 957 Currently the syntax of the set builder scripts is limited. It support 958 comments, the package command, macros (the +%{}+), and defining macros 959 (+%define+). It is planned to allow more of the configuration file syntax in 960 the future. 961 962 The builder uses configuration files that allow the full range of the 963 configuration script syntax. Configuration files follow most of the RPM spec 964 file format. They support macros and logic as well as the ability to include 965 other configuration files. The ability to include other configuration files 966 allow a simple way to configuration control the builds. Configuration files 967 have four main areas: 968 969 . Descriptions and definitions. 970 + 971 The description lists various useful pieces of information about the 972 package. None of this is currently enforced how-ever it is good practice to 973 provide it. The definitions are the sources and the patches. 974 . Preparation 975 + 976 The preparation is the set up of the source code ready for building. The set up 977 follows the unusual command structure used by RPM. The follwing macro 978 trickshows how to conditional patch the source if a patch has been declared. 979 + 980 ------------------------------------------------------------- 981 cd expat-%{expat_version} 982 %{?patch0:%patch0 -p1} 983 cd .. 984 ------------------------------------------------------------- 985 + 986 . Build 987 + 988 The build phase. This is a fragment of shell script that can be mixed with 989 conditional configuration scripting to create the list of build commands. 990 + 991 . Install 992 + 993 The install phase. Again this is a fragment of shell script. 994 995 This is a configuration script to build gdb: 996 997 ------------------------------------------------------------- 998 # 999 # GDB 7.xx Version 1. 1000 # 1001 # This configuration file configure's, make's and install's gdb. 1002 # 1003 1004 %include %{_configdir}/checks.cfg <1> 1005 1006 Name: %{_target}-gdb-%{gdb_version}-%{release} <2> 1007 Summary: GDB v%{gdb_version} for target %{_target} on host %{_host} 1008 Version: %{gdb_version} 1009 Release: %{release} 1010 URL: http://www.gnu.org/software/gdb/ 1011 BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n) 1012 1013 # 1014 # Source 1015 # 1016 Source0: http://ftp.gnu.org/gnu/gdb/gdb-%{gdb_version}.tar.bz2 <3> 1017 VersionControl0 git clone git://sourceware.org/git/gdb.git 1018 1019 # 1020 # Prepare the source code. 1021 # 1022 %prep <4> 1023 %setup -q -c -T -n %{name}-%{version} 1024 cd gdb-%{gdb_version} 1025 %{?patch0:%patch0 -p1} 1026 cd .. 1027 1028 %build <5> 1029 export PATH="%{_bindir}:${PATH}" 1030 mkdir -p build 1031 cd build 1032 %if "%{_build}" != "%{_host}" 1033 CFLAGS_FOR_BUILD="-g -O2 -Wall" \ 1034 %endif 1035 CFLAGS="$SB_OPT_FLAGS" \ 1036 ../gdb-%{gdb_version}/configure \ 1037 --build=%{_build} --host=%{_host} \ 1038 --target=%{_target} \ 1039 --verbose --disable-nls \ 1040 --without-included-gettext \ 1041 --disable-win32-registry \ 1042 --disable-werror \ 1043 --enable-sim \ 1044 --with-expat \ 1045 --with-python \ 1046 --prefix=%{_prefix} --bindir=%{_bindir} \ 1047 --exec-prefix=%{_exec_prefix} \ 1048 --includedir=%{_includedir} --libdir=%{_libdir} \ 1049 --mandir=%{_mandir} --infodir=%{_infodir} 1050 1051 %{__make} %{?_smp_mflags} all 1052 cd .. 1053 1054 %install <6> 1055 export PATH="%{_bindir}:${PATH}" 1056 rm -rf $SB_BUILD_ROOT 1057 1058 cd build 1059 %{__make} DESTDIR=$SB_BUILD_ROOT install 1060 1061 # Dropped in FSF-binutils-2.9.5, but Cygwin still ships it. 1062 rm -rf $SB_BUILD_ROOT%{_infodir}/configure.info* 1063 1064 rm -f $SB_BUILD_ROOT%{_infodir}/dir 1065 touch $SB_BUILD_ROOT%{_infodir}/dir 1066 1067 cd .. 1068 ------------------------------------------------------------- 1069 1070 <1> Including a file. The +_configdir+ macro searchs a list of paths. 1071 <2> The description section. 1072 <3> The source file as a URL. If not found in the +sources+ directories it is 1073 downloaded. 1074 <4> Preparing the source code. 1075 <5> The commands to build +gdb+. 1076 <6> The installation phase. Notice the +DESTDIR=+ feature is used. 1077 1078 Controlling Configurations 1079 ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1080 1081 This is a simple process of including the specific pieces you need. There 1082 typically is three layers where the top level is specific and each sub-layer is 1083 more generic configured by the layer above it. The typical layering is: 1084 1085 . Build Set 1086 . Package definition 1087 . Package configuration 1088 1089 The build set defines the packages to be built plus any specific configuration 1090 needed. Some packages default to standard values if the build set does not 1091 provide any specific configuration and some configurations raise an error 1092 indicating a required configuration is missing. 1093 1094 Using the RTEMS 4.10 Tools Set build as an example the build set configuration 1095 is: 1096 1097 ------------------------------------------------------------- 1098 # 1099 # Tools Set for RTEMS 4.10 1100 # 1101 1102 %define rtems_version 4.10 1103 1104 %define release 1 <1> 1105 1106 package: rtems-%{rtems_version}-%{_target}-%{release} 1107 1108 # 1109 # Project custom message 1110 # 1111 %define gcc_version_message RTEMS %{rtems_version}-%{release},gcc-%{gcc_version}/newlib-%{newlib_version} 1112 1113 # 1114 # Tools configuration. 1115 # 1116 rtems-binutils-2.20.1-1 <2> 1117 rtems-gcc-4.4.7-newlib-1.18.0-1 1118 rtems-gdb-7.3.1-1 1119 ------------------------------------------------------------- 1120 1121 <1> The release of the RTEMS 4.10 tools package. 1122 <2> The build configurations. These reference the specific version of the tools 1123 including the related patches. You should note the configurations referenced 1124 are RTEMS specific, that is prefixed with +rtems-+. 1125 1126 The GCC and Newlib file +rtems-gcc-4.4.7-newlib-1.18.0-1+ is: 1127 1128 ------------------------------------------------------------- 1129 # 1130 # GCC 4.4.7, Newlib 1.18.0 1131 # 1132 1133 %include %{_configdir}/checks.cfg <1> 1134 %include %{_configdir}/base.cfg <2> 1135 1136 %define gcc_version 4.4.7 <3> 1137 %define newlib_version 1.18.0 1138 %define mpfr_version 2.4.1 1139 %define mpc_version 0.8.2 1140 %define gmp_version 5.0.5 1141 1142 %define with_threads 1 <4> 1143 %define with_plugin 0 1144 %define with_iconv 1 1145 1146 # 1147 # AVR C++ does not work. 1148 # configure: error: unable to detect exception model 1149 # 1150 %if %{_target} == avr-rtems4.10 <5> 1151 %define enable_cxx 0 1152 %endif 1153 1154 # 1155 # M32C C++ does not work. 1156 # gcc-4.4.7/libstdc++-v3/src/mt_allocator.cc:76: error: cast from 'void*' to 'size_t' loses precision 1157 # 1158 %if %{_target} == m32c-rtems4.10 1159 %define enable_cxx 0 1160 %endif 1161 1162 %ifn %{defined enable_cxx} <6> 1163 %define enable_cxx 1 1164 %endif 1165 1166 # 1167 # The RTEMS 4.10 patches 1168 # 1169 Patch0: gcc-core-4.4.7-rtems4.10-20120314.diff <7> 1170 %if %{enable_cxx} 1171 Patch1: gcc-g++-4.4.7-rtems4.10-20120314.diff 1172 %endif 1173 Patch10: newlib-1.18.0-rtems4.10-20110518.diff 1174 1175 # 1176 # The gcc/newlib build instructions. We use 4.4 Release 1. 1177 # 1178 %include %{_configdir}/gcc-4.4-1.cfg <8> 1179 ------------------------------------------------------------- 1180 1181 <1> Perform some standard checks such as the release being set. 1182 <2> Set up some standard macros needed by most configure type packages. 1183 <3> The specific versions of the various parts that make a GCC embedded 1184 cross-compiler. 1185 <4> Configure some specific parts of GCC and Newlib for RTEMS. 1186 <5> Disable C++ for the AVR target because it does not build for RTEMS. 1187 <6> Default is to build C++. 1188 <7> The various patches. This file's revision increases with each patch change. 1189 <8> The generic GCC/Newlib build configuration for gcc-4.4.x. 1190 1191 Project Configuration 1192 ~~~~~~~~~~~~~~~~~~~~~ 1193 1194 The RTEMS Source Builder has a +config+ and +patches+ directory that contain some 1195 useful and often needed configurations and patches. You do not need to add your 1196 project specific configurations into the RTEMS Source Builder. You can create a 1197 private set and then use the RTEMS Source Builder to build your packages. 1198 1199 Create a +config+ directory and place your build sets and configuration in 1200 them. If you have private patches add them to a +patches+ directory next to the 1201 +config+ directiory. When you run a RTEMS Source Builder command it will first search 1202 the for the specific file then the local +config+ directoy then the Source 1203 Builder's +config+ directory. The same goes for +patches+. 1204 1205 For example of this set up look in the +rtems+ directory in the Source 1206 Builder. It is actually a standard alone project configuration private to the 1207 RTEMS project. 1208 1209 If you are an open source project and you find the RTEMS Source Builder useful and 1210 would like your configuration held in the RTEMS Source Builder's repository please 1211 contact me directly. 1212 1213 The Builder 1214 ~~~~~~~~~~~ 1215 1216 TBD 1188 The +%bconf_without+ macro provides a way to test if the user has passed a 1189 specific option on the command line with the +--without-<label>+ option. This 1190 option is only available with the +sb-builder+ command. 1191 1192 1193 Project Configuration Sets 1194 -------------------------- 1195 1196 The RTEMS Source Builder supports project configurations. Project 1197 configurations can be public or private and can be contained in the RTEMS 1198 Source Builder project if suitable, other projects they use the RTEM Source 1199 Builder or privately on your local file system. 1200 1201 The configuration file loader searches the macro +_configdir+ and by default 1202 this is set to +%{\_topdir}/config:%{\_sbdir}/config+ where +_topdir+ is the 1203 your current working direct, in other words the directory you invoke the RTEMS 1204 Source Builder command in, and +_sbdir+ is the directory where the RTEMS Source 1205 Builder command resides. Therefore the +config+ directory under each of these 1206 is searched so all you need to do is create a +config+ in your project and add 1207 your configuration files. They do not need to be under the RTEMS Source Builder 1208 source tree. Public projects are included in the main RTEMS Source Builder such 1209 as RTEMS. 1210 1211 You can also add your own +patches+ directory next to your +config+ directort 1212 as the +%patch+ command searches the +_patchdir+ macro variable and it is 1213 by default set to +%{\_topdir}/patches:%{\_sbdir}/patches+. 1214 1215 The +source-builder/config+ directory provides generic scripts for building 1216 various tools. You can specialise these in your private configurations to make 1217 use of them. If you add new generic configurations please contribute them back 1218 to the project 1219 1220 RTEMS Configurations 1221 ~~~~~~~~~~~~~~~~~~~~ 1222 1223 The RTEMS Configurations are grouped by RTEMS version. In RTEMS the tools are 1224 specific to a specific version because of variations between Newlib and 1225 RTEMS. Restructuring in RTEMS and Newlib sometimes moves _libc_ functionality 1226 between them and this makes existing tool incompatible with RTEMS. 1227 1228 RTEMS allows architectures to have different tool versions and patches. The 1229 large number of architectures RTEMS supports can make it difficult to get a 1230 common stable version of all the packages. An architecture may require a recent 1231 GCC because an existing bug has been fixed, how-ever the more recent verison 1232 may have a bug in other architecture. Architecture specific patches should be 1233 limited to the architecture it relates to. The patch may fix a problem on the 1234 effect architecture how-ever it could introduce a problem in another 1235 architecture. Limit exposure limits any possible crosstalk bewteen 1236 architectures. 1237 1238 RTEMS supports _stable_ and _unstable_ configuration of tools. The stable build sets 1239 are referenced as +<version>/rtems-<arch>+ and the unstable build sets are 1240 references as +<version>/unstable/rtems-<arch>+. 1217 1241 1218 1242 Commands … … 1222 1246 ~~~~~~~~~~~~~~~~~~ 1223 1247 1224 This commands checks your system is set up correctly. 1225 1226 ------------------------------------------------------------- 1227 $ . /source-builder/sb-check --help1248 This commands checks your system is set up correctly. Most options are ignored. 1249 1250 ------------------------------------------------------------- 1251 $ ../source-builder/sb-check --help 1228 1252 sb-check: [options] [args] 1229 RTEMS Source Builder, an RTEMS Tools Project (c) 2012 Chris Johns1253 RTEMS Source Builder, an RTEMS Tools Project (c) 2012-2013 Chris Johns 1230 1254 Options and arguments: 1231 1255 --force : Create directories that are not present … … 1253 1277 --with-<label> : Add the --with-<label> to the build 1254 1278 --without-<label> : Add the --without-<label> to the build 1255 ------------------------------------------------------------- 1256 1257 Set Builder (sb-set-builder) 1258 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1259 1260 This command builds a set as described in a build set. Build set files have the 1261 extension of +.bset+. 1262 1263 ------------------------------------------------------------- 1264 $ ./source-builder/sb-set-builder --help 1265 sb-set-builder: [options] [args] 1266 RTEMS Source Builder, an RTEMS Tools Project (c) 2012 Chris Johns 1279 $ ../source-builder/sb-check 1280 RTEMS Source Builder environent is ok 1281 ------------------------------------------------------------- 1282 1283 Defaults (sb-defaults) 1284 ~~~~~~~~~~~~~~~~~~~~~~ 1285 1286 This commands outputs and the default macros for your when given no 1287 arguments. Most options are ignored. 1288 1289 ------------------------------------------------------------- 1290 $ ../source-builder/sb-defaults --help 1291 sb-defaults: [options] [args] 1292 RTEMS Source Builder, an RTEMS Tools Project (c) 2012-2013 Chris Johns 1267 1293 Options and arguments: 1268 --force : Create directories that are not present1294 --force : Force the build to proceed 1269 1295 --trace : Trace the execution (not current used) 1270 1296 --dry-run : Do everything but actually run the build … … 1290 1316 --with-<label> : Add the --with-<label> to the build 1291 1317 --without-<label> : Add the --without-<label> to the build 1318 ------------------------------------------------------------- 1319 1320 Set Builder (sb-set-builder) 1321 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1322 1323 This command builds a set. 1324 1325 ------------------------------------------------------------- 1326 $ ../source-builder/sb-set-builder --help 1327 sb-set-builder: [options] [args] 1328 RTEMS Source Builder, an RTEMS Tools Project (c) 2012-2013 Chris Johns 1329 Options and arguments: 1330 --force : Force the build to proceed 1331 --trace : Trace the execution (not current used) 1332 --dry-run : Do everything but actually run the build 1333 --warn-all : Generate warnings 1334 --no-clean : Do not clean up the build tree 1335 --no-smp : Run with 1 job and not as many as CPUs 1336 --rebuild : Rebuild (not used) 1337 --host : Set the host triplet 1338 --build : Set the build triplet 1339 --target : Set the target triplet 1340 --prefix path : Tools build prefix, ie where they are installed 1341 --prefixbase path : 1342 --topdir path : Top of the build tree, default is $PWD 1343 --configdir path : Path to the configuration directory, default: ./config 1344 --builddir path : Path to the build directory, default: ./build 1345 --sourcedir path : Path to the source directory, default: ./source 1346 --tmppath path : Path to the temp directory, default: ./tmp 1347 --log file : Log file where all build out is written too 1348 --url url : URL to look for source 1349 --targetcflags flags : List of C flags for the target code 1350 --targetcxxflags flags : List of C++ flags for the target code 1351 --libstdcxxflags flags : List of C++ flags to build the target libstdc++ code 1352 --with-<label> : Add the --with-<label> to the build 1353 --without-<label> : Add the --without-<label> to the build 1354 --list-bsets : List available build sets 1355 --keep-going : Do not stop on error. 1356 --no-install : Do not install the packages to the prefix. 1357 --bset-tar-file : Create a build set tar file 1292 1358 --list-configs : List available configurations 1293 --list-bsets : List available build sets 1294 ------------------------------------------------------------- 1359 --pkg-tar-files : Create package tar files 1360 ------------------------------------------------------------- 1361 1362 .Arguments 1363 The +[args]+ are a list build sets to build. 1364 1365 .Options 1366 +--force+;; 1367 Force the build to proceed even if the host check fails. Typically this happens 1368 if executables are found in the path at a different location to the host 1369 defaults. 1370 +--trace+;; 1371 Trace enable printing of debug information to stdout. It is really only of use 1372 to RTEMS Source Builder's developers. 1373 +--dry-run+;; 1374 Do everything but actually run the build commands. This is useful when checking 1375 a new configuration parses cleanly. 1376 +--warn-all+;; 1377 Generate warnings. 1378 +--no-clean+;; 1379 Do not clean up the build tree during the cleaning phase of the build. This 1380 leaves the source and the build output on disk so you can make changes, or 1381 amend or generate new patches. It also allows you to review configure type 1382 output such as +config.log+. 1383 +--no-smp+;; 1384 Run +make+ with 1 job and not as many as there are cores. This option can help 1385 isolate parallel make type bugs or make the log file output 1386 sequential. Parallel jobs can make the output confusing. 1387 +--host+;; 1388 Set the host triplet value. Becareful with this option. 1389 +--build+;; 1390 Set the build triplet. Becareful with this option. 1391 +--target+;; 1392 Set the target triplet. Becareful with this option. This is useful if you have 1393 a generic configuration script that can work for a range of architectures. 1394 +--prefix path+;; 1395 Tools build prefix, ie where they are installed. 1396 +--prefixbase path+;; 1397 The prefix base is appended to the build root path. 1398 +--topdir path+;; 1399 Top of the build tree, that is the current directory you are in. 1400 +--configdir path+;; 1401 Path to the configuration directory. This overrides the built in defaults. 1402 +--builddir path+;; 1403 Path to the build directory. This overrides the default of +build+. 1404 +--sourcedir path+;; 1405 Path to the source directory. This overrides the default of +source+. 1406 +--tmppath path+;; 1407 Path to the temporary directory. This overrides the default of +tmp+. 1408 +--log file+;; 1409 Log all the output from the build process. The output is directed to +stdout+ 1410 if no log file is provided. 1411 +--url url+;; 1412 URL to look for source when downloading. This is can be comma separate list. 1413 +--targetcflags flags+;; 1414 List of C flags for the target code. This allows for specific local 1415 customisation when testing new variations. 1416 +--targetcxxflags flags+;; 1417 List of C++ flags for the target code. This allows for specific local 1418 customisation when testing new variations. 1419 +--libstdcxxflags flags+;; 1420 List of C\++ flags to build the target libstdc++ code. This allows for specific 1421 local customisation when testing new variations. 1422 +--with-<label>+;; 1423 Add the --with-<label> to the build. This can be tested for in a script with 1424 the +%bconf_with+ macro. 1425 +--without-<label>+;; 1426 Add the --without-<label> to the build. This can be tested for in a script with 1427 the +%bconf_without+ macro. 1428 +--list-bsets+;; 1429 List available build sets. 1430 +--list-configs+;; 1431 List available configurations. 1432 +--keep-going+;; 1433 Do not stop on error. This is useful if your build sets performs a large number 1434 of testing related builds and there are errors. 1435 +--no-install+;; 1436 Do not install the packages to the prefix. Use this if you are only after the 1437 tar files. 1438 +--bset-tar-file+;; 1439 Create a build set tar file. This is a single tar file of all the packages in 1440 the build set. 1441 +--pkg-tar-files+;; 1442 Create package tar files. A tar file will be created for each package built in 1443 a build set. 1295 1444 1296 1445 Set Builder (sb-builder) … … 1360 1509 ------------------------------------------------------------- 1361 1510 $ sudo apt-get install autoconf automake bison flex binutils gcc g++ gdb \ 1362 texinfo unzip ncurses-dev python-dev 1511 texinfo unzip ncurses-dev python-dev git 1363 1512 ------------------------------------------------------------- 1364 1513
Note: See TracChangeset
for help on using the changeset viewer.