[Momonga-devel.ja:00180] Re: add some conditionals to rpm.spec
- From: KOMATSU Shinichiro <koma2@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 24 Jul 2002 05:00:36 +0900
こまつ@おおばか
> patch を添付しますので、よろしければ当てておいていただけませんか?
添付するのを忘れてました。。。
--
---------------------------------------
東京大学大学院総合文化研究科
広域科学専攻相関基礎科学系
佐々研究室 博士3年
小松 晋一朗
mailto:koma2@xxxxxxxxxxxxxxxxxxxx
http://kamuy.c.u-tokyo.ac.jp/~koma2/
---------------------------------------
--- rpm.spec.orig Fri Jul 12 21:19:13 2002
+++ rpm.spec Wed Jul 24 04:40:58 2002
@@ -1,4 +1,18 @@
+%{!?with_python_subpackage: %define with_python_subpackage 1}
+%{!?with_perl_subpackage: %define with_perl_subpackage 1}
+%{!?with_apidocs: %define with_apidocs 1}
+%{!?with_internal_db: %define with_internal_db 1}
+
%define buildpython2 0
+
+%if %buildpython2
+%define python_name python
+%define python_version 2.2
+%else
+%define python_name python1
+%define python_version 1.5.2
+%endif
+
# XXX enable at your own risk, CDB access to rpmdb isn't cooked yet.
%define enable_cdb create cdb
@@ -11,7 +25,7 @@
Summary: The Red Hat package management system.
Name: rpm
Version: 4.0.4
-Release: 30m
+Release: 31m
Group: System Environment/Base
URL: http://www.rpm.org/
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{version}.tar.gz
@@ -49,12 +63,12 @@
BuildRequires: zlib-devel
# XXX Red Hat 5.2 has not bzip2 or python
BuildRequires: bzip2 >= 0.9.0c-2
-%if %{buildpython2}
-BuildRequires: python-devel = 2.2
-%else
-BuildRequires: python1-devel = 1.5.2
+%if %{with_python_subpackage}
+BuildRequires: %{python_name}-devel = %{python_version}
%endif
+%if %{with_perl_subpackage}
BuildRequires: perl = 1:5.6.1
+%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -91,16 +105,13 @@
This package contains scripts and executable programs that are used to
build packages using RPM.
+%if %{with_python_subpackage}
%package python
Summary: Python bindings for apps which will manipulate RPM packages.
Group: Development/Libraries
Requires: rpm = %{version}-%{release}
Requires: popt >= 1.6.4-%{release}
-%if %{buildpython2}
-Requires: python = 2.2
-%else
-Requires: python1 = 1.5.2
-%endif
+Requires: %{python_name} = %{python_version}
%description python
The rpm-python package contains a module which permits applications
@@ -109,7 +120,9 @@
This package should be installed if you want to develop Python
programs that will manipulate RPM packages and databases.
+%endif
+%if %{with_perl_subpackage}
%package perl
Summary: Native bindings to the RPM API for Perl.
Group: Development/Languages
@@ -137,6 +150,7 @@
is not yet installed. Error management and the export of most defined
constants, through RPM::Error and RPM::Constants, respectively, are
also available.
+%endif
%package -n popt
Summary: A C library for parsing command line parameters.
@@ -183,11 +197,18 @@
%patch122 -p1
%build
+
+%if %{with_python_subpackage}
+%define confarg_python --withi-python
+%else
+%define confarg_python --without-python
+%endif
+
aclocal-old
automake-old -c -a
autoconf-old
%ifos linux
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir='/usr/share/info' --mandir='/usr/share/man'
+CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir='/usr/share/info' --mandir='/usr/share/man' %{confarg_python}
%else
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr
%endif
@@ -199,12 +220,14 @@
make
+%if %{with_perl_subpackage}
{ cd Perl-RPM
PATH="%{_builddir}/%{buildsubdir}:$PATH" CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL
export SUBDIR="%{_builddir}/%{buildsubdir}"
make INC="-I. -I$SUBDIR/lib -I$SUBDIR/rpmdb -I$SUBDIR/rpmio -I$SUBDIR/popt" \
LDDLFLAGS="-shared -L$SUBDIR/lib/.libs -L$SUBDIR/rpmdb/.libs -L$SUBDIR/rpmio/.libs -L$SUBDIR/popt/.libs" %{?_smp_mflags}
}
+%endif
%install
rm -rf $RPM_BUILD_ROOT
@@ -241,8 +264,11 @@
%endif
+%if %{with_apidocs}
bzip2 apidocs/man/man*/* || :
+%endif
+%if %{with_perl_subpackage}
{ cd Perl-RPM
eval `perl '-V:installsitearch'`
eval `perl '-V:installarchlib'`
@@ -255,6 +281,7 @@
rm -f $RPM_BUILD_ROOT/$installsitearch/auto/RPM/.packlist
cd ..
}
+%endif
{ cd $RPM_BUILD_ROOT
%{__strip} ./bin/rpm
@@ -326,8 +353,10 @@
%postun -n popt -p /sbin/ldconfig
%endif
+%if %{with_python_subpackage}
%post python -p /sbin/ldconfig
%postun python -p /sbin/ldconfig
+%endif
%define rpmattr %attr(0755, rpm, rpm)
@@ -491,11 +520,14 @@
%{__prefix}%{__share}/man/man8/rpmbuild.8*
+%if %{with_python_subpackage}
%files python
%defattr(-,root,root)
%{__prefix}/lib/python*/site-packages/rpmmodule.so
#%{__prefix}/lib/python2.2/site-packages/poptmodule.so
+%endif
+%if %{with_perl_subpackage}
%files perl
%defattr(-,root,root)
%rpmattr %{__prefix}/bin/rpmprune
@@ -504,10 +536,13 @@
%{perl_sitearch}/RPM.pm
%{__prefix}%{__share}/man/man1/rpmprune.1*
%{__prefix}%{__share}/man/man3/RPM*
+%endif
%files devel
%defattr(-,root,root)
+%if %{with_apidocs}
%doc apidocs
+%endif
%{__prefix}/include/rpm
%{__prefix}/lib/librpm.a
%{__prefix}/lib/librpm.la
@@ -551,6 +586,12 @@
%{_includedir}/popt.h
%changelog
+* Tue Jul 23 2002 KOMATSU Shinichiro <koma2@xxxxxxxxxxxxxxxxxxxx>
+- (4.0.4-31m)
+- add conditionals
+ (%%with_python_subpackage, %%with_perl_subpackage,
+ %%with_apidocs, %%with_internal_db)
+
* Wed Jul 10 2002 Kenta MURATA <muraken2@xxxxxxxxx>
- (4.0.4-29m)
- change distribution.