xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-extended/sysstat/sysstat.inc (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSUMMARY = "System performance tools"
2*4882a593SmuzhiyunDESCRIPTION = "The sysstat utilities are a collection of performance monitoring tools for Linux."
3*4882a593SmuzhiyunHOMEPAGE = "http://sebastien.godard.pagesperso-orange.fr/"
4*4882a593SmuzhiyunLICENSE = "GPL-2.0-or-later"
5*4882a593SmuzhiyunSECTION = "console/utils"
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunSRC_URI = "http://pagesperso-orange.fr/sebastien.godard/${BP}.tar.xz \
8*4882a593Smuzhiyun           file://99_sysstat \
9*4882a593Smuzhiyun           file://sysstat.service \
10*4882a593Smuzhiyun          "
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunUPSTREAM_CHECK_URI = "http://sebastien.godard.pagesperso-orange.fr/download.html"
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunDEPENDS += "base-passwd"
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun# autotools-brokensep as this package doesn't use automake
17*4882a593Smuzhiyuninherit autotools-brokensep gettext systemd upstream-version-is-even
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunPACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
20*4882a593SmuzhiyunPACKAGECONFIG[lm-sensors] = "--enable-sensors,--disable-sensors,lmsensors,lmsensors-libsensors"
21*4882a593SmuzhiyunPACKAGECONFIG[cron] = "--enable-install-cron --enable-copy-only,--disable-install-cron --disable-copy-only"
22*4882a593SmuzhiyunPACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_system_unitdir}"
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunEXTRA_OECONF += "--disable-stripping"
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunSYSTEMD_PACKAGES = "${PN}"
27*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "sysstat.service"
28*4882a593SmuzhiyunSYSTEMD_AUTO_ENABLE = "enable"
29*4882a593Smuzhiyun
30*4882a593Smuzhiyundo_configure:prepend() {
31*4882a593Smuzhiyun    export sa_lib_dir=${libexecdir}/sa
32*4882a593Smuzhiyun}
33*4882a593Smuzhiyun
34*4882a593Smuzhiyundo_install() {
35*4882a593Smuzhiyun	autotools_do_install
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun	# Don't version the documentation
38*4882a593Smuzhiyun	mv ${D}${docdir}/${BP} ${D}${docdir}/${BPN}
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun	# don't install /var/log/sa when populating rootfs. Do it through volatile
41*4882a593Smuzhiyun	rm -rf ${D}/var
42*4882a593Smuzhiyun	if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
43*4882a593Smuzhiyun	        install -d ${D}/etc/default/volatiles
44*4882a593Smuzhiyun		install -m 0644 ${WORKDIR}/99_sysstat ${D}/etc/default/volatiles
45*4882a593Smuzhiyun	fi
46*4882a593Smuzhiyun	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
47*4882a593Smuzhiyun	        install -d ${D}${sysconfdir}/tmpfiles.d
48*4882a593Smuzhiyun	        echo "d ${localstatedir}/log/sa - - - -" \
49*4882a593Smuzhiyun		     > ${D}${sysconfdir}/tmpfiles.d/sysstat.conf
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun		# Unless both cron and systemd are enabled, install our own
52*4882a593Smuzhiyun		# systemd unit file. Otherwise the package will install one.
53*4882a593Smuzhiyun	        if ${@bb.utils.contains('PACKAGECONFIG', 'cron systemd', 'false', 'true', d)}; then
54*4882a593Smuzhiyun			install -d ${D}${systemd_system_unitdir}
55*4882a593Smuzhiyun			install -m 0644 ${WORKDIR}/sysstat.service ${D}${systemd_system_unitdir}
56*4882a593Smuzhiyun			sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_system_unitdir}/sysstat.service
57*4882a593Smuzhiyun	        fi
58*4882a593Smuzhiyun	fi
59*4882a593Smuzhiyun}
60*4882a593Smuzhiyun
61*4882a593Smuzhiyunpkg_postinst:${PN} () {
62*4882a593Smuzhiyun	if [  ! -n "$D" ]; then
63*4882a593Smuzhiyun		if [ -e /etc/init.d/populate-volatile.sh ]; then
64*4882a593Smuzhiyun			/etc/init.d/populate-volatile.sh update
65*4882a593Smuzhiyun		fi
66*4882a593Smuzhiyun	fi
67*4882a593Smuzhiyun}
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunFILES:${PN} += "${systemd_system_unitdir} ${nonarch_base_libdir}/systemd"
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunTARGET_CC_ARCH += "${LDFLAGS}"
72