Issue
I am trying to build an rpm for a compiled version of apache. I want the rpm to build it in /opt/apache.... I am able to create the RPM file itself but when I do a rpm -qpl on the file it shows up as empty.
Here is my spec file:
Name: custom-http
Version: 2.2.25
Release: 1%{?dist}
Summary: A custom build of Apache
License: NA
URL: http://x.x.x.x:/repo2
Source0: http://x.x.x.x:/repo2/httpd-2.2.25.tar.gz
BuildRequires: xfce4-dev-tools apr-util openssl-devel
%description
Custom compiled version of Apache version 2.2.25
%prep
%setup -n httpd-2.2.25
%build
./configure --disable-rpaths --with-included-apr --enable-mods-shared=all --with-mpm=prefork --enable-ssl --prefix=/opt/apache --enable-so
make %{?_smp_mflags}
%install
make install
%clean
%files
%doc
%changelog
* Thu Jan 30 2014 name <email address>
- First attempt
~
Solution
First, you need to install the files to the buildroot when doing make install
, since you don't want the files to be installed in the actual filesystem root when building the package.
This means that you have to replace the make install
with make install DESTDIR=%{buildroot}
, which you can also write simply as %make_install
(to see what a macro expands to, you can do rpm -E <macro>
, i.e.
$ rpm -E %make_install
/usr/bin/make install DESTDIR=$HOME/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}.x86_64
).
Then, as Ignacio Vazquez-Abrams said, you will need to populate the %files
section. To find out what you have to write there, just do a build from the tarball, install it in some temporary directory (using DESTDIR
when calling make install
), and then list the installed files. Read i.e. [1] for more on this.
Other notes:
%doc
actually belongs to the%files
section (judging from the extra spacing you added around%doc
, it is not clear whether you are aware of this).%clean
is not necessary anymore if you are targeting a recent rpm distro (i.e. Fedora > F13, RHEL >= 6).
[1] http://fedoraproject.org/wiki/How_to_create_an_RPM_package#.25files_section
Answered By - smani Answer Checked By - Robin (WPSolving Admin)