diff --git a/README.md b/README.md index 1ceff21..38e3830 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # mozldap +The Mozilla LDAP C SDK is a set of libraries that allow applications to communicate with LDAP directory servers. These libraries are derived from the University of Michigan and Netscape LDAP libraries. They use Mozilla NSPR and NSS for crypto. + diff --git a/fix_headers.sh b/fix_headers.sh new file mode 100644 index 0000000..403bab6 --- /dev/null +++ b/fix_headers.sh @@ -0,0 +1,82 @@ +#!/bin/sh -euf +# -*- mode: Ksh; tab-width: 8; fill-column: 70; -*- +# $Id: fix_headers.sh,v 0.0.1 2006/04/05 15:39:57 legion Exp $ + +PROG="${0##*/}" + +usage() { + [ "$1" = 0 ] || exec >&2 + cat < + +include_dir - system includes location +project_include_dir - project includes + +Examle: +$PROG '/usr/include' '/var/tmp/firefox-buildroot/usr/include/firefox' + +EOF + [ -n "$1" ] && exit "$1" || exit +} + +msg() { + printf %s\\n "$@" +} + +err() { + msg "Error: $@" >&2 +} + +find_header() { + local path="$1" && shift + local fn="$1" && shift + while [ -n "$path" ]; do + [ -f "$path/$fn" ] && break + path="${path%/*}" + done + [ -f "$path/$fn" ] && msg "$path/$fn" || return 1 +} + +[ "$#" -eq 2 ] || usage 1 +include_dir="$(readlink -ve "$1")" && shift +indir="$(readlink -ve "$1")" && shift + +exclude_list= +indir="$indir/" +for p in nss nspr mozldap; do + [ "$indir" != "${indir#*/$p/}" ] || exclude_list="$exclude_list $p" +done +indir="${indir%/}" + +find "$indir/" -name '*.h' | +while read h; do + sed -ne 's|^[[:space:]]*#[[:space:]]*include[[:space:]]\+"\([^"]\+\)".*$|\1|p' -- "$h" | sort -u | + while read ih; do + ih_name="${ih##*/}" + eh="$(find "$include_dir" -name "$ih_name")" || err "$h: '$ih'" + if [ -z "$eh" ]; then + if ! eh="$(find_header "${h%/*}" "$ih")"; then + eh="$(find "$indir/" -name "$ih_name")" || err "$h: '$ih'" + [ "$(printf %s\\n "$eh" |wc -l)" = "1" ] || { err "$h: '$(msg "$eh" |tr \\n \ )'"; continue; } + fi + if [ -z "$eh" ]; then + err "not found: $h: '$ih'" + continue + fi + subst "s%^\([[:space:]]*#[[:space:]]*include\)[[:space:]]\+\"$ih\"%\1 <${eh#*$include_dir/}>%" -- "$h" || + err "$h" + continue + fi + nh="${eh#$include_dir/}" + + for p in $exclude_list; do + nh="${nh#*$p/}" + done + + subst "s%^\([[:space:]]*#[[:space:]]*include\)[[:space:]]\+\"$ih\"%\1 <$nh>%" -- "$h" || + err "$h: 's%^\([[:space:]]*#[[:space:]]*include\)[[:space:]]\+\"$ih\"%\1 <$nh>%'" + done +done diff --git a/mozldap.spec b/mozldap.spec new file mode 100644 index 0000000..7243c7f --- /dev/null +++ b/mozldap.spec @@ -0,0 +1,164 @@ +%define major %(echo %version | cut -d. -f -1) +%define minor %(echo %version | cut -d. -f 2-2) +%define submin %(echo %version | cut -d. -f 3-) +%define libsuffix %{major}0 + +Name: mozldap +Version: 6.0.6 +Release: 1mamba +Summary: Mozilla LDAP C SDK +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: gil +URL: https://wiki.mozilla.org/LDAP_C_SDK +Source0: ftp://ftp.mozilla.org/pub/mozilla.org/directory/c-sdk/releases/v%{version}/src/mozldap-%{version}.tar.gz +Source1: fix_headers.sh +License: GPL,MPL 1.1,LGPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libgcc +BuildRequires: libnspr-devel +BuildRequires: libnss-devel +BuildRequires: libsasl-devel +BuildRequires: libstdc++6-devel +BuildRequires: libsvrcore-devel +## AUTOBUILDREQ-END +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +The Mozilla LDAP C SDK is a set of libraries that allow applications to communicate with LDAP directory servers. These libraries are derived from the University of Michigan and Netscape LDAP libraries. They use Mozilla NSPR and NSS for crypto. + +%package devel +Group: Development/Libraries +Summary: Development libraries and examples for Mozilla LDAP C SDK +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +The Mozilla LDAP C SDK is a set of libraries that allow applications to communicate with LDAP directory servers. + +This package contains static libraries and header files need for development. + +%package tools +Group: Development/Tools +Summary: Tools for the Mozilla LDAP C SDK +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description tools +The Mozilla LDAP C SDK is a set of libraries that allow applications to communicate with LDAP directory servers. + +This package provides the ldapsearch, ldapmodify, and ldapdelete tools that use the Mozilla LDAP C SDK libraries. + +%prep +%setup -q + +%build + +cd mozilla/directory/c-sdk + +%configure \ + --with-sasl \ + --enable-clu \ + --with-system-nss \ + --with-system-nspr \ + --with-system-svrcore \ + --with-pthreads \ + --enable-strip \ + --enable-optimize="%{optflags}" \ + --enable-mdupdate \ + --disable-debug + +#ifarch x86_64 +# --enable-64bit \ +#endif + +# Enable compiler optimizations and disable debugging code +export BUILD_OPT=1 +# Generate symbolic info for debuggers +export XCFLAGS="%{optflags} $(pkg-config --cflags-only-I nss) $(pkg-config --cflags-only-I nspr)" +export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 +export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 + +make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +mkdir -p %{buildroot}%{_exec_prefix}/lib/pkgconfig + +sed \ + -e "s,%%bindir%%,%{_libdir}/mozldap,g" \ + -e "s,%%libdir%%,%{_libdir},g" \ + -e "s,%%prefix%%,%{_prefix},g" \ + -e "s,%%exec_prefix%%,%{_prefix},g" \ + -e "s,%%includedir%%,%{_includedir}/mozldap,g" \ + -e "s,%%major%%,%{major},g" \ + -e "s,%%minor%%,%{minor},g" \ + -e "s,%%submin%%,%{submin},g" \ + -e "s,%%libsuffix%%,%{libsuffix},g" \ + -e "s,%%NSPR_VERSION%%,$(pkg-config --modversion nspr),g" \ + -e "s,%%NSS_VERSION%%,$(pkg-config --modversion nss),g" \ + -e "s,%%MOZLDAP_VERSION%%,%{version},g" \ + mozilla/directory/c-sdk/mozldap.pc.in > \ + %{buildroot}%{_exec_prefix}/lib/pkgconfig/mozldap.pc + +mkdir -p %{buildroot}%{_includedir}/mozldap +mkdir -p %{buildroot}%{_libdir}/mozldap +mkdir -p %{buildroot}%{_datadir}/mozldap/etc + + +for filel in mozilla/dist/lib/*.so ; do + install -m 755 $filel %{buildroot}%{_libdir}/ +done + +for fileb in mozilla/dist/bin/ldap* ; do + install -m 755 $fileb %{buildroot}%{_libdir}/mozldap +done + +for fileh in mozilla/dist/public/ldap/*.h ; do + install -pm 644 $fileh %{buildroot}%{_includedir}/mozldap +done + +cp -r mozilla/directory/c-sdk/ldap/examples %{buildroot}%{_datadir}/mozldap + +install -m 644 mozilla/directory/c-sdk/ldap/examples/xmplflt.conf \ + %{buildroot}%{_datadir}/mozldap/etc + +install -m 644 mozilla/directory/c-sdk/ldap/libraries/libldap/ldap{searchprefs,templates,filter}.conf \ + %{buildroot}%{_datadir}/mozldap/etc + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_libdir}/libldap%{libsuffix}.so +%{_libdir}/libldif%{libsuffix}.so +%{_libdir}/libprldap%{libsuffix}.so +%{_libdir}/libssldap%{libsuffix}.so +%doc mozilla/directory/c-sdk/README.rpm + +%files devel +%defattr(-,root,root) +%dir %{_includedir}/mozldap +%{_includedir}/mozldap/*.h +%{_datadir}/mozldap +%{_exec_prefix}/lib/pkgconfig/mozldap.pc + +%files tools +%defattr(-,root,root) +%dir %{_libdir}/mozldap +%{_libdir}/mozldap/ldapcmp +%{_libdir}/mozldap/ldapcompare +%{_libdir}/mozldap/ldapdelete +%{_libdir}/mozldap/ldapmodify +%{_libdir}/mozldap/ldappasswd +%{_libdir}/mozldap/ldapsearch + +%changelog +* Mon Dec 21 2009 gil 6.0.6-1mamba +- package created by autospec