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

src_prepare() {
	default

	gkautoreconf
}

src_configure() {
	export enable_pkg_config=yes

	local myconf=(
		--enable-static=yes
		--disable-padlock-support
	)

	CC_FOR_BUILD="$(tc-getBUILD_CC)" \
	gkconf "${myconf[@]}"
}

src_install() {
	default

	rm -rf \
		"${D}"/usr/bin/dumpsexp \
		"${D}"/usr/bin/hmac256 \
		"${D}"/usr/bin/mpicalc \
		"${D}"/usr/share

	# remove hardcoded $BROOT
	sed -i \
		-e 's/-L\/[^-"]*//' \
		-e 's/-I\/[^"]*//' \
		"${D}"/usr/bin/libgcrypt-config  \
		|| die

	# libgcrypt-config tries to be smart and will omit include
	# and lib dir due to set prefix
	sed -i \
		-e "s|x/usr/include|x/dont-try-to-be-smart|" \
		-e "s|x/usr/lib|x/dont-try-to-be-smart|" \
		"${D}"/usr/bin/libgcrypt-config \
		|| die "Failed to make libgcrypt-config dumb!"

	mv "${D}"/usr/bin/libgcrypt-config "${D}"/usr/bin/libgcrypt-config.ori \
		|| die "Failed to rename '${D}/usr/bin/libgcrypt-config' to '${D}/usr/bin/libgcrypt-config.ori'!" 

	cat >"${D}"/usr/bin/libgcrypt-config <<-EOF
	#!/bin/sh

	SYSROOT=\$(dirname "\$(dirname "\$(dirname "\$(readlink -fm "\$0")")")")

	exec "\${SYSROOT}"/usr/bin/libgcrypt-config.ori "\$@" | sed -e 's#/#'\${SYSROOT}'/#'
	EOF

	chmod +x "${D}"/usr/bin/libgcrypt-config \
		|| die "Failed to chmod of '${D}/bin/libgcrypt-config'!"
}