summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_setup_env.subr
blob: de304328b318a1efc40a8a745398dab4416dfa8c (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
#
# . ./build.vars and set -o errexit -o noglob are assumed.
# See warning at the top of build.vars.
#

pkg_setup_env() {
	PKG_SUBDIR_PATH=${PWD}/${PKG_SUBDIR#/};
	if [ -z "${PKG_CONFIGURE}" ]; then
		PKG_CONFIGURE=${PKG_SUBDIR_PATH}/configure;
	else
		PKG_CONFIGURE=${PWD}/${PKG_CONFIGURE#/};
	fi;
	if [ "${PKG_BUILD_TYPE}" = "host" ]; then
		export AR=ar;
		export CC=gcc;
		export CXX=g++;
		export RANLIB=ranlib;
	else
		export AR=${PKG_TARGET}-ar;
		export CC=${PKG_TARGET}-gcc;
		export CXX=${PKG_TARGET}-g++;
		export RANLIB=${PKG_TARGET}-ranlib;
	fi;
	if [ -x ${PKG_CONFIGURE} ]; then
		export CFLAGS_FOR_BUILD="${HOST_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}";
	else
		__no_autoconf=1;
	fi;
	if [ "${PKG_SLIBTOOL}" != "default" ]; then
		export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}";
	fi;
	cd ${PKG_BUILD_DIR};
	set_build_script_done setup distclean -configure;
};

# vim:filetype=sh