aboutsummaryrefslogtreecommitdiff
blob: d9963469f9b6eb7dc77eb68ba038d6c628579941 (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
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

src_prepare() {
	default

	local defs='-DNO_DLM -DNO_COROSYNC -DNO_LIBUDEV'
	sed -i \
		-e "/^CFLAGS = /s:^CFLAGS = \(.*\)$:CFLAGS = ${CFLAGS} ${defs}:" \
		-e "/^CXFLAGS = /s:^CXFLAGS = \(.*\)$:CXFLAGS = ${CFLAGS} ${defs}:" \
		-e "/^CWFLAGS = /s:^CWFLAGS = \(.*\)$:CWFLAGS = -Wall:" \
		-e "s/^# LDFLAGS = -static/LDFLAGS = -static/" \
		-e "s|^UDEVDIR := .*|UDEVDIR = $(get_udevdir)|" \
		Makefile \
		|| die "Failed to sed mdadm Makefile"
}

src_compile() {
	CXFLAGS="-DNO_LIBUDEV" gkmake V=1 mdadm mdmon
}

src_install() {
	gkmake V=1 DESTDIR="${D}" install-udev

	mkdir -p "${D}"/sbin || die "Failed to create '${D}/sbin'!"

	cp -a mdadm "${D}"/sbin/ \
		|| die "Failed to copy '${S}/mdadm' to '${D}/sbin/'!"

	"${STRIP}" --strip-all "${D}"/sbin/mdadm \
		|| die "Failed to strip '${D}/sbin/mdadm'!"

	cp -a mdmon "${D}"/sbin/ \
		|| die "Failed to copy '${D}/sbin/mdmon' to '${D}/sbin/'!"

	"${STRIP}" --strip-all "${D}"/sbin/mdmon \
		|| die "Failed to strip '${D}/sbin/mdmon'!"
}