summaryrefslogtreecommitdiff
path: root/media-gfx/sam2p/sam2p-0.49.4_p20190718-r1.ebuild
blob: fd8877e311deedf3aab8bff761a8efb6fa74a8d1 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools toolchain-funcs

COMMIT="b953f63307c4a83fa4615a4863e3fb250205cd98"

DESCRIPTION="Utility to convert raster images to EPS, PDF and many others"
HOMEPAGE="https://github.com/pts/sam2p"
SRC_URI="https://github.com/pts/sam2p/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-macos"
IUSE="examples gif"
RESTRICT="test"

BDEPEND="dev-lang/perl"

S="${WORKDIR}/${PN}-${COMMIT}"

PATCHES=(
	"${FILESDIR}"/${PN}-build-fixes.patch
	"${FILESDIR}"/${PN}-0.49.4_p20190718-fix-configure-clang.patch
)

src_prepare() {
	default

	# configure.in files are deprecated
	mv configure.{in,ac} || die

	# missing include for memset
	sed -i '1s;^;#include <string.h>\n;' pts_defl.c || die

	# eautoreconf is still needed or you get bad warnings
	eautoreconf
}

src_configure() {
	tc-export CC CXX

	econf \
		--enable-lzw \
		$(use_enable gif)
}

src_compile() {
	emake GCC_STRIP= \
		CC="$(tc-getCC)" \
		CXX="$(tc-getCXX)" \
		LD="$(tc-getCC)" \
		LDXX="$(tc-getCXX)" \
		LDY="$(tc-getCC)"
}

src_install() {
	dobin sam2p
	einstalldocs

	if use examples; then
		# clear pre-compressed files
		rm examples/*.gz || die

		dodoc -r examples
		docompress -x /usr/share/doc/${PF}/examples
	fi
}