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

EAPI=7

MPV=140.50.6
DESCRIPTION="Darwin system headers from Libc ${PV}, macOS 10.13.6"
HOMEPAGE="https://opensource.apple.com/source/Libc"
SRC_URI="https://opensource.apple.com/tarballs/Libc/Libc-${PV}.tar.gz
	https://opensource.apple.com/tarballs/libmalloc/libmalloc-${MPV}.tar.gz"

LICENSE="APSL-2"
SLOT="0/10.13"
KEYWORDS="~x64-macos"
IUSE="+man"

BDEPEND="sys-apps/darwin-miscutils"

S=${WORKDIR}/Libc-${PV}

src_prepare() {
	default

	# convert BSD find to GNU find syntax
	sed -i \
		-e 's/find -E ${SRCROOT}/find ${SRCROOT} -regextype posix-extended/' \
		xcodescripts/manpages.sh || die
	chmod 755 xcodescripts/manpages.sh || die

	# add libmalloc manpage stuff to Libc to automate the installation
	cp "${WORKDIR}"/libmalloc-${MPV}/man/*.3 man/ || die
	cat "${WORKDIR}"/libmalloc-${MPV}/man/manpages.lst \
		>> man/manpages.lst || die
}

src_compile() {
	: ;  # nothing to do
}

src_install() {
	run_xcode_ish() {
		env ARCHS="x86_64 i386" \
			PLATFORM_NAME=macosx \
			VARIANT_PLATFORM_NAME=macosx \
			DERIVED_FILES_DIR="${T}" \
			SRCROOT="${S}" \
			DSTROOT="${ED}" \
			PUBLIC_HEADERS_FOLDER_PATH="/usr/include" \
			PRIVATE_HEADERS_FOLDER_PATH="remove-me" \
			"$@"
	}

	run_xcode_ish ./xcodescripts/headers.sh || die
	if use man ; then
		run_xcode_ish ./xcodescripts/manpages.sh || die
	fi

	insinto /usr/include
	doins -r "${WORKDIR}"/libmalloc-${MPV}/include/malloc

	rm -Rf "${ED}"/remove-me "${ED}"/System || die
}