Skip to content

Commit 83c2ecb

Browse files
authored
Merge pull request #240 from mattip/gfortran-11
Always use gfortran-11 on macos
2 parents 92e5374 + a9846b5 commit 83c2ecb

File tree

9 files changed

+82
-242
lines changed

9 files changed

+82
-242
lines changed

.github/workflows/posix.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ on:
44
push:
55
branches: [ main ]
66
pull_request:
7-
branches: [ main ]
7+
branches:
8+
- main
9+
- maintenance/**
810
workflow_dispatch: null
911
schedule:
1012
- cron: '0 0 * * 0'
1113

1214
env:
1315
OPENBLAS_COMMIT: "v0.3.30-349-gf6df9beb"
14-
MACOSX_DEPLOYMENT_TARGET: 10.9
1516

1617
jobs:
1718
build:

.github/workflows/windows-arm.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
push:
55
branches: [ main ]
66
pull_request:
7-
branches: [ main ]
7+
branches:
8+
- main
9+
- maintenance/**
810

911
env:
1012
OPENBLAS_COMMIT: "v0.3.30-349-gf6df9beb"

.github/workflows/windows.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
push:
55
branches: [ main ]
66
pull_request:
7-
branches: [ main ]
7+
branches:
8+
- main
9+
- maintenance/**
810
workflow_dispatch: null
911

1012
env:

ci-before-build.sh

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# Most of the content in this file comes from https://github.com/multi-build/multibuild, with some modifications
55
# Follow the license below
66

7-
8-
97
# .. _license:
108

119
# *********************
@@ -41,9 +39,6 @@
4139
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
4240
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4341

44-
45-
46-
#! /bin/bash
4742
set -xe
4843

4944
if [[ "$NIGHTLY" = "true" ]]; then
@@ -55,40 +50,6 @@ if [[ "$NIGHTLY" = "true" ]]; then
5550
sed -e "s/^version = .*/version = \"${version}\"/" -i.bak pyproject.toml
5651
fi
5752

58-
59-
#!/bin/bash
60-
# Utilities for both OSX and Docker Linux
61-
# python or python3 should be on the PATH
62-
63-
# Only source common_utils once
64-
if [ -n "$COMMON_UTILS_SOURCED" ]; then
65-
return
66-
fi
67-
COMMON_UTILS_SOURCED=1
68-
69-
# Turn on exit-if-error
70-
set -e
71-
72-
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
73-
DOWNLOADS_SDIR=downloads
74-
PYPY_URL=https://downloads.python.org/pypy
75-
76-
if [ $(uname) == "Darwin" ]; then
77-
IS_MACOS=1; IS_OSX=1;
78-
else
79-
# In the manylinux_2_24 image, based on Debian9, "python" is not installed
80-
# so link in something for the various system calls before PYTHON_EXE is set
81-
which python || export PATH=/opt/python/cp39-cp39/bin:$PATH
82-
83-
if [ "$MB_ML_LIBC" == "musllinux" ]; then
84-
IS_ALPINE=1;
85-
MB_ML_VER=${MB_ML_VER:-"_1_2"}
86-
else
87-
# Default Manylinux version
88-
MB_ML_VER=${MB_ML_VER:-2014}
89-
fi
90-
fi
91-
9253
# Work round bug in travis xcode image described at
9354
# https://github.com/direnv/direnv/issues/210
9455
shell_session_update() { :; }
@@ -103,4 +64,5 @@ unset -f popd
10364
# Build OpenBLAS
10465
source build-openblas.sh
10566

67+
# Build wheel
10668
source tools/build_prepare.sh

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
99
[project]
1010
name = "scipy-openblas64"
1111
# v0.3.30-349-gf6df9beb
12-
version = "0.3.30.349.0"
12+
version = "0.3.30.349.1"
1313
requires-python = ">=3.7"
1414
description = "Provides OpenBLAS for python packaging"
1515
readme = "README.md"
@@ -46,7 +46,6 @@ repair-wheel-command = "bash ci-repair-wheel.sh {dest_dir} {wheel}"
4646
test-command = "cd {package} && bash ci-test.sh "
4747
environment-pass = [
4848
"OPENBLAS_COMMIT",
49-
"MACOSX_DEPLOYMENT_TARGET",
5049
"NIGHTLY",
5150
"MB_ML_LIBC",
5251
"MB_ML_VER",

tools/build_steps.sh

Lines changed: 27 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,15 @@
1+
#!bash
2+
13
# Build script for manylinux and OSX
24
BUILD_PREFIX=${BUILD_PREFIX:-/usr/local}
35

46
ROOT_DIR=$(dirname $(dirname "${BASH_SOURCE[0]}"))
57

68
MB_PYTHON_VERSION=3.9
79

8-
function any_python {
9-
for cmd in $PYTHON_EXE python3 python; do
10-
if [ -n "$(type -t $cmd)" ]; then
11-
echo $cmd
12-
return
13-
fi
14-
done
15-
echo "Could not find python or python3"
16-
exit 1
17-
}
18-
19-
function get_os {
20-
# Report OS as given by uname
21-
# Use any Python that comes to hand.
22-
$(any_python) -c 'import platform; print(platform.uname()[0])'
23-
}
24-
25-
2610
function before_build {
2711
# Manylinux Python version set in build_lib
28-
if [ -n "$IS_OSX" ]; then
12+
if [ "$(uname -s)" == "Darwin" ]; then
2913
if [ ! -e /usr/local/lib ]; then
3014
sudo mkdir -p /usr/local/lib
3115
sudo chmod 777 /usr/local/lib
@@ -39,29 +23,39 @@ function before_build {
3923
# get_macpython_environment ${MB_PYTHON_VERSION} venv
4024
python3.9 -m venv venv
4125
source venv/bin/activate
42-
alias gfortran=gfortran-15
26+
27+
unalias gfortran 2>/dev/null || true
28+
source tools/gfortran_utils.sh
29+
download_and_unpack_gfortran ${PLAT} native
30+
export FC=/opt/gfortran/gfortran-darwin-${PLAT}-native/bin/gfortran
31+
which ${FC}
32+
${FC} --version
33+
local libdir=/opt/gfortran/gfortran-darwin-${PLAT}-native/lib
34+
# Remove conflicting shared objects
35+
rm -fv ${libdir}/libiconv*
36+
export FFLAGS="-L${libdir} -Wl,-rpath,${libdir}"
37+
# Not clear why this is needed for tests on arm64...
38+
export LDFLAGS="$FFLAGS"
39+
4340
# Deployment target set by gfortran_utils
4441
echo "Deployment target $MACOSX_DEPLOYMENT_TARGET"
4542

4643
# Build the objconv tool
47-
(cd ${ROOT_DIR}/objconv && bash ../tools/build_objconv.sh)
44+
if [[ ! -x objconv/objconv ]]; then
45+
(cd ${ROOT_DIR}/objconv && bash ../tools/build_objconv.sh)
46+
fi
4847
fi
4948
}
5049

5150
function clean_code {
5251
set -ex
53-
# Copied from common_utils.sh, with added debugging
5452
local build_commit=$1
5553
[ -z "$build_commit" ] && echo "build_commit not defined" && exit 1
5654
pushd OpenBLAS
5755
git fetch origin --tags
58-
echo after git fetch origin
5956
git checkout $build_commit
60-
echo after git checkout $build_commit
6157
git clean -fxd
62-
echo after git clean
6358
git submodule update --init --recursive
64-
echo after git submodule update
6559
popd
6660
}
6761

@@ -108,12 +102,7 @@ function build_lib {
108102
local interface64=${2:-$INTERFACE64}
109103
local nightly=${3:0}
110104
local manylinux=${MB_ML_VER:-1}
111-
if [ -n "$IS_OSX" ]; then
112-
# Do build, add gfortran hash to end of name
113-
do_build_lib "$plat" "gf_${GFORTRAN_SHA:0:7}" "$interface64" "$nightly"
114-
else
115-
do_build_lib "$plat" "" "$interface64" "$nightly"
116-
fi
105+
do_build_lib "$plat" "$interface64" "$nightly"
117106
}
118107

119108
function patch_source {
@@ -129,19 +118,16 @@ function do_build_lib {
129118
# Build openblas lib
130119
# Input arg
131120
# plat - one of i686, x86_64, arm64
132-
# suffix (optional) - suffix for output archive name
133-
# Suffix added with hyphen prefix
134121
# interface64 (optional) - whether to build ILP64 openblas
135122
# with 64_ symbol suffix
136123
# nightly (optional) - whether to build for nightlies
137124
#
138125
# Depends on globals
139126
# BUILD_PREFIX - install suffix e.g. "/usr/local"
140127
local plat=$1
141-
local suffix=$2
142-
local interface64=$3
143-
local nightly=$4
144-
case $(get_os)-$plat in
128+
local interface64=$2
129+
local nightly=$3
130+
case $(uname -s)-$plat in
145131
Linux-x86_64)
146132
local bitness=64
147133
local target="PRESCOTT"
@@ -150,16 +136,8 @@ function do_build_lib {
150136
Darwin-x86_64)
151137
local bitness=64
152138
local target="CORE2"
153-
# Use gfortran-11
154-
unalias gfortran
155-
# Since install_fortran uses `uname -a` to determine arch,
156-
# force the architecture
157-
arch -${PLAT} bash -s << EOF
158-
source ${ROOT_DIR}/gfortran-install/gfortran_utils.sh
159-
install_gfortran
160-
EOF
161-
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
162139
CFLAGS="$CFLAGS -arch x86_64"
140+
MACOSX_DEPLOYMENT_TARGET="10.9"
163141
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
164142
local dynamic_list="CORE2 NEHALEM SANDYBRIDGE HASWELL SKYLAKEX"
165143
;;
@@ -171,8 +149,8 @@ EOF
171149
Linux-aarch64)
172150
local bitness=64
173151
local target="ARMV8"
174-
# manylinux2014 image uses gcc-10, which miscompiles ARMV8SVE and up
175152
if [ "$MB_ML_VER" == "2014" ]; then
153+
# manylinux2014 image uses gcc-10, which miscompiles ARMV8SVE and up
176154
echo setting DYNAMIC_LIST for manylinux2014 to ARMV8 only
177155
local dynamic_list="ARMV8"
178156
fi
@@ -183,7 +161,6 @@ EOF
183161
CFLAGS="$CFLAGS -ftrapping-math -mmacos-version-min=11.0"
184162
MACOSX_DEPLOYMENT_TARGET="11.0"
185163
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
186-
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
187164
;;
188165
*-s390x)
189166
local bitness=64
@@ -201,9 +178,6 @@ EOF
201178
1)
202179
local interface_flags="INTERFACE64=1 SYMBOLSUFFIX=64_ LIBNAMESUFFIX=64_ OBJCONV=$PWD/objconv/objconv";
203180
local symbolsuffix="64_";
204-
if [ -n "$IS_OSX" ]; then
205-
$PWD/objconv/objconv --help
206-
fi
207181
;;
208182
*)
209183
local interface_flags="OBJCONV=$PWD/objconv/objconv"
@@ -246,8 +220,6 @@ EOF
246220
fi
247221
mv $BUILD_PREFIX/lib/pkgconfig/openblas*.pc $BUILD_PREFIX/lib/pkgconfig/scipy-openblas.pc
248222
local plat_tag=$(get_plat_tag $plat)
249-
local suff=""
250-
[ -n "$suffix" ] && suff="-$suffix"
251223
if [ "$interface64" = "1" ]; then
252224
# OpenBLAS does not install the symbol suffixed static library,
253225
# do it ourselves
@@ -260,7 +232,7 @@ EOF
260232
rm $BUILD_PREFIX/lib/pkgconfig/scipy-openblas.pc.bak
261233
fi
262234

263-
local out_name="openblas${symbolsuffix}-${version}-${plat_tag}${suff}.tar.gz"
235+
local out_name="openblas${symbolsuffix}-${version}-${plat_tag}.tar.gz"
264236
tar zcvf libs/$out_name \
265237
$BUILD_PREFIX/include/*blas* \
266238
$BUILD_PREFIX/include/*lapack* \

tools/docker_build_wrap.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/bin/bash
22
# Depends on:
3-
# BUILD_PREFIX
43
# PLAT
4+
# INTERFACE64 (could be missing or empty)
5+
# NIGHTLY (could be missing or empty)
56
set -e
67

78
# Change into root directory of repo
89
if [[ ! -e tools/build_steps.sh ]];then
910
cd /io
1011
fi
1112
source tools/build_steps.sh
12-
do_build_lib "$PLAT" "" "$INTERFACE64" "$NIGHTLY"
13+
do_build_lib "$PLAT" "$INTERFACE64" "$NIGHTLY"

0 commit comments

Comments
 (0)