LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   howto create rpm (ffmpeg in particular) (https://www.linuxquestions.org/questions/linux-software-2/howto-create-rpm-ffmpeg-in-particular-369897/)

dtra 10-05-2005 01:31 AM

howto create rpm (ffmpeg in particular)
 
hi all

i want to find out how to create an rpm, i am a linux novice, but i don't think that that should stop me

i need to create an ffmpeg rpm because the ones that i have been using are getting a little outdated and do not provide all that i need

the version that i am currently using is the latest one for rhel3 from dag.wieers.com
created from the src rpm so that i could enable amr_nb

the problem is, it doesn't seem to convert some videos correctly, and it may be because the build is too old

so i just want to find out if this can be done by someone like me, and if it is easy enough to do over and over (so i can upgrade the build if necessary)

i know that ffmpeg has a lot of third party libraries that need to be installed as well

these i would just install as normal from rpm (eg. amr_nb, mp3, etc)

thanks
dave

unSpawn 10-05-2005 06:34 PM

Sure, why not. It's not that hard.
If the system is unchanged rpm's are built in the /usr/src/redhat tree:
BUILD -> here are rpm's unpacked, configured and compiled
RPMS -> packaged rpm's are stored here
SOURCES -> tarballs and patches
SPECS -> the .spec files with which to script building an rpm
SRPMS -> packaged rpm's are stored here (tarball+patches+spec file)

BTW, before I continue, some tarballs come with a spec file (zcat tarball.tgz|tar -t|grep -ie "\.spec$"). Then you can build it straight away with "rpm -tb app.spec" and forget the rest below.

OK. You already know you will have to install the dependencies like development libraries. Next grab the last .src.rpm (or the spec file, get the latest tarball separately) and install/place it. This will leave you with the tarball (+patches if any) in SOURCES and the .spec file in SPECS. Unpack the tarball manually, apply patches, then configure and compile it to see if there are no errors. If there aren't any continue looking at the .spec file. Here is a crude example:

Code:

%define name    app
%define ver      0.1
%define rel      1

Summary: %{name}
Name: %name
Version: %ver
Release: %rel
Copyright: GPL
Group: Console/Applications
URL: http://www.One.com/~Some/app.html
Source: %{name}-%{ver}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}
Provides: %{name}

%description
This is a useful app.

%prep
%setup -q

%build
./configure --prefix=/usr/local
make

%install
rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT%{prefix} install-strip

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%doc AUTHORS COPYING ChangeLog NEWS README doc/*
%{config}/etc/app.conf
%{prefix}/sbin/app


%changelog
* Sat Sep 11 1999 Some One <Some@One.com>
- First rpm

Check the topmost defines so the %{name} and %{ver} is in sync with the version of your tarball, else rpm can't find and unpack it. Usually you don't have to tweak the rest above %prep and %setup unless you got patching to do. Under %build you'll find the commands you previously ran on the commandline to get the package to build: replace 'em here if necessary. Now try "rpm -bb app.spec" (bb=build only binary rpm) and see if it will build. If it fails the commands can be seen in tmpfiles in the %{_tmppath} (see: rpmbuild --showrc|grep -ie topdir). Post any errors here and we'll see.

This looks like a lot, but it isn't. And you're right, when you got the spec file right for one rpm you usually don't have to tweak much afterwards.

* If you think you will want to build more rpm's have a look at this IBM developerWorks doc Packaging software with RPM, Part 2: Building without root. Because if you keep building rpm's as root account user you will probably fsck up one time polluting your system.

tkedwards 10-05-2005 06:38 PM

See also:
http://qa.mandriva.com/twiki/bin/view/Main/RpmHowTo - Mandriva RPM HOWTO
http://www.rpm.org/RPM-HOWTO/ - RPM.org RPM Howto

dtra 10-20-2005 07:44 PM

oops, thank you, didn't realise i got a response
hopefully i can pull this off

reddazz 10-20-2005 11:46 PM

For Redhat/FEdora rpms take a look at the Fedora Developers Guide.


All times are GMT -5. The time now is 07:24 PM.