summaryrefslogtreecommitdiff
path: root/sys-apps/shepherd/shepherd-1.0.9.ebuild
blob: 709be29b4f7eb399010b2acf7a4e764ea6513203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
EAPI=8

DESCRIPTION="GNU service manager written in Guile"
HOMEPAGE="https://www.gnu.org/software/shepherd/"
SRC_URI="mirror://gnu/shepherd/${P}.tar.gz"

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"

IUSE="service-files sysv-utils test"

DEPEND="
    dev-scheme/guile:3.0
    >=dev-scheme/fibers-1.1.0
"

RDEPEND="
    ${DEPEND}
    app-arch/gzip
    app-arch/zstd
"

BDEPEND="
    sys-apps/texinfo
    sys-apps/help2man
    sys-devel/gettext
"

src_configure() {
    econf \
        --with-gzip="${EPREFIX}/usr/bin/gzip" \
        --with-zstd="${EPREFIX}/usr/bin/zstd"
}

src_compile() {
    emake GUILE_AUTO_COMPILE=0
}

src_test() {
    use test || return 0
    emake -k check GUILE_AUTO_COMPILE=0
}

src_install() {
    emake DESTDIR="${D}" install GUILE_AUTO_COMPILE=0

    if ! use sysv-utils; then
        rm -f \
            "${D}/sbin/halt" \
            "${D}/sbin/reboot" \
            "${D}/sbin/shutdown" \
            "${D}/usr/sbin/halt" \
            "${D}/usr/sbin/reboot" \
            "${D}/usr/sbin/shutdown"

        rm -f \
            "${D}/usr/share/man/man8/halt.8" \
            "${D}/usr/share/man/man8/halt.8.bz2" \
            "${D}/usr/share/man/man8/halt.8.gz" \
            "${D}/usr/share/man/man8/halt.8.xz" \
            "${D}/usr/share/man/man8/reboot.8" \
            "${D}/usr/share/man/man8/reboot.8.bz2" \
            "${D}/usr/share/man/man8/reboot.8.gz" \
            "${D}/usr/share/man/man8/reboot.8.xz" \
            "${D}/usr/share/man/man8/shutdown.8" \
            "${D}/usr/share/man/man8/shutdown.8.bz2" \
            "${D}/usr/share/man/man8/shutdown.8.gz" \
            "${D}/usr/share/man/man8/shutdown.8.xz"
    fi

    dodoc AUTHORS NEWS README THANKS

    insinto /usr/share/licenses/${PN}
    doins COPYING

    if use service-files; then
        insinto /etc/shepherd

        if [[ -f "${FILESDIR}/shepherd.scm" ]]; then
            doins "${FILESDIR}/shepherd.scm"
        fi

        if [[ -d "${FILESDIR}/services" ]]; then
            insinto /etc/shepherd/services
            for service in "${FILESDIR}"/services/*.scm; do
                [[ -f "${service}" ]] || continue
                doins "${service}"
            done
        fi
    fi
}