summaryrefslogtreecommitdiff
blob: fb88bae39fea242f94f58fd917fb619676b59983 (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-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit toolchain-funcs

DESCRIPTION="Standalone tool for generating man pages with a simple syntax"
HOMEPAGE="https://git.sr.ht/~sircmpwn/scdoc"
SRC_URI="https://git.sr.ht/~sircmpwn/scdoc/snapshot/${P}.tar.xz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"

src_prepare() {
	default

	sed -i 's/-Werror//' Makefile || die 'Failed to remove -Werror'
	sed -i 's/CFLAGS=/CFLAGS+=/' Makefile || die 'Failed to patch makefile'
}

src_compile() {
	MY_HS="./scdoc"
	if tc-is-cross-compiler; then
		tc-export_build_env
		MY_HS="./hostscdoc"
		MAKEOPTS+=" HOST_SCDOC=./hostscdoc"
		emake scdoc OUTDIR="${S}/.build.host" CC=$(tc-getBUILD_CC) \
			CFLAGS="${BUILD_CFLAGS}" LDFLAGS="${BUILD_LDFLAGS}"
		mv scdoc hostscdoc || die 'Failed to rename host scdoc'
	fi
	emake LDFLAGS="${LDFLAGS}" HOST_SCDOC="${MY_HS}"
}

src_install() {
	emake DESTDIR="${D}" HOST_SCDOC="${MY_HS}" install
}