summaryrefslogtreecommitdiff
blob: bd475b6a016d04b8731e106375f0c192bae07271 (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
# Check if we're installing .la files unnecessarily
# https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0303

libtool_la_check() {
	if [[ ${CATEGORY}/${PN} == dev-libs/libltdl ]] ; then
		# bug #293921
		return
	fi

	# Bail out if there aren't any .la files being installed
	readarray -d '' files < <(find "${ED}"/usr/lib* -name '*.la' -print0)
	[[ -n "${files[@]}" ]] || return

	if grep -q "dev-libs/libltdl" <<<${RDEPEND}; then
		# Nothing to do here
		return
	fi

	# Iterate over all the .la files we are installing to verify there's
	# a corresponding .a file - they're pointless without a corresponding
	# static library.
	local file
	local dir
	local base
	local bad_files=()
	for file in "${files[@]}" ; do
		dir=$(dirname ${file})
		base=${dir%/}
		base=${base%.la}

		if [[ ! -f ${dir}/${base}.a ]] ; then
			bad_files+=( ${file} )
		fi
	done

	if [[ -n "${bad_files[@]}" ]] ; then
		eqawarn "QA Notice: Installing libtool files (.la) without corresponding static libraries!"
		eqatag -v libtool-la.unnecessary "${bad_files[@]#${D}}"
	fi
}

libtool_la_check
: # guarantee successful exit

# vim:ft=sh