Change-Id: Ia6c5a6cadf707423a9236ea33248e35f1b0084bd
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
+mktemp_compat() {
+ case "$platform" in
+ macos*)
+ # On MacOSX, mktemp doesn't respect TMPDIR in the same way as many
+ # other systems. Use the final positional argument to force the
+ # tempfile or tempdir to be created inside $TMPDIR, which must
+ # already exist.
+ if [ -n "${TMPDIR}" ] ; then
+ mktemp "${@}" "${TMPDIR}/tmp.XXXXXXXXXX"
+ else
+ mktemp "${@}"
+ fi
+ ;;
+ *)
+ mktemp "${@}"
+ ;;
+ esac
+}
+
print_header "Build: Out of tree"
# Create and enter a temporary build directory
print_header "Build: Out of tree"
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
$MAKE dist
# Create and enter a temporary build directory
$MAKE dist
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
# Extract the distribution tar in the build directory,
cd "$builddir"
# Extract the distribution tar in the build directory,
print_header "Build: Distribution Out of tree"
# Create and enter a temporary build directory
print_header "Build: Distribution Out of tree"
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
# Run configure out of tree and generate the tar file
"$SRCDIR/configure" || failed_configure
$MAKE dist
cd "$builddir"
# Run configure out of tree and generate the tar file
"$SRCDIR/configure" || failed_configure
$MAKE dist
- dist_srcdir="$(mktemp -d)"
+ dist_srcdir="$(mktemp_compat -d)"
cd "$dist_srcdir"
# Extract the distribution tar in the new source directory,
cd "$dist_srcdir"
# Extract the distribution tar in the new source directory,
$TAR xvf "$builddir"/*.tar.* --strip 1
# Create and enter a second temporary build directory
$TAR xvf "$builddir"/*.tar.* --strip 1
# Create and enter a second temporary build directory
- builddir="$(mktemp -d)"
+ builddir="$(mktemp_compat -d)"
cd "$builddir"
# Run configure from the extracted distribution tar,
cd "$builddir"
# Run configure from the extracted distribution tar,
+mktemp_compat() {
+ case "$platform" in
+ macos*)
+ # On MacOSX, mktemp doesn't respect TMPDIR in the same way as many
+ # other systems. Use the final positional argument to force the
+ # tempfile or tempdir to be created inside $TMPDIR, which must
+ # already exist.
+ if [ -n "${TMPDIR}" ] ; then
+ mktemp "${@}" "${TMPDIR}/tmp.XXXXXXXXXX"
+ else
+ mktemp "${@}"
+ fi
+ ;;
+ *)
+ mktemp "${@}"
+ ;;
+ esac
+}
+
echo "Out of tree build"
# Create and enter a temporary build directory
echo "Out of tree build"
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
+mktemp_compat() {
+ case "$platform" in
+ macos*)
+ # On MacOSX, mktemp doesn't respect TMPDIR in the same way as many
+ # other systems. Use the final positional argument to force the
+ # tempfile or tempdir to be created inside $TMPDIR, which must
+ # already exist.
+ if [ -n "${TMPDIR}" ] ; then
+ mktemp "${@}" "${TMPDIR}/tmp.XXXXXXXXXX"
+ else
+ mktemp "${@}"
+ fi
+ ;;
+ *)
+ mktemp "${@}"
+ ;;
+ esac
+}
+
print_header "Build: Out of tree"
# Create and enter a temporary build directory
print_header "Build: Out of tree"
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
$MAKE dist
# Create and enter a temporary build directory
$MAKE dist
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
# Extract the distribution tar in the build directory,
cd "$builddir"
# Extract the distribution tar in the build directory,
print_header "Build: Distribution Out of tree"
# Create and enter a temporary build directory
print_header "Build: Distribution Out of tree"
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
# Run configure out of tree and generate the tar file
"$SRCDIR/configure" || failed_configure
$MAKE dist
cd "$builddir"
# Run configure out of tree and generate the tar file
"$SRCDIR/configure" || failed_configure
$MAKE dist
- dist_srcdir="$(mktemp -d)"
+ dist_srcdir="$(mktemp_compat -d)"
cd "$dist_srcdir"
# Extract the distribution tar in the new source directory,
cd "$dist_srcdir"
# Extract the distribution tar in the new source directory,
$TAR xvf "$builddir"/*.tar.* --strip 1
# Create and enter a second temporary build directory
$TAR xvf "$builddir"/*.tar.* --strip 1
# Create and enter a second temporary build directory
- builddir="$(mktemp -d)"
+ builddir="$(mktemp_compat -d)"
cd "$builddir"
# Run configure from the extracted distribution tar,
cd "$builddir"
# Run configure from the extracted distribution tar,
+mktemp_compat() {
+ case "$platform" in
+ macos*)
+ # On MacOSX, mktemp doesn't respect TMPDIR in the same way as many
+ # other systems. Use the final positional argument to force the
+ # tempfile or tempdir to be created inside $TMPDIR, which must
+ # already exist.
+ if [ -n "${TMPDIR}" ] ; then
+ mktemp "${@}" "${TMPDIR}/tmp.XXXXXXXXXX"
+ else
+ mktemp "${@}"
+ fi
+ ;;
+ *)
+ mktemp "${@}"
+ ;;
+ esac
+}
+
print_header "Build: Out of tree"
# Create and enter a temporary build directory
print_header "Build: Out of tree"
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
cd "$builddir"
"$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
$MAKE dist
# Create and enter a temporary build directory
$MAKE dist
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
# Extract the distribution tar in the build directory,
cd "$builddir"
# Extract the distribution tar in the build directory,
print_header "Build: Distribution Out of tree"
# Create and enter a temporary build directory
print_header "Build: Distribution Out of tree"
# Create and enter a temporary build directory
+ builddir=$(mktemp_compat -d)
cd "$builddir"
# Run configure out of tree and generate the tar file
"$SRCDIR/configure" "${DIST_CONF_OPTS[@]}" || failed_configure
$MAKE dist
cd "$builddir"
# Run configure out of tree and generate the tar file
"$SRCDIR/configure" "${DIST_CONF_OPTS[@]}" || failed_configure
$MAKE dist
- dist_srcdir="$(mktemp -d)"
+ dist_srcdir="$(mktemp_compat -d)"
cd "$dist_srcdir"
# Extract the distribution tar in the new source directory,
cd "$dist_srcdir"
# Extract the distribution tar in the new source directory,
$TAR xvf "$builddir"/*.tar.* --strip 1
# Create and enter a second temporary build directory
$TAR xvf "$builddir"/*.tar.* --strip 1
# Create and enter a second temporary build directory
- builddir="$(mktemp -d)"
+ builddir="$(mktemp_compat -d)"
cd "$builddir"
# Run configure from the extracted distribution tar,
cd "$builddir"
# Run configure from the extracted distribution tar,