Difference between revisions of "Build rpm packages with checkinstall"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 25: Line 25:
 
hello: main.c
 
hello: main.c
 
         gcc main.c -o hello
 
         gcc main.c -o hello
 +
 +
install: hello
 +
        cp hello /usr/local/bin
 
EOF
 
EOF
 
sed -i "s/        /\t/g" Makefile  
 
sed -i "s/        /\t/g" Makefile  

Revision as of 16:05, 6 February 2011

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.

The program

Here is how we create our program, hello world:

cd
mkdir hello
cd hello
cat >main.c <<EOF
#include <stdio.h>

int main()
{
  printf("hello world");
}
EOF

The Makefile

To build our program, we need a makefile. Here is how we create it:

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 

Install checkinstall

Next step is to install the checkinstall tool, in this example for SUSE Linux 11.3 x64:

yast -i checkinstall