# Compile SQUID with --enable-wccpv2

## marek.garamszegi

Hi all !

Can anybody help me how to emerge (compile) Squid Proxy with

```
--enable-wccpv2
```

configure parameter ??? According to 

```
squid -v 
```

defaultly under Gentoo it is compiled without WCCPv2 option.

Which USE flag may I use, or how to compile with --enable-wccpv2 ???

Marek

----------

## ianw1974

Hi,

I can't see any use flags for it, from what I found:

```
[ebuild  N     ] net-proxy/squid-3.1.16  USE="epoll kerberos ldap mysql pam samba sqlite ssl -caps -ecap -icap-client (-ipf-transparent) -ipv6 (-kqueue) -logrotate -nis (-pf-transparent) -postgres -radius -sasl (-selinux) -snmp -test -tproxy -zero-penalty-hit" 3,320 kB
```

I can only assume maybe the tproxy flag would give you this, but I couldn't say for definite.  For sure that ipf-transparent and pf-transparent are not the ones you need, and the only one left for transparent proxying would be tproxy.

The only reference found for wccp I found here:

```
jasiek files # cat /usr/portage/net-proxy/squid/files/squid-2.7.9-gentoo.patch  | grep -i wccp

 #if USE_WCCPv2

     wccp2Init();
```

no other files have any references.  Hope some of that helps a little.

----------

## marek.garamszegi

I have already set USE flag tproxy in /etc/make.conf

it doenst help.

```
mail ~ # emerge --info

Portage 2.1.10.11 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.12.2-r0, 3.0.6-gentoo x86_64)

=================================================================

System uname: Linux-3.0.6-gentoo-x86_64-Quad-Core_AMD_Opteron-tm-_Processor_2356-with-gentoo-2.0.3

Timestamp of tree: Thu, 10 Nov 2011 12:00:01 +0000

app-shells/bash:          4.1_p9

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.7.2-r3, 3.1.4-r3

dev-util/cmake:           2.8.4-r1

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.0.3

sys-apps/openrc:          0.8.3-r1

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.68

sys-devel/automake:       1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.5.3-r1

sys-devel/gcc-config:     1.4.1-r1

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)

sys-libs/glibc:           2.12.2

Repositories: gentoo

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=barcelona -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=barcelona -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

EMERGE_DEFAULT_OPTS="--alphabetical"

FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LANG="cs_CZ.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="cs_CZ"

MAKEOPTS="-j1"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="acl acpi amd64 apache2 bzip2 caps cli courier cracklib crypt cxx dbus dri expat fortran freetds gallery gd gdbm gpm gre gzip hash hashlib iconv imagemagick imap java jpeg jpgraph kerberos libwww logrotate maildir maildrop mhash mmx mmxext modules mssql mudflap multilib mydms mysql ncurses nls nptl nptlonly openmp pam pcntl pcre pdf pdo php png python quota quotas readline samba sasl session smp snmp sockets sse sse2 sse3 sse4a ssl suid sysfs syslog sysvipc tcpd tftp tproxy udev unicode xml xmlrpc xsl xslt zip zlib" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev keyboard mouse vmmouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="cs_CZ" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev vesa vga vmware" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
```

Marek

----------

## marek.garamszegi

Do know anybody other way, ho to compile Squid with --enable-wccpv2 ???

Is there any other legal options (insert some lines to make.conf or modify some files in /usr/portage) ???

I think id I manually configure source and compile, when upgrade comes, portage will ignore my compilation with configure options and when I emerge -U --deep world, my custom compile was ingnored.

Im thinking about last chance is modify squids ebuild, or make patch for ebuild, but i dont know how.

Can anybody help me please ?

Marek

----------

## cach0rr0

if you want to keep a separate copy of the ebuild in a local overlay, changing the ebuild to add this somewhere towards the bottom of src_configure would work:

```

    if use wccpv2; then

            myconf="${myconf} --enable-wccpv2"

    fi

```

You would need to add this before "econf" is called. 

You should also edit the metadata.xml (in your local overlay) and add in a new "flag name" entry for a 'wccpv2' USE flag

Then add 'wccpv2' to your USE in make.conf, make sure you've added your local overlay to make.conf appropriately, and emerge. You can setup a local overlay where you like; I just use /root. If you want to do the same:

```

mkdir -p /root/overlays/proxies/net-proxy/squid

cp -r /usr/portage/net-proxy/squid/* /root/overlays/proxies/net-proxy/squid/

<edit overlay copy of ebuild>

<edit overlay copy of metadata.xml>

ebuild filename.ebuild digest

echo 'PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /root/overlays/proxies"' >> /etc/make.conf

```

quick and dirty, but it works

whenever you sync, you would have to keep an eye out and see if a new squid version is released. If it is, you would want to copy over the new files (in their entirety, ideally) from /usr/portage, redo the edits, and go from there. Annoying maybe, but at least it keeps things portage-friendly somewhat

----------

## marek.garamszegi

I try it ! It looks good !

Is it clearest way I do it ?

Marek

----------

## cach0rr0

 *marek.garamszegi wrote:*   

> I try it ! It looks good !
> 
> Is it clearest way I do it ?
> 
> Marek

 

Not sure. It's the first way that came to mind where I knew it would work. 

It may be the case that some other configure option combined with --enable-wccpv2 is redundant - i honestly dont know, but it's possible. However that would be the only scenario in which I can envision an easier way of doing this.

----------

## marek.garamszegi

You should also edit the metadata.xml (in your local overlay) and add in a new "flag name" entry for a 'wccpv2' USE flag

Then add 'wccpv2' to your USE in make.conf, make sure you've added your local overlay to make.conf appropriately, and emerge. You can setup a local overlay where you like; I just use /root. If you want to do the same:

```

mkdir -p /root/overlays/proxies/net-proxy/squid

cp -r /usr/portage/net-proxy/squid/* /root/overlays/proxies/net-proxy/squid/

<edit overlay copy of ebuild>

<edit overlay copy of metadata.xml>

ebuild filename.ebuild digest

echo 'PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /root/overlays/proxies"' >> /etc/make.conf

```

Thanks for help, but Ihave little problem, maybe I forgot somewhere put wccpv2 keyword...

```
 >>> Configuring source in /var/tmp/portage/net-proxy/squid-3.1.16/work/squid-3.1.16 ...

 * QA Notice: USE Flag 'wccpv2' not in IUSE for net-proxy/squid-3.1.16

```

----------

## marek.garamszegi

It is now working !!! SQUID is compiled with WCCPv2 option now.

if you want to keep a separate copy of the ebuild in a local overlay, changing the ebuild to add this somewhere towards the bottom of src_configure would work: 

```

if use wccpv2; then

            myconf="${myconf} --enable-wccpv2"

    fi 

```

UPDATE: It is neccessary to modify IUSE line in ebuild from:

```
 IUSE="caps ipv6 pam ldap samba sasl kerberos nis radius ssl snmp selinux logrotate test \ " 
```

to

```
 IUSE="caps ipv6 pam ldap samba sasl kerberos nis radius ssl snmp selinux logrotate test wccpv2\ 
```

```

mkdir -p /root/overlays/proxies/net-proxy/squid

cp -r /usr/portage/net-proxy/squid/* /root/overlays/proxies/net-proxy/squid/

<edit overlay copy of ebuild>

<edit overlay copy of metadata.xml>

ebuild filename.ebuild digest

echo 'PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /root/overlays/proxies"' >> /etc/make.conf

```

----------

## cach0rr0

doh! i completely missed IUSE

that's what i get for not testing and trying to do things too quickly  :Smile: 

if this works for you, it might be worth filing a bug to see if this change can be incorporated into the real portage-provided ebuild. It's a small change, but, I don't know if this impacts anything else or not. 

If it gets incorporated into portage, you wont have to maintain your own local ebuild

----------

## marek.garamszegi

 *Quote:*   

>  *cach0rr0 wrote:*   doh! i completely missed IUSE
> 
> that's what i get for not testing and trying to do things too quickly 
> 
> if this works for you, it might be worth filing a bug to see if this change can be incorporated into the real portage-provided ebuild. It's a small change, but, I don't know if this impacts anything else or not. 
> ...

 

It works fine, without problem. I think I have not a good english to specify problem when specifying bug. 

I wish this "funcionality" has implemented in portage, to others, You cach0rr0 will help me much, without You I did not finish this task, otherwise I must configure source manually. Yours reply help me solve problem with transparent proxy with cisco router and now it is easily for me maintain our system.

Thanks once more !

Marek

----------

