midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame 300.coreutils.build

Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
parse_with_pkg_name ${2}				\
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
	coreutils diffutils findutils patch		\
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
	gawk bash make grep sed binutils;
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) 96b309
	if [ "x${PKG_NAME}" = "xbinutils" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	&& [ "x${3}" = "xhost" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 75a203
		_no_config_cache=${_no_destdir:=1};
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		_configure_args="--disable-werror --prefix=${PREFIX} --with-sysroot=${PREFIX_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		set_build_dir ${PKG_SUBDIR} cross;
Lucio Andrés Illanes Albornoz (arab, vxp) fa26ee
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 999fdc
		_no_config_cache=${_no_destdir:=0};
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		_configure_args="-C --host=${HOST_NATIVE} --prefix=";
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		set_build_dir ${PKG_SUBDIR} native;
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	_configure_args="${_configure_args}${PKG_CONFIGURE_EXTRA_ARGS:+ ${PKG_CONFIGURE_EXTRA_ARGS}}";
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;
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};
lalbornoz 340f4c
	[ ${_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) c49754
		${_configure_args} --target=${TARGET};
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;
lalbornoz 340f4c
if ! is_build_script_done installed; then
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
	if [ ${_no_destdir:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		make ${MAKEFLAGS} DESTDIR=${PREFIX_NATIVE} install;
lalbornoz 340f4c
	else
lalbornoz 340f4c
		make ${MAKEFLAGS} install;
lalbornoz 340f4c
	fi;
lalbornoz 340f4c
	set_build_script_done installed finished;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh