Creation Zone

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 26 September 2004

Linux: Installing Source RPM (SRPM) package

Posted on 15:35 by Unknown
RPM stands for RedHat Package Manager. RPM is a system for installing and managing software & most common software package manager used for Linux distributions. Because it allows you to distribute software already compiled, a user can install the software with a single command.



There are two flavors of RPMs: binary & source code. Source code are designated by ending with -src.rpm rather than just .rpm



Installing source rpms (SRPM):

Unlike ordinary packages, they can't be uninstalled using RPM. SRPM packages are not under the control of the RPM database. All RPM does is copy the files contained in the package to the hard disk. SRPMs are not listed in the RPM database and not marked as installed in YaST's package selection forms.



A source RPM (SRPM) package typically contains a gzipped tar archive with the source files, and an RPM spec file



Govinda:/users/techno/downloads # ls -l xmms*src*

-rw------- 1 techno users 4032244 2004-09-28 12:43 xmms-1.2.10-1.src.rpm



Listing the contents of a source rpm:

Govinda:/users/techno/downloads # rpm -qpl xmms-1.2.10-1.src.rpm

xmms-1.2.10.tar.gz

xmms.spec



Source rpm can be installed just like any other rpm with "-ivvh" flags

Govinda:/users/techno/downloads # rpm -ivvh xmms-1.2.10-1.src.rpm

D: counting packages to install

D: found 1 packages

D: looking for packages to download

D: retrieved 0 packages

D: New Header signature

D: Signature size: 180

D: Signature pad : 4

D: sigsize : 184

D: Header + Archive: 4031964

D: expected size : 4031964

D: found 1 source and 0 binary packages

D: New Header signature

D: Signature size: 180

D: Signature pad : 4

D: sigsize : 184

D: Header + Archive: 4031964

D: expected size : 4031964

D: installing a source package

D: sources in: /usr/src/packages/SOURCES

D: spec file in: /usr/src/packages/SPECS

D: file: xmms-1.2.10.tar.gz action: unknown

D: file: xmms.spec action: unknown

xmms ##################################################

GZDIO: 494 reads, 4041876 total bytes in 0.020 secs




Verbose output shows that the sources are under: /usr/src/packages/SOURCES & the specification (SPEC) file is under: /usr/src/packages/SPECS

Govinda:/users/techno/downloads # ls -l /usr/src/packages/SOURCES/xmms*

-rw-rw-r-- 1 root root 4034832 2004-02-23 13:54 /usr/src/packages/SOURCES/xmms-1.2.10.tar.gz

Govinda:/users/techno/downloads # ls -l /usr/src/packages/SPECS/xmms*

-rw-rw-r-- 1 root root 6665 2004-02-23 13:57 /usr/src/packages/SPECS/xmms.spec



The RPM build tree

-----------------------

To use RPM as a tool for building software packages, we must follow some rules in terms of locations for the source code used to build this software. Expect two different kinds of input to build a package:



(1) Source

Of course we need source code to build the package (assume that we got the source without any customizations). Usually these sources are distributed as compresse tar file (tgz). RPM can handle other formats as well



(2) Spec file

The spec file is the heart of RPM's package building process. It's like a make file, as it contains information on how to build the package. But it's settled on a much higher level and contains all meta information about the package. .spec is the extension for SPEC files



Note:

It is not uncommon to have a patch included in the source files



RPM directories for building packages

----------------------------------------------------------------------------------

Directory Contents

----------------------------------------------------------------------------------

SPECS Spec files

SOURCES Source and patch files

BUILD Used to build (unpack and compile) the software package

RPMS Contains the build RPM files (sorted by architecture)

SRPMS Contains the build SRPM files




RPM Build Stages

---------------------------------------------------------------------

Flag Stage

---------------------------------------------------------------------

p prep (unpack sources and apply patches)

l list check (do some cursory checks on %files)

c compile (prep and compile)

i install (prep, compile, install)

b binary package (prep, compile, install, package)

a bin/src package (prep, compile, install, package)



Building the Package

-------------------------

After the SRPM is installed, we can continue with the RPM build stages. RPM builds packages in 4 stages:



(1) Preparation

The prep-stage is where the actual work building the binary package starts. In this stage the sources are unpacked and the patches to the sources are applied (if any). If the package builder had forseen any additional preparations which have to be done prior to compiling the sources, they will be executed in this stage



(2) Compilation

After the sources are prepared, the compilation process can take place. In this stage all source files are compiled and linked to the resulting binaries, libraries, etc.



(3) Installation

This stage installs the new software package on the system. At this point the build process changes your actual system. It puts the binaries, libraries, configuration files, etc. in the places where they belong for the new software package. No entry is made in the RPM database reflecting this installation.



Quick Note:

Installing binaries from a source package doesn't include that the package is under the control of the RPM database



(4) Packaging

The last step is to create the RPM and the SRPM for the new software package. You can turn off this stage when you just want to compile and install the package. Better create the new SRPM, if sources were modified ange the behavior of the binaries



RPM Build Options

------------------------------------------------------------------------------------

Option Meaning

------------------------------------------------------------------------------------

-bstage-spec or

-tstage-tarball build package (see table 34-2 for stage spec)

--short-circuit skip straight to specified stage (only for c,i)

--clean remove build tree when done

--rmsource remove sources and spec file when done

--buildrootdir use dir as the build root

--buildarcharch build the packages for architecture arch

--buildosos build the packages for operating system os

--test do not execute any stages

--timechecksecs set the time check to secs seconds (0 disables)

--rebuildsrpm install source package, build binary package and remove

spec file, sources, patches, and icons.

--rmsourcespec remove sources and spec file

--recompilesrpm like --rebuild, but don't build any package

------------------------------------------------------------------------------------




To start the build process use the command rpm -b with the spec file as argument. Running rpm -ba will go through all stages and result in a RPM package, a SRPM package, and the software installed in your system (but not entered in the RPM database). If you don't want to go through the whole build process and want to stop at a certain stage, you can give the stage name as additional argument to rpm



If you are only interested in looking at the source code, you can stop at prep stage. The sources are installed, unpacked, and all changes SuSE made to them are applied



Govinda:/usr/src/packages/SPECS # rpm -bp xmms.spec

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.69504

+ umask 022

+ cd /usr/src/packages/BUILD

+ cd /usr/src/packages/BUILD

+ rm -rf xmms-1.2.10

+ /bin/gzip -dc /usr/src/packages/SOURCES/xmms-1.2.10.tar.gz

+ tar -xf -

+ STATUS=0

+ '[' 0 -ne 0 ']'

+ cd xmms-1.2.10

++ /usr/bin/id -u

+ '[' 0 = 0 ']'

+ /bin/chown -Rhf root .

++ /usr/bin/id -u

+ '[' 0 = 0 ']'

+ /bin/chgrp -Rhf root .

+ /bin/chmod -Rf a+rX,g-w,o-w .

+ exit 0




First the tar files gets uncompressed and unpacked. If you look into the directory /usr/src/packages/BUILD after you execute the prep stage, you'll see that there is a subdirectory, xmms-1.2.10 containing the source files for the xmms package



Govinda:/usr/src/packages/BUILD/xmms-1.2.10 # ls -l

total 1841

drwxr-xr-x 12 root root 1232 2004-02-23 13:53 .

drwxrwxrwt 3 root root 80 2004-09-28 13:22 ..

-rw-r--r-- 1 root root 9127 2004-01-11 10:22 ABOUT-NLS

-rw-r--r-- 1 root root 2110 2004-01-16 16:41 AUTHORS

-rw-r--r-- 1 root root 17992 2003-05-19 14:22 COPYING

-rw-r--r-- 1 root root 212169 2004-02-23 13:53 ChangeLog

drwxr-xr-x 5 root root 200 2004-02-23 13:53 Effect

-rw-r--r-- 1 root root 6679 2000-12-22 15:09 FAQ

drwxr-xr-x 5 root root 192 2004-02-23 13:53 General

-rw-r--r-- 1 root root 9236 2003-05-19 14:22 INSTALL

drwxr-xr-x 8 root root 256 2004-02-23 13:53 Input

-rw-r--r-- 1 root root 238 2004-01-16 16:11 Makefile.am

-rw-r--r-- 1 root root 24209 2004-02-23 13:44 Makefile.in

-rw-r--r-- 1 root root 8395 2004-02-23 13:49 NEWS

drwxr-xr-x 8 root root 264 2004-02-23 13:53 Output

-rw-r--r-- 1 root root 40371 2004-01-16 16:41 README

....

....




To continue with the example, we'll go on to the compilation stage. You could either start over and let RPM do the preparation again, or use the prepared sources and jump right into the compilation. The default for RPM is to start over at the beginning. The command rpm -bc will have the source and patch files (if any) do the preparation work and then compile the source code. Since we have gone through the preparation already, we will short-circuit RPM and only do the compilation:



Govinda:/usr/src/packages/SPECS # rpm -bc --short-circuit xmms.spec

Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.13688

+ umask 022

+ cd /usr/src/packages/BUILD

+ cd xmms-1.2.10

+ unset LINGUAS

+ CFLAGS=-O2 -march=i486 -mcpu=i686

+ export CFLAGS

+ CXXFLAGS=-O2 -march=i486 -mcpu=i686

+ export CXXFLAGS

+ FFLAGS=-O2 -march=i486 -mcpu=i686

+ export FFLAGS

+ '[' -f configure.in ']'

+ libtoolize --copy --force

You should update your `aclocal.m4' by running aclocal.

+ ./configure i386-pc-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info

configure: WARNING: you should use --build, --host, --target

checking build system type... i386-pc-linux

checking host system type... i386-pc-linux

...

...

make[3]: Entering directory `/usr/src/packages/BUILD/xmms-1.2.10/libxmms'

if /bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -D_REENTRANT -I/usr/X11R6/include -I../intl -I.. -O2 -march=i486 -mcpu=i686 -Wall -Wpointer-arith -MT configfile.lo -MD -MP -MF ".deps/configfile.Tpo" -c -o configfile.lo `test -f 'configfile.c' || echo './'`configfile.c; then mv -f ".deps/configfile.Tpo" ".deps/configfile.Plo"; else rm -f ".deps/configfile.Tpo"; exit 1; fi

gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -D_REENTRANT -I/usr/X11R6/include -I../intl -I.. -O2 -march=i486 -mcpu=i686 -Wall -Wpointer-arith -MT configfile.lo -MD -MP -MF .deps/configfile.Tpo -c configfile.c -o configfile.o

...

...



After this step the binaries are ready to be installed in your system. You can copy them manually if you are only interested in special parts of the package, or let RPM install the entire set. This is done with rpm -bi. Again, this command by default starts at the very beginning. But we can use the --short-circuit switch again to skip the first two stages:



# rpm -bi --short-circuit xmms.spec

Executing: %install

+ umask 022

+ cd /usr/src/packages/BUILD

+ cd rxvt-2.4.7

+ make install

./autoconf/mkinstalldirs /usr/X11R6/bin

./autoconf/mkinstalldirs /usr/X11R6/man/man1

make[1]: Entering directory `/usr/src/packages/BUILD/xmms-1.2.10/src'

....

....




Besides the missing entry in the RPM database, you now have the same status as you would have with the installed binary package.



The last stage is to create the binary and the source packages. You do this with rpm -ba. Unfortunately there is no way to skip the other stages for this option. So you have to go through the whole process again. The only choice you have is to skip building of the source package. If you want to do this use rpm -bb instead of rpm -ba. In order to have a complete example we will create the binary and the source package:



# rpm -bb xmms.spec

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.3103

+ umask 022

+ cd /usr/src/packages/BUILD

+ cd /usr/src/packages/BUILD

+ rm -rf xmms-1.2.10

+ /bin/gzip -dc /usr/src/packages/SOURCES/xmms-1.2.10.tar.gz



...

...

Wrote: /usr/src/packages/SRPMS/xmms-1.2.10.src.rpm

Wrote: /usr/src/packages/RPMS/i386/xmms-1.2.10.i386.rpm



The build process is completed. RPM tells you where it put the source and the binary package



For the impatient

=============

Method# 1:



step (1) Install source rpm

rpm -ivh <application>.src.rpm

This decompresses the source files into /usr/src directory under which the source and spec files (building parameters) are unloaded into the ./SOURCES and ./SPECS directories, respectively.



step (2) cd into /usr/src/SPECS directory and run the following commands in order to build the source according the spec files:

rpm -bb <application>.spec

This compiles the source and packages the binaries into tidy RPM packages for you.



step (3) Install the RPM that you just built:

cd /usr/src/RPMS

rpm -Uvh <application>.i386.rpm

Method# 2:

To compile and install a source RPM package, do the following:

# rpm --rebuild <application>.src.rpm

…

(lots of output)

…

Wrote: /usr/src/packages/RPMS/i386/<application>.i386.rpm

…

+ exit 0

…


If all goes well, you can skip everything below. If not, you may want to cd /usr/src/packages/BUILD/<application>-Version, read on below, and try to figure out how to compile the application
Email ThisBlogThis!Share to XShare to Facebook
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • *nix: Workaround to cannot find zipfile directory in one of file.zip or file.zip.zip ..
    Symptom: You are trying to extract the archived files off of a huge (any file with size > 2 GB or 4GB, depending on the OS) ZIP file with...
  • JDS: Installing Sun Java Desktop System 2.0
    This document will guide you through the process of installing JDS 2.0 on a PC from integrated CDROM images Requirements I...
  • Linux: Installing Source RPM (SRPM) package
    RPM stands for RedHat Package Manager. RPM is a system for installing and managing software & most common software package manager used ...
  • Solaris: malloc Vs mtmalloc
    Performance of Single Vs Multi-threaded application Memory allocation performance in single and multithreaded environments is an important a...
  • C/C++: Printing Stack Trace with printstack() on Solaris
    libc on Solaris 9 and later, provides a useful function called printstack , to print a symbolic stack trace to the specified file descripto...
  • Installing MySQL 5.0.51b from the Source Code on Sun Solaris
    Building and installing the MySQL server from the source code is relatively very easy when compared to many other OSS applications. At least...
  • Oracle Apps on T2000: ORA-04020 during Autoinvoice
    The goal of this brief blog post is to provide a quick solution to all Sun-Oracle customers who may run into a deadlock when a handful of th...
  • Siebel Connection Broker Load Balancing Algorithm
    Siebel server architecture supports spawning multiple application object manager processes. The Siebel Connection Broker, SCBroker, tries to...
  • 64-bit dbx: internal error: signal SIGBUS (invalid address alignment)
    The other day I was chasing some lock contention issue with a 64-bit application running on Solaris 10 Update 1; and stumbled with an unexpe...
  • Oracle 10gR2/Solaris x64: Fixing ORA-20000: Oracle Text errors
    First, some facts: * Oracle Applications 11.5.10 (aka E-Business Suite 11 i ) database is now supported on Solaris 10 for x86-64 architectur...

Categories

  • 80s music playlist
  • bandwidth iperf network solaris
  • best
  • black friday
  • breakdown database groups locality oracle pmap sga solaris
  • buy
  • deal
  • ebiz ebs hrms oracle payroll
  • emca oracle rdbms database ORA-01034
  • friday
  • Garmin
  • generic+discussion software installer
  • GPS
  • how-to solaris mmap
  • impdp ora-01089 oracle rdbms solaris tips upgrade workarounds zombie
  • Magellan
  • music
  • Navigation
  • OATS Oracle
  • Oracle Business+Intelligence Analytics Solaris SPARC T4
  • oracle database flashback FDA
  • Oracle Database RDBMS Redo Flash+Storage
  • oracle database solaris
  • oracle database solaris resource manager virtualization consolidation
  • Oracle EBS E-Business+Suite SPARC SuperCluster Optimized+Solution
  • Oracle EBS E-Business+Suite Workaround Tip
  • oracle lob bfile blob securefile rdbms database tips performance clob
  • oracle obiee analytics presentation+services
  • Oracle OID LDAP ADS
  • Oracle OID LDAP SPARC T5 T5-2 Benchmark
  • oracle pls-00201 dbms_system
  • oracle siebel CRM SCBroker load+balancing
  • Oracle Siebel Sun SPARC T4 Benchmark
  • Oracle Siebel Sun SPARC T5 Benchmark T5-2
  • Oracle Solaris
  • Oracle Solaris Database RDBMS Redo Flash F40 AWR
  • oracle solaris rpc statd RPC troubleshooting
  • oracle solaris svm solaris+volume+manager
  • Oracle Solaris Tips
  • oracle+solaris
  • RDC
  • sale
  • Smartphone Samsung Galaxy S2 Phone+Shutter Tip Android ICS
  • solaris oracle database fmw weblogic java dfw
  • SuperCluster Oracle Database RDBMS RAC Solaris Zones
  • tee
  • thanksgiving sale
  • tips
  • TomTom
  • windows

Blog Archive

  • ►  2013 (16)
    • ►  December (3)
    • ►  November (2)
    • ►  October (1)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (1)
  • ►  2012 (14)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (2)
  • ►  2011 (15)
    • ►  December (2)
    • ►  November (1)
    • ►  October (2)
    • ►  September (1)
    • ►  August (2)
    • ►  July (1)
    • ►  May (2)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2010 (19)
    • ►  December (3)
    • ►  November (1)
    • ►  October (2)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  May (5)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2009 (25)
    • ►  December (1)
    • ►  November (2)
    • ►  October (1)
    • ►  September (1)
    • ►  August (2)
    • ►  July (2)
    • ►  June (1)
    • ►  May (2)
    • ►  April (3)
    • ►  March (1)
    • ►  February (5)
    • ►  January (4)
  • ►  2008 (34)
    • ►  December (2)
    • ►  November (2)
    • ►  October (2)
    • ►  September (1)
    • ►  August (4)
    • ►  July (2)
    • ►  June (3)
    • ►  May (3)
    • ►  April (2)
    • ►  March (5)
    • ►  February (4)
    • ►  January (4)
  • ►  2007 (33)
    • ►  December (2)
    • ►  November (4)
    • ►  October (2)
    • ►  September (5)
    • ►  August (3)
    • ►  June (2)
    • ►  May (3)
    • ►  April (5)
    • ►  March (3)
    • ►  February (1)
    • ►  January (3)
  • ►  2006 (40)
    • ►  December (2)
    • ►  November (6)
    • ►  October (2)
    • ►  September (2)
    • ►  August (1)
    • ►  July (2)
    • ►  June (2)
    • ►  May (4)
    • ►  April (5)
    • ►  March (5)
    • ►  February (3)
    • ►  January (6)
  • ►  2005 (72)
    • ►  December (5)
    • ►  November (2)
    • ►  October (6)
    • ►  September (5)
    • ►  August (5)
    • ►  July (10)
    • ►  June (8)
    • ►  May (9)
    • ►  April (6)
    • ►  March (6)
    • ►  February (5)
    • ►  January (5)
  • ▼  2004 (36)
    • ►  December (1)
    • ►  November (5)
    • ►  October (12)
    • ▼  September (18)
      • Solaris: Virtual Memory System
      • Linux: Installing Source RPM (SRPM) package
      • Linux: Installing Dynamic Fonts
      • UNIX/C: Program that prints Itself
      • SPARC: Position Independent Code (PIC)
      • Solaris/S1S9: Scope of Symbols IV - hidden scope
      • Solaris/S1S9: Scope of Symbols - Adv/Disadv of GLO...
      • Solaris/S1S9: Scope of Symbols :: III symbolic sco...
      • Solaris/S1S9: Scope of Symbols - III symbolic scope
      • Solaris/S1S9: Scope of Symbols: Default scope contd.,
      • Solaris/S1S9: Scope of Symbols - II :: Default scope
      • Solaris/S1S9: Scope of Symbols - I :: Source files
      • Solaris & UltraSPARC IV: Displaying processor info...
      • JDS: Installing Sun Java Desktop System 2.0
      • Solaris: malloc Vs mtmalloc
      • Solaris: Recovering from a Runtime Linker Failure
      • Linux: Finding out the amount of free & used memory
      • UNIX®: How to build a Shared Library (*.so file)
Powered by Blogger.

About Me

Unknown
View my complete profile