summaryrefslogtreecommitdiff
blob: c91cfdb53b42a202154cf1cd44f38ce0b5c75780 (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
93
94
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit flag-o-matic toolchain-funcs

DESCRIPTION="Heirloom toolchest - original Unix tools"
HOMEPAGE="http://heirloom.sourceforge.net/tools.html"
SRC_URI="http://downloads.sourceforge.net/project/heirloom/heirloom/${PV}/heirloom-${PV}.tar.bz2"

LICENSE="CDDL GPL-2 LGPL-2.1 9base ZLIB"
SLOT="0"
KEYWORDS="~amd64 ~x86"

RDEPEND="
	sys-libs/ncurses:=
	sys-libs/zlib
"
DEPEND="${RDEPEND}"
BDEPEND="
	sys-apps/ed
	sys-devel/bc
	virtual/pkgconfig
"

S="${WORKDIR}/heirloom-${PV}"

PATCHES=(
	"${FILESDIR}"/${P}-major.patch
	"${FILESDIR}"/${P}-makefile.patch
	"${FILESDIR}"/${P}-glibc-2.30.patch
	"${FILESDIR}"/${P}-glibc-2.31.patch
	"${FILESDIR}"/${P}-gcc-10.patch
	"${FILESDIR}"/${P}-clang.patch
)

# slightly broken
RESTRICT="test"

src_prepare() {
	default

	sed -i "s/\bar\b/$(tc-getAR)/g" libwchar/Makefile.mk || die
}

src_compile() {
	append-cppflags -D_GNU_SOURCE
	emake -j1 \
		CC="$(tc-getCC)" \
		AR="$(tc-getAR)" \
		RANLIB="$(tc-getRANLIB)" \
		CFLAGS="${CFLAGS}" \
		CFLAGS2="${CFLAGS}" \
		CFLAGSS="${CFLAGS}" \
		CFLAGSU="${CFLAGS}" \
		CPPFLAGS="${CPPFLAGS}" \
		LCURS="$( $(tc-getPKG_CONFIG) --libs ncurses)" \
		LDFLAGS="${LDFLAGS}" \
		DEFBIN="/usr/bin/${PN}/5bin" \
		DEFSBIN="/usr/bin/${PN}/5bin" \
		SV3BIN="/usr/bin/${PN}/5bin" \
		S42BIN="/usr/bin/${PN}/5bin/s42" \
		SUSBIN="/usr/bin/${PN}/5bin/posix" \
		UCBBIN="/usr/bin/${PN}/ucb" \
		CCSBIN="/usr/bin/${PN}/ccs/bin" \
		SU3BIN="/usr/bin/${PN}/5bin/posix2001" \
		DEFLIB="/usr/bin/${PN}/5lib" \
		LIBZ=-lz
}

src_install() {
	# we don't want to strip here, so use "true" as noop
	emake -j1 \
		STRIP="true" \
		ROOT="${ED}" \
		DEFBIN="/usr/bin/${PN}/5bin" \
		DEFSBIN="/usr/bin/${PN}/5bin" \
		SV3BIN="/usr/bin/${PN}/5bin" \
		S42BIN="/usr/bin/${PN}/5bin/s42" \
		SUSBIN="/usr/bin/${PN}/5bin/posix" \
		UCBBIN="/usr/bin/${PN}/ucb" \
		CCSBIN="/usr/bin/${PN}/ccs/bin" \
		SU3BIN="/usr/bin/${PN}/5bin/posix2001" \
		DEFLIB="/usr/bin/${PN}/5lib" \
		install
}

pkg_postinst() {
	elog "You may want to adjust your \$PATH, to enable "
	elog "using the apps of heirloom toolchest by default."
	elog "Man pages are installed in /usr/share/man/5man/"
	elog "You may need to set \$MANPATH to access them."
}