Rpm

僅打包建構文件的某個子集

  • January 12, 2016

我正在嘗試以libmp3lamelibmp3lame-develDebian 打包它的方式大致相同的方式進行打包:它們libmp3lame作為一個包提供libmp3lame.so共享庫、libmp3lame-dev提供標頭檔和文件,並lame取決於libmp3lame提供實際的二進製文件。

這是我的規範文件,libmp3lame.spec

Summary: Shared libraries for LAME.
Name: libmp3lame
Version: 3.99.5
Release: 1
License: LGPL
Vendor: The LAME Project
Packager: Naftuli Tzvi Kay <--->
URL: http://www.mp3dev.org
Group: Applications/Multimedia
Source: lame-%{version}.tar.gz
BuildRequires: gcc => 3.0.1, /usr/bin/find, ncurses-devel, nasm

%description
Shared libraries for LAME.

%package devel
Summary: Shared libraries for LAME (development files).
Group: Development/Libraries
Requires: %{name} = %{version}

%description devel
Shared libraries for LAME (development files).

%prep
%setup -n lame-%{version}

%build

# Vorbis makes the build fail for now. . .
rm -f config.cache

# configuration swiped from debian
%configure \
   --enable-nasm \
   --disable-rpath \
   --enable-dynamic-frontends \
   --enable-expopt=full \
   --enable-nasm \
   --with-fileio=lame
%{__make} %{?_smp_mflags} test CFLAGS="%{optflags}"

%install

%makeinstall
%{__ln_s} -f lame/lame.h %{buildroot}%{_includedir}/lame.h
### make install really shouldn't install these
# %{__rm} -rf %{buildroot}%{_docdir}/lame/

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%clean
%{__rm} -rf %{buildroot}

%files
%defattr (-,root,root)
%{_libdir}/libmp3lame.so.*
%{_libdir}/libmp3lame.so

%files devel
%defattr (-, root, root)
%doc API HACKING STYLEGUIDE
%{_includedir}/*

%changelog

* Mon Jan 11 2016 Naftuli Tzvi Kay <---> - 3.99.5-1
- Repackaged for reasons.

我看到以下建構錯誤:

RPM build errors:
   Installed (but unpackaged) file(s) found:
  /usr/bin/lame
  /usr/lib64/libmp3lame.a
  /usr/lib64/libmp3lame.la
  /usr/share/doc/lame/html/about.html
  /usr/share/doc/lame/html/abr.html
  /usr/share/doc/lame/html/cbr.html
  /usr/share/doc/lame/html/contact.html
  /usr/share/doc/lame/html/contributors.html
  /usr/share/doc/lame/html/detailed.html
  /usr/share/doc/lame/html/history.html
  /usr/share/doc/lame/html/index.html
  /usr/share/doc/lame/html/introduction.html
  /usr/share/doc/lame/html/links.html
  /usr/share/doc/lame/html/list.html
  /usr/share/doc/lame/html/ms_stereo.html
  /usr/share/doc/lame/html/usage.html
  /usr/share/doc/lame/html/vbr.html
  /usr/share/man/man1/lame.1.gz

我試圖只在最終的 RPM 中包含我需要的文件,但它似乎仍然抱怨這一點。

make install在該階段創建的建構文件%makeinstall需要明確包含或排除。

rm我可以通過在 之後執行手動命令來解決此問題,但在使用子句%makeinstall的部分中似乎還有另一種解決方法:%files``%exclude

%files
%defattr (-,root,root)
%{_libdir}/libmp3lame.so.*
%{_libdir}/libmp3lame.so
%exclude %{_bindir}/lame
%exclude %{_libdir}/libmp3lame.a
%exclude %{_libdir}/libmp3lame.la

引用自:https://unix.stackexchange.com/questions/254952