Skip to content

Commit 3ba35c9

Browse files
authored
Merge pull request #8152 from jsquyres/pr/macos-portability-fixes
MacOS portability fixes
2 parents d330551 + 89920ba commit 3ba35c9

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

config/getdate.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@
77
# Provide a way to override build date for reproducible build results
88
# See https://reproducible-builds.org/ for why this is good.
99

10-
date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" "$@"
10+
# There are several different flavors of date(1) out there.
11+
# Try a few different CLI options for date(1) to see which one works.
12+
13+
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
14+
date -u -d "@$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u "$@"

configure.ac

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,29 @@ AC_DEFUN([OMPI_CHECK_DIR_FOR_SPACES],[
131131
AC_MSG_ERROR([Cannot continue.])])
132132
])
133133

134+
AC_DEFUN([OMPI_CANONICALIZE_PATH],[
135+
case $host_os in
136+
darwin*)
137+
# MacOS does not have "readlink -f" or realpath (at least as
138+
# of MacOS Cataline / 10.15). Instead, use Python, because we
139+
# know MacOS comes with a /usr/bin/python that has
140+
# os.path.realpath.
141+
$2=`/usr/bin/python -c 'import os; print os.path.realpath("'$1'")'`
142+
;;
143+
*)
144+
$2=`readlink -f $1`
145+
;;
146+
esac
147+
])
148+
134149
OMPI_CHECK_DIR_FOR_SPACES([$srcdir], [a], [source tree])
135-
OMPI_CHECK_DIR_FOR_SPACES([`readlink -f $srcdir`], [an], [absolute source tree])
136-
OMPI_CHECK_DIR_FOR_SPACES([`readlink -f .`], [a], [build tree])
150+
OMPI_CANONICALIZE_PATH([$srcdir], [ompi_dir])
151+
OMPI_CHECK_DIR_FOR_SPACES([$ompi_dir], [an], [absolute source tree])
152+
OMPI_CANONICALIZE_PATH([.], [ompi_dir])
153+
OMPI_CHECK_DIR_FOR_SPACES([$ompi_dir], [a], [build tree])
137154
OMPI_CHECK_DIR_FOR_SPACES([$prefix], [a], [prefix])
138-
OMPI_CHECK_DIR_FOR_SPACES([`readlink -f $prefix`], [an], [absolute prefix])
155+
OMPI_CANONICALIZE_PATH([$prefix], [ompi_dir])
156+
OMPI_CHECK_DIR_FOR_SPACES([$ompi_dir], [an], [absolute prefix])
139157

140158
opal_show_subtitle "Checking versions"
141159

0 commit comments

Comments
 (0)