blob: a25a4c28d2e71c6e6e47da2d6aa7c5849427d0ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#
# . ./build.vars and set -o errexit are assumed.
#
if [ ${ARG_TARBALL:-0} -eq 0 ]; then
log_msg "Skipping distribution tarball creation.";
exit 0;
else
log_msg info "Building distribution tarballs...";
update_build_status build_finish tarball_start;
cd ${PREFIX};
if [ "${TARBALL_SUFFIX}" = "bz2" ]; then
TARBALL_COMPRESS_CMD="bzip2";
elif [ "${TARBALL_SUFFIX}" = "gz" ]; then
TARBALL_COMPRESS_CMD="gzip";
elif [ "${TARBALL_SUFFIX}" = "xz" ]; then
TARBALL_COMPRESS_CMD="xz";
else
log_msg failexit "Unknown tarball suffix \`.${TARBALL_SUFFIX}'.";
fi;
TARBALL_FNAME=${TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX};
TARBALL_SRC_FNAME=${TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX};
fi;
PREFIX_BASENAME=${PREFIX_NATIVE##*/};
rm_if_exists -m ${PREFIX_BASENAME}/lib.bak;
tar -C ${PREFIX_BASENAME}/lib -cpf - . | tar -C ${PREFIX_BASENAME}/lib.bak -xpf -;
log_msg info "Backed up ${PREFIX_BASENAME}/lib.";
find native/lib -maxdepth 1 -type l \
-exec sh -c '[ -f "${DEST:=native/lib/$(readlink -- "${0}")}" ] && \
rm -f -- "${0}" && ln -f -- "${DEST}" "${0}"' {} \;;
log_msg info "Converted symbolic links in ${PREFIX_BASENAME}/lib to hard links.";
tar -cpf - $(find_with_no_paths "${TARBALL_EXCLUDE_PATHS} native/lib.bak" . \
-mindepth 1 -maxdepth 2 -type d -not -path ./native) \
"Create \`Midipix mintty shell' shortcut.vbs" midipix.sh README |\
${TARBALL_COMPRESS_CMD} -c > ${TARBALL_FNAME};
log_msg info "Finished building binary distribution tarball.";
if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] &&\
gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
gpg --armor --passphrase-file /dev/null \
--local-user "${TARBALL_SIGN_GPG_KEY}" --sign ${TARBALL_FNAME};
log_msg info "Signed binary distribution tarball.";
fi;
rm -rf ${PREFIX_BASENAME}/lib; mv ${PREFIX_BASENAME}/lib.bak ${PREFIX_BASENAME}/lib;
log_msg info "Restored ${PREFIX_BASENAME}/lib.";
log_msg info "Building source tarball...";
tar -cpf - $(find tmp -mindepth 1 -maxdepth 1 -type d) |\
${TARBALL_COMPRESS_CMD} -c > ${TARBALL_SRC_FNAME};
log_msg info "Finished building source tarball.";
if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SRC_SIGN_GPG_KEY}" ] &&\
gpg --list-keys "${TARBALL_SRC_SIGN_GPG_KEY}" >/dev/null 2>&1; then
gpg --armor --passphrase-file /dev/null \
--local-user "${TARBALL_SRC_SIGN_GPG_KEY}" --sign ${TARBALL_SRC_FNAME};
log_msg info "Signed source tarball.";
fi;
update_build_status tarball_finish;
# vim:filetype=sh
|