File dba-squid-411.spec of Package dba-squid-411

#
# spec file for package squid
#

%define real_name       squid
%define version         4.11
%define vers            411
%define prefix          /DBA/%{real_name}/%{version}
%define maketest        0
%define latest_script   set_squid_4.latest.sh


Name:           dba-%{real_name}-%{vers}
Summary:        Squid WWW proxy server 4.11
Version:        %{version}
Release:        1
License:        GPL-2.0-or-later
Url:            http://www.squid-cache.org
Group:          Productivity/Networking/Web/Proxy
AutoReqProv:    on
Source:         http://www.squid-cache.org/Versions/v4/%{real_name}-%{version}.tar.bz2
Source1:        %{real_name}-rpmlintrc
Source2:        unsquid.pl
Source3:        %{latest_script}
BuildRoot:      %{_tmppath}/%{real_name}-%{version}-build

#!BuildIgnore:  dba-openssl-098o dba-openssl-098r dba-openssl-098x dba-openssl-101c dba-openssl-101g-static
#!BuildIgnore:  dba-libxml2-290 dba-git-2191

BuildRequires:  ed expat gcc-c++ libcap-devel libtool openldap2-devel pam-devel
BuildRequires:  openssl-devel cyrus-sasl-devel

%if %{?suse_version:1}0
BuildRequires:  db-devel openldap2 openldap2-devel
%else
BuildRequires:  openldap openldap-devel
%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700
BuildRequires:  libdb
%else
BuildRequires:  db4-devel
%endif
%endif

%if 0%{?suse_version}
BuildRequires:  libexpat-devel
%else
BuildRequires:  expat-devel
%endif

%if 0%{?suse_version} || 0%{?fedora_version} || 0%{?centos_version}
BuildRequires:  opensp-devel sharutils
%endif

%if 0%{?sles_version} == 9
BuildRequires:  heimdal-devel
%else
BuildRequires:  krb5-devel
%endif

%if 0%{?suse_version} > 1030 || 0%{?fedora_version} > 8
BuildRequires:  fdupes
%endif

BuildRequires:  libxml2-devel

%if 0%{?suse_version} >= 1100
BuildRequires:          -post-build-checks
%endif

%description
The stable version of the Squid WWW Proxy Server.

Home page: http://www.squid-cache.org


Authors:
--------
    Duane Wessels <wessels@ircache.net>


%prep
%setup -n %{real_name}-%{version}
perl -pi -e 's%^#!/usr/local/bin/perl%#!/usr/bin/perl%g' `find -name "*.pl"`


%build
#%if 0%{?suse_version} > 1010
#./bootstrap.sh
#autoreconf -fiv
#%endif
export CFLAGS="%{optflags} -fPIE -fPIC -DOPENSSL_LOAD_CONF"
export CXXFLAGS="%{optflags} -fPIE -fPIC -DOPENSSL_LOAD_CONF"
export LDFLAGS='-Wl,-z,relro,-z,now -pie'

# not compiling for CentOS or RHEL i586 environment: undefined reference to `__sync_fetch_and_add_4'
%if 0%{?centos_version} >= 500 || 0%{?rhel_version} >= 500
export 	krb5_config="/usr/bin/krb5-config"
%ifarch %ix86
export CFLAGS="$CFLAGS -march=i686"
%endif
%endif


./configure --prefix=%{prefix} \
	--with-dl \
	--enable-storeio \
	--enable-disk-io=AIO,Blocking,DiskDaemon,DiskThreads \
	--enable-removal-policies=heap,lru \
	--enable-icmp \
	--enable-delay-pools \
	--enable-esi \
	--enable-icap-client \
	--enable-useragent-log \
	--enable-referer-log \
	--enable-kill-parent-hack \
	--enable-arp-acl \
	--enable-ssl \
	--enable-forw-via-db \
	--enable-cache-digests \
	--enable-linux-netfilter \
	--with-large-files \
	--enable-underscores \
	--enable-auth-basic \
	--enable-auth-ntlm \
	--enable-auth-negotiate \
	--enable-auth-digest \
%if 0%{?sles_version} == 10
	--enable-basic-auth-helpers=DB,LDAP,MSNT,NCSA,PAM,POP3,SASL,SMB,getpwnam,multi-domain-NTLM,squid_radius_auth \
	--enable-external-acl-helpers=LDAP_group,eDirectory_userip,file_userip,session,unix_group,wbinfo_group \
	--disable-auth-negotiate \
%else
	--enable-basic-auth=DB,LDAP,MSNT,NCSA,PAM,POP3,SASL,SMB,YP,getpwnam,multi-domain-NTLM,RADIUS \
%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700 || 0%{?fedora_version} >= 20
	--enable-external-acl-helpers=LDAP_group,eDirectory_userip,file_userip,kerberos_ldap_group,unix_group,wbinfo_group \
%else
	--enable-external-acl-helpers=LDAP_group,eDirectory_userip,file_userip,kerberos_ldap_group,unix_group,wbinfo_group \
%endif
	--enable-negotiate-auth-helpers=squid_kerb_auth \
%endif
	--enable-ntlm-auth-helpers=fakeauth,no_check,smb_lm \
	--enable-digest-auth-helpers=eDirectory,ldap,password \
	--enable-ntlm-fail-open \
	--enable-stacktraces \
	--enable-x-accelerator-vary \
	--with-default-user=squid \
    --disable-ident-lookups \
    --disable-arch-native \
    --enable-follow-x-forwarded-for


# --enable-auth=basic,digest,ntlm,negotiate \

# overwrite the number of open filedescriptors of configure to 4096
# to be backward compatible, but numbers above should not be overwritten
if [ `awk '/SQUID_MAXFD/{print $3}' include/autoconf.h` -lt 4096 ]; then
     set +x
     echo "adapting SQUID_MAXFD to 4096"
     set -x
     perl -pi -e 's;(\#define SQUID_MAXFD) [0-9]+;$1 4096;' include/autoconf.h
fi
make %{?jobs:-j%jobs}

%install
%{__mkdir_p} %{buildroot}%{prefix}
make install DESTDIR=$RPM_BUILD_ROOT SAMBAPREFIX=/usr
install -m 755 %{SOURCE2} %{buildroot}%{prefix}/bin/

%if 0%{?rhel_version} >= 500 || 0%{?centos_version} >= 500
find %{buildroot}%{prefix} -name "smb_auth.pl" |xargs -i rm -f {}
%endif

%{__install} -m 0755 %{S:3} %{buildroot}%{prefix}/bin/%{latest_script}


%post
cd %{prefix}/..
%{prefix}/bin/%{latest_script}

%check
%if %maketest
make check
%endif


%clean
%__rm -rf "%{buildroot}"


%files
%defattr(-,root,root)
%dir %{prefix}
%{prefix}/bin
%{prefix}/etc
%{prefix}/libexec
%{prefix}/sbin
%{prefix}/share


%changelog
* Wed Apr 29 2020 Dennis Hampe <dennis.hampe@bertelsmann.de>
- add special requiremnet for sles15
* Wed Jan 08 2020 Dennis Hampe <dennis.hampe@bertelsmann.de>
- inital version
openSUSE Build Service is sponsored by