midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame pkg.build

Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
# . ./build.vars and set -o errexit are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
# Order for build level 2 (runtime:) psxtypes pemagine dalist ntapi psxscl ntcon ntctty
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
parse_with_pkg_name ${2}					\
Lucio Andrés Illanes Albornoz (arab, vxp) fb434b
	apk_tools bash binutils binutils_host bzip2 coreutils	\
Lucio Andrés Illanes Albornoz (arab, vxp) 6b41d7
	dalist dash diffutils findutils gawk git gmp		\
Lucio Andrés Illanes Albornoz (arab, vxp) 06ec5b
	grep gzip less libelf libressl libz make mpc mpfr	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36eb07
	ncurses	ntapi ntcon ntctty openssh patch pemagine	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36eb07
	popt psxscl psxstub psxtypes rsync sed tar util_linux	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36eb07
	which xz;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
case "${SCRIPT_FNAME%[0-9][0-9]*}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
1)	_configure_args="--host=${HOST_NATIVE} --prefix=${PKG_PREFIX:-/} --target=${TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	PKG_NO_CONFIG_CACHE=1; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
2)
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	_configure_args="--prefix=${PREFIX_LVL} --host=${HOST_NATIVE}";
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	PKG_BUILD_TYPE=cross; PKG_URL_TYPE=git;
Lucio Andrés Illanes Albornoz (arab, vxp) 06ec5b
	PKG_NO_CONFIG_CACHE=${PKG_NO_DESTDIR:=${PKG_NO_EXTRACT:=${PKG_NO_LIBTOOL_MIDIPIX:=1}}};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	PKG_UNSET_VARS_BUILD="CC LD CFLAGS LDFLAGS PREFIX";
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	export CFLAGS_PATH=-I${PREFIX_LVL}/include;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	export LDFLAGS_PATH=-L${PREFIX_LVL}/lib;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	;;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
*)	_configure_args=${PKG_CONFIGURE_ARGS:--C --host=${HOST_NATIVE} --prefix= --target=${TARGET}}; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done fetch; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	if [ "x${PKG_URL_TYPE:-wget}" = "xwget" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		rm_if_exists $(get_basename ${PKG_URL});
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		fetch ${PKG_URL} ${PKG_SHA256SUM};
Lucio Andrés Illanes Albornoz (arab, vxp) fa26ee
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		rm_if_exists ${PKG_SUBDIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		fetch_git ${PKG_SUBDIR} ${PKG_URL} "${PKG_GIT_ARGS_EXTRA}";
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		PKG_NO_EXTRACT=1;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d3841
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done fetch -extract;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
else
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	[ "x${PKG_URL_TYPE:-wget}" = "xwget" ] || PKG_NO_EXTRACT=1;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
if command -v pkg_${PKG_NAME}_finish >/dev/null; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	pkg_${PKG_NAME}_finish; exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
elif [ ${PKG_NO_EXTRACT:-0} -eq 0 ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
! is_build_script_done extract; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	rm_if_exists ${PKG_SUBDIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	tar -axf ${PKG_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done extract -build_dir;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if [ -n "${PKG_BUILD_DIR}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	BUILD_DIR=${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
else
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_dir ${PKG_SUBDIR} ${PKG_BUILD_TYPE:-native};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done build_dir; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	[ ${PKG_SUBDIR} != ${BUILD_DIR} ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		rm_if_exists -m ${BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done build_dir -patch;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done patch; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	[ -f portage/${PKG_SUBDIR}.midipix.patch ] &&		\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		patch -b -d ${PKG_SUBDIR} -p1			\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			< portage/${PKG_SUBDIR}.midipix.patch;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	[ ${PKG_NO_PATCH_LOCAL:-0} -eq 0 ] &&			\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	[ -f ${_PWD}/${PKG_SUBDIR}.local.patch ] &&		\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		patch -b -d ${PKG_SUBDIR} -p1			\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			< ${_PWD}/${PKG_SUBDIR}.local.patch;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	if [ -n "${PKG_PATCHES_EXTRA_URL}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		apply_patches ${PKG_PATCHES_EXTRA_URL} ${PKG_SUBDIR};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		if [ -n "${PKG_PATCHES_EXTRA_MANIFEST}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			compare_hash_manifest ${PKG_PATCHES_EXTRA_MANIFEST};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	[ ${PKG_NO_CONFIG_CACHE:-0} -eq 0 ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		cp portage/config.cache ${BUILD_DIR}/;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	[ ${PKG_NO_LIBTOOL_MIDIPIX:-0} -eq 0 ] &&		\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		cp portage/libtool.midipix ${PKG_SUBDIR}/;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done patch -configure;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
cd ${BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if [ ${PKG_NO_CONFIGURE:-0} -eq 0 ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
&& ! is_build_script_done configure; then
Lucio Andrés Illanes Albornoz (arab, vxp) fb434b
	command -v pkg_${PKG_NAME}_configure_pre >/dev/null	\
Lucio Andrés Illanes Albornoz (arab, vxp) fb434b
		&& pkg_${PKG_NAME}_configure_pre;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	../${PKG_SUBDIR}/configure				\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		${_configure_args}				\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		${PKG_CONFIGURE_ARGS_EXTRA};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done configure clean -build;
lalbornoz 340f4c
else
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done clean;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if [ ${PKG_NO_CLEAN:-0} -eq 0 ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
&& ! is_build_script_done clean; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	make ${MAKEFLAGS} clean;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done clean -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done build; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if [ -n "${PKG_UNSET_VARS_BUILD}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		unset ${PKG_UNSET_VARS_BUILD}
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	make	${PKG_MAKEFLAGS_BUILD_EXTRA:+${PKG_MAKEFLAGS_BUILD_EXTRA}}\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		${MAKEFLAGS}					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		${AR:+AR=${AR}}					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		${CC:+CC=${CC}} ${CFLAGS:+"CFLAGS=${CFLAGS}"}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		${LD:+LD=${LD}} ${LDFLAGS:+"LDFLAGS=${LDFLAGS}"}\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		${RANLIB:+RANLIB=${RANLIB}};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done build -install1;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done install1; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if command -v pkg_${PKG_NAME}_install >/dev/null; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		pkg_${PKG_NAME}_install;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	elif [ ${PKG_NO_DESTDIR:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) fb434b
		make	${PKG_MAKEFLAGS_INSTALL_EXTRA:+${PKG_MAKEFLAGS_INSTALL_EXTRA}}\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${MAKEFLAGS}					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${AR:+AR=${AR}}					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${CC:+CC=${CC}} ${CFLAGS:+"CFLAGS=${CFLAGS}"}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${LD:+LD=${LD}} ${LDFLAGS:+"LDFLAGS=${LDFLAGS}"}\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${RANLIB:+RANLIB=${RANLIB}}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36eb07
			DESTDIR=${PREFIX_LVL}				\
Lucio Andrés Illanes Albornoz (arab, vxp) 36eb07
			${PKG_INSTALL_TARGET:-install};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	else
Lucio Andrés Illanes Albornoz (arab, vxp) fb434b
		make	${PKG_MAKEFLAGS_INSTALL_EXTRA:+${PKG_MAKEFLAGS_INSTALL_EXTRA}}\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${MAKEFLAGS}					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${AR:+AR=${AR}}					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${CC:+CC=${CC}} ${CFLAGS:+"CFLAGS=${CFLAGS}"}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${LD:+LD=${LD}} ${LDFLAGS:+"LDFLAGS=${LDFLAGS}"}\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${PREFIX:+PREFIX=${PREFIX}}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36eb07
			${RANLIB:+RANLIB=${RANLIB}}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36eb07
			${PKG_INSTALL_TARGET:-install};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done install1 -install2 -finish;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if [ -n "${PKG_PREFIX_EXTRA}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
&& ! is_build_script_done install2; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		make DESTDIR=${PKG_PREFIX_EXTRA} install;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done install2 -install3 -finish;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if command -v pkg_${PKG_NAME}_install_post >/dev/null\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
&& ! is_build_script_done install3; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	pkg_${PKG_NAME}_install_post;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done install3 -finish;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
set_build_script_done finish;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh