--- curl.spec.ORIG	2010-06-30 11:51:06.000000000 +0200
+++ curl-openssl.spec	2011-05-20 22:37:19.000000000 +0200
@@ -1,10 +1,17 @@
+# Relocate all the files to /opt/curl-openssl.
+%global _prefix /opt/curl-openssl
+# Intresting _mandir is hardcoded to /usr/share/man and
+# not %%_prefix/share/man - that's a bug.
+%global _mandir %{_prefix}/share/man
+
+
 Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
-Name: curl
+Name: curl-openssl
 Version: 7.19.7
-Release: 16%{?dist}
+Release: 17%{?dist}
 License: MIT
 Group: Applications/Internet
-Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma
+Source: http://curl.haxx.se/download/curl-%{version}.tar.lzma
 Source2: curlbuild.h
 Patch1: curl-7.19.7-modelfree.patch
 Patch2: curl-7.19.7-ssl-retry.patch
@@ -33,7 +40,7 @@
 BuildRequires: krb5-devel
 BuildRequires: libidn-devel
 BuildRequires: libssh2-devel >= 1.2
-BuildRequires: nss-devel
+BuildRequires: openssl-devel
 BuildRequires: openldap-devel
 BuildRequires: openssh-clients
 BuildRequires: openssh-server
@@ -47,7 +54,16 @@
 %endif
 
 BuildRequires: zlib-devel
-Requires: libcurl = %{version}-%{release}
+Requires: libcurl-openssl = %{version}-%{release}
+
+# We do not want curl-openssl to provide or require the 
+#.so and similar  files that the real curl provides so we must 
+# so filter them out.
+%filter_provides_in %{_libdir}/.*\.so.*$ 
+%filter_from_provides /pkgconfig(libcurl)/d
+%filter_from_requires /libcurl\.so\..*/d
+%filter_setup
+
 
 %description
 cURL is a tool for getting files from HTTP, FTP, FILE, LDAP, LDAPS,
@@ -56,7 +72,7 @@
 interactivity. cURL offers many useful capabilities, like proxy support,
 user authentication, FTP upload, HTTP post, and file transfer resume.
 
-%package -n libcurl
+%package -n libcurl-openssl
 Summary: A library for getting files from web servers
 Group: Development/Libraries
 
@@ -64,29 +80,29 @@
 # this forces update of libssh2 before update of libcurl
 Requires: libssh2 >= 1.2
 
-%description -n libcurl
+%description -n libcurl-openssl
 This package provides a way for applications to use FTP, HTTP, Gopher and
 other servers for getting files.
 
-%package -n libcurl-devel
+%package -n libcurl-openssl-devel
 Summary: Files needed for building applications with libcurl
 Group: Development/Libraries
 Requires: automake
-Requires: libcurl = %{version}-%{release}
+Requires: libcurl-openssl = %{version}-%{release}
 Requires: libidn-devel
 Requires: pkgconfig
 
-Provides: curl-devel = %{version}-%{release}
-Obsoletes: curl-devel < %{version}-%{release}
+Provides: curl-openssl-devel = %{version}-%{release}
+Obsoletes: curl-openssl-devel < %{version}-%{release}
 
-%description -n libcurl-devel
+%description -n libcurl-openssl-devel
 cURL is a tool for getting files from FTP, HTTP, Gopher, Telnet, and
 Dict servers, using any of the supported protocols. The libcurl-devel
 package includes files needed for developing applications which can
 use cURL's capabilities internally.
 
 %prep
-%setup -q
+%setup -q -n curl-%{version}
 
 # upstream patches (already applied)
 %patch1 -p1
@@ -146,7 +162,7 @@
 done
 
 %build
-%configure --without-ssl --with-nss --enable-ipv6 \
+%configure --without-ssl --with-openssl --enable-ipv6 \
 	--with-ca-bundle=%{_sysconfdir}/pki/tls/certs/ca-bundle.crt \
 	--with-gssapi --with-libidn \
 	--enable-ldaps --disable-static --with-libssh2 --enable-manual
@@ -194,9 +210,12 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post -n libcurl -p /sbin/ldconfig
+# We don't update the central cache but do create the symlinks.
+%post -n libcurl-openssl
+/sbin/ldconfig -N %{_libdir}
 
-%postun -n libcurl -p /sbin/ldconfig
+%postun -n libcurl-openssl 
+/sbin/ldconfig -N %{_libdir}
 
 %files
 %defattr(-,root,root,-)
@@ -207,11 +226,12 @@
 %{_bindir}/curl
 %{_mandir}/man1/curl.1*
 
-%files -n libcurl
+%files -n libcurl-openssl
 %defattr(-,root,root,-)
 %{_libdir}/libcurl.so.*
+%dir %{_prefix}
 
-%files -n libcurl-devel
+%files -n libcurl-openssl-devel
 %defattr(-,root,root,-)
 %doc docs/examples/*.c docs/examples/Makefile.example docs/INTERNALS
 %doc docs/CONTRIBUTE docs/libcurl/ABI
@@ -224,6 +244,9 @@
 %{_datadir}/aclocal/libcurl.m4
 
 %changelog
+* Fri May 20 2011 Steve Traylen <steve.traylen@cern.ch> 7.19.7-17
+- Build RHEL6 RPM against openssl in alternate directory.
+
 * Wed Jun 30 2010 Kamil Dudka <kdudka@redhat.com> 7.19.7-16
 - add support for NTLM authentication (#606819)
 
