Rpm

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m
m
Line 5: Line 5:
 
</source>
 
</source>
  
Create a tar file containing the source code, named like so: <code>&lt;packagename&gt;-&lt;version&gt;.tgz</code>
+
Create a tar file containing the source code, named like so: <code>&lt;packagename&gt;-&lt;version&gt;.tgz</code>:
 
<source lang="bash">
 
<source lang="bash">
 
tar -cavf ~/rpmbuild/SOURCES/mylib-1.0.1.tgz --transform='#^#mylib-1.0.1/#s' *.c *.h makefile
 
tar -cavf ~/rpmbuild/SOURCES/mylib-1.0.1.tgz --transform='#^#mylib-1.0.1/#s' *.c *.h makefile
 
</source>
 
</source>
  
Create a *.spec file using the following template:
+
Create a *.spec file using the following template, and store it in <code>~/rpmbuild/SPECS/mylib.spec</code>:
 
<source lang="text">
 
<source lang="text">
 
Summary: Test library
 
Summary: Test library
Line 53: Line 53:
 
* Wed May 30 2012 Attie Grande <attie@attie.co.uk>
 
* Wed May 30 2012 Attie Grande <attie@attie.co.uk>
 
- created RPM build infrastructure
 
- created RPM build infrastructure
 +
</source>
 +
 +
Build the RPM:
 +
<source lang="bash">
 +
cd ~/rpmbuild
 +
rpmbuild -ba SPECS/mylib.spec
 
</source>
 
</source>

Revision as of 17:29, 30 May 2012

Building an RPM package

Create the following directory structure:

mkdir -p ~/rpmbuild/SOURCES ~/rpmbuildrpm/SPECS

Create a tar file containing the source code, named like so: <packagename>-<version>.tgz:

tar -cavf ~/rpmbuild/SOURCES/mylib-1.0.1.tgz --transform='#^#mylib-1.0.1/#s' *.c *.h makefile

Create a *.spec file using the following template, and store it in ~/rpmbuild/SPECS/mylib.spec:

Summary: Test library
Name: mylib
Version: 1.0.1
Release: 1
License: LGPL
#BuildRequires: make, gcc, binutils, coreutils, gzip
Group: System/Libraries
Source: mylib-1.0.1.tgz
 
BuildRoot: /ver/tmp/${name}-buildroot
 
%description
Test library
 
%prep
%setup -q
 
%build
make configure
make
 
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/include
mkdir -p $RPM_BUILD_ROOT/usr/lib
sudo SYS_ROOT=$RPM_BUILD_ROOT make install
 
%clean
rm -rf $RPM_BUILD_ROOT
 
%files
/usr/lib/libmy.a
/usr/lib/libmy.a.1.0.1
/usr/lib/libmy.so
/usr/lib/libmy.so.1.0.1
/usr/lib/libmy.so.1.0.1.dbg
/usr/include/my.h
 
%changelog
* Wed May 30 2012 Attie Grande <attie@attie.co.uk>
- created RPM build infrastructure

Build the RPM:

cd ~/rpmbuild
rpmbuild -ba SPECS/mylib.spec
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox