|
| 1 | +# Copyright 1999-2025 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +PYTHON_COMPAT=( python3_{11..13} ) |
| 7 | + |
| 8 | +inherit autotools systemd python-r1 |
| 9 | + |
| 10 | +DESCRIPTION="Varnish is a state-of-the-art, high-performance HTTP accelerator" |
| 11 | +HOMEPAGE="https://varnish-cache.org/" |
| 12 | +SRC_URI="http://varnish-cache.org/_downloads/${P}.tgz" |
| 13 | + |
| 14 | +LICENSE="BSD-2 GPL-2" |
| 15 | +SLOT="0/2" |
| 16 | +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" |
| 17 | +# From Fedora: |
| 18 | +# Default: Use jemalloc, as adviced by upstream project |
| 19 | +IUSE="+jemalloc jit selinux static-libs unwind" |
| 20 | + |
| 21 | +CDEPEND=" |
| 22 | + sys-libs/readline:= |
| 23 | + dev-libs/libedit |
| 24 | + dev-libs/libpcre2[jit?] |
| 25 | + sys-libs/ncurses:= |
| 26 | + jemalloc? ( dev-libs/jemalloc:= ) |
| 27 | + unwind? ( sys-libs/libunwind:= ) |
| 28 | +" |
| 29 | + |
| 30 | +# varnish compiles stuff at run time |
| 31 | +RDEPEND=" |
| 32 | + ${PYTHON_DEPS} |
| 33 | + ${CDEPEND} |
| 34 | + acct-user/varnish |
| 35 | + acct-group/varnish |
| 36 | + sys-devel/gcc |
| 37 | + selinux? ( sec-policy/selinux-varnishd ) |
| 38 | +" |
| 39 | +DEPEND=" |
| 40 | + ${CDEPEND} |
| 41 | + dev-python/docutils |
| 42 | + dev-python/sphinx |
| 43 | + virtual/pkgconfig |
| 44 | +" |
| 45 | + |
| 46 | +REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
| 47 | + |
| 48 | +PATCHES=( "${FILESDIR}/${PN}-7.1.2-disable-tests.patch" ) |
| 49 | + |
| 50 | +src_prepare() { |
| 51 | + default |
| 52 | + |
| 53 | + # Remove -Werror bug #528354 |
| 54 | + sed -i -e 's/-Werror\([^=]\)/\1/g' configure.ac || die |
| 55 | + |
| 56 | + # Upstream doesn't put varnish.m4 in the m4/ directory |
| 57 | + # We link because the Makefiles look for the file in |
| 58 | + # the original location |
| 59 | + ln -sf ../varnish.m4 m4/varnish.m4 || die |
| 60 | + |
| 61 | + eautoreconf |
| 62 | +} |
| 63 | + |
| 64 | +src_configure() { |
| 65 | + local myeconfargs=( |
| 66 | + --with-contrib |
| 67 | + $(use_enable static-libs static) |
| 68 | + $(use_enable jit pcre2-jit) |
| 69 | + $(use_with jemalloc) |
| 70 | + $(use_with unwind) |
| 71 | + ) |
| 72 | + econf "${myeconfargs[@]}" |
| 73 | +} |
| 74 | + |
| 75 | +src_install() { |
| 76 | + emake DESTDIR="${D}" install |
| 77 | + |
| 78 | + python_replicate_script "${D}/usr/share/varnish/vmodtool.py" |
| 79 | + |
| 80 | + newinitd "${FILESDIR}"/varnishlog.initd varnishlog |
| 81 | + newconfd "${FILESDIR}"/varnishlog.confd varnishlog |
| 82 | + |
| 83 | + newinitd "${FILESDIR}"/varnishncsa.initd varnishncsa |
| 84 | + newconfd "${FILESDIR}"/varnishncsa.confd varnishncsa |
| 85 | + |
| 86 | + newinitd "${FILESDIR}"/varnishd.initd-r4 varnishd |
| 87 | + newconfd "${FILESDIR}"/varnishd.confd-r4 varnishd |
| 88 | + |
| 89 | + insinto /etc/logrotate.d/ |
| 90 | + newins "${FILESDIR}/varnishd.logrotate-r2" varnishd |
| 91 | + |
| 92 | + diropts -m750 |
| 93 | + |
| 94 | + keepdir /var/lib/varnish |
| 95 | + keepdir /var/log/varnish |
| 96 | + |
| 97 | + systemd_dounit "${FILESDIR}/${PN}d.service" |
| 98 | + |
| 99 | + insinto /etc/varnish/ |
| 100 | + doins vmod/vmod_*.vcc |
| 101 | + doins etc/example.vcl |
| 102 | + |
| 103 | + dodoc README.rst |
| 104 | + dodoc doc/changes.rst |
| 105 | + |
| 106 | + fowners root:varnish /etc/varnish/ |
| 107 | + fowners varnish:varnish /var/lib/varnish/ |
| 108 | + fperms 0750 /var/lib/varnish/ /etc/varnish/ |
| 109 | + |
| 110 | + find "${ED}" -name "*.la" -delete || die |
| 111 | +} |
0 commit comments