LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 12-23-2009, 04:38 AM   #1
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Smile anyone making rpm's from source (.src and .tar.gz/bz2)


Hi, the moniker says it all really, does anyone here build rpm packages from it's source.

If so, I'd be interested in reading more about it.

There are somany programs out there in the OSS world, but rather difficult to keep track of through the various package managers.

Any thoughts welcome, any news on the kde4 mandriva packger.
I mean the dev/person who builds rpms from the kde4 source for x86_64 as well as i586

I'm mostly interested in x86_64.

thanks, happy holidays everyone!

Regards Glenn
 
Old 12-23-2009, 04:02 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hey Glenn,

I do a bit of packaging, did you have any specific questions or just looking for a general intro/howto ?

cheers
 
Old 12-23-2009, 05:34 PM   #3
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Hi, thanks for the reply.

Yes, I'm interested in a howto, but the rpm-build tutes I have read are old or incomplete.

I've been using GNU/Linux for a while now(since 2001) and I want to sort out some things

Like avoiding "dependency-hell" and the bloat associated with gtk+ vs Qt (cute), and i586 vs x86_64.

If you know of a starting point, please share it with me. I intend to contribute to OSS by way of packaging.

I have done (barely passed) 3 programming courses (Pascal, java, c+, and objC), but I am by no means a programmer.

The last time I checked was a few years ago, about building rpm's from source.

I am interested in getting to a point where I may contribute to the repos, but that may take a while.

Thank you, regards Glenn
 
Old 12-23-2009, 06:36 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
The shortest method to getting started :-

Code:
$ sudo yum install rpm-build rpmdevtools rpmlint
...
$ rpmdev-setuptree
This will create the directory ~/rpmbuild with several subdirs:
- SPECS ( spec files go here )
- SOURCES ( tar.gz etc go here )
- BUILD ( temp dir for unpacking/patching sources )
- RPMS ( finished packages will be under here in arch specific subdirs )
- SRPMS ( if you opt to build src.rpm's they will be under here )

The rpmdevtools package provides several spec file templates:
/etc/rpmdevtools/spectemplate-R.spec
/etc/rpmdevtools/spectemplate-dummy.spec
/etc/rpmdevtools/spectemplate-lib.spec
/etc/rpmdevtools/spectemplate-minimal.spec
/etc/rpmdevtools/spectemplate-ocaml.spec
/etc/rpmdevtools/spectemplate-perl.spec
/etc/rpmdevtools/spectemplate-php-pear.spec
/etc/rpmdevtools/spectemplate-python.spec
/etc/rpmdevtools/spectemplate-ruby.spec

The minimal template is ideal for generating an rpm from a 'configure/make/make install' type tarball, on Fedora this is the default.

Code:
cd ~/rpmbuild
cp /path/to/myapp-1.0.0.tar.gz SOURCES/
vi SPECS/myapp.spec
.. should open a new file based on the minimal template. Simply supply the missing details.

Name, Version and Summary - pretty straight forward
Group - find a matching category in /usr/share/doc/rpm-xxx/GROUPS
License, URL - pretty straight forward
Source0 - I usually use %{name}-%{version}.tar.gz, make sure that myapp-1.0.0.tar.gz is named accordingly

BuildRequires - what the package needs to compile, comma separated ( gcc, make, ... )
Requires - what the package depends on to function, comma separated
Description - pretty straight forward

skip down to the %files section, you will need to add all the files that the package will provide, you can specify a directory to include all files under it

eg.
Code:
%files
%defattr(-,root,root,-)
/opt/myapp
/etc/rc.d/init.d/myapp
The %defattr macro determines the default permissions and ownership for all files. When building an rpm where the source has a makefile, the file permissions are most likely already correct. If you need to override them just modify like so:

Code:
%files
%defattr(-,root,root,-)
/opt/myapp
%attr(755,root,root) /etc/rc.d/init.d/myapp
The %doc directive works well when your source has documentation in it's root dir, it will place the files under /usr/share/doc/myapp-1.0.0/.

eg.
Code:
%doc CHANGES
%doc INSTALL
Add an entry to the %changelog section like so: (taken from initscripts.spec)
Code:
* Fri Feb 07 1997 Erik Troan <ewt@redhat.com>
- Added usernetctl wrapper for user mode ifup and ifdown's and man page
- Rewrote ppp and slip kill and retry code
- Added doexec and man page
Save your spec file and exit vi.

First build attempt:
Code:
rpmbuild -ba SPECS/myapp.spec
If all goes well, it should tell you that it has written 2 files, a src.rpm and an .rpm

You can run 'rpmbuild -b?' to only perform specific sections ( helps when troubleshooting), please see the man page.

Once you have a successful build try running rpmlint:

Code:
rpmlint SPECS/myapp.spec
Take the output with a grain of salt, but sometimes it helps.

If you're having trouble it can also help to download someone else's src.rpm, install it and take a look at their spec file


Hope this helps, my fingers are worn out

cheers
 
1 members found this post helpful.
Old 12-23-2009, 07:20 PM   #5
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Thanks heaps for the effort!

I shall begin, but first I'll have to deal with my family (that time of year)

But I'll post back in a day or so with feedback and questions, if I have any.

Thanks heaps.

Regards Glenn
 
Old 12-23-2009, 09:06 PM   #6
jkerr82508
Member
 
Registered: Dec 2006
Location: Fife, Scotland
Posts: 268

Rep: Reputation: 69
This may help (it includes information that may be specific to Mandriva):

http://wiki.mandriva.com/en/Mandriva_RPM_HOWTO

Jim
 
Old 12-24-2009, 06:12 AM   #7
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Thank you sir.

Happy holidays!

kind regards Glenn
 
Old 12-25-2009, 06:48 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,514

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
rpmbuild

A couple of good links ( I think.)

http://docs.fedoraproject.org/drafts...specfiles.html
http://docs.fedoraproject.org/drafts...n/ch09s05.html
http://docs.fedoraproject.org/drafts...html#id2972829
.....

http://www.rpm.org/max-rpm-snapshot/index.html
http://www.rpm.org/max-rpm/s1-rpm-bu...spec-file.html
http://www.rpm.org/max-rpm-snapshot/...b-command.html
.....

A "beginners" example spec file is attached .. .. and it works OK ..
.....
Attached Files
File Type: txt xfardicEL5.spec.txt (1.5 KB, 11 views)
 
Old 12-25-2009, 06:39 PM   #9
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Thank you, I have some (quite a bit of...) reading to do, Thanks for the .txt, I does help.

please excuse me for not responding (yet).

I appreciate your support.

cheers, Glenn
 
Old 12-26-2009, 08:21 PM   #10
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Hi kbp, I'm working through the example above,

this spec part,
Quote:
Code:

cd ~/rpmbuild
cp /path/to/myapp-1.0.0.tar.gz SOURCES/
vi SPECS/myapp.spec
do I need to unpack the .tar.bz2, first?

The point I'm at is that the spec file is created, empty. Have I missed linking the templates?
Quote:
should open a new file based on the minimal template. Simply supply the missing details.
Code:
cd ~/rpmbuild

glenn@GamesBox:~/rpmbuild$ vi /home/glenn/rpmbuild/SPECS/kdelibs.spec
The install of the packages for setup seem to have worked.
Code:
glenn@GamesBox:~/rpmbuild$ ls /etc/rpmdevtools/
newspec.conf             spectemplate-minimal.spec   spectemplate-python.spec
rmdevelrpms.conf         spectemplate-ocaml.spec     spectemplate-ruby.spec
spectemplate-fonts.spec  spectemplate-perl.spec
spectemplate-lib.spec    spectemplate-php-pear.spec
I have copied the sources to ...
Code:
glenn@GamesBox:~/rpmbuild$ ls /home/glenn/rpmbuild/SOURCES                       (27-12 12:16)
kdeaccessibility-4.3.4.tar.bz2   kdelibs-experimental-4.3.4.tar.bz2
kdeadmin-4.3.4.tar.bz2           kdemultimedia-4.3.4.tar.bz2
kdeartwork-4.3.4.tar.bz2         kdenetwork-4.3.4.tar.bz2
kdebase-4.3.4.tar.bz2            kdepim-4.3.4.tar.bz2
kdebase-runtime-4.3.4.tar.bz2    kdepimlibs-4.3.4.tar.bz2
kdebase-workspace-4.3.4.tar.bz2  kdepim-runtime-4.3.4.tar.bz2
kdebindings-4.3.4.tar.bz2        kdeplasma-addons-4.3.4.tar.bz2
kdeedu-4.3.4.tar.bz2             kdesdk-4.3.4.tar.bz2
kdegames-4.3.4.tar.bz2           kdetoys-4.3.4.tar.bz2
kdegraphics-4.3.4.tar.bz2        kdeutils-4.3.4.tar.bz2
kde-l10n-en_GB-4.3.4.tar.bz2     kdewebdev-4.3.4.tar.bz2
kdelibs-4.3.4.tar.bz2            oxygen-icons-4.3.4.tar.bz2
I feel I have missed a step, and no, I have not read all the links here yet.

Your assistance is appreciated.

Regards Glenn
 
Old 12-27-2009, 01:30 AM   #11
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hey mate,

No, you don't need to unpack the tarball, rpmbuild will do that for you.

Maybe there's a difference between the Fedora rpmdevtools package and the Mandriva one, as a workaround just copy the minimal template into the SPECS dir and rename it.
I'll do a bit of digging and see if I can work out what the difference is...

Other than that you're on track

cheers
 
Old 12-27-2009, 02:47 AM   #12
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
OK, I see. that should work.

cheers, Glenn
 
Old 12-27-2009, 03:12 AM   #13
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Best practice to learn how to compile and create is to unpack packages with similar structure or same package from another distribution, unpack it and check it's spec file. That is how I started a year ago. Since then I recompiled about 30 package packs from Fedora to CentOS and created several mine own based on the source. use http://rpm.pbone.net to search for what you need. Look for a binary package you want and on it's page should be a link to src package.
 
Old 12-27-2009, 04:18 AM   #14
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Hi DrLove73, That is what I am doing, I realise where the lists are, but for this version of kde (4.3.4), there is no ref on pbone for this version (only 4.3.85).

and the list is quite long.

urpmi gives me some details, but for older versions. (4.3.2, the version I have installed.)

Bit of a guessing game, but this is not severe, or crucial, It's just time, and I don't mind.

Plenty of disk-space and time.

Thank you for the tips.

Much appreciated, regards Glenn

ps, it's just setting up the spec file atm, I've compiled from source many, many times.

Last edited by GlennsPref; 12-27-2009 at 04:19 AM. Reason: setting up the spec file....
 
Old 12-27-2009, 04:31 AM   #15
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657

Original Poster
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
To be sure, here is what the default minimal-spec file gives me before edit.
/etc/rpmdevtools/spectemplate-minimal.spec
Code:
Name:           
Version:        
Release:        1%{?dist}
Summary:        

Group:          
License:        
URL:            
Source0:        
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  
Requires:       

%description


%prep
%setup -q


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc



%changelog
 
  


Reply



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
tar-command not found while compiling glibc-libidn-2.7.tar.bz2 of lfs6.3 aditya_gpch Linux From Scratch 1 05-13-2008 11:27 PM
Is the source in a distro-specific RPM the same as the sourcecode in a TAR.GZ or BZ2? GrapefruiTgirl Linux - Software 42 10-03-2007 08:30 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
How to? compile and install from source? (tar.*/gz2/bz2) entob Slackware 9 03-30-2004 06:23 PM
.rpms, .tar.gz, .tgz, .src.rpm, & .tar.bz2 whoots Mandriva 10 10-18-2003 12:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 11:41 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
Open Source Consulting | Domain Registration