midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame 999.tarballs.build

Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
#
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
# . ./build.vars and set -o errexit are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
#
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
if [ ${ARG_TARBALL:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	log_msg "Skipping distribution tarball creation.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
else
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	log_msg info "Building distribution tarballs...";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	update_build_status build_finish tarball_start;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	cd ${PREFIX};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	if [ "${TARBALL_SUFFIX}" = "bz2" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		TARBALL_COMPRESS_CMD="bzip2";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	elif [ "${TARBALL_SUFFIX}" = "gz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		TARBALL_COMPRESS_CMD="gzip";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	elif [ "${TARBALL_SUFFIX}" = "xz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		TARBALL_COMPRESS_CMD="xz";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	else
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		log_msg failexit "Unknown tarball suffix \`.${TARBALL_SUFFIX}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	TARBALL_FNAME=${TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX};	
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	TARBALL_SRC_FNAME=${TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
PREFIX_BASENAME=${PREFIX_NATIVE##*/};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
rm_if_exists -m ${PREFIX_BASENAME}/lib.bak;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
tar -C ${PREFIX_BASENAME}/lib -cpf - . | tar -C ${PREFIX_BASENAME}/lib.bak -xpf -;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
log_msg info "Backed up ${PREFIX_BASENAME}/lib.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
find native/lib -maxdepth 1 -type l						\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	-exec sh -c '[ -f "${DEST:=native/lib/$(readlink -- "${0}")}" ] &&	\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		rm -f -- "${0}" && ln -f -- "${DEST}" "${0}"' {} \;;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
log_msg info "Converted symbolic links in ${PREFIX_BASENAME}/lib to hard links.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
tar -cpf - $(find_with_no_paths "${TARBALL_EXCLUDE_PATHS} native/lib.bak" .	\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		-mindepth 1 -maxdepth 2 -type d -not -path ./native)		\
Lucio Andrés Illanes Albornoz (arab, vxp) d5465d
	"Create \`Midipix mintty shell' shortcut.vbs" midipix.sh README		|\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
${TARBALL_COMPRESS_CMD} -c > ${TARBALL_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
log_msg info "Finished building binary distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
			gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	gpg --armor --passphrase-file /dev/null					\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		--local-user "${TARBALL_SIGN_GPG_KEY}" --sign ${TARBALL_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	log_msg info "Signed binary distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
rm -rf ${PREFIX_BASENAME}/lib; mv ${PREFIX_BASENAME}/lib.bak ${PREFIX_BASENAME}/lib;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
log_msg info "Restored ${PREFIX_BASENAME}/lib.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
log_msg info "Building source tarball...";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
tar -cpf - $(find tmp -mindepth 1 -maxdepth 1 -type d)				|\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
${TARBALL_COMPRESS_CMD} -c > ${TARBALL_SRC_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
log_msg info "Finished building source tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SRC_SIGN_GPG_KEY}" ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
			gpg --list-keys "${TARBALL_SRC_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	gpg --armor --passphrase-file /dev/null					\
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
		--local-user "${TARBALL_SRC_SIGN_GPG_KEY}" --sign ${TARBALL_SRC_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	log_msg info "Signed source tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
update_build_status tarball_finish;
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
# vim:filetype=sh