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) 820be1
# . ./build.vars and set -o errexit -o noglob 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) 820be1
log_msg info "Building distribution tarballs...";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
cd ${PREFIX};
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
if [ "${TARBALL_SUFFIX}" = "bz2" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	if [ -n "$(which pbzip2 2>/dev/null)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		TARBALL_COMPRESS_CMD="pbzip2";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		TARBALL_COMPRESS_CMD="bzip2";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
elif [ "${TARBALL_SUFFIX}" = "gz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	if [ -n "$(which pigz 2>/dev/null)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		TARBALL_COMPRESS_CMD="pigz";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		TARBALL_COMPRESS_CMD="gzip";
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
elif [ "${TARBALL_SUFFIX}" = "xz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	TARBALL_COMPRESS_CMD="xz";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	TARBALL_COMPRESS_ARGS="-T0";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
else
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	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
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
PREFIX_BASENAME=${PREFIX_NATIVE##*/};
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
TARBALL_FNAME=${TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX};	
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
TARBALL_MINIPIX_FNAME=${TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX};	
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
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
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
secure_rm ${PREFIX_BASENAME}/lib.bak;
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
insecure_mkdir ${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) b6f92f
for __ in $(find native/lib -maxdepth 1 -type l); do
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
	___="native/lib/$(readlink -- ${__})";
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
	if [ -f "${___}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
		secure_rm ${__}; ln -f -- "${___}" "${__}";
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
done;
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) 820be1
tar -cpf - $(find . -maxdepth 2 -mindepth 1 -type d				\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		-not -path ./native -not -path ./native/lib.bak			\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		-not -path ./tmp -not -path ./tmp/\*)				\
Lucio Andrés Illanes Albornoz (arab, vxp) d5465d
	"Create \`Midipix mintty shell' shortcut.vbs" midipix.sh README		|\
Lucio Andrés Illanes Albornoz (arab, vxp) 4ca510
${TARBALL_COMPRESS_CMD} ${TARBALL_COMPRESS_ARGS} -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) afe7b9
secure_rm ${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) f42965
tar -cpf - minipix 								\
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
	"Create \`Midipix mintty shell' shortcut.vbs" midipix.sh README		|\
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
${TARBALL_COMPRESS_CMD} ${TARBALL_COMPRESS_ARGS} -c > ${TARBALL_MINIPIX_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
log_msg info "Finished building binary Minipix distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_MINIPIX_SIGN_GPG_KEY}" ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
			gpg --list-keys "${TARBALL_MINIPIX_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
	gpg --armor --passphrase-file /dev/null					\
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
		--local-user "${TARBALL_MINIPIX_SIGN_GPG_KEY}" --sign ${TARBALL_MINIPIX_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
	log_msg info "Signed binary Minipix distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
if [ "${BUILD}" = "debug" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	log_msg info "Building source tarball...";
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
	tar -cpf - $(find tmp -mindepth 2 -maxdepth 2				\
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
		-not -path tmp/.\*						\
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
		-not -path tmp/ntctty/.git -not -path tmp/psxscl/.git)		|\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	${TARBALL_COMPRESS_CMD} ${TARBALL_COMPRESS_ARGS} -c > ${TARBALL_SRC_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	log_msg info "Finished building source tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SRC_SIGN_GPG_KEY}" ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
				gpg --list-keys "${TARBALL_SRC_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
		gpg --armor --passphrase-file /dev/null				\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
			--local-user "${TARBALL_SRC_SIGN_GPG_KEY}" --sign ${TARBALL_SRC_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		log_msg info "Signed source tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	fi;
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
# vim:filetype=sh