aboutsummaryrefslogtreecommitdiff
path: root/libexec/build-make-source
blob: 229c34159aa83bd2dde7c9079467115689000dbe (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
#!/usr/bin/env build

build_make_source_cleanup()
{
	for arg in ${BUILD_SOURCE_CLEAN}; do
		if [ -d "${arg}" ]; then
			rm -rf "${arg}"
		elif [ -f "${arg}" ]; then
			rm "${arg}"
		fi
	done
}

build_make_source()
{(
	build-make-prep "${1}"

	trap build_make_source_cleanup 0
	echo "building source: ${1}"

	load_rules "${1}"

	if [ -d "${BUILDER_PKGDIR}/${CATEGORY}/${NAME}/source" ]; then
		die "source already exists for '${CATEGORY}/${NAME}'"
	fi

	mkenv "source"
	PKG_LOGFILE="${L}/source.log"

	mv "${S}" "${BUILDER_PKGDIR}/${CATEGORY}/${NAME}/source" >> "${PKG_LOGFILE}" 2>&1
 )}

if test "${BUILDER_CALL_STACK}" = '__main__'; then
	simple_usage 'source' '[all|[<category>/]<package|all>]' "$@"
	build_make_source "${@}"
fi

# vim: filetype=sh