Changeset e119c6a in rtems-source-builder


Ignore:
Timestamp:
May 14, 2014, 6:38:24 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
e249bd1
Parents:
1b29191
Message:

doc: Update the documentation for the new source and patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/source-builder.txt

    r1b29191 re119c6a  
    1010
    1111Chris Johns <chrisj@rtems.org>
    12 1.6, April 2014
     121.7, May 2014
    1313
    1414RTEMS Tools From Source
     
    462462
    463463You can also suppress installing the files using the `--no-install` option to
    464 the `sb-set-builder` command.
     464the `sb-set-builder` command. This is usefu if your prefix is not accessiable
     465when building Canadian cross compiled tool sets.
    465466
    466467-------------------------------------------------------------
     
    609610
    610611The RTEMS Source Builder is a Python program and every care is taken to test
    611 the code however bugs, crashes, and build failure can and do happen. If you
    612 find a bug please report it via the RTEMS Bug tracker tool Bugzilla:
    613 
    614 https://www.rtems.org/bugzilla/
    615 
    616 or via email on the RTEMS Users list.
    617 
    618 Please include the:
     612the code however bugs, crashes, and build failures can and do happen. If you
     613find a bug please report it via the RTEMS Bug tracker tool Bugzilla or via
     614email on the RTEMS Users list. RTEMS's bugzilla is found at
     615https://www.rtems.org/bugzilla/.
     616
     617Please include the generated RSB report. If you see the following a report has
     618been generated:
     619
     620-------------------------------------------------------------
     621 ...
     622 ...
     623Build FAILED <1>
     624  See error report: rsb-report-4.11-rtems-lm32.txt <2>
     625-------------------------------------------------------------
     626<1> The build has failed.
     627<2> The report's file name.
     628
     629The generated report contains the command line, version of the RSB, your host
     630+uname+ details, the version of Python and the last 200 lines of the log.
     631
     632If there is no report please send for some reason and something has falied
     633please report the following:
    619634
    620635. Command line,
     
    623638. If you have made any modifications.
    624639
    625 If there is a crash please cut and paste the Python backtrace into the bug
    626 report. If the tools fail to build please locate the first error in the log
     640If there is a Python crash please cut and paste the Python backtrace into the
     641bug report. If the tools fail to build please locate the first error in the log
    627642file. This can be difficult to find on hosts with many cores so it sometimes
    628643pays to run the command with the +--jobs=none+ option to get a log that is
     
    778793accepted upstream.
    779794
    780 Patches are numbered and the number of available slots depends on the package's
    781 configuration file. For example +source-builder/config/gcc-common-1.cfg+ has 2
    782 groups of patch numbers, 0 to 9 for GCC and 10 to 19 for newlib. An example is:
    783 
    784 -------------------------------------------------------------
    785 %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
    786 -------------------------------------------------------------
    787 
    788 The +patch0+ is applied if defined and the option can also be optionally
    789 defined and passed to patch. An example is a patch to the moxie binutils:
    790 
    791 -------------------------------------------------------------
    792 #
    793 # Moxie Binutil and GDB patches
    794 #
    795 %define rtems_binutils_patch1 %{rtems_binutils_patches}/moxie/binutils-2.22-rtems4.11-moxie-20130214.diff
    796 %define rtems_binutils_patch2 %{rtems_binutils_patches}/moxie/binutils-2.22-rtems4.11-moxie-20130516.diff
    797 -------------------------------------------------------------
    798 
    799 These patches use the default +-p1+ option to patch. Note the patch file name
    800 includes all the details so it is easy to track and locate when in the +patches+
    801 directory after download.
    802 
    803 The +rtems-4.11-base.bset+ provides paths to the RTEMS Tools repository for
    804 each common tools package the RSB builds. It is recommended you use
    805 them. Please check the file for details.
     795Patches are added to a component's name and in the +%prep:+ section the patches
     796can be set up, meaning they are applied to source. The patches are applied in
     797the order they are added. If there is a dependency make sure you order the
     798patches correctly when you add them. You can add any number of patches and the
     799RSB will handle them efficently.
     800
     801Patches can have options. These are added before the patch URL. If no options
     802are provided the patch's setup default options are used.
     803
     804Patches can be declared in build set up files.
     805
     806This examples shows how to declare a patch for gdb in the +lm32+ architecture:
     807
     808-------------------------------------------------------------
     809%patch add <1> gdb <2> %{rtems_gdb_patches}/lm32/gdb-sim-lm32uart.diff <3>
     810-------------------------------------------------------------
     811<1> The patch's +add+ command.
     812<2> The group of patches this patch belongs too.
     813<3> The patch's URL. It is downloaded from here.
     814
     815The patches are applied when a patch +setup+ command is issued in the +%prep:+
     816section. All patches in the group are applied. To apply the GDB patch above
     817use:
     818
     819-------------------------------------------------------------
     820%patch setup <1> gdb <2> -p1 <3>
     821-------------------------------------------------------------
     822<1> The patch's +setup+ command.
     823<2> The group of patches to apply.
     824<3> The patch group's default options. If no option is given with the patch
     825these options are used.
    806826
    807827Architecture specific patches live in the architecture build set file isolating
     
    855875RSB build command.
    856876
     877TIP: Canadian Cross built tools will not run on the machine being used to build
     878them so you should provide the +--bset-tar-files+ and +--no-install+
     879options. The option to not install the files lets you provide a prefix that
     880does not exist or you cannot access.
     881
    857882Command Line
    858883~~~~~~~~~~~~
     
    920945The RTEMS Source Builder provides a flexible way to manage source. Source and
    921946patches are declare in configurations file using the +source+ and +patch+
    922 directives. There are a single line containing a Universal Resource Location or
     947directives. These are a single line containing a Universal Resource Location or
    923948URL and can contain macros and shell expansions. The <<_prep,%prep>> section
    924949details the source and patch directives
     
    929954'http':: Remote access using the HTTP protocol.
    930955'https':: Remote access using the Secure HTTP protocol.
    931 'ftp:: Remote access using the FTP protocol.
    932 'git:: Remote access to a GIT repository.
    933 'cvs:: Remote access to a CVS repository.
    934 'file:: Local access to an existing source directory.
     956'ftp':: Remote access using the FTP protocol.
     957'git':: Remote access to a GIT repository.
     958'cvs':: Remote access to a CVS repository.
     959'pm':: Remote access to a patch management repository.
     960'file':: Local access to an existing source directory.
    935961
    936962HTTP, HTTPS, and FTP
    937963^^^^^^^^^^^^^^^^^^^^
    938964
    939 Remote access to TAR files is provided using HTTP, HTTPS and FTP protocols. The
    940 full URL provided is used to access the remote file including any query
    941 components. The URL is parsed to extract the file component and the local
    942 source directory is checked for that file. If the file is located the remote
    943 file is not downloaded. Currently no other checks are made. If a download fails
    944 you need to manually remove the file from the source directory and start the
    945 build process again.
    946 
    947 The URL can contain macros. These are expand before issuing the request to
    948 download the file. The GNU GCC compiler source URL is:
    949 
    950 -------------------------------------------------------------
    951 Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
    952 -------------------------------------------------------------
     965Remote access to TAR or ZIP files is provided using HTTP, HTTPS and FTP
     966protocols. The full URL provided is used to access the remote file including
     967any query components. The URL is parsed to extract the file component and the
     968local source directory is checked for that file. If the file is located locally
     969the remote file is not downloaded. Currently no other checks are made. If a
     970download fails you need to manually remove the file from the source directory
     971and start the build process again.
     972
     973The URL can contain macros. These are expanded before issuing the request to
     974download the file. The standard GNU GCC compiler source URL is:
     975
     976-------------------------------------------------------------
     977%source set<1> gcc<2> ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
     978-------------------------------------------------------------
     979<1> The +%source+ command's set command sets the source. The first is set and
     980following sets are ignored.
     981<2> The source is part of the +gcc+ group.
    953982
    954983The type of compression is automatically detected from the file extension. The
    955984supported compression formats are:
    956985
    957 `gz`:: GNU ZIP
    958 `bzip2`:: BZIP2 ??
    959 `zip`:: ??
    960 'xy':: XY ??
    961 
    962 The output of the decompression tool is feed to the standard `tar` utility and
    963 unpacked into the build directory.
    964 
    965 If the URL references the GitHub API server 'https://api.github.com/' a tarball
    966 of the specified version is download. For example the URL for the STLINK
    967 project on GitHub and version is:
     986'gz':: GNU ZIP
     987'bzip2':: BZIP2
     988'zip':: ZIP
     989'xy':: XY
     990
     991The output of the decompression tool is feed to the standard `tar` utility if
     992not a ZIP file and unpacked into the build directory. ZIP files are unpacked by
     993the decompression tool and all other files must be in the tar file format.
     994
     995The +%source+ directive typically supports a single source file tar or zip
     996file. The +set+ command is used to set the URL for a specific source group. The
     997first set command encoutner is registered and any further set commands are
     998ignored. This allows you to define a base standard source location and override
     999it in build and architecture specific files. You can also add extra source
     1000files to a group. This is typically done when a collection of source is broken
     1001down in a number of smaller files and you require the full package. The
     1002source's +setup+ command must reide in the +%prep:+ section and it unpacks the
     1003source code ready to be built.
     1004
     1005If the source URL references the GitHub API server 'https://api.github.com/' a
     1006tarball of the specified version is download. For example the URL for the
     1007STLINK project on GitHub and version is:
    9681008
    9691009-------------------------------------------------------------
    9701010%define stlink_version 3494c11
    971 Source0: https://api.github.com/repos/texane/stlink/texane-stlink-%{stlink_version}.tar.gz
    972 -------------------------------------------------------------
    973 
    974 the TAR file is downloaded and used.
     1011%source set stlink https://api.github.com/repos/texane/stlink/texane-stlink-%{stlink_version}.tar.gz
     1012-------------------------------------------------------------
    9751013
    9761014GIT
     
    9931031
    9941032-------------------------------------------------------------
    995 Source0: git://gcc.gnu.org/git/gcc.git?branch=gcc-4_7-branch?reset=hard
     1033%source set gcc git://gcc.gnu.org/git/gcc.git?branch=gcc-4_7-branch?reset=hard
    9961034-------------------------------------------------------------
    9971035
    9981036This will clone the GCC git repository and checkout the 4.7-branch and perform
    999 a hard reset.
     1037a hard reset. You can select specific branches and apply patches. The
     1038repository is cleaned up before each build to avoid various version control
     1039errors that can arise.
    10001040
    10011041CVS
     
    10151055
    10161056-------------------------------------------------------------
    1017 Source0: cvs://pserver:anoncvs@sourceware.org/cvs/src?module=newlib?src-prefix=src
     1057%source set newlib cvs://pserver:anoncvs@sourceware.org/cvs/src?module=newlib?src-prefix=src
    10181058-------------------------------------------------------------
    10191059
     
    14141454# Source
    14151455#
    1416 Source0: http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
     1456%source set dtc http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
    14171457-------------------------------------------------------------
    14181458
     
    14391479unsure why something is being done a particular way.
    14401480
    1441 The preparation phase will often include a number of conditional patch
    1442 commands. Outer layers can provide patches as needed while being able to use a
    1443 common recipe. Users can override the standard build and supply a custom patch
    1444 for testing using the user macro command line interface.
     1481The preparation phase will often include source and patch setup commands. Outer
     1482layers can set the source package and add patches as needed while being able to
     1483use a common recipe for the build. Users can override the standard build and
     1484supply a custom patch for testing using the user macro command line interface.
    14451485
    14461486-------------------------------------------------------------
     
    14511491  build_top=$(pwd)
    14521492
    1453   %setup -q -n dtc-v%{dtc_version}
    1454   %{?patch0:%patch0 -p1}
    1455   %{?patch1:%patch1 -p1}
    1456   %{?patch2:%patch2 -p1}
    1457   %{?patch3:%patch3 -p1}
    1458   %{?patch4:%patch4 -p1}
    1459   %{?patch5:%patch5 -p1}
    1460   %{?patch6:%patch6 -p1}
    1461   %{?patch7:%patch7 -p1}
     1493  %source setup dtc -q -n dtc-v%{dtc_version}
     1494  %patch setup dtc -p1
    14621495
    14631496  cd ${build_top}
     
    16171650~~~~~~~~~~~~~~~~
    16181651
     1652_This section needs to be updated once I sort out snapshot testing._
     1653
    16191654Testing of release canidates and snapshots is important to those helping
    16201655maintain tool sets. The RTEMS Source Builder helps by providing a simple and
     
    16351670[gcc-4.7-snapshot]
    16361671GCC_Version: none, override, '4.7-20130413'
    1637 Source0:     none, override, 'http://mirrors.kernel.org/sources.redhat.com/gcc/
     1672Source:     none, override, 'http://mirrors.kernel.org/sources.redhat.com/gcc/
    16381673snapshots/%{gcc_version}/gcc-%{gcc_version}.tar.bz2'
    16391674Patch0:      none, udefine,  ''
     
    16791714+%version+:: The package's version string.
    16801715+%buildarch+:: The build architecture.
    1681 +%setup+:: Setup a source package.
    16821716+%source+:: Define a source code package. This macro has a number appended.
    16831717+%patch+:: Define a patch. This macro has a is number appended.
     
    17421776_prep_ or preparation block defines the setup of the package's source and is a
    17431777mix of RTEMS Source Builder macros and shell scripting. The sequence is
    1744 typically +%setup+ macros for source, +%patch+ macros to patch the source
    1745 mixed with some shell commands to correct any source issues.  A +%prep+ section
    1746 starts with a +%setup+ command. This creates the package source top level
    1747 directory then is followed by the first source file.
    1748 
    1749 -------------------------------------------------------------
    1750                      <1>       <2>
    1751 %setup -q -c -T -n %{name}-%{version}
    1752 %setup -q -T -D -n %{name}-%{version} -a0
    1753 -------------------------------------------------------------
    1754 
    1755 <1> The package's name.
    1756 <2> The version of the package.
    1757 
    1758 The source for a package is declared with the +%source*+ macro where +*+ is
    1759 a number. For example +%source0+ is the source 0 tar file and is defined with
    1760 something similar to this:
    1761 
    1762 -------------------------------------------------------------
    1763 Source0: http://ftp.gnu.org/gnu/gdb/gdb-%{gdb_version}.tar.bz2
    1764 -------------------------------------------------------------
    1765 
    1766 This URL is the primary location of the GNU GCC source code and the RTEMS
     1778typically +%source+ macros for source, +%patch+ macros to patch the source
     1779mixed with some shell commands to correct any source issues.
     1780
     1781-------------------------------------------------------------
     1782              <1>                <2>      <3>
     1783%source setup gcc -q -c -T -n %{name}-%{version}
     1784-------------------------------------------------------------
     1785
     1786<1> The source group to set up.
     1787<2> The source's name.
     1788<3> The version of the source.
     1789
     1790The source set up are declared with the source +set+ and +add+ commands. For
     1791example:
     1792
     1793-------------------------------------------------------------
     1794%source set gdb http://ftp.gnu.org/gnu/gdb/gdb-%{gdb_version}.tar.bz2
     1795-------------------------------------------------------------
     1796
     1797This URL is the primary location of the GNU GDB source code and the RTEMS
    17671798Source Builder can download the file from this location and by inspecting the
    1768 file extension use +bzip2+ decompression. When the +%prep+ section is processed
    1769 a check of the local +source+ directory is made to see if the file has already
    1770 been downloaded. If not found in the source cache directory the package is
    1771 downloaded from the URL. You can append other base URLs via the command line
    1772 option +--url+. This option accepts a comma delimited list of sites to try.
    1773 
    1774 You can combine the source macro with conditional logic to implement a default
    1775 that can be over-riden in the top level files. This lets you reuse a generic
    1776 build script with different sources. This happens if you have a private source
    1777 package with local modifications. The following example is taken from the
    1778 +gcc-4.8-1.cfg+ build script.
    1779 
    1780 -------------------------------------------------------------
    1781 %ifn %{defined Source0}
    1782  Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
    1783 %endif
    1784 -------------------------------------------------------------
     1799file extension use +bzip2+ decompression with +tar+. When the +%prep+ section
     1800is processed a check of the local +source+ directory is made to see if the file
     1801has already been downloaded. If not found in the source cache directory the
     1802package is downloaded from the URL. You can append other base URLs via the
     1803command line option +--url+. This option accepts a comma delimited list of
     1804sites to try.
    17851805
    17861806You could optionally have a few source files that make up the package. For
     
    17901810
    17911811-------------------------------------------------------------
    1792 %{?source1:%setup -q -T -D -n %{name}-%{version} -a1}
    1793 -------------------------------------------------------------
    1794 
    1795 The +source1+ macro value is checked and if present the command string after
    1796 the +:+ is executed. It is common to see a number of these present allowing top
    1797 level configuration files including a base configuration the ability to define
    1798 a number of source packages.
    1799 
    1800 -------------------------------------------------------------
    1801 %{?source1:%setup -q -T -D -n %{name}-%{version} -a1}
    1802 %{?source2:%setup -q -T -D -n %{name}-%{version} -a2}
    1803 %{?source3:%setup -q -T -D -n %{name}-%{version} -a3}
     1812%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-code-%{gcc_version}.tar.bz2
     1813%source add gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-g++-%{gcc_version}.tar.bz2
     1814%source setup gcc -q -T -D -n gcc-%{gcc_version}
     1815-------------------------------------------------------------
     1816
     1817Separate modules use separate source groups. The GNU GCC compiler for RTEMS
     1818uses Newlib, MPFR, MPC, and GMP source packages. You define the source with:
     1819
     1820-------------------------------------------------------------
     1821%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
     1822%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
     1823%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
     1824%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
     1825%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
     1826-------------------------------------------------------------
     1827
     1828and set up with:
     1829
     1830-------------------------------------------------------------
     1831%source setup gcc -q -n gcc-%{gcc_version}
     1832%source setup newlib -q -D -n newlib-%{newlib_version}
     1833%source setup mpfr -q -D -n mpfr-%{mpfr_version}
     1834%source setup mpc -q -D -n mpc-%{mpc_version}
     1835%source setup gmp -q -D -n gmp-%{gmp_version}
    18041836-------------------------------------------------------------
    18051837
    18061838Patching also occurs during the preparation stage. Patches are handled in a
    1807 similar way to the source packages. Most patches are based around the top of
    1808 the source tree. This is an example of the patch scripting for the GCC 4.8
    1809 series of compilers:
    1810 
    1811 -------------------------------------------------------------
    1812 cd gcc-%{gcc_version} <1>
    1813 %{?patch0:%patch0 -p1} <2>
    1814 %{?patch1:%patch1 -p1}
    1815 %{?patch2:%patch2 -p1}
    1816 %{?patch3:%patch3 -p1}
    1817 %{?patch4:%patch4 -p1}
    1818 %{?patch5:%patch5 -p1}
    1819 %{?patch6:%patch6 -p1}
    1820 %{?patch7:%patch7 -p1}
    1821 %{?patch8:%patch8 -p1}
    1822 %{?patch9:%patch9 -p1}
    1823 cd .. <3>
    1824 -------------------------------------------------------------
    1825 
    1826 <1> Change from the top of the source tree into the package being patched's top
    1827     directory.
    1828 <2> The conditional macro expansion checks if +%patch0+ is defined and if
    1829     defined issues the +%patch0" macro giving +-p1+ to the patch command.
    1830 <3> Return back to the top of the source tree.
     1839similar way to the source packages except you only +add+ patches. Patches are
     1840applied using the +setup+ command. The +setup+ command takes the default patch
     1841option. You can provide options with each patch by adding them as arguments
     1842before the patch URL. Patches with no options uses the +setup+ default.
     1843
     1844-------------------------------------------------------------
     1845%patch add gdb %{rtems_gdb_patches}/gdb-sim-arange-inline.diff
     1846%patch add gdb -p0 <1> %{rtems_gdb_patches}/gdb-sim-cgen-inline.diff
     1847-------------------------------------------------------------
     1848<1> This patch has a custom option.
     1849
     1850To apply these patches:
     1851
     1852-------------------------------------------------------------
     1853%patch setup gdb -p1 <1>
     1854-------------------------------------------------------------
     1855<1> The default options.
    18311856
    18321857%build
     
    20052030wrong architecture.
    20062031
    2007 %setup
    2008 ^^^^^^
    2009 
    2010 The +%setup+ macro sets up the source code tree and is used in the +%prep+
    2011 section of the script. The options are:
     2032%source
     2033^^^^^^^
     2034
     2035The +%source+ macro has 3 commands that controls what it does. You can +set+
     2036the source files, +add+ source files to a source group, and +setup+ the source
     2037file group getting it ready to be used.
     2038
     2039Source files are source code files in tar or zip files that are unpacked,
     2040copied or symbolically linked into the package's build tree. Building a package
     2041requires one or more dependent packages. These are typically the packages
     2042source code plus dependent libraries or modules. You can create any number of
     2043these source groups and set each of them up with a separe source group for each
     2044needed library or module. Each source group normally has a single tar, zip or
     2045repository and the +set+ defines this. Some projects split the source code into
     2046separate tar or zip files and you install them by using the +add+ command.
     2047
     2048The first instance of a +set+ command creates the source group and sets the
     2049source files to be set up. Subsequence +set+ commands for the same source group
     2050are ignored. this lets you define the standard source files and override them
     2051for specific releases or snapshots.. To set a source file group:
     2052
     2053-------------------------------------------------------------
     2054%source set gcc <1> ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
     2055-------------------------------------------------------------
     2056<1> The source group is +gcc+.
     2057
     2058To add another source package to be installed into the same source tree you use
     2059the +add+ command:
     2060
     2061-------------------------------------------------------------
     2062%source add gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/g++-%{gcc_version}.tar.bz2
     2063-------------------------------------------------------------
     2064
     2065The source +setup+ command can only be issued in the +%prep:+ section. The
     2066setup is:
     2067
     2068-------------------------------------------------------------
     2069%source gcc setup -q -T -D -n %{name}-%{version}
     2070-------------------------------------------------------------
     2071
     2072Accepted options are:
    20122073
    20132074[horizontal]
     
    20282089specified on the nth Source: macro line before changing directory into the build
    20292090directory.
    2030 +-a <n>+:: The -a option is used to direct %setup to unpack the source archive
    2031 specified on the nth Source: macro line after changing directory into the build
    2032 directory.
    2033 
    2034 %source
    2035 ^^^^^^^
    2036 
    2037 The +%source+ macro is numbered and defines a source tar file used in the
    2038 package. The +%setup+ macro references the packages defined here. A macro is
    2039 defined as:
    2040 
    2041 -------------------------------------------------------------
    2042 Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
    2043 -------------------------------------------------------------
    2044 
    2045 The setup script is:
    2046 
    2047 -------------------------------------------------------------
    2048 %setup -q -T -D -n %{name}-%{version} -a0
    2049 -------------------------------------------------------------
    2050 
    2051 The +-a0+ means use +%source0+.
    20522091
    20532092%patch
    20542093^^^^^^
    20552094
    2056 The +%patch+ macro is numbered and can define a patch and in the +%prep+
    2057 section applies the patch. To define a patch append a +:+ followed by the patch
    2058 filename:
    2059 
    2060 -------------------------------------------------------------
    2061 Patch0: gcc-4.7.2-rtems4.11-20121026.diff
    2062 -------------------------------------------------------------
     2095The +%patch+ macro has the same 3 command as the +%source+ command however the
     2096+set+ commands is not really that useful with the with command. You add patches
     2097with the +add+ command and +setup+ applies the patches. Patch options can be
     2098added to each patch by placing them before the patch URL. If no patch option is
     2099provided the default options passed to the +setup+ command are used. An option
     2100starts with a '-'. The +setup+ command must reside inside the +%prep+ section.
     2101
     2102Patches are grouped in a similar way to the +%source+ macro so you can control
     2103applying a group of patches to a specific source tree.
    20632104
    20642105The +__patchdir+ path is search.
    20652106
    2066 Placing +%patch+ in the +%prep+ section will apply it with any trailing options
    2067 passed to the +patch+ command. This allows the +-p+ option to be passed to
    2068 strip any leading path components from the patch contents.
    2069 
    2070 -------------------------------------------------------------
    2071 %patch0 -p1
    2072 -------------------------------------------------------------
    2073 
    2074 You will typically see the patch conditionally used as:
    2075 
    2076 -------------------------------------------------------------
    2077 %{patch0:%patch0 -p1}
    2078 -------------------------------------------------------------
    2079 
    2080 In this case the patch will only be applied if it is defined.
     2107
     2108To add a patch:
     2109
     2110-------------------------------------------------------------
     2111%patch add gcc <1>  gcc-4.7.2-rtems4.11-20121026.diff
     2112%patch add gcc -p0 <2>  gcc-4.7.2-rtems4.11-20121101.diff
     2113-------------------------------------------------------------
     2114<1> The patch group is +gcc+.
     2115<2> Option for this specific patch.
     2116
     2117Placing +%patch setup+ in the +%prep+ section will apply the groups patches.
     2118
     2119-------------------------------------------------------------
     2120%patch setup gcc <1>  -p1 <2>
     2121-------------------------------------------------------------
     2122<1> The patch group.
     2123<2> The default option used to apply the patch.
    20812124
    20822125%echo
Note: See TracChangeset for help on using the changeset viewer.