midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone
Blob Blame History Raw
#
# set -o errexit -o noglob are assumed.
#

pkgp_dist_tarball_dist() {
	TARBALL_FNAME="${DEFAULT_TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}";
	tar -cpf - $(find . -maxdepth 2 -mindepth 1 -type d				\
			-not -path ./${PREFIX_BASENAME} 				\
			-not -path ./${PREFIX_BASENAME}.bak				\
			-not -path ./${PREFIX_BASENAME}.bak/\*				\
			-not -path ./tmp -not -path ./tmp/\*)				\
		midipix_shortcut.vbs midipix.sh	README SHA256SUMS			|\
	"${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_FNAME}";
	ex_rtl_log_msg info "Finished building binary distribution tarball.";
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&		\
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
		gpg --armor --passphrase-file /dev/null					\
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_FNAME}";
		ex_rtl_log_msg info "Signed binary distribution tarball.";
	fi;
};

pkgp_dist_tarball_toolchain() {
	TARBALL_CROSS_FNAME="${DEFAULT_TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}";
	tar -cpf - bin include lib lib64 libexec share "${PKG_TARGET}"			|\
	"${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_CROSS_FNAME}";
	ex_rtl_log_msg info "Finished building toolchain tarball.";
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&		\
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
		gpg --armor --passphrase-file /dev/null					\
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_CROSS_FNAME}";
		ex_rtl_log_msg info "Signed toolchain tarball.";
	fi;
};

pkgp_dist_tarball_minipix() {
	TARBALL_MINIPIX_FNAME="${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}";
	tar -cpf - minipix 								\
		midipix_shortcut.vbs midipix.sh README					|\
	"${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_MINIPIX_FNAME}";
	ex_rtl_log_msg info "Finished building binary Minipix distribution tarball.";
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&		\
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
		gpg --armor --passphrase-file /dev/null					\
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_MINIPIX_FNAME}";
		ex_rtl_log_msg info "Signed binary Minipix distribution tarball.";
	fi;
};

pkgp_dist_tarball_src() {
	TARBALL_SRC_FNAME="${DEFAULT_TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}";
	ex_rtl_log_msg info "Building source tarball...";
	tar -cpf - $(find tmp -mindepth 2 -maxdepth 2				\
		-not -path tmp/.\*						\
		-not -path tmp/ntctty\*						\
		-not -path tmp/psxscl\*						\
		-not -path tmp/ptycon\*)					|\
	"${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_SRC_FNAME}";
	ex_rtl_log_msg info "Finished building source tarball.";
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&	\
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
		gpg --armor --passphrase-file /dev/null				\
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}";
		ex_rtl_log_msg info "Signed source tarball.";
	fi;
};

pkg_dist_tarballs_all() {
	ex_rtl_log_msg info "Building distribution tarballs...";
	case "${DEFAULT_TARBALL_SUFFIX}" in
	bz2)	if [ -n "$(which pbzip2 2>/dev/null)" ]; then
			TARBALL_COMPRESS_CMD="pbzip2";
		else
			TARBALL_COMPRESS_CMD="bzip2";
		fi; ;;
	gz)	if [ -n "$(which pigz 2>/dev/null)" ]; then
			TARBALL_COMPRESS_CMD="pigz";
		else
			TARBALL_COMPRESS_CMD="gzip";
		fi; ;;
	xz)	TARBALL_COMPRESS_CMD="xz";
		TARBALL_COMPRESS_ARGS="-T0"; ;;
	*)	ex_rtl_log_msg failexit "Unknown tarball suffix \`.${DEFAULT_TARBALL_SUFFIX}'.";
	esac;
	ex_rtl_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}";
	pkgp_dist_tarball_dist; pkgp_dist_tarball_toolchain; pkgp_dist_tarball_minipix;
	if [ "${BUILD}" = "debug" ]; then
		pkgp_dist_tarball_src;
	fi;
};

# vim:filetype=sh