LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2009, 08:45 AM   #1
nataloi
Member
 
Registered: Apr 2009
Distribution: Linux version 2.6.25-14.fc9.i686 (mockbuild@) (gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) )
Posts: 30

Rep: Reputation: 15
first time to build rpm question about .rpmmacros


Ok, so I am getting ready to build my first rpm for nagios-3.0.6 I have not created a .rpmmacros file do I just create one from scratch or will it build an .rpmmacros for me when I run
rpmbuild -ba nagios-3.0.6.tar.gz ? If I do need to create it where do I put it? What other directories do i need to build and where do I build them?

also I found the following on DAG:Building RPM packages

You can do this by adding the following to ~/.rpmmacros.

%_topdir /home/dag/redhat/

As a consequence, RPM will need the default directory structure underneath. So you can do as user:
mkdir -p ~/redhat/{BUILD,RPMS/{i386,i686,noarch},SOURCES,SPECS,SRPMS}

I have questions about this stuff...what is this "~" and what does it mean? and what about the mkdir command above are those things in the {} options?
What is the difference between BUILD and RPMS and i386,i686, and noarch?

thanks for the education...
Natalie
 
Old 07-08-2009, 09:09 AM   #2
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
It sounds like you're in a little bit over your head. Why do you need to build nagios from source?

To answer your questions, your shell will expand that - ~ becomes your home directory, and { and } enumerate everything in the list inside them, creating a tree like this:
Code:
`-- redhat
    |-- BUILD
    |-- RPMS
    |   |-- i386
    |   |-- i686
    |   `-- noarch
    |-- SOURCES
    |-- SPECS
    `-- SRPMS
Additionally, rpmbuild is used on .spec files that you normal get out of source RPMs, not .tar.gzs. There is a different procedure normally used for compiling software that comes packaged like that, described here.

Last edited by karamarisan; 07-08-2009 at 09:11 AM.
 
Old 07-08-2009, 09:30 AM   #3
nataloi
Member
 
Registered: Apr 2009
Distribution: Linux version 2.6.25-14.fc9.i686 (mockbuild@) (gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) )
Posts: 30

Original Poster
Rep: Reputation: 15
oh yeah I AM in over my head...but well I found that's how I learn best. I am the only one in my little company So the reason for building an rpm for nagios is so that when I install it all the proper libraries etc are there...or so I was told, also there is a .spec file in the tar ball and I read that as long as the .spec file was there that the rpmbuild -ta would take care of it (my bad in last post used option -ba). Ok so I executed the mkdir as written and it did build the directory structure as indicated - THANKS! (I changed redhat to nagios)

One other question...what about the .rpmmacros file - do I need to create that?
 
Old 07-08-2009, 10:05 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545
I think reading the IBM's "Building RPM packages without being root" part 1 and part 2, Maximum RPM and Fedora/RH docs [1 2 3] can help fill most gaps wrt building RPMs. The ~/.rpmmacros file helps "anchor" the build process to a directory you assign to it. For instance if you created the directory "/home/nataloi/rpmbuild" then having a line "%_topdir /home/nataloi/rpmbuild" ensures the build process will always look there for the BUILD, SOURCES, SPECS, RPMS and SRPMS directories. try this basic ~/.rpmmacros file:
Code:
%{_topdir}            %{getenv:HOME}/rpmbuild
%{_builddir}          %{_topdir}/BUILD
%{_rpmdir}            %{_topdir}/RPMS
%{_sourcedir}         %{_topdir}/SOURCES
%{_specdir}           %{_topdir}/SPECS
%{_srcrpmdir}         %{_topdir}/SRPMS
%{_buildrootdir}      %{_topdir}/BUILDROOT
#
# You can also:
# force compile-time optimization flags:
# %optflags       i686 -O3
# or set a proxy:
#%httpproxy http://myhost
#%httpport 8118
# or redefine other macros:
# %__os_install_post /usr/lib/rpm/brp-compress /usr/lib/rpm/brp-strip-comment-note

...that said RPMForge / DAG packaging of Nagios seems pretty complete so I wonder what that was all about with nagios libs.
 
Old 07-08-2009, 10:15 AM   #5
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
Building an rpm from source won't include dependencies. Why don't you just use your distro's package management tools? If you're running Red Hat, that's probably yum.
 
  


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
How to build kernel RPM without rebuilding the whole thing every time JoeyAdams Fedora 2 06-22-2008 08:15 PM
How can I generate / build and RPM from *.src.rpm file sreekumartg Red Hat 3 02-23-2007 05:23 PM
cannot build source rpm/ rpm questions kpachopoulos Fedora 3 07-24-2005 09:15 AM
RPM build question NetScripter Linux - General 3 10-20-2003 02:42 AM
~/.rpmmacros problem sooaai Linux - Newbie 0 08-15-2003 03:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:12 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration