imported>ThorstenStaerk |
imported>ThorstenStaerk |
Line 1: |
Line 1: |
− | This is an example how to [[build rpm packages]] using the checkinstall tool. We will a program that only outputs "hello world" and create an [[rpm]] [[package]] from it. We do this in a folder hello.
| + | #REDIRECT [[BASH OPERATORS]] |
− | | |
− | = The program =
| |
− | Here is how we create our program, hello world:
| |
− | <pre>
| |
− | cd
| |
− | mkdir hello
| |
− | cd hello
| |
− | cat >main.c <<EOF
| |
− | #include <stdio.h> | |
− | | |
− | int main()
| |
− | {
| |
− | printf("hello world");
| |
− | }
| |
− | EOF
| |
− | </pre>
| |
− | | |
− | = The Makefile =
| |
− | To [[build]] our program, we need a [[makefile]]. Here is how we create it:
| |
− | <pre>
| |
− | cat >Makefile <<EOF
| |
− | all:hello
| |
− | | |
− | hello: main.c
| |
− | gcc main.c -o hello
| |
− | | |
− | install: hello
| |
− | cp hello /usr/local/bin
| |
− | EOF
| |
− | sed -i "s/ /\t/g" Makefile
| |
− | </pre>
| |
− | | |
− | = Install checkinstall =
| |
− | Next step is to install the checkinstall tool, in this example for SUSE Linux 11.3 x64:
| |
− | yast -i checkinstall
| |
− | | |
− | = Run checkinstall =
| |
− | Next step is to run checkinstall:
| |
− | <pre>
| |
− | checkinstall
| |
− | | |
− | checkinstall 1.6.2, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
| |
− | This software is released under the GNU GPL.
| |
− | | |
− | | |
− | The package documentation directory ./doc-pak does not exist.
| |
− | Should I create a default set of package docs? [y]:
| |
− | | |
− | Preparing package documentation...OK
| |
− | | |
− | *** No known documentation files were found. The new package
| |
− | *** won't include a documentation directory.
| |
− | | |
− | Please choose the packaging method you want to use.
| |
− | Slackware [S], RPM [R] or Debian [D]? R
| |
− | | |
− | | |
− | **************************************
| |
− | **** RPM package creation selected ***
| |
− | **************************************
| |
− | | |
− | This package will be built according to these values:
| |
− | | |
− | 1 - Summary: [ This is a program that prints a friendly hello world greeting. ]
| |
− | 2 - Name: [ hello ]
| |
− | 3 - Version: [ 20110206 ]
| |
− | 4 - Release: [ 1 ]
| |
− | 5 - License: [ GPL ]
| |
− | 6 - Group: [ Applications/System ]
| |
− | 7 - Architecture: [ x86_64 ]
| |
− | 8 - Source location: [ hello ]
| |
− | 9 - Alternate source location: [ ]
| |
− | 10 - Requires: [ ]
| |
− | 11 - Provides: [ hello ]
| |
− | | |
− | Enter a number to change any of them or press ENTER to continue:
| |
− | | |
− | Installing with make...Installing with install...
| |
− | | |
− | ========================= Installation results ===========================
| |
− | cp hello /usr/local/bin
| |
− | | |
− | ======================== Installation successful ==========================
| |
− | | |
− | Copying files to the temporary directory...OK
| |
− | | |
− | Stripping ELF binaries and libraries...OK
| |
− | | |
− | Compressing man pages...OK
| |
− | | |
− | Building file list...OK
| |
− | | |
− | Building RPM package...OK
| |
− | | |
− | NOTE: The package will not be installed
| |
− | | |
− | Erasing temporary files...OK
| |
− | | |
− | Deleting doc-pak directory...OK
| |
− | | |
− | Deleting temp dir...OK
| |
− | | |
− | | |
− | **********************************************************************
| |
− | | |
− | Done. The new package has been saved to
| |
− | | |
− | /usr/src/packages/RPMS/x86_64/hello-20110206-1.x86_64.rpm
| |
− | You can install it in your system anytime using:
| |
− | | |
− | rpm -i hello-20110206-1.x86_64.rpm
| |
− | | |
− | **********************************************************************
| |
− | </pre>
| |