Description: Clean up spec file for RPM build
Fix Description: Make the spec files use the conventions used by the Fedora/Red Hat packaging system
This commit is contained in:
richm%stanfordalumni.org 2006-05-11 14:51:02 +00:00
Родитель adeeba1cb8
Коммит d105e63963
3 изменённых файлов: 319 добавлений и 54 удалений

Просмотреть файл

@ -1,8 +1,11 @@
%define nspr_version 4.6
%define nss_version 3.11
%define nspr_name nspr
%define nspr_version 4.6
%define nss_name nss
%define nss_version 3.11
%define svrcore_name svrcore-devel
%define svrcore_version 4.0.1
%define major 5
%define minor 17
%define major 5
%define minor 17
Summary: Mozilla LDAP C SDK
Name: mozldap
@ -11,11 +14,12 @@ Release: 3
License: MPL/GPL/LGPL
URL: http://www.mozilla.org/directory/csdk.html
Group: System Environment/Libraries
Requires: nspr >= %{nspr_version}, nss >= %{nss_version}
Requires: %{nspr_name} >= %{nspr_version}
Requires: %{nss_name} >= %{nss_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: nspr-devel >= %{nspr_version}, nss-devel >= %{nss_version}, svrcore-devel >= %{svrcore_version}
BuildRequires: pkgconfig
BuildRequires: gawk
BuildRequires: %{nspr_name}-devel >= %{nspr_version}
BuildRequires: %{nss_name}-devel >= %{nss_version}
BuildRequires: %{svrcore_name} >= %{svrcore_version}
Provides: mozldap
Source0: %{name}-%{version}.tar.gz
@ -31,9 +35,11 @@ NSPR and NSS for crypto.
%package tools
Summary: Tools for the Mozilla LDAP C SDK
Group: System Environment/Base
Requires: mozldap = %{version}-%{release}
BuildRequires: nspr-devel >= %{nspr_version}, nss-devel >= %{nss_version}, svrcore-devel >= %{svrcore_version}
Provides: mozldap-tools
Requires: %{name} >= %{version}-%{release}
BuildRequires: %{nspr_name}-devel >= %{nspr_version}
BuildRequires: %{nss_name}-devel >= %{nss_version}
BuildRequires: %{svrcore_name} >= %{svrcore_version}
Provides: %{name}-tools
%description tools
The mozldap-tools package provides the ldapsearch,
@ -44,9 +50,10 @@ Mozilla LDAP C SDK libraries.
%package devel
Summary: Development libraries and examples for Mozilla LDAP C SDK
Group: Development/Libraries
Requires: mozldap = %{version}-%{release}
Requires: nspr-devel >= %{nspr_version}, nss-devel >= %{nss_version}
Provides: mozldap-devel
Requires: %{name} >= %{version}-%{release}
Requires: %{nspr_name}-devel >= %{nspr_version}
Requires: %{nss_name}-devel >= %{nss_version}
Provides: %{name}-devel
%description devel
Header and Library files for doing development with the Mozilla LDAP C SDK
@ -57,7 +64,7 @@ Header and Library files for doing development with the Mozilla LDAP C SDK
arg64="--enable-64bit"
%endif
cd mozilla/directory/c-sdk
./configure $arg64 --with-nss --with-system-svrcore --enable-optimize --disable-debug
./configure $arg64 --with-system-svrcore --enable-optimize --disable-debug
%build
@ -85,23 +92,23 @@ make BUILDCLU=1 HAVE_SVRCORE=1 BUILD_OPT=1
# Set up our package file
%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
%{__cat} mozldap.pc.in | sed -e "s,%%libdir%%,%{_libdir},g" \
%{__cat} %{name}.pc.in | sed -e "s,%%libdir%%,%{_libdir},g" \
-e "s,%%prefix%%,%{_prefix},g" \
-e "s,%%exec_prefix%%,%{_prefix},g" \
-e "s,%%includedir%%,%{_includedir}/mozldap,g" \
-e "s,%%includedir%%,%{_includedir}/%{name},g" \
-e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
-e "s,%%NSS_VERSION%%,%{nss_version},g" \
-e "s,%%SVRCORE_VERSION%%,%{svrcore_version},g" \
-e "s,%%MOZLDAP_VERSION%%,%{version},g" > \
$RPM_BUILD_ROOT/%{_libdir}/pkgconfig/mozldap.pc
$RPM_BUILD_ROOT/%{_libdir}/pkgconfig/%{name}.pc
%install
# There is no make install target so we'll do it ourselves.
%{__mkdir_p} $RPM_BUILD_ROOT/%{_includedir}/mozldap
%{__mkdir_p} $RPM_BUILD_ROOT/%{_includedir}/%{name}
%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}
%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/mozldap
%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/%{name}
# Copy the binary libraries we want
for file in libssldap50.so libprldap50.so libldap50.so
@ -112,31 +119,31 @@ done
# Copy the binaries we want
for file in ldapsearch ldapmodify ldapdelete ldapcmp ldapcompare
do
%{__install} -m 755 mozilla/dist/bin/$file $RPM_BUILD_ROOT/%{_libdir}/mozldap
%{__install} -m 755 mozilla/dist/bin/$file $RPM_BUILD_ROOT/%{_libdir}/%{name}
done
# Copy the include files
for file in mozilla/dist/public/ldap/*.h
do
%{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}/mozldap
%{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}/%{name}
done
# Copy the developer files
%{__mkdir_p} $RPM_BUILD_ROOT/usr/share/mozldap
cp -r mozilla/directory/c-sdk/ldap/examples $RPM_BUILD_ROOT/usr/share/mozldap
%{__mkdir_p} $RPM_BUILD_ROOT/usr/share/mozldap/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/examples/xmplflt.conf $RPM_BUILD_ROOT/usr/share/mozldap/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/libraries/libldap/ldaptemplates.conf $RPM_BUILD_ROOT/usr/share/mozldap/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfilter.conf $RPM_BUILD_ROOT/usr/share/mozldap/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/libraries/libldap/ldapsearchprefs.conf $RPM_BUILD_ROOT/usr/share/mozldap/etc
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -r mozilla/directory/c-sdk/ldap/examples $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/examples/xmplflt.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/libraries/libldap/ldaptemplates.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/libraries/libldap/ldapfilter.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 mozilla/directory/c-sdk/ldap/libraries/libldap/ldapsearchprefs.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
# Rename the libraries and create the symlinks
cd $RPM_BUILD_ROOT/%{_libdir}
for file in libssldap50.so libprldap50.so libldap50.so
do
mv $file $file.${major}.${minor}
ln -s $file.${major}.%{minor} $file.${major}
ln -s $file.${major} $file
mv $file $file.%{major}.%{minor}
ln -s $file.%{major}.%{minor} $file.%{major}
ln -s $file.%{major} $file
done
%clean
@ -165,19 +172,29 @@ done
%files tools
%defattr(0755,root,root)
%{_libdir}/mozldap/ldapsearch
%{_libdir}/mozldap/ldapmodify
%{_libdir}/mozldap/ldapdelete
%{_libdir}/mozldap/ldapcmp
%{_libdir}/mozldap/ldapcompare
%attr(0755,root,root) %dir %{_libdir}/%{name}
%{_libdir}/%{name}/ldapsearch
%{_libdir}/%{name}/ldapmodify
%{_libdir}/%{name}/ldapdelete
%{_libdir}/%{name}/ldapcmp
%{_libdir}/%{name}/ldapcompare
%files devel
%defattr(0644,root,root)
%{_libdir}/pkgconfig/mozldap.pc
%{_includedir}/mozldap
/usr/share/mozldap
%{_libdir}/pkgconfig/%{name}.pc
%attr(0755,root,root) %dir %{_includedir}/%{name}
%{_includedir}/%{name}
%attr(0755,root,root) %dir %{_datadir}/%{name}
%attr(0755,root,root) %dir %{_datadir}/%{name}/etc
%attr(0755,root,root) %dir %{_datadir}/%{name}/examples
%{_datadir}/%{name}
%changelog
* Tue Apr 18 2006 Richard Megginson <richm@stanforalumni.org> - 5.17-3
- make more Fedora Core friendly - move each requires and buildrequires to a separate line
- remove --with-nss since svrcore implies it; fix some macro errors; macro-ize nspr and nss names
- fix directory attrs in devel package
* Tue Jan 31 2006 Rich Megginson <rmeggins@redhat.com> - 5.17-2
- use --with-system-svrcore to configure

Просмотреть файл

@ -0,0 +1,249 @@
#!/bin/sh
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Netscape svrcore library.
#
# The Initial Developer of the Original Code is
# Red Hat
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Rich Megginson <richm@stanfordalumni.org>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# This script can be used to build the svrcore-devel rpm and srpm. It assumes
# you begin with nothing but this script. You must have nspr, nspr-devel,
# nss, and nss-devel installed on your system in order to run this script. Not
# only will the script check, but the rpmbuild will also check and bomb out if
# those dependencies are not present. The script allows you to build the rpm
# as a non root user and puts the build files under the current directory. This
# script does not install the rpm.
#
# You may need to edit this script to change:
# the versions of nspr and nss used
# the CVS tag for pulling svrcore
# the svrcore version and release - these should match the spec file
# Always switch into the base directory of this
# shell script prior to executing it so that all
# of its output is written to this directory
cd `dirname $0`
# This script may ONLY be run on Linux!
OS=`uname`
if [ ${OS} != "Linux" ]; then
echo "The '$0' script is ONLY executable on a 'Linux' machine!"
exit 255
fi
# This script may ONLY be executed on either
# an 'i386' platform or an 'x86_64' platform!
PLATFORM=`uname -i`
if [ ${PLATFORM} = "i386" ]; then
# define NSS variables unique to this script
BITSIZE=32-bit
NSPR_BUILDTIME_DEPENDENCY="nspr-4.6-1.i386"
NSPR_DEVEL_BUILDTIME_DEPENDENCY="nspr-devel-4.6-1.i386"
NSS_BUILDTIME_DEPENDENCY="nss-3.11-1.i386"
NSS_DEVEL_BUILDTIME_DEPENDENCY="nss-devel-3.11-1.i386"
elif [ ${PLATFORM} = "x86_64" ]; then
# define NSS variables unique to this script
BITSIZE=64-bit
NSPR_BUILDTIME_DEPENDENCY="nspr-4.6-1.x86_64"
NSPR_DEVEL_BUILDTIME_DEPENDENCY="nspr-devel-4.6-1.x86_64"
NSS_BUILDTIME_DEPENDENCY="nss-3.11-1.x86_64"
NSS_DEVEL_BUILDTIME_DEPENDENCY="nss-devel-3.11-1.x86_64"
else
echo "The '$0' script is ONLY executable on either"
echo "an 'i386' platform or an 'x86_64' platform!"
exit 255
fi
# initialize environment variables for this script
unset LD_LIBRARY_PATH
CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
export CVSROOT
# Check Build Requirements:
#
# This script requires that the associated ${BITSIZE} NSPR
# packages are installed on the system PRIOR to execution!
#
echo "Checking that ALL ${BITSIZE} Buildtime Dependencies are present . . ."
BUILDTIME_DEPENDENCIES=0
TOTAL_BUILDTIME_DEPENDENCIES=4
RPM_PRESENCE=`rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' ${NSPR_BUILDTIME_DEPENDENCY}`
if [ "${RPM_PRESENCE}" != "${NSPR_BUILDTIME_DEPENDENCY}" ]; then
echo " Missing '${NSPR_BUILDTIME_DEPENDENCY}'!"
else
echo " Found '${NSPR_BUILDTIME_DEPENDENCY}'!"
BUILDTIME_DEPENDENCIES=`expr ${BUILDTIME_DEPENDENCIES} + 1`
fi
RPM_PRESENCE=`rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' ${NSPR_DEVEL_BUILDTIME_DEPENDENCY}`
if [ "${RPM_PRESENCE}" != "${NSPR_DEVEL_BUILDTIME_DEPENDENCY}" ]; then
echo " Missing '${NSPR_DEVEL_BUILDTIME_DEPENDENCY}'!"
else
echo " Found '${NSPR_DEVEL_BUILDTIME_DEPENDENCY}'!"
BUILDTIME_DEPENDENCIES=`expr ${BUILDTIME_DEPENDENCIES} + 1`
fi
RPM_PRESENCE=`rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' ${NSS_BUILDTIME_DEPENDENCY}`
if [ "${RPM_PRESENCE}" != "${NSS_BUILDTIME_DEPENDENCY}" ]; then
echo " Missing '${NSS_BUILDTIME_DEPENDENCY}'!"
else
echo " Found '${NSS_BUILDTIME_DEPENDENCY}'!"
BUILDTIME_DEPENDENCIES=`expr ${BUILDTIME_DEPENDENCIES} + 1`
fi
RPM_PRESENCE=`rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' ${NSS_DEVEL_BUILDTIME_DEPENDENCY}`
if [ "${RPM_PRESENCE}" != "${NSS_DEVEL_BUILDTIME_DEPENDENCY}" ]; then
echo " Missing '${NSS_DEVEL_BUILDTIME_DEPENDENCY}'!"
else
echo " Found '${NSS_DEVEL_BUILDTIME_DEPENDENCY}'!"
BUILDTIME_DEPENDENCIES=`expr ${BUILDTIME_DEPENDENCIES} + 1`
fi
if [ ${BUILDTIME_DEPENDENCIES} -ne ${TOTAL_BUILDTIME_DEPENDENCIES} ]; then
echo "Install ALL of the missing ${BITSIZE} Buildtime Dependencies before preceding!"
exit 255
fi
echo "Finished."
# define the remaining variables
PACKAGE=svrcore-devel
VERSION=4.0.1
RELEASE=3
SVRCORE_TAG=SVRCORE_4_0_1_RTM
SVRCORE_CORECONF_TAG=$SVRCORE_TAG
PRJ=${PACKAGE}-${VERSION}
RPM_HOME=`pwd`
SPEC_FILENAME=${PACKAGE}.spec
# define subroutines for this script
usage() {
echo
echo "Usage: $0"
echo
}
mkdirs() {
for d in "$@" ; do
if [ -d $d ]; then
mv $d $d.deleted
rm -rf $d.deleted &
fi
mkdir -p $d
done
}
# check the number of arguments supplied to this script
if [ $# -ne 0 ] ; then
usage
exit 255
fi
# remove any old RPM directories
echo "Removing any old RPM directories . . ."
if [ -d ${RPM_HOME}/BUILD ]; then
rm -rf ${RPM_HOME}/BUILD
fi
if [ -d ${RPM_HOME}/SOURCES ]; then
rm -rf ${RPM_HOME}/SOURCES
fi
if [ -d ${RPM_HOME}/SPECS ]; then
rm -rf ${RPM_HOME}/SPECS
fi
echo "Finished."
echo "Changing current working directory to ${RPM_HOME}."
cd ${RPM_HOME}
# create new RPM directories
echo "Creating new RPM directories . . ."
mkdirs BUILD
if [ ! -d ${RPM_HOME}/RPMS ]; then
mkdirs ${RPM_HOME}/RPMS
fi
if [ ! -d ${RPM_HOME}/SGTARS ]; then
mkdirs ${RPM_HOME}/SGTARS
fi
mkdirs SOURCES SPECS
if [ ! -d ${RPM_HOME}/SRPMS ]; then
mkdirs ${RPM_HOME}/SRPMS
fi
echo "Finished."
# check out SVRCORE CORECONF code
echo "Checking out SVRCORE CORECONF source code . . ."
cvs -z3 -Q export -r ${SVRCORE_CORECONF_TAG} -d ${PRJ} -N mozilla/security/coreconf
echo "Finished."
# check out SVRCORE code
echo "Checking out SVRCORE source code . . ."
cvs -z3 -Q export -r ${SVRCORE_TAG} -d ${PRJ} -N mozilla/security/svrcore
echo "Finished."
# create a tarball from the checked out code
echo "Creating tarball of SVRCORE source code . . ."
tar cf - ${PRJ} | gzip > SOURCES/${PRJ}.tar.gz
echo "Finished."
# remove the checked out code
echo "Removing checked out SVRCORE source code . . ."
rm -rf ${PRJ}
echo "Finished."
# copy spec file
cp ${SPEC_FILENAME} SPECS/${SPEC_FILENAME}
# copy the SVRCORE source file template
cp ${SVRCORE_TEMPLATE} SOURCES/${SVRCORE_TEMPLATE}
# build the ${BITSIZE} RPM and Source RPM
echo "Executing ${BITSIZE} rpmbuild of ${SPEC_FILENAME} file . . . "
if [ ! -f SRPMS/${PACKAGE}-${VERSION}-${RELEASE}.src.rpm ]; then
rpmbuild --define="_topdir ${RPM_HOME}" --target ${PLATFORM} -ba --clean --rmsource --rmspec SPECS/${SPEC_FILENAME}
else
rpmbuild --define="_topdir ${RPM_HOME}" --target ${PLATFORM} -bb --clean --rmsource --rmspec SPECS/${SPEC_FILENAME}
fi
echo "Finished doing ${BITSIZE} rpmbuild of ${SPEC_FILENAME} file."
echo "Removing BUILD directory . . ."
if [ -d ${RPM_HOME}/BUILD ]; then
rm -rf ${RPM_HOME}/BUILD
fi
echo "Finished."
echo "Removing SOURCES directory . . ."
if [ -d ${RPM_HOME}/SOURCES ]; then
rm -rf ${RPM_HOME}/SOURCES
fi
echo "Finished."
echo "Removing SPECS directory . . ."
if [ -d ${RPM_HOME}/SPECS ]; then
rm -rf ${RPM_HOME}/SPECS
fi
echo "Finished."

Просмотреть файл

@ -4,14 +4,15 @@
Summary: Svrcore - development files for secure PIN handling using NSS crypto
Name: svrcore-devel
Version: 4.0.1
Release: 2
Release: 3
License: MPL/GPL/LGPL
URL: http://www.mozilla.org/projects/security/pki/
Group: Development/Libraries
Requires: nspr-devel >= %{nspr_version}, nss-devel >= %{nss_version}
Requires: nspr-devel >= %{nspr_version}
Requires: nss-devel >= %{nss_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: nspr-devel >= %{nspr_version}, nss-devel >= %{nss_version}
BuildRequires: pkgconfig
BuildRequires: nspr-devel >= %{nspr_version}
BuildRequires: nss-devel >= %{nss_version}
BuildRequires: gawk
Provides: svrcore-devel
@ -38,21 +39,16 @@ export BUILD_OPT
XCFLAGS=$RPM_OPT_FLAGS
export XCFLAGS
#export NSPR_INCLUDE_DIR=`nspr-config --includedir`
#export NSPR_LIB_DIR=`nspr-config --libdir`
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
export PKG_CONFIG_ALLOW_SYSTEM_LIBS
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nspr | sed 's/-I//'`
NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --variable=includedir nspr`
export NSPR_INCLUDE_DIR
NSS_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nss | sed 's/-I//'`
NSS_INCLUDE_DIR=`/usr/bin/pkg-config --variable=includedir nss`
export NSS_INCLUDE_DIR
%ifarch x86_64 ppc64 ia64 s390x
@ -71,11 +67,11 @@ make EXPORTS="" RELEASE="" REQUIRES="" MODULE="" IMPORTS="" OBJDIR=. INSTALL=tru
%{__cat} svrcore.pc.in | sed -e "s,%%libdir%%,%{_libdir},g" \
-e "s,%%prefix%%,%{_prefix},g" \
-e "s,%%exec_prefix%%,%{_prefix},g" \
-e "s,%%includedir%%,%{_includedir}/nss3,g" \
-e "s,%%includedir%%,%{_includedir},g" \
-e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
-e "s,%%NSS_VERSION%%,%{nss_version},g" \
-e "s,%%SVRCORE_VERSION%%,%{version},g" > \
$RPM_BUILD_ROOT/%{_libdir}/pkgconfig/svrcore.pc
$RPM_BUILD_ROOT/%{_libdir}/pkgconfig/%{name}.pc
%install
@ -103,11 +99,14 @@ done
%files
%defattr(0644,root,root)
%{_libdir}/pkgconfig/svrcore.pc
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/libsvrcore.a
%{_includedir}/svrcore.h
%changelog
* Tue Apr 18 2006 Rich Megginson <rmeggins@redhat.com> - 4.0.1-3
- Use pkg-config --variable=includedir to get include dirs
* Wed Feb 1 2006 Rich <rmeggins@redhat.com> - 4.0.1-2
- Requires nss version was wrong