midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame pkg.build

Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
parse_with_pkg_name ${2}				\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	bash binutils binutils_host coreutils diffutils	\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	findutils gawk gmp grep libelf make mpc mpfr	\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	patch sed;
lalbornoz 340f4c
if is_build_script_done finished; then
lalbornoz 340f4c
        exit 212;
lalbornoz 340f4c
else
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	fetch ${PKG_URL} ${PKG_SHA256SUM};
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	if [ "x${SCRIPT_FNAME%[0-9][0-9]*}" = "x1" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		_configure_args="--host=${HOST_NATIVE} --prefix=${PKG_PREFIX:-/}";
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		PKG_NO_CONFIG_CACHE=1;
Lucio Andrés Illanes Albornoz (arab, vxp) fa26ee
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		_configure_args=${PKG_CONFIGURE_ARGS:--C --host=${HOST_NATIVE} --prefix=};
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d3841
	if [ ${PKG_NO_DESTDIR:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d3841
		: ${DESTDIR:=${PREFIX_NATIVE}};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d3841
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	set_build_dir ${PKG_SUBDIR} ${PKG_BUILD_TYPE:-native};
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done extracted; 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};
lalbornoz 340f4c
	set_build_script_done extracted -patched;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done patched; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	if [ -n "${PKG_PATCHES_EXTRA}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		(rm_if_exists -m -c ${PKG_SUBDIR}-patches-extra;
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
		wget -c -nd -np -r -R \*.htm\* -R \*.sig ${PKG_PATCHES_EXTRA}
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
		for _patch_fname in			\
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
				$(find . -type f -not -iname \*.sig | sort); do
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
			patch -d ../${PKG_SUBDIR} -p0	\
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
				< ${_patch_fname};
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
		done;
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
		for _patch_fname in ${PKG_PATCHES_EXTRA_MANIFEST}; do
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
			_patch_sha256sum=${2}; shift;
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
			if ! compare_hash ${_patch_fname} ${_patch_sha256sum}; then
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
				log_msg fail "Error: hash mismatch for patch file \`${_patch_fname}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
				exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
		done); wait;
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	patch -d ${PKG_SUBDIR} -p1			\
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		< portage/${PKG_SUBDIR}.midipix.patch;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	if [ ${PKG_NO_LIBTOOL_MIDIPIX:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		cp portage/libtool.midipix ${PKG_SUBDIR}/;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	fi;
lalbornoz 340f4c
	set_build_script_done patched -configured;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done configured; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	rm_if_exists -m -c ${BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	[ ${PKG_NO_CONFIG_CACHE:-0} -eq 0 ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
		cp ../portage/config.cache .;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	../${PKG_SUBDIR}/configure			\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		${_configure_args}			\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		--target=${TARGET}			\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		${PKG_CONFIGURE_EXTRA_ARGS};
lalbornoz 340f4c
	set_build_script_done configured -built;
lalbornoz 340f4c
else
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	cd ${BUILD_DIR};
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done built; then
lalbornoz 340f4c
	make ${MAKEFLAGS};
lalbornoz 340f4c
	set_build_script_done built -installed;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
if ! is_build_script_done installed1; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	make ${MAKEFLAGS} ${DESTDIR:+DESTDIR=${DESTDIR}} install;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	set_build_script_done installed1 -installed2 -finished;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
if [ -n "${PKG_PREFIX_EXTRA}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
&& ! is_build_script_done installed2; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	make DESTDIR=${PKG_PREFIX_EXTRA} install;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	set_build_script_done installed2 -finished;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
elif command -v pkg_${PKG_NAME}_install_post >/dev/null; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
	pkg_${PKG_NAME}_install_post;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
set_build_script_done finished;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh