xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-networking/recipes-daemons/squid/squid_4.15.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSUMMARY = "A fully-featured http proxy and web-cache daemon for Linux"
2*4882a593SmuzhiyunDESCRIPTION = "A fully-featured http proxy and web-cache daemon for Linux. \
3*4882a593SmuzhiyunSquid offers a rich access control, authorization and logging environment to \
4*4882a593Smuzhiyundevelop web proxy and content serving applications. \
5*4882a593SmuzhiyunSquid offers a rich set of traffic optimization options, most of which are \
6*4882a593Smuzhiyunenabled by default for simpler installation and high performance. \
7*4882a593Smuzhiyun"
8*4882a593SmuzhiyunHOMEPAGE = "http://www.squid-cache.org"
9*4882a593SmuzhiyunSECTION = "web"
10*4882a593SmuzhiyunLICENSE = "GPL-2.0-or-later"
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunMAJ_VER = "${@oe.utils.trim_version("${PV}", 1)}"
13*4882a593SmuzhiyunMIN_VER = "${@oe.utils.trim_version("${PV}", 2)}"
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSRC_URI = "http://www.squid-cache.org/Versions/v${MAJ_VER}/${BPN}-${PV}.tar.bz2 \
16*4882a593Smuzhiyun           file://Set-up-for-cross-compilation.patch \
17*4882a593Smuzhiyun           file://Skip-AC_RUN_IFELSE-tests.patch \
18*4882a593Smuzhiyun           file://Fix-flawed-dynamic-ldb-link-test-in-configure.patch \
19*4882a593Smuzhiyun           file://squid-use-serial-tests-config-needed-by-ptest.patch \
20*4882a593Smuzhiyun           file://run-ptest \
21*4882a593Smuzhiyun           file://volatiles.03_squid \
22*4882a593Smuzhiyun           file://set_sysroot_patch.patch \
23*4882a593Smuzhiyun           file://squid-don-t-do-squid-conf-tests-at-build-time.patch \
24*4882a593Smuzhiyun           file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
25*4882a593Smuzhiyun           file://0001-tools.cc-fixed-unused-result-warning.patch \
26*4882a593Smuzhiyun           file://0001-splay.cc-fix-bind-is-not-a-member-of-std.patch \
27*4882a593Smuzhiyun           file://0001-Fix-build-on-Fedora-Rawhide-772.patch \
28*4882a593Smuzhiyun           "
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunSRC_URI:remove:toolchain-clang = "file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch"
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunSRC_URI[sha256sum] = "71635811e766ce8b155225a9e3c7757cfc7ff93df26b28d82e5e6fc021b9a605"
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
35*4882a593Smuzhiyun                    file://errors/COPYRIGHT;md5=0e03cd976052c45697ad5d96e7dff8dc \
36*4882a593Smuzhiyun                    "
37*4882a593SmuzhiyunDEPENDS = "libtool krb5 openldap db cyrus-sasl"
38*4882a593Smuzhiyun
39*4882a593Smuzhiyuninherit autotools pkgconfig useradd ptest perlnative
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunLDFLAGS:append:mipsarch = " -latomic"
42*4882a593SmuzhiyunLDFLAGS:append:powerpc = " -latomic"
43*4882a593SmuzhiyunLDFLAGS:append:riscv64 = " -latomic"
44*4882a593SmuzhiyunLDFLAGS:append:riscv32 = " -latomic"
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunUSERADD_PACKAGES = "${PN}"
47*4882a593SmuzhiyunUSERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/squid --shell /bin/false --user-group squid"
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunPACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
50*4882a593Smuzhiyun                  "
51*4882a593SmuzhiyunPACKAGECONFIG[libnetfilter-conntrack] = "--with-netfilter-conntrack=${includedir}, --without-netfilter-conntrack, libnetfilter-conntrack"
52*4882a593SmuzhiyunPACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
53*4882a593SmuzhiyunPACKAGECONFIG[werror] = "--enable-strict-error-checking,--disable-strict-error-checking,"
54*4882a593SmuzhiyunPACKAGECONFIG[esi] = "--enable-esi,--disable-esi,expat libxml2"
55*4882a593SmuzhiyunPACKAGECONFIG[ssl] = "--with-openssl=yes,--with-openssl=no,openssl"
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunBASIC_AUTH = "DB SASL LDAP"
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunDEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
60*4882a593SmuzhiyunBASIC_AUTH += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'PAM', '', d)}"
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunEXTRA_OECONF += "--with-default-user=squid --enable-auth-basic='${BASIC_AUTH}' \
63*4882a593Smuzhiyun                 --sysconfdir=${sysconfdir}/${BPN} \
64*4882a593Smuzhiyun                 --with-logdir=${localstatedir}/log/${BPN} \
65*4882a593Smuzhiyun                 'PERL=${USRBINPATH}/env perl'"
66*4882a593Smuzhiyun
67*4882a593Smuzhiyunexport BUILDCXXFLAGS="${BUILD_CXXFLAGS}"
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunTESTDIR = "test-suite"
70*4882a593Smuzhiyun
71*4882a593Smuzhiyundo_configure:prepend() {
72*4882a593Smuzhiyun    export SYSROOT=$PKG_CONFIG_SYSROOT_DIR
73*4882a593Smuzhiyun}
74*4882a593Smuzhiyun
75*4882a593Smuzhiyundo_compile_ptest() {
76*4882a593Smuzhiyun    oe_runmake -C ${TESTDIR} buildtest-TESTS
77*4882a593Smuzhiyun}
78*4882a593Smuzhiyun
79*4882a593Smuzhiyundo_install_ptest() {
80*4882a593Smuzhiyun    cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH}
81*4882a593Smuzhiyun    cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun    # do NOT need to rebuild Makefile itself
84*4882a593Smuzhiyun    sed -i 's/^Makefile:.*$/Makefile:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun    # Add squid-conf-tests for runtime tests
87*4882a593Smuzhiyun    sed -e 's/^\(runtest-TESTS:\)/\1 squid-conf-tests/' \
88*4882a593Smuzhiyun        -e "s/\(list=' \$(TESTS)\)/\1 squid-conf-tests/" \
89*4882a593Smuzhiyun        -i ${D}${PTEST_PATH}/${TESTDIR}/Makefile
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun    # Ensure the path for command true is correct
92*4882a593Smuzhiyun    sed -i 's:^TRUE = .*$:TRUE = /bin/true:' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
93*4882a593Smuzhiyun}
94*4882a593Smuzhiyun
95*4882a593Smuzhiyundo_install:append() {
96*4882a593Smuzhiyun    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
97*4882a593Smuzhiyun        install -d ${D}${sysconfdir}/tmpfiles.d
98*4882a593Smuzhiyun        echo "d ${localstatedir}/run/${BPN} 0755 squid squid -" >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
99*4882a593Smuzhiyun        echo "d ${localstatedir}/log/${BPN} 0750 squid squid -" >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
100*4882a593Smuzhiyun    fi
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun    install -d ${D}${sysconfdir}/default/volatiles
103*4882a593Smuzhiyun    install -m 0644 ${WORKDIR}/volatiles.03_squid ${D}${sysconfdir}/default/volatiles/03_squid
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun    rmdir "${D}${localstatedir}/run/${BPN}"
106*4882a593Smuzhiyun    rmdir --ignore-fail-on-non-empty "${D}${localstatedir}/run"
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun    rmdir "${D}${localstatedir}/log/${BPN}"
109*4882a593Smuzhiyun    rmdir --ignore-fail-on-non-empty "${D}${localstatedir}/log"
110*4882a593Smuzhiyun}
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunFILES:${PN} += "${libdir} ${datadir}/errors ${datadir}/icons"
113*4882a593SmuzhiyunFILES:${PN}-dbg += "/usr/src/debug"
114*4882a593SmuzhiyunFILES:${PN}-doc += "${datadir}/*.txt"
115*4882a593Smuzhiyun
116*4882a593SmuzhiyunRDEPENDS:${PN} += "perl"
117*4882a593SmuzhiyunRDEPENDS:${PN}-ptest += "make"
118