Blame subr/pkg_configure.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz b9a715
pkgp_configure_autotools() {
Lucio Andrés Illanes Albornoz 7ab7cc
	local _libtool="" _rc=0;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
	if ! [ -x "${PKG_CONFIGURE:-}" ]; then
Lucio Andrés Illanes Albornoz b9a715
		return 2;
Lucio Andrés Illanes Albornoz b9a715
	elif [ -d "${PKG_BASE_DIR}/${PKG_SUBDIR}/sofort" ]\
Lucio Andrés Illanes Albornoz b9a715
	||   [ "${PKG_CONFIGURE_TYPE:-}" = "sofort" ]; then
Lucio Andrés Illanes Albornoz b9a715
		return 2;
Lucio Andrés Illanes Albornoz b9a715
	else
Lucio Andrés Illanes Albornoz 7ab7cc
		case "${PKG_LIBTOOL:-}" in
Lucio Andrés Illanes Albornoz 7ab7cc
		"")	_libtool=""; ;;
Lucio Andrés Illanes Albornoz 7ab7cc
		none)	_libtool=""; ;;
Lucio Andrés Illanes Albornoz 7ab7cc
		*)	_libtool="${PKG_LIBTOOL}"; ;;
Lucio Andrés Illanes Albornoz 7ab7cc
		esac;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		rtl_export_vars												\
Lucio Andrés Illanes Albornoz e1d469
			PKG_CONFIG "${PKG_PKG_CONFIG:-}"								\
Lucio Andrés Illanes Albornoz 703f24
			PKG_CONFIG_LIBDIR "${PKG_PKG_CONFIG_LIBDIR:-}"							\
Lucio Andrés Illanes Albornoz 7ab7cc
			PYTHON "${PKG_PYTHON:-}"									\
Lucio Andrés Illanes Albornoz 7ab7cc
			${_libtool:+MAKE} ${_libtool:+"make LIBTOOL=${_libtool}"};
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		AR="${PKG_AR}"												\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		CC="${PKG_CC}"												\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		RANLIB="${PKG_RANLIB}"											\
Lucio Andrés Illanes Albornoz e1d469
		CFLAGS="${PKG_CFLAGS_CONFIGURE:-}${PKG_CFLAGS_CONFIGURE_EXTRA:+ ${PKG_CFLAGS_CONFIGURE_EXTRA}}"		\
Lucio Andrés Illanes Albornoz e1d469
		CPPFLAGS="${PKG_CFLAGS_CONFIGURE:-}${PKG_CFLAGS_CONFIGURE_EXTRA:+ ${PKG_CFLAGS_CONFIGURE_EXTRA}}"	\
Lucio Andrés Illanes Albornoz e1d469
		CXXFLAGS="${PKG_CXXFLAGS_CONFIGURE:-}${PKG_CXXFLAGS_CONFIGURE_EXTRA:+ ${PKG_CXXFLAGS_CONFIGURE_EXTRA}}"	\
Lucio Andrés Illanes Albornoz e1d469
		LDFLAGS="${PKG_LDFLAGS_CONFIGURE:-}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}"	\
Lucio Andrés Illanes Albornoz e1d469
		"${PKG_CONFIGURE}" ${PKG_CONFIGURE_ARGS:-} ${PKG_CONFIGURE_ARGS_EXTRA:-} ${PKG_CONFIGURE_ARGS_EXTRA_DEBUG:-};
Lucio Andrés Illanes Albornoz b9a715
		_rc=$((${?} ? 1 : ${_rc}));
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		rtl_export_vars	-u											\
Lucio Andrés Illanes Albornoz e1d469
			PKG_CONFIG "${PKG_PKG_CONFIG:-}"								\
Lucio Andrés Illanes Albornoz 703f24
			PKG_CONFIG_LIBDIR "${PKG_PKG_CONFIG_LIBDIR:-}"							\
Lucio Andrés Illanes Albornoz 7ab7cc
			PYTHON "${PKG_PYTHON:-}"									\
Lucio Andrés Illanes Albornoz 7ab7cc
			${_libtool:+MAKE} ${_libtool:+"make LIBTOOL=${_libtool}"};
Lucio Andrés Illanes Albornoz bf9edf
		return "${_rc}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz b9a715
pkgp_configure_cmake() {
Lucio Andrés Illanes Albornoz b9a715
	local _cmake_args_auto"" _build_type="" _IFS0="${IFS:- 	}" _rc=0 IFS;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
	if [ "${PKG_CMAKE_LISTFILE:+1}" != 1 ]\
Lucio Andrés Illanes Albornoz b9a715
	|| ! [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/${PKG_CMAKE_LISTFILE}" ]; then
Lucio Andrés Illanes Albornoz b9a715
		_rc=2;
Lucio Andrés Illanes Albornoz b9a715
	else
Lucio Andrés Illanes Albornoz b9a715
		rtl_fileop rm config.cache || return 1;
Lucio Andrés Illanes Albornoz b9a715
		rtl_export_vars							\
Lucio Andrés Illanes Albornoz b9a715
			PKG_CONFIG		"${PKG_PKG_CONFIG:-}"		\
Lucio Andrés Illanes Albornoz b9a715
			PKG_CONFIG_LIBDIR	"${PKG_PKG_CONFIG_LIBDIR:-}"	\
Lucio Andrés Illanes Albornoz b9a715
			PYTHON			"${PKG_PYTHON:-}";
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		case "${BUILD_KIND}" in
Lucio Andrés Illanes Albornoz b9a715
		debug)		_build_type="debug"; ;;
Lucio Andrés Illanes Albornoz b9a715
		release|*)	_build_type="release"; ;;
Lucio Andrés Illanes Albornoz b9a715
		esac;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		_cmake_args_auto="
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_AR=${PKG_AR}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_BUILD_TYPE=${_build_type}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_C_COMPILER=${PKG_CC}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_C_FLAGS=${PKG_CFLAGS_CONFIGURE:-}${PKG_CFLAGS_CONFIGURE_EXTRA:+ ${PKG_CFLAGS_CONFIGURE_EXTRA}}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_CPP_FLAGS=${PKG_CPPFLAGS_CONFIGURE:-}${PKG_CPPFLAGS_CONFIGURE_EXTRA:+ ${PKG_CPPFLAGS_CONFIGURE_EXTRA}}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_CXX_COMPILER=${PKG_CXX}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_CXX_FLAGS=${PKG_CXXFLAGS_CONFIGURE:-}${PKG_CXXFLAGS_CONFIGURE_EXTRA:+ ${PKG_CXXFLAGS_CONFIGURE_EXTRA}}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_EXE_LINKER_FLAGS=${PKG_LDFLAGS_CONFIGURE:-}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_FIND_ROOT_PATH=${PKG_PREFIX}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_INSTALL_PREFIX=
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_LINKER=$(which "ld")
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_MODULE_LINKER_FLAGS=${PKG_LDFLAGS_CONFIGURE:-}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_RANLIB=${PKG_RANLIB}
Lucio Andrés Illanes Albornoz b9a715
			-DCMAKE_SHARED_LINKER_FLAGS=${PKG_LDFLAGS_CONFIGURE:-}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}
Lucio Andrés Illanes Albornoz b9a715
			-DPKG_CONFIG_EXECUTABLE=${PKG_PKG_CONFIG}" || return 1;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		case "${PKG_BUILD_TYPE}" in
Lucio Andrés Illanes Albornoz b9a715
		host|cross)
Lucio Andrés Illanes Albornoz b9a715
			;;
Lucio Andrés Illanes Albornoz b9a715
		native)
Lucio Andrés Illanes Albornoz b9a715
			_cmake_args_auto="${_cmake_args_auto:+${_cmake_args_auto}}
Lucio Andrés Illanes Albornoz b9a715
				-DCMAKE_LINKER=$(which "${PKG_TARGET}-ld")
Lucio Andrés Illanes Albornoz b9a715
				-DCMAKE_SYSROOT=${PKG_PREFIX}
Lucio Andrés Illanes Albornoz b9a715
				-DCMAKE_SYSTEM_NAME=Midipix" || return 1;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
			case "${ARCH}" in
Lucio Andrés Illanes Albornoz b9a715
			nt32)	_cmake_args_auto="${_cmake_args_auto:+${_cmake_args_auto}}
Lucio Andrés Illanes Albornoz b9a715
					-DCMAKE_SYSTEM_PROCESSOR=i686"; ;;
Lucio Andrés Illanes Albornoz b9a715
			nt64)	_cmake_args_auto="${_cmake_args_auto:+${_cmake_args_auto}}
Lucio Andrés Illanes Albornoz b9a715
					-DCMAKE_SYSTEM_PROCESSOR=x86_64"; ;;
Lucio Andrés Illanes Albornoz b9a715
			esac; ;;
Lucio Andrés Illanes Albornoz b9a715
		esac;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		IFS="
Lucio Andrés Illanes Albornoz b9a715
	";	"${PKG_CMAKE}"							\
Lucio Andrés Illanes Albornoz b9a715
			${_cmake_args_auto}					\
Lucio Andrés Illanes Albornoz b9a715
			${PKG_CMAKE_ARGS:-}					\
Lucio Andrés Illanes Albornoz b9a715
			${PKG_CMAKE_ARGS_EXTRA:-}				\
Lucio Andrés Illanes Albornoz b9a715
		       	"${PKG_BASE_DIR}/${PKG_SUBDIR}";
Lucio Andrés Illanes Albornoz b9a715
		_rc=$((${?} ? ${?} : ${_rc})); IFS="${_IFS0}";
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		rtl_export_vars	-u						\
Lucio Andrés Illanes Albornoz b9a715
			PKG_CONFIG		"${PKG_PKG_CONFIG:-}"		\
Lucio Andrés Illanes Albornoz b9a715
			PKG_CONFIG_LIBDIR	"${PKG_PKG_CONFIG_LIBDIR:-}"	\
Lucio Andrés Illanes Albornoz b9a715
			PYTHON			"${PKG_PYTHON:-}";
Lucio Andrés Illanes Albornoz b9a715
	fi;
Lucio Andrés Illanes Albornoz b9a715
	return "${_rc}";
Lucio Andrés Illanes Albornoz b9a715
};
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
pkgp_configure_sofort() {
Lucio Andrés Illanes Albornoz b9a715
	local _rc=0 _vname="" _vnames="" _vval="";
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
	if ! [ -x "${PKG_CONFIGURE:-}" ]; then
Lucio Andrés Illanes Albornoz b9a715
		return 2;
Lucio Andrés Illanes Albornoz b9a715
	elif ! [ -d "${PKG_BASE_DIR}/${PKG_SUBDIR}/sofort" ]\
Lucio Andrés Illanes Albornoz b9a715
	&&   ! [ "${PKG_CONFIGURE_TYPE:-}" = "sofort" ]; then
Lucio Andrés Illanes Albornoz b9a715
		return 2;
Lucio Andrés Illanes Albornoz b9a715
	else
Lucio Andrés Illanes Albornoz b9a715
		for _vname in AR CC CXX LD RANLIB; do
Lucio Andrés Illanes Albornoz b9a715
			if eval [ '"${PKG_'"${_vname}"':+1}"' = 1 ]; then
Lucio Andrés Illanes Albornoz b9a715
				_vnames="${_vnames:+${_vnames} }${_vname}";
Lucio Andrés Illanes Albornoz b9a715
				eval ${_vname}='${PKG_'"${_vname}"'}'; export ${_vname};
Lucio Andrés Illanes Albornoz b9a715
			fi;
Lucio Andrés Illanes Albornoz b9a715
			if eval [ '"${PKG_SOFORT_NATIVE_'"${_vname}"':+1}"' = 1 ]; then
Lucio Andrés Illanes Albornoz b9a715
				_vnames="${_vnames:+${_vnames} }NATIVE_${_vname}";
Lucio Andrés Illanes Albornoz b9a715
				eval NATIVE_${_vname}='${PKG_SOFORT_NATIVE_'"${_vname}"'}'; export NATIVE_${_vname};
Lucio Andrés Illanes Albornoz b9a715
			fi;
Lucio Andrés Illanes Albornoz b9a715
		done;
Lucio Andrés Illanes Albornoz b9a715
		for _vname in CFLAGS CPPFLAGS CXXFLAGS LDFLAGS; do
Lucio Andrés Illanes Albornoz b9a715
			if eval [ '"${PKG_'"${_vname}"'_CONFIGURE:+1}"' = 1 ]; then
Lucio Andrés Illanes Albornoz b9a715
				eval _vval='${PKG_'"${_vname}"'_CONFIGURE}';
Lucio Andrés Illanes Albornoz b9a715
				if eval [ '"${PKG_'"${_vname}"'_CONFIGURE_EXTRA:+1}"' = 1 ]; then
Lucio Andrés Illanes Albornoz b9a715
					eval _vval='${_vval:+${_vval} }${PKG_'"${_vname}"'_CONFIGURE_EXTRA}';
Lucio Andrés Illanes Albornoz b9a715
				fi;
Lucio Andrés Illanes Albornoz b9a715
				_vnames="${_vnames:+${_vnames} }${_vname} ${_vname}_SHARED ${_vname}_STATIC";
Lucio Andrés Illanes Albornoz b9a715
				eval ${_vname}='${_vval}'\; ${_vname}_SHARED='${_vval}'\; ${_vname}_STATIC='${_vval}';
Lucio Andrés Illanes Albornoz b9a715
				export ${_vname} ${_vname}_SHARED ${_vname}_STATIC;
Lucio Andrés Illanes Albornoz b9a715
			fi;
Lucio Andrés Illanes Albornoz b9a715
			if eval [ '"${PKG_SOFORT_NATIVE_'"${_vname}"':+1}"' = 1 ]; then
Lucio Andrés Illanes Albornoz b9a715
				eval _vval='${PKG_SOFORT_NATIVE_'"${_vname}"'}';
Lucio Andrés Illanes Albornoz b9a715
				if eval [ '"${PKG_SOFORT_NATIVE_'"${_vname}"'_EXTRA:+1}"' = 1 ]; then
Lucio Andrés Illanes Albornoz b9a715
					eval _vval='${_vval:+${_vval} }${PKG_SOFORT_NATIVE_'"${_vname}"'_EXTRA}';
Lucio Andrés Illanes Albornoz b9a715
				fi;
Lucio Andrés Illanes Albornoz b9a715
				_vnames="${_vnames:+${_vnames} }NATIVE_${_vname}";
Lucio Andrés Illanes Albornoz b9a715
				eval NATIVE_${_vname}='${_vval}'; export NATIVE_${_vname};
Lucio Andrés Illanes Albornoz b9a715
			fi;
Lucio Andrés Illanes Albornoz b9a715
		done;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		RANLIB="${PKG_RANLIB}"				\
Lucio Andrés Illanes Albornoz b9a715
			"${PKG_CONFIGURE}"			\
Lucio Andrés Illanes Albornoz b9a715
				${PKG_CONFIGURE_ARGS:-}		\
Lucio Andrés Illanes Albornoz b9a715
				${PKG_CONFIGURE_ARGS_EXTRA:-}	\
Lucio Andrés Illanes Albornoz b9a715
				${PKG_CONFIGURE_ARGS_EXTRA_DEBUG:-};
Lucio Andrés Illanes Albornoz b9a715
		_rc=$((${?} ? 1 : ${_rc}));
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		for _vname in ${_vnames}; do
Lucio Andrés Illanes Albornoz b9a715
			unset "${_vname}";
Lucio Andrés Illanes Albornoz b9a715
		done;
Lucio Andrés Illanes Albornoz b9a715
		return "${_rc}";
Lucio Andrés Illanes Albornoz b9a715
	fi;
Lucio Andrés Illanes Albornoz b9a715
};
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
pkg_configure() {
Lucio Andrés Illanes Albornoz b9a715
	local _rc=0 _type="";
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
	for _type in autotools sofort cmake; do
Lucio Andrés Illanes Albornoz b9a715
		if [ "${PKG_CONFIGURE_TYPE:+1}" = 1 ]\
Lucio Andrés Illanes Albornoz b9a715
		&& [ "${PKG_CONFIGURE_TYPE}" != "${_type}" ]; then
Lucio Andrés Illanes Albornoz b9a715
			continue;
Lucio Andrés Illanes Albornoz b9a715
		else
Lucio Andrés Illanes Albornoz b9a715
			pkgp_configure_${_type} "${@}"; _rc="${?}";
Lucio Andrés Illanes Albornoz b9a715
			case "${_rc}" in
Lucio Andrés Illanes Albornoz b9a715
			0|1)	return "${_rc}"; ;;
Lucio Andrés Illanes Albornoz b9a715
			2)	_rc=0; continue; ;;
Lucio Andrés Illanes Albornoz b9a715
			esac;
Lucio Andrés Illanes Albornoz b9a715
		fi;
Lucio Andrés Illanes Albornoz b9a715
	done;
Lucio Andrés Illanes Albornoz b9a715
	return "${_rc}";
Lucio Andrés Illanes Albornoz b9a715
};
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
# vim:filetype=sh textwidth=0