rpm/rpm.spec
2019-08-31 00:04:11 +03:00

806 lines
22 KiB
RPMSpec

%define commit ad56b44cacb64c7402c74d553d772dc151debee5
%define short_commit %(echo %{commit} | head -c 4)
# When updating, change commit hash above to the commit in
# https://abf.io/soft/rpm5 that you want to build from
# and bump "Release".
%{?build_selinux}%{?!build_selinux:%bcond_with selinux}
%{?build_squirrel}%{?!build_squirrel:%bcond_without squirrel}
%bcond_with bootstrap
%bcond_with debug
%bcond_without ossp_uuid
%bcond_without augeas
#XXX: this macro is a bit awkward, better can be done!
%if %{with bootstrap}
%bcond_with perl
%bcond_with python
%bcond_with tcl
%bcond_with embed
%bcond_with docs
%bcond_with sqlite
%define __noautoreq 'perl\\(XML::LibXML\\)'
%else
%bcond_without perl
%bcond_without python
%bcond_without tcl
%bcond_without embed
%bcond_without docs
# use what's in berkeley db
%bcond_with sqlite
%endif
%bcond_with notyet
%if %{with notyet}
%bcond_without xar
%bcond_without ruby
%bcond_without js
%else
%bcond_with xar
%bcond_with ruby
%bcond_with js
%endif
%if %{with debug}
%global debugcflags %{debugcflags} -g3 -O0 -DDEBUG
%endif
# can probably be restored now..
%if %{with bootstrap}
#include %%{_sourcedir}/bootstrap.spec
%endif
%define bdb db52
%define libver 5.4
%define minorver 10
%define librpmname %mklibname rpm %{libver}
%define librpmnamedevel %mklibname rpm -d
%define librpmstatic %mklibname rpm -d -s
Summary: The RPM package management system
Name: rpm
Epoch: 1
Version: %{libver}.%{minorver}
Release: 99.git%{short_commit}
License: LGPLv2.1+
Group: System/Configuration/Packaging
Url: http://rpm5.org/
Source0: https://abf.io/soft/rpm5/archive/rpm5-%{commit}.tar.gz
# These are a bit dated with a lot of redundant macros and many of them no
# of use at all anymore! Should ideally just contain the macros different
# from the default; _arch, optflags, _lib & _multilib*.
# stripping away the rest (along with os specificity) and create a resulting
# cpu-macros.tar.gz to push upstream would seem like a sane improvement.
Source2: rpm.rpmlintrc
Source3: cpu-os-macros.tar.gz
Source5: RPMBDB-0.1.tar.xz
Source6: autosetup.macros
%if %{with debug}
# git diff master debug
Patch0: debug.patch
%endif
BuildRequires: autoconf >= 2.57
BuildRequires: bzip2-devel
BuildRequires: automake >= 1.8
BuildRequires: elfutils-devel
BuildRequires: sed >= 4.0.3
BuildRequires: beecrypt-devel >= 4.2.1-8
BuildRequires: ed
BuildRequires: gettext-devel
BuildRequires: byacc
BuildRequires: pkgconfig(neon)
#BuildRequires: rpm-%{_target_vendor}-setup-build
BuildRequires: rpm-mandriva-setup-build
BuildRequires: readline-devel
BuildRequires: ncurses-devel
BuildRequires: pkgconfig(libssl)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libpcre)
BuildRequires: pkgconfig(libpcreposix)
%if %{mdvver} >= 201900
# libnsl.so was removed from glibc-devel
BuildRequires: pkgconfig(libnsl)
%endif
BuildRequires: acl-devel
BuildRequires: magic-devel
BuildRequires: pkgconfig(popt) >= 1.15
BuildRequires: libxml2-devel >= 2.7.8-9
# we're now building with internal..
#BuildRequires: pkgconfig(lua)
# needed by internal lua
BuildRequires: expat-devel
%ifarch %{ix86} x86_64 ppc ppc64 ia64
BuildRequires: pkgconfig(libcpuinfo)
%endif
BuildRequires: syck-devel
BuildRequires: keyutils-devel
BuildRequires: gomp-devel
BuildRequires: pkgconfig(gnutls)
BuildRequires: gnupg2
# required by parts of test suite...
BuildRequires: wget
# Should we prefer internal xar in stead? internal xar contains at least
# lzma/xz patches, what's the state of these and upstream?
# does internal xar contain any other rpm specific patches as well, or..?
%if %{with xar}
BuildRequires: xar-devel
%endif
BuildRequires: %{bdb}-devel >= 5.2.36-3
# required by test suite
BuildRequires: %{bdb}-utils
%if %{with perl}
BuildRequires: perl-devel
%endif
%if %{with python}
BuildRequires: python-devel
%endif
%if %{with js}
BuildRequires: pkgconfig(mozjs185)
%endif
%if %{with ruby}
BuildRequires: ruby-devel
%endif
%if %{with tcl}
BuildRequires: tcl-devel
%endif
%if %{with squirrel}
BuildRequires: squirrel-devel
%endif
%if %{with docs}
BuildRequires: doxygen
BuildRequires: graphviz
#BuildRequires: texlive
%endif
%if %{with sqlite}
BuildRequires: pkgconfig(sqlite3)
%endif
%if %{with ossp_uuid}
BuildRequires: pkgconfig(ossp-uuid)
%endif
%if %{with augeas}
BuildRequires: pkgconfig(augeas)
%endif
%if %{with debug}
BuildRequires: pkgconfig(valgrind)
%endif
BuildRequires: spec-helper >= 0.31.12
BuildRequires: stdc++-static-devel >= 4.6.2-8
BuildRequires: elfutils >= 0.153
BuildRequires: libtool >= 2.4.2-3
Requires: cpio
Requires: gawk
Requires: mktemp
Requires: update-alternatives
Requires: %{bdb}_recover
Suggests: %{bdb}-utils
Requires: %{librpmname} = %{EVRD}
Conflicts: rpm-build < 1:5.3.10-0.20110422.3
Requires(pre): coreutils
%rename rpmconstant
%rename multiarch-utils
%rename rpm-manbo-setup
#rename rpm-%{_target_vendor}-setup
%rename rpm-mandriva-setup
%description
RPM is a powerful command line driven package management system capable of
installing, uninstalling, verifying, querying, and updating software packages.
Each software package consists of an archive of files along with information
about the package like its version, a description, etc.
# TODO: review which files goes into what packages...?
%files -f %{name}.lang
%doc CHANGES doc/manual/[a-z]*
%if %{with docs}
%exclude %{_docdir}/rpm/html
%endif
/bin/rpm
%{_bindir}/multiarch-dispatch
%{_bindir}/rpmconstant*
%{_bindir}/rpm2cpio*
%{_rpmhome}/bin/augtool
%{_rpmhome}/bin/chroot
%{_rpmhome}/bin/cp
%{_rpmhome}/bin/dbconvert
%{_rpmhome}/bin/find
#%%{_rpmhome}/bin/grep
#%%{_rpmhome}/bin/lua
%{_rpmhome}/bin/mtree
%{_rpmhome}/bin/mgo
#%%{_rpmhome}/bin/rc
%{_rpmhome}/bin/rpmdbchk
%{_rpmhome}/bin/rpmspecdump
%{_rpmhome}/bin/wget
%if %{with xar}
%{_rpmhome}/bin/txar
%endif
%{_rpmhome}/dbconvert.sh
%{_rpmhome}/rpm.*
%{_rpmhome}/rpm2cpio
%{_rpmhome}/rpmdb_loadcvt
%{_rpmhome}/tgpg
%dir %{_localstatedir}/lib/rpm
%dir %{_localstatedir}/lib/rpm/log
%dir %{_localstatedir}/lib/rpm/tmp
%{_rpmhome}/macros.d/*
%{_rpmhome}/cpuinfo.yaml
%{_rpmhome}/macros
%{_rpmhome}/rpmpopt
%{_rpmhome}/platform/*/macros
%config(noreplace) %{_localstatedir}/lib/rpm/DB_CONFIG
%dir %{_localstatedir}/spool/repackage
%dir %{_rpmhome}
%dir %{_rpmhome}/bin
%dir %{_rpmhome}/lib
%dir %{_rpmhome}/platform/
%dir %{_rpmhome}/platform/*/
%dir %{_rpmhome}/macros.d
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/macros
%dir %{_sysconfdir}/%{name}/macros.d
%dir %{_sysconfdir}/%{name}/premacros.d
%dir %{_sysconfdir}/%{name}/sysinfo
%{_sysconfdir}/%{name}/macros.d/*.macros
%{_sysconfdir}/%{name}/premacros.d/*.macros
%{_mandir}/man[18]/*.[18]*
%lang(pl) %{_mandir}/pl/man[18]/*.[18]*
%lang(ru) %{_mandir}/ru/man[18]/*.[18]*
%lang(ja) %{_mandir}/ja/man[18]/*.[18]*
%lang(sk) %{_mandir}/sk/man[18]/*.[18]*
%lang(fr) %{_mandir}/fr/man[18]/*.[18]*
%lang(ko) %{_mandir}/ko/man[18]/*.[18]*
%exclude %{_mandir}/man8/rpmbuild.8*
%exclude %{_mandir}/man8/rpmdeps.8*
%{_sysconfdir}/cron.daily/rpm
%config(noreplace,missingok) %{_sysconfdir}/logrotate.d/rpm
%dir %{multiarch_bindir}
%dir %{multiarch_includedir}
%if "%{_lib}" == "lib64"
%dir %(linux32 rpm -E %%{multiarch_bindir})
%dir %(linux32 rpm -E %%{multiarch_includedir})
%endif
%{_includedir}/multiarch-dispatch.h
#----------------------------------------------------------------------------
%package -n %{librpmname}
Summary: Libraries used by rpm
Group: System/Libraries
# Forcing upgrades of anything else linked against it as rpmdb is incompatible
# with older versions (#61658, comment #136)
Conflicts: librpm < 5.3
Conflicts: %{_lib}db5.1 < 5.1.25
Conflicts: %{_lib}elfutils1 < 0.152
Conflicts: %{_lib}beecrypt7 < 4.2.1
%description -n %{librpmname}
RPM is a powerful command line driven package management system capable of
installing, uninstalling, verifying, querying, and updating software packages.
This package contains common files to all applications based on rpm.
%files -n %{librpmname}
%{_libdir}/librpm-%{libver}.so
%{_libdir}/librpmconstant-%{libver}.so
%{_libdir}/librpmdb-%{libver}.so
%{_libdir}/librpmio-%{libver}.so
%{_libdir}/librpmmisc-%{libver}.so
%{_libdir}/librpmbuild-%{libver}.so
%if %{with js}
%{_rpmhome}/lib/librpmjsm.so.*
%{_rpmhome}/lib/rpmjsm.so
%endif
#----------------------------------------------------------------------------
%package -n %{librpmnamedevel}
Summary: Development files for applications which will manipulate RPM packages
Group: Development/C
Requires: %{librpmname} = %{EVRD}
Provides: rpm-devel = %{EVRD}
%rename %{_lib}rpmconstant-devel
%description -n %{librpmnamedevel}
This package contains the RPM C library and header files. These
development files will simplify the process of writing programs
which manipulate RPM packages and databases and are intended to make
it easier to create graphical package managers or any other tools
that need an intimate knowledge of RPM packages in order to function.
This package should be installed if you want to develop programs that
will manipulate RPM packages and databases.
%files -n %{librpmnamedevel}
#%%doc apidocs/html
%{_includedir}/rpm
%{_libdir}/librpm.so
%{_libdir}/librpmconstant.so
%{_libdir}/librpmdb.so
%{_libdir}/librpmio.so
%{_libdir}/librpmmisc.so
%{_libdir}/librpmbuild.so
%{_libdir}/pkgconfig/rpm.pc
%if %{with js}
%{_rpmhome}/lib/librpmjsm.so
%endif
#----------------------------------------------------------------------------
%package -n %{librpmstatic}
Summary: Static libraries for rpm development
Group: Development/C
Requires: %{librpmnamedevel} = %{EVRD}
%description -n %{librpmstatic}
Static libraries for rpm development.
%files -n %{librpmstatic}
%{_libdir}/librpm.a
%{_libdir}/librpmconstant.a
%{_libdir}/librpmdb.a
%{_libdir}/librpmio.a
%{_libdir}/librpmmisc.a
%{_libdir}/librpmbuild.a
#----------------------------------------------------------------------------
%package build
Summary: Scripts and executable programs used to build packages
Group: System/Configuration/Packaging
Requires: autoconf
Requires: automake
Requires: file
Requires: gcc-c++
Requires: gzip-utils
Requires: libtool-base >= 2.4.2-3
Requires: patch >= 2.5.9-7
Requires: make
Requires: unzip
Requires: which
Requires: elfutils >= 0.152-4
Requires: rpm = %{EVRD}
#Requires: rpm-%{_target_vendor}-setup-build
Requires: rpm-mandriva-setup-build
Requires: spec-helper >= 0.31.12
#Requires: rpmlint-%{_target_vendor}-policy >= 0.3.2
Requires: rpmlint-rosa-policy >= 0.3.2
%if %{without bootstrap}
Requires: python-rpm = %{EVRD}
Requires: perl-RPM = %{EVRD}
%endif
# Used by __urlgetfile to download files from external sources
Requires: wget
Conflicts: rpmlint < 1.4-4
Conflicts: multiarch-utils < 1:5.3.10
Conflicts: rpm < 1:5.4.4-32
%rename rpm-manbo-setup-build
%description build
This package contains scripts and executable programs that are used to
build packages using RPM.
%files build
%{_bindir}/gendiff
%{_bindir}/rpmbuild
%{_bindir}/multiarch-platform
#%%{_rpmhome}/bin/abi-compliance-checker.pl
%{_rpmhome}/bin/api-sanity-autotest.pl
%{_rpmhome}/bin/api-sanity-checker.pl
%{_rpmhome}/bin/dbsql
%{_rpmhome}/bin/debugedit
%{_rpmhome}/bin/install-sh
%{_rpmhome}/bin/lua
%{_rpmhome}/bin/luac
%{_rpmhome}/bin/mkinstalldirs
%{_rpmhome}/bin/pom2spec
%{_rpmhome}/bin/rpmcache
%{_rpmhome}/bin/rpmcmp
%{_rpmhome}/bin/rpmdeps
%{_rpmhome}/bin/rpmdigest
%{_rpmhome}/bin/rpmkey
%{_rpmhome}/bin/rpmlua
%{_rpmhome}/bin/rpmluac
%{_rpmhome}/bin/rpmrepo
%{_rpmhome}/bin/sqlite3
%dir %{_rpmhome}/helpers
%{_rpmhome}/helpers/*
%dir %{_rpmhome}/qf
%{_rpmhome}/qf/*
%{_rpmhome}/vcheck
%{_rpmhome}/brp-*
%{_rpmhome}/check-files
%{_rpmhome}/check-multiarch-files
#%%{_rpmhome}/cross-build
%{_rpmhome}/find-debuginfo.sh
%{_rpmhome}/find-lang.sh
%{_rpmhome}/find-prov.pl
%{_rpmhome}/find-provides.perl
%{_rpmhome}/find-req.pl
%{_rpmhome}/find-requires.perl
%{_rpmhome}/fontconfig.prov
%{_rpmhome}/gem_helper.rb
%{_rpmhome}/getpo.sh
%{_rpmhome}/gstreamer.sh
%{_rpmhome}/http.req
%{_rpmhome}/javadeps.sh
%{_rpmhome}/kmod-deps.sh
%{_rpmhome}/mkmultiarch
%{_rpmhome}/mono-find-provides
%{_rpmhome}/mono-find-requires
%{_rpmhome}/executabledeps.sh
%{_rpmhome}/libtooldeps.sh
%{_rpmhome}/osgideps.pl
%{_rpmhome}/perldeps.pl
%{_rpmhome}/perl.prov
%{_rpmhome}/perl.req
%{_rpmhome}/php.prov
%{_rpmhome}/php.req
%{_rpmhome}/pkgconfigdeps.sh
%{_rpmhome}/pythondeps.sh
%{_rpmhome}/pythoneggs.py
%{_rpmhome}/qmldeps.sh
%{_rpmhome}/rubygems.rb
%{_rpmhome}/symclash.*
%{_rpmhome}/u_pkg.sh
%{_rpmhome}/vpkg-provides.sh
%{_rpmhome}/vpkg-provides2.sh
%if %{with js}
%{_rpmhome}/bin/tjs
%endif
%{_rpmhome}/macros.rpmbuild
%{_mandir}/man8/rpmbuild.8*
%{_mandir}/man8/rpmdeps.8*
#----------------------------------------------------------------------------
%if %{with python}
%package -n python-rpm
Summary: Python bindings for apps which will manipulate RPM packages
Group: Development/Python
%description -n python-rpm
The rpm-python package contains a module which permits applications
written in the Python programming language to use the interface
supplied by RPM (RPM Package Manager) libraries.
This package should be installed if you want to develop Python
programs that will manipulate RPM packages and databases.
%files -n python-rpm
%if %{with embed}
%{_rpmhome}/lib/rpmpython.so
%endif
%dir %{py_platsitedir}/rpm
%{py_platsitedir}/rpm/*.py
%{py_platsitedir}/rpm/*.so
%endif
#----------------------------------------------------------------------------
%if %{with perl}
%define perlmod RPM
%package -n perl-%{perlmod}
Summary: Perl bindings for RPM
Group: Development/Perl
Requires: perl-IO-String
%description -n perl-%{perlmod}
The RPM Perl module provides an object-oriented interface to querying both
the installed RPM database as well as files on the filesystem.
%files -n perl-%{perlmod}
#%%doc perl/Changes
%if %{with embed}
%{_rpmhome}/lib/rpmperl.so
%endif
%{_mandir}/man3/RPM*
%{perl_vendorarch}/%{perlmod}.pm
%dir %{perl_vendorarch}/%{perlmod}
%{perl_vendorarch}/%{perlmod}/*.pm
%{perl_vendorarch}/auto/%{perlmod}
%endif
#----------------------------------------------------------------------------
%if %{with perl}
%package -n perl-RPMBDB
Summary: Perl extension for accessing certain Berkeley DB functionality
Group: Development/Perl
Requires: %{librpmname} = %{EVRD}
%description -n perl-RPMBDB
This perl extension provides certain Berkeley DB functionality used by urpmi.
%files -n perl-RPMBDB
%{perl_vendorarch}/RPMBDB.pm
%dir %{perl_vendorarch}/auto/RPMBDB
%{perl_vendorarch}/auto/RPMBDB/RPMBDB.so
%endif
#----------------------------------------------------------------------------
%if %{with ruby}
%package -n rpm-rubyembed
Summary: Ruby embedding module for rpm
Group: Development/Ruby
Requires: ruby(abi)
%description -n rpm-rubyembed
This package provides embedded ruby interpreter support for RPM.
%files -n rpm-rubyembed
%{_rpmhome}/bin/trb
%{_rpmhome}/lib/rpm.so
%{_rpmhome}/lib/rpmruby.so
%endif
#----------------------------------------------------------------------------
%if %{with tcl}
%package -n rpm-tclembed
Summary: Tcl embedding module for rpm
Group: Development/Other
Requires: tcl
%description -n rpm-tclembed
This package provides embedded Tcl interpreter support for RPM.
%files -n rpm-tclembed
%{_rpmhome}/lib/rpmtcl.so
%endif
#----------------------------------------------------------------------------
%if %{with squirrel}
%package -n rpm-squirrelembed
Summary: Squirrel embedding module for rpm
Group: Development/Other
Requires: squirrel
%description -n rpm-squirrelembed
This package provides embedded Squirrel interpreter support for RPM.
%files -n rpm-squirrelembed
%{_rpmhome}/lib/rpmsquirrel.so
%endif
#----------------------------------------------------------------------------
%if %{with docs}
%package apidocs
Summary: API documentation for RPM
Group: Books/Computer books
BuildArch: noarch
%description apidocs
This package contains the RPM API documentation generated in HTML format.
%files apidocs
%dir %{_docdir}/rpm/html
%{_docdir}/rpm/html/*
%endif
#----------------------------------------------------------------------------
%prep
%setup -q -a5 -n rpm5-%{commit}
mkdir -p cpu-os-macros
tar -zxf %{SOURCE3} -C cpu-os-macros
%apply_patches
%build
./autogen.sh
%configure2_5x --enable-nls \
--with-pic \
%if %{with debug}
--enable-debug \
--enable-build-debug \
--with-valgrind \
%endif
--enable-posixmutexes \
%if %{with python}
--with-python=%{python_version} \
%if %{with embed}
--with-pythonembed=external \
%endif
%else
--without-python \
%endif
%if %{with perl}
--with-perl=vendor \
%if %{with embed}
--with-perlembed=external \
%endif
%else
--without-perl \
%endif
%if %{with js}
--with-mozjs185=external \
%else
--without-mozjs185 \
%endif
%if %{with ruby}
--with-ruby=external \
%if %{with embed}
--with-rubyembed=external \
%endif
%endif
%if %{with tcl}
--with-tcl=external \
%endif
%if %{with squirrel}
--with-squirrel=external \
%endif
--with-glob \
%if %{with selinux}
--with-selinux \
%else
--without-selinux \
%endif
%if %{with docs}
--with-apidocs \
%endif
--with-libelf \
--with-popt=external \
--with-xz=external \
--with-bzip2=external \
--with-lua=internal \
--with-expat=external \
--with-pcre=external \
%ifarch %{ix86} x86_64 ppc ppc64 ia64
--with-cpuinfo=external \
%else
--without-cpuinfo \
%endif
--with-syck=external \
--with-file=external \
--with-path-magic=%{_datadir}/misc/magic.mgc \
--with-beecrypt=external \
--with-usecrypto=beecrypt \
--with-keyutils=external \
--with-neon=external \
--with-acl \
--enable-openmp \
%if %{with xar}
--with-xar=%{_includedir}/xar \
%endif
--with-db \
--with-dbsql=external \
--without-db-tools-integrated \
%if %{with sqlite}
--with-sqlite=external \
%else
--without-sqlite \
%endif
%if %{with ossp_uuid}
%if 0
# TODO: needs to be fixed properly for automatic detection in internal lua build
%endif
--with-uuid=%{_libdir}:%{_includedir}/ossp-uuid \
%else
--without-uuid \
%endif
%if %{with augeas}
--with-augeas=external \
%else
--without-augeas \
%endif
%if 0
--with-extra-path-macros=%{_usrlibrpm}/macros.d/mandriva \
%else
--with-extra-path-macros=%{_usrlibrpm}/platform/%%{_target}/macros:%{_sysconfdir}/rpm/macros.d/*.macros:%{_usrlibrpm}/macros.d/mandriva \
%endif
--with-vendor=mandriva \
--enable-build-warnings
# XXX: Making ie. a --with-pre-macros option might be more aestethic and easier
# of use to others if pushed back upstream?
# For our case, this is only used to define _prefer_target_cpu before any other
# macros so that rpm knows about this for libcpuinfo when loading macros, but
# could perhaps be useful to others, ie. for defining a _target_vendor earlier,
# so that vendor specific macros to load could be defined at runtime rather
# than compile time.. Sounds convenient if LSB certification is done on a specific
# set of binaries (does it..?) wrt. Manbo Labs.
echo '#define PREMACROFILES "%{_sysconfdir}/rpm/premacros.d/*.macros"' >> config.h
%make
%if %{with docs}
%make apidocs
%endif
%if %{with perl}
pushd RPMBDB-*
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" CCCDLFLAGS="-fno-PIE -fPIC"
sed -i -e 's,-fPIC -fno-PIE,-fno-PIE -fPIC,g' ../perl/Makefile.perl
%make
popd
%endif
%check
#make check
%install
%makeinstall_std -k
%if %{with perl}
%makeinstall_std -C RPMBDB-*
%endif
# XXX: why isn't this installed by 'make install'?
install -m755 scripts/symclash.* %{buildroot}%{_rpmhome}
# Save list of packages through cron
install -m755 scripts/rpm.daily -D %{buildroot}%{_sysconfdir}/cron.daily/rpm
install -m644 scripts/rpm.log -D %{buildroot}%{_sysconfdir}/logrotate.d/rpm
mkdir -p %{buildroot}/var/spool/repackage
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/{{pre,}macros.d,sysinfo}
# actual usefulness of this seems rather dubious with macros.d now...
cat > %{buildroot}%{_sysconfdir}/%{name}/macros <<EOF
# Put your own system macros here
# usually contains
# Set this one according your locales
# %%_install_langs
EOF
# FIXME: weird issue, seems to have issue with lines starting with '%%_'...
cat > %{buildroot}%{_sysconfdir}/%{name}/premacros.d/cpuinfo_target.macros <<EOF
# This sets which of the available architectures to prefer when building
# packages with libcpuinfo support enabled.
%%_prefer_target_cpu x86_64 i586
EOF
# Get rid of unpackaged files
# XXX: is there any of these we might want to keep?
for f in %{py_platsitedir}/poptmodule.a %{py_platsitedir}/rpmmodule.a \
%{py_platsitedir}/rpm/*.a %{_rpmhome}/*.a %{_rpmhome}/lib/*.a\
%{_rpmhome}/{Specfile.pm,cpanflute2,cpanflute,sql.prov,sql.req,tcl.req} \
%{_rpmhome}/{config.site,cross-build,rpmdiff.cgi} \
%{_rpmhome}/trpm %{_bindir}/rpmdiff; do
rm -f %{buildroot}$f
done
%find_lang %{name}
mkdir -p %{buildroot}/var/lib/rpm/{log,tmp}
for dbi in `./rpm --macros macros/macros --eval %_dbi_tags_4|tr : ' '` __db.00{0..9}; do
touch %{buildroot}/var/lib/rpm/$dbi
echo "%attr(0644, root, root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_localstatedir}/lib/rpm/$dbi" >> %{name}.lang
done
install -d %{buildroot}/bin
# FIXME: considering that most libraries dynamically linked against is located
# in /usr/lib*, this doesn't make much sense unless we either statically link
# against them (Ark Linux actually does this) or move the libraries to /lib*,
# neither being very attractive options, not to mention maintenance headaches
# spread across these library packages...
# So moving rpm back to /usr/bin probably makes the most sense...
# An optional, "minimal" rpm-static package with /bin/rpm could perhaps be done
# if anyone expresses actual interest in this...
mv %{buildroot}%{_bindir}/rpm %{buildroot}/bin/rpm
cp -r cpu-os-macros %{buildroot}%{_usrlibrpm}/platform
install -m644 %{SOURCE6} -D %{buildroot}%{_sysconfdir}/%{name}/macros.d/autosetup.macros
%if %{with docs}
install -d %{buildroot}%{_docdir}/rpm
cp -r apidocs/html %{buildroot}%{_docdir}/rpm
%endif
install -d %{buildroot}%{multiarch_bindir}
install -d %{buildroot}%{multiarch_includedir}
%if "%{_lib}" == "lib64"
install -d %{buildroot}%(linux32 rpm -E %%{multiarch_bindir})
install -d %{buildroot}%(linux32 rpm -E %%{multiarch_includedir})
%endif
# should really be handled by make script..
ln -f %{buildroot}%{_rpmhome}/bin/{rpmlua,lua}
ln -f %{buildroot}%{_rpmhome}/bin/{rpmluac,luac}