Blame subr.pkg/pkg_configure.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
8d7a8a
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
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() {
b70ff5
	local _ppca_rc=0;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
	if ! [ -x "${PKG_CONFIGURE:-}" ]; then
e9fa07
		_ppca_rc=2;
Lucio Andrés Illanes Albornoz b9a715
	elif [ -d "${PKG_BASE_DIR}/${PKG_SUBDIR}/sofort" ]\
e9fa07
	||   [ "${PKG_CONFIGURE_TYPE:-}" = "sofort" ];
e9fa07
	then
e9fa07
		_ppca_rc=2;
Lucio Andrés Illanes Albornoz b9a715
	else
938c5c
		ex_rtl_run_configure								\
b70ff5
			"${PKG_AR}" "${PKG_CC}" "${PKG_CONFIGURE}" "${PKG_CXX}" "${PKG_LD}"	\
b70ff5
			"${PKG_LIBTOOL}" "${PKG_PKG_CONFIG}" "${PKG_PYTHON:-}" "${PKG_RANLIB}"	\
b70ff5
			--									\
b70ff5
			"${PKG_CONFIGURE_ARGS:-}" "${PKG_CONFIGURE_ARGS_EXTRA:-}"		\
b70ff5
			"${PKG_CONFIGURE_ARGS_LIST:-}" "${PKG_CONFIGURE_ARGS_EXTRA_LIST:-}"	\
b70ff5
			--									\
b70ff5
			"${PKG_CFLAGS_CONFIGURE:-}" "${PKG_CFLAGS_CONFIGURE_EXTRA:-}"		\
b70ff5
			"${PKG_CPPFLAGS_CONFIGURE:-}" "${PKG_CPPFLAGS_CONFIGURE_EXTRA:-}"	\
b70ff5
			"${PKG_CXXFLAGS_CONFIGURE:-}" "${PKG_CXXFLAGS_CONFIGURE_EXTRA:-}"	\
b70ff5
			"${PKG_LDFLAGS_CONFIGURE:-}" "${PKG_LDFLAGS_CONFIGURE_EXTRA:-}"		\
b70ff5
			"${PKG_PKG_CONFIG_LIBDIR:-}"						\
b70ff5
			;
b70ff5
		_ppca_rc=$((${?} ? 1 : ${_ppca_rc}));
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
e9fa07
e9fa07
	return "${_ppca_rc}";
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() {
b70ff5
	local _ppcc_build_type="" _ppcc_rc=0 _ppcc_system_name="" _ppcc_system_processor="";
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
e9fa07
		_ppcc_rc=2;
Lucio Andrés Illanes Albornoz b9a715
	else
Lucio Andrés Illanes Albornoz b9a715
		case "${BUILD_KIND}" in
e9fa07
		debug)		_ppcc_build_type="debug"; ;;
e9fa07
		release|*)	_ppcc_build_type="release"; ;;
Lucio Andrés Illanes Albornoz b9a715
		esac;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
		case "${PKG_BUILD_TYPE}" in
Lucio Andrés Illanes Albornoz b9a715
		native)
b70ff5
			_ppcc_system_name="Midipix";
Lucio Andrés Illanes Albornoz b9a715
			case "${ARCH}" in
b70ff5
			nt32)	_ppcc_system_processor="i686"; ;;
b70ff5
			nt64)	_ppcc_system_processor="x86_64"; ;;
b70ff5
			esac;
Lucio Andrés Illanes Albornoz b9a715
		esac;
Lucio Andrés Illanes Albornoz b9a715
938c5c
		ex_rtl_run_configure_cmake							\
b70ff5
			"${PKG_AR}" "${PKG_CC}" "${ARG_CCACHE}" "${PKG_CMAKE}" "${PKG_CXX}"	\
b70ff5
			"${PKG_LD}" "${PKG_PKG_CONFIG}" "${PKG_PYTHON:-}" "${PKG_RANLIB}"	\
b70ff5
			--									\
b70ff5
			"${_ppcc_build_type}" "${PKG_CMAKE_ARGS:-}" "${PKG_CMAKE_ARGS_EXTRA:-}"	\
b70ff5
			"${PKG_PREFIX}" "${PKG_BASE_DIR}/${PKG_SUBDIR}" "${_ppcc_system_name}"	\
b70ff5
			"${_ppcc_system_processor}"						\
b70ff5
			--									\
b70ff5
			"${PKG_CFLAGS_CONFIGURE:-}" "${PKG_CFLAGS_CONFIGURE_EXTRA:-}"		\
b70ff5
			"${PKG_CPPFLAGS_CONFIGURE:-}" "${PKG_CPPFLAGS_CONFIGURE_EXTRA:-}"	\
b70ff5
			"${PKG_CXXFLAGS_CONFIGURE:-}" "${PKG_CXXFLAGS_CONFIGURE_EXTRA:-}"	\
b70ff5
			"${PKG_LDFLAGS_CONFIGURE:-}" "${PKG_LDFLAGS_CONFIGURE_EXTRA:-}"		\
b70ff5
			"${PKG_PKG_CONFIG_LIBDIR:-}"						\
b70ff5
			;
b70ff5
		_ppcc_rc=$((${?} ? 1 : ${_ppcc_rc}));
Lucio Andrés Illanes Albornoz b9a715
	fi;
e9fa07
e9fa07
	return "${_ppcc_rc}";
Lucio Andrés Illanes Albornoz b9a715
};
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
pkgp_configure_sofort() {
e9fa07
	local _ppcs_rc=0 _ppcs_vname="" _ppcs_vnames="" _ppcs_vval="";
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
	if ! [ -x "${PKG_CONFIGURE:-}" ]; then
e9fa07
		_ppcs_rc=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
e9fa07
		_ppcs_rc=2;
Lucio Andrés Illanes Albornoz b9a715
	else
b70ff5
		for _ppcs_vname in AR CC CCLD CXX RANLIB; do
e9fa07
			if eval [ '"${PKG_'"${_ppcs_vname}"':+1}"' = 1 ]; then
b70ff5
				if [ "${_ppcs_vname}" = CCLD ]; then
b70ff5
					_ppcs_vnames="${_ppcs_vnames:+${_ppcs_vnames} }LD";
b70ff5
					eval LD='${PKG_'"${_ppcs_vname}"'}'; export LD;
b70ff5
				else
b70ff5
					_ppcs_vnames="${_ppcs_vnames:+${_ppcs_vnames} }${_ppcs_vname}";
b70ff5
					eval ${_ppcs_vname}='${PKG_'"${_ppcs_vname}"'}'; export ${_ppcs_vname};
b70ff5
				fi;
Lucio Andrés Illanes Albornoz b9a715
			fi;
e9fa07
e9fa07
			if eval [ '"${PKG_SOFORT_NATIVE_'"${_ppcs_vname}"':+1}"' = 1 ]; then
e9fa07
				_ppcs_vnames="${_ppcs_vnames:+${_ppcs_vnames} }NATIVE_${_ppcs_vname}";
e9fa07
				eval NATIVE_${_ppcs_vname}='${PKG_SOFORT_NATIVE_'"${_ppcs_vname}"'}'; export NATIVE_${_ppcs_vname};
Lucio Andrés Illanes Albornoz b9a715
			fi;
Lucio Andrés Illanes Albornoz b9a715
		done;
e9fa07
e9fa07
		for _ppcs_vname in CFLAGS CPPFLAGS CXXFLAGS LDFLAGS; do
e9fa07
			if eval [ '"${PKG_'"${_ppcs_vname}"'_CONFIGURE:+1}"' = 1 ]; then
e9fa07
				eval _ppcs_vval='${PKG_'"${_ppcs_vname}"'_CONFIGURE}';
e9fa07
				if eval [ '"${PKG_'"${_ppcs_vname}"'_CONFIGURE_EXTRA:+1}"' = 1 ]; then
e9fa07
					eval _ppcs_vval='${_ppcs_vval:+${_ppcs_vval} }${PKG_'"${_ppcs_vname}"'_CONFIGURE_EXTRA}';
Lucio Andrés Illanes Albornoz b9a715
				fi;
e9fa07
				_ppcs_vnames="${_ppcs_vnames:+${_ppcs_vnames} }${_ppcs_vname} ${_ppcs_vname}_SHARED ${_ppcs_vname}_STATIC";
e9fa07
				eval ${_ppcs_vname}='${_ppcs_vval}'\; ${_ppcs_vname}_SHARED='${_ppcs_vval}'\; ${_ppcs_vname}_STATIC='${_ppcs_vval}';
e9fa07
				export ${_ppcs_vname} ${_ppcs_vname}_SHARED ${_ppcs_vname}_STATIC;
Lucio Andrés Illanes Albornoz b9a715
			fi;
e9fa07
e9fa07
			if eval [ '"${PKG_SOFORT_NATIVE_'"${_ppcs_vname}"':+1}"' = 1 ]; then
e9fa07
				eval _ppcs_vval='${PKG_SOFORT_NATIVE_'"${_ppcs_vname}"'}';
e9fa07
				if eval [ '"${PKG_SOFORT_NATIVE_'"${_ppcs_vname}"'_EXTRA:+1}"' = 1 ]; then
e9fa07
					eval _ppcs_vval='${_ppcs_vval:+${_ppcs_vval} }${PKG_SOFORT_NATIVE_'"${_ppcs_vname}"'_EXTRA}';
Lucio Andrés Illanes Albornoz b9a715
				fi;
e9fa07
				_ppcs_vnames="${_ppcs_vnames:+${_ppcs_vnames} }NATIVE_${_ppcs_vname}";
e9fa07
				eval NATIVE_${_ppcs_vname}='${_ppcs_vval}'; export NATIVE_${_ppcs_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:-}		\
1cbe20
				${PKG_CONFIGURE_ARGS_EXTRA:-};
e9fa07
		_ppcs_rc=$((${?} ? 1 : ${_ppcs_rc}));
Lucio Andrés Illanes Albornoz b9a715
e9fa07
		for _ppcs_vname in ${_ppcs_vnames}; do
e9fa07
			unset "${_ppcs_vname}";
Lucio Andrés Illanes Albornoz b9a715
		done;
Lucio Andrés Illanes Albornoz b9a715
	fi;
e9fa07
e9fa07
	return "${_ppcs_rc}";
Lucio Andrés Illanes Albornoz b9a715
};
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
pkg_configure() {
e9fa07
	local	_pc_group_name="${1}" _pc_pkg_name="${2}" _pc_restart_at="${3}"	\
e9fa07
		_pc_rc=0 _pc_type="";
Lucio Andrés Illanes Albornoz b9a715
e9fa07
	for _pc_type in autotools sofort cmake; do
Lucio Andrés Illanes Albornoz b9a715
		if [ "${PKG_CONFIGURE_TYPE:+1}" = 1 ]\
e9fa07
		&& [ "${PKG_CONFIGURE_TYPE}" != "${_pc_type}" ]; then
Lucio Andrés Illanes Albornoz b9a715
			continue;
Lucio Andrés Illanes Albornoz b9a715
		else
e9fa07
			pkgp_configure_${_pc_type} "${@}"; _pc_rc="${?}";
e9fa07
			case "${_pc_rc}" in
e9fa07
			0|1)	return "${_pc_rc}"; ;;
e9fa07
			2)	_pc_rc=0; continue; ;;
Lucio Andrés Illanes Albornoz b9a715
			esac;
Lucio Andrés Illanes Albornoz b9a715
		fi;
Lucio Andrés Illanes Albornoz b9a715
	done;
e9fa07
	return "${_pc_rc}";
Lucio Andrés Illanes Albornoz b9a715
};
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
# vim:filetype=sh textwidth=0