LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-24-2003, 05:34 PM   #1
rinux
Member
 
Registered: May 2003
Posts: 44

Rep: Reputation: 15
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

Last edited by rinux; 09-24-2003 at 05:56 PM.
 
Old 09-24-2003, 07:11 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600

%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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tutorial custom package making? Potatopopper Slackware 4 11-19-2005 04:07 PM
Making a Slackware package.... ivoencarnacao Slackware 5 02-25-2005 07:21 AM
problem making slackware package busbarn Programming 3 07-21-2004 08:12 PM
can reinstall the rpm package without delete the rpm package eye Red Hat 1 10-20-2003 07:53 AM
Howto on making .deb package files preben Debian 1 08-21-2003 07:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration