#
# set +o errexit -o noglob is assumed.
#

pkg_libzip_configure() {
	local _build_type="";
	case "${BUILD}" in
	debug)		_build_type="Debug"; ;;
	release) 	_build_type="Release"; ;;
	*)		exit 1; ;;
	esac;
	rm -f config.cache;
	env	CFLAGS="-L${PKG_PREFIX}/lib --sysroot=${PKG_PREFIX}"		\
		PREFIX="" LDFLAGS="-lbz2"					\
	cmake	-DBZIP2_INCLUDE_DIR="${PKG_PREFIX}/include"			\
		-DBZIP2_LIBRARIES="${PKG_PREFIX}/lib/libbz2.lib.a"		\
		-DCMAKE_AR="${PREFIX}/bin/${PKG_AR}"				\
		-DCMAKE_BUILD_TYPE="${_build_type}"				\
		-DCMAKE_C_COMPILER="${PREFIX}/bin/${PKG_CC}"			\
		-DCMAKE_C_STANDARD_LIBRARIES="-lbz2 -lfts"			\
		-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY			\
		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER			\
		-DCMAKE_INSTALL_PREFIX=						\
		-DCMAKE_RANLIB="${PREFIX}/bin/${PKG_RANLIB}"			\
		-DCMAKE_SYSTEM_NAME="Midipix"					\
		-DENABLE_GNUTLS=:BOOL=OFF					\
		-DENABLE_MBEDTLS=:BOOL=OFF					\
		-DOPENSSL_CRYPTO_LIBRARY="${PKG_PREFIX}/lib/libcrypto.lib.a"	\
		-DOPENSSL_SSL_LIBRARY="${PKG_PREFIX}/lib/libssl.lib.a"		\
		-DZLIB_INCLUDE_DIR="${PKG_PREFIX}/include"			\
		-DZLIB_LIBRARY="${PKG_PREFIX}/lib/libz.a"			\
		-DLIBLZMA_INCLUDE_DIR="${PKG_PREFIX}/include"                   \
		-DLIBLZMA_LIBRARY="${PKG_PREFIX}/lib/liblzma.lib.a"             \
		"../libzip-${PKG_VERSION}";
};

pkg_libzip_host_configure() {
	local _build_type="";
	case "${BUILD}" in
	debug)		_build_type="Debug"; ;;
	release) 	_build_type="Release"; ;;
	*)		exit 1; ;;
	esac;
	rm -f config.cache;
	env	PREFIX="" LDFLAGS="-L${PKG_PREFIX}/lib -lbz2 -lfts -lssl"	\
	cmake	-DCMAKE_BUILD_TYPE="${_build_type}"				\
		-DCMAKE_C_STANDARD_LIBRARIES="-lbz2 -lcrypto -lfts"		\
		-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY			\
		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER			\
		-DCMAKE_INSTALL_PREFIX=						\
		-DENABLE_GNUTLS=:BOOL=OFF					\
		-DENABLE_MBEDTLS=:BOOL=OFF					\
		"../libzip-${PKG_VERSION}";
};

# vim:filetype=sh