LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   making an RPM package ?? (https://www.linuxquestions.org/questions/linux-software-2/making-an-rpm-package-96467/)

rinux 09-24-2003 05:34 PM

making an RPM package ??
 
hello everybody,

i wanna make a small aoftware package using linux redhat 9, but it is failing and failing with errors i solved all of them i think now but it still making errors i don't know why ?!

do anyone did it before who can tell me trusted steps or a hyperlink to a trusted tutorial to do it

and here is the steps i did exactly, tell me what is wrong plzz
Quote:

files in hello-1.0 directory
hello.c:
# <include stdio.h>
main()
{
printf("Hello, World!\n");
}
Makefile:
all: hello

hello: hello.c
gcc -o hello hello.c
clean:
rm -f hello

install: hello
cp hello /usr/bin

README:
(c) Copyright ........

Then, i went back to /root directory and made a tar file of all these files, and gzip it
up.
» # cd /root
» # mkdir hello-1.0
» # cd hello-1.0
» # vi hello.c
» # vi Makefile
» # vi README
» # cd ..
» # tar -zcvf hello-1.0.tar.gz hello-1.0/

Copy the hello-1.0.tar.gz to /usr/src/redhat/SOURCES
» # cp hello-1.0.tar.gz /usr/src/redhat/SOURCES

Create the /usr/src/redhat/SPECS/hello.spec file
» # vi /usr/src/redhat/SPECS/hello.spec
and here is the specs file
Quote:

Summary: Hello, World program
Name: hello
Version: 1.0
Release: 1
Copyright: GPL
Group: Applications/Useless
Source: hello-1.0.tar.gz
Distribution: Useless Linux 1.0
Vendor: eee
Packager: rrrr
%description
This program prints the text "Hello, World!"
%prep
rm -fr $RPM_BUILD_DIR/hello-1.0
tar -zxvf $RPM_SOURCE_DIR/hello-1.0.tar.gz
%build
cd $RPM_BUILD_DIR/hello-1.0
make
%install
cd $RPM_BUILD_DIR/hello-1.0
make install
%files
%doc $RPM_BUILD_DIR/hello-1.0/README
/usr/bin/hello
Start the RPM prep stage .
» # rpm -bp /usr/src/redhat/SPECS/hello.spec
» # ls -lR /usr/src/redhat/BUILD

Start the RPM build stage .
» # rpm -bc /usr/src/redhat/SPECS/hello.spec
» # ls -lR /usr/src/redhat/BUILD

Start the RPM install stage .
» # rpm -bi /usr/src/redhat/SPECS/hello.spec
» # ls -lR /usr/src/redhat/BUILD
» # ls -l /usr/bin/hello
» # ls -l /usr/share/doc/hello-1.0
» # hello

Create the binary RPM .
» # rpm -bb /usr/src/redhat/SPECS/hello.spec
» # ls -l /usr/src/redhat/RPMS/i386
» # rpm -qilp /usr/src/redhat/RPMS/i386/hello-1.0-1.i386.rpm

Create the source RPM .
» # rpm -ba /usr/src/redhat/SPECS/hello.spec
» # ls -l /usr/src/redhat/SRPMS
» # rpm -qilp /usr/src/redhat/SRPMS/hello-1.0-1.src.rpm

i tried to substitute $RPM_BUILD_DIR/ with the real directory, but also it failed

also i used rpmbuild instead of rpm as i am using redhat 9

THANKS A LOT

unSpawn 09-24-2003 07:11 PM


%define maj 1
%define min 0
%define rel 1

Summary: Print hello world
Name: hello
Version: %{maj}.%{min}
Release: %{rel}
License: GPL
Group: Applications/Base
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}
Provides: %{name}
Packager: name <add@re.ss>
Prefix: /usr/bin

%description
This program prints the text "Hello, World!"
%if

%prep
%setup -q

%build
make

%install
install -m 755 hello ${RPM_BUILD_ROOT}/usr/bin

%clean
rm -rf ${RPM_BUILD_ROOT}

# %post # Nothing necessary here
# %preun # Nothing necessary here
# %postun # Nothing necessary here

%files
%defattr(640,root,root,550)
%doc README
%attr(755,root,root) /usr/bin/hello

%changelog
* Mon Dec 31 2007 name <add@re.ss> patchlevel
- Made spec file



Run "rpm -ba specfilename 2>&1|tee specfilename.log".
If any errors, they'll be in the log ready to post.


All times are GMT -5. The time now is 06:25 PM.