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

#
# spec file for package squid
#

%define real_name       squid
%define version         7.2
%define vers            72
%define prefix          /DBA/%{real_name}/%{version}
%define maketest        0
%define latest_script   set_squid_7.latest.sh


Name:           dba-%{real_name}-%{vers}
Summary:        Squid WWW proxy server 7.2
Version:        %{version}
Release:        1
License:        GPL-2.0-or-later
Url:            http://www.squid-cache.org
Group:          Productivity/Networking/Web/Proxy
AutoReqProv:    on
Source:         https://github.com/squid-cache/squid/releases/download/SQUID_7.2/%{real_name}-%{version}.tar.bz2 
Source1:        %{real_name}-rpmlintrc
Source2:        unsquid.pl
Source3:        %{latest_script}
Source4:        filter-requires-squid.sh
#Patch1:         libxmlparser.patch
BuildRoot:      %{_tmppath}/%{real_name}-%{version}-build

%global debug_package %{nil}

%define _use_internal_dependency_generator 0
%define __find_requires %{SOURCE4}

#!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 libcap-devel libtool pam-devel
BuildRequires:  cyrus-sasl-devel pkgconfig libtool-ltdl-devel

#!BuildIgnore:  openssl-devel libopenssl-devel openssl
BuildRequires:   dba-openssl-3016-static
%define ssldir /DBA/openssl/3.0.16

%if 0%{?centos_version} >= 900
BuildRequires:  openldap
BuildRequires:  openldap-devel
%else
BuildRequires:  openldap2-devel
%endif

%if %{?suse_version:1}0
BuildRequires:  db-devel
%if 0%{?suse_version} < 1590
BuildRequires: gcc11-c++
%else
BuildRequires: gcc-c++
%endif
%else

BuildRequires: gcc-c++
%if 0%{?centos_version} >= 1000
%else
%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700
BuildRequires:  libdb
%else
BuildRequires:  db4-devel
%endif
%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

BuildRequires:  krb5-devel

%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

Requires: perl-URI

%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}
#%patch1 -p1

perl -pi -e 's%^#!/usr/local/bin/perl%#!/usr/bin/perl%g' `find -name "*.pl"`

%{__chmod} +x %{SOURCE4}

%build
export LDFLAGS='-Wl,-z,relro,-z,now -pie -Wno-stringop-overflow -O1 -Wno-unused-function'
%if 0%{?centos_version} >= 1000
export LDFLAGS="$LDFLAGS -Wno-alloc-size-larger-than"
%endif
export CFLAGS="%{optflags} -Wno-stringop-overflow -O1 -fPIE -fPIC -DOPENSSL_LOAD_CONF"
export CXXFLAGS="%{optflags} -Wno-stringop-overflow -O1 -fPIE -fPIC -DOPENSSL_LOAD_CONF"

export CFLAGS="$CFLAGS -I%{ssldir}/include/openssl"
export LDFLAGS="$LDFLAGS -L%{ssldir}/lib64 -lssl -lcrypto -ldl -pthread"
export PKG_CONFIG_PATH="%{ssldir}/lib64/pkgconfig:$PKG_CONFIG_PATH"

# not compiling for CentOS or RHEL i5.7 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

%if 0%{?suse_version}
%if 0%{?suse_version} < 1590
export CC=gcc-11
export CXX=g++-11
%endif
%endif

%if 0%{?centos_version} >= 900
%else
export LIBLDAP_LIBS="-lldap -llber"
%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-crtd \
        --with-openssl=%{ssldir} \
        --without-gnutls \
        --enable-forw-via-db \
	--enable-cache-digests \
	--enable-linux-netfilter \
	--with-large-files \
    --enable-ldap \
	--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 \
        --enable-translation \
	--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
export PKG_CONFIG_PATH="%{ssldir}/lib/pkgconfig:$PKG_CONFIG_PATH"
%{__mkdir_p} %{buildroot}%{prefix}
%{__mkdir_p} %{buildroot}%{prefix}/bin
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
* Mon Oct 20 2025 Dennis Hampe <dennis.hampe@bertelsmann.de>
- inital version
openSUSE Build Service is sponsored by