Skip to content

Commit bcf9294

Browse files
committed
macos: always use native gfortran, re-export env variables from gfortran_utils
1 parent ab38810 commit bcf9294

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

tools/build_steps.sh

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,6 @@ function get_os {
2626
function before_build {
2727
# Manylinux Python version set in build_lib
2828
if [ -n "$IS_OSX" ]; then
29-
if [ ! -e /usr/local/lib ]; then
30-
sudo mkdir -p /usr/local/lib
31-
sudo chmod 777 /usr/local/lib
32-
touch /usr/local/lib/.dir_exists
33-
fi
34-
if [ ! -e /usr/local/include ]; then
35-
sudo mkdir -p /usr/local/include
36-
sudo chmod 777 /usr/local/include
37-
touch /usr/local/include/.dir_exists
38-
fi
39-
# get_macpython_environment ${MB_PYTHON_VERSION} venv
4029
python3.9 -m venv venv
4130
source venv/bin/activate
4231
# Use gfortran from conda
@@ -48,6 +37,11 @@ function before_build {
4837
source tools/gfortran_utils.sh
4938
install_gfortran
5039
EOF
40+
# re-export these, since we ran in a shell
41+
export FC="$(find /opt/gfortran/gfortran-darwin-${PLAT}-native/bin -name "*-gfortran")"
42+
local libgfortran="$(find /opt/gfortran/gfortran-darwin-${PLAT}-native/lib -name libgfortran.dylib)"
43+
local libdir=$(dirname $libgfortran)
44+
export FFLAGS="-L$libdir -Wl,-rpath,$libdir"
5145
5246
# Build the objconv tool
5347
(cd ${ROOT_DIR}/objconv && bash ../tools/build_objconv.sh)
@@ -61,13 +55,9 @@ function clean_code {
6155
[ -z "$build_commit" ] && echo "build_commit not defined" && exit 1
6256
pushd OpenBLAS
6357
git fetch origin --tags
64-
echo after git fetch origin
6558
git checkout $build_commit
66-
echo after git checkout $build_commit
6759
git clean -fxd
68-
echo after git clean
6960
git submodule update --init --recursive
70-
echo after git submodule update
7161
popd
7262
}
7363

tools/gfortran_utils.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ if [ "$(uname)" == "Darwin" ]; then
7979

8080
function install_gfortran {
8181
download_and_unpack_gfortran $(uname -m) native
82-
if [[ "${PLAT:-}" == "universal2" || "${PLAT:-}" == "arm64" ]]; then
83-
download_and_unpack_gfortran arm64 cross
84-
fi
8582
check_gfortran
8683
}
8784

tools/local_build.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ set -e
55

66
# Set extra env
77
if [[ $(uname) == "Darwin" ]]; then
8-
# Force x86_64
9-
export PLAT=x86_64
8+
# export PLAT=x86_64
9+
export PLAT=arm64
10+
# Force installation of gfortran
11+
export IS_MACOS=1
12+
export IS_OSX=1
13+
1014
elif [[ $(uname -m) == "x86_64" ]]; then
1115
echo got x86_64
1216
export PLAT=x86_64

0 commit comments

Comments
 (0)