backticks
[openafs-wiki.git] / devel / HowToBuildOpenAfsRpmPackages.mdwn
index 2ebb0bf..c5305c1 100644 (file)
@@ -13,10 +13,6 @@ Upgrade your kernel to the most recent version:
     $ sudo yum update kernel
     $ sudo reboot                   # if updated
 
-Install the kernel-devel package for your running kernel.
-
-    $ sudo yum install "kernel-devel-uname-r == $(uname -r)"
-
 Install the packages required to build the OpenAFS source RPM (SRPM):
 
     $ sudo yum install rpm-build yum-utils make perl libtool bzip2 wget
@@ -35,15 +31,16 @@ development and testing.
 The OpenAFS Release Team provides software releases as source code
 distributions. A source RPM (SRPM) file can easily be built from a source
 distribution release with the `makesrpm.pl` script provided in the source tree.
-After creating the SRPM, run `rpmbuild --rebuild` with the SRPM to build the
-binary OpenAFS RPMs.
 
 Download the source distribution files from [openafs.org][3].  Four files are
 provided in a release; a source tarball, a documentation tarball, release
 notes, and a change log. Extract the `makesrpm.pl` script from the source
 tarball and then run `makesrpm.pl` to build the source RPM (SRPM). The
-resulting SRPM will be placed in the current directory. Run `rpmbuild` to build
-the binary RPMs. The resulting RPMs will be placed in `~/rpmbuild/RPMS`.
+resulting SRPM will be placed in the current directory.  Install the build
+dependencies with `yum-builddeps`, plus the kernel module build dependencies
+(which will not be installed with `yum-builddeps` due to some quirks of the
+OpenAFS spec file.) Finally, run `rpmbuild` to build the binary RPMs.  The
+resulting RPMs will be placed in `~/rpmbuild/RPMS`.
 
     # Download source release.
     $ wget https://www.openafs.org/dl/openafs/1.8.5/openafs-1.8.5-src.tar.bz2
@@ -55,19 +52,17 @@ the binary RPMs. The resulting RPMs will be placed in `~/rpmbuild/RPMS`.
     $ tar xf openafs-1.8.5-src.tar.bz2 --strip-components=4 '*/makesrpm.pl'
     $ perl makesrpm.pl openafs-1.8.5-src.tar.bz2 openafs-1.8.5-doc.tar.bz2 RELNOTES-1.8.5 ChangeLog
 
-    # Install build dependencies and build the binary RPMs.
-    $ rpm -iv openafs-1.8.5-1.src.rpm
-    $ sudo yum-builddep ~/rpmbuild/SPECS/openafs.spec
-    $ rpmbuild -bb ~/rpmbuild/SPECS/openafs.spec
-
-If the build dependencies are already installed, you can let rpmbuild install
-the source RPM and build the packages in one step:
+    # Install build dependencies.
+    $ sudo yum-builddep openafs-1.8.5-1.src.rpm
+    $ sudo yum install "kernel-devel-uname-r == $(uname -r)"
+    $ sudo yum install elfutils-devel                         # if RHEL/CentOS 8
 
+    # Build RPMs.
     $ rpmbuild --rebuild openafs-1.8.5-1.src.rpm
 
 ## Method 2: Building from a git checkout
 
-The OpenAFS makefile has a targets to build a source RPM (SRPM) from a git
+The OpenAFS makefile has a target (`make srpm`) to build a source RPM (SRPM) from a git
 checkout of a release or pre-release tag.  A downside to this method is the
 release notes and change log provided in the OpenAFS source distribution
 releases are not included in the generated SRPM. This method can also be used
@@ -80,7 +75,9 @@ release or pre-release tag, or a commit based on a stable branch.  Run the
 `regen.sh` tool to generate the `configure` script, then run `configure` to
 generate the makefile. (The `configure` options given in this step are not used
 to generate the binaries; those are defined in the spec file.)  The resulting
-source RPM will be placed in the `./packages` directory.
+source RPM will be placed in the `./packages` directory.  Install the build
+dependencies with `yum-builddep` and then build the binary RPMs with
+`rpmbuild`.
 
     $ sudo yum install git make krb5-devel
 
@@ -93,14 +90,12 @@ source RPM will be placed in the `./packages` directory.
     $ make dist
     $ make srpm
 
-    # Install build dependencies and build the binary RPMs.
-    $ rpm -iv packages/openafs-1.8.5-1.src.rpm
-    $ sudo yum-builddep ~/rpmbuild/SPECS/openafs.spec
-    $ rpmbuild -bb ~/rpmbuild/SPECS/openafs.spec
-
-If the build dependencies have already been installed, you can let rpmbuild
-install the source RPM and build the packages in one step:
+    # Install build dependencies.
+    $ sudo yum-builddep packages/openafs-1.8.5-1.src.rpm
+    $ sudo yum install "kernel-devel-uname-r == $(uname -r)"
+    $ sudo yum install elfutils-devel                         # if RHEL/CentOS 8
 
+    # Build RPMs.
     $ rpmbuild --rebuild packages/openafs-1.8.5-1.src.rpm
 
 ## Build options
@@ -117,10 +112,11 @@ both the userspace and kernel modules are built.
 
 To build all of the packages except the OpenAFS kernel module:
 
-    $ rpmbuild --rebuild \
+    $ rpmbuild \
+      --rebuild \
       --define "build_userspace 1" \
       --define "build_modules 0" \
-      openafs-1.8.5-1.src.rpm
+      openafs-<version>-<release>.src.rpm
 
 To build only the OpenAFS kernel module for the currently running kernel:
 
@@ -128,7 +124,7 @@ To build only the OpenAFS kernel module for the currently running kernel:
       --rebuild \
       --define "build_userspace 0" \
       --define "build_modules 1" \
-      openafs-1.8.5-1.src.rpm
+      openafs-<version>-<release>.src.rpm
 
 Specify the `kervers` option to build kernel modules for specific kernel
 versions.  Install `kernel-devel` packages for the versions you wish to build.
@@ -142,19 +138,21 @@ older kernel versions.
     kernel-devel-3.10.0-957.27.2.el7.x86_64
     kernel-devel-3.10.0-1062.12.1.el7.x86_64
 
+    $ rpm -i openafs-<version>-<release>.src.rpm
+
     $ rpmbuild \
-      --rebuild \
+      -bb \
       --define "build_userspace 0" \
       --define "build_modules 1" \
       --define "kernvers 3.10.0-957.27.2.el7.x86_64" \
-      openafs-1.8.5-1.src.rpm
+      ~/rpmbuild/SPECS/openafs.spec
 
     $ rpmbuild \
-      --rebuild \
+      --bb \
       --define "build_userspace 0" \
       --define "build_modules 1" \
       --define "kernvers 3.10.0-1062.12.1.el7.x86_64" \
-      openafs-1.8.5-1.src.rpm
+      ~/rpmbuild/SPECS/openafs.spec
 
 Additional `rpmbuild` options provided by the OpenAFS spec file are:
 
@@ -321,7 +319,6 @@ To build OpenAFS packages from a git checkout:
     $ git clone git://git.openafs.org/openafs.git
     $ cd openafs
     $ afsutil package
-    $ ls packages
 
 The `afsutil package` command will build packages for the userspace and kernel
 modules by default. See the `--build` option to build these separately.