Skip to content

Commit dfbe5fd

Browse files
committed
typo, cleanup, simplify
1 parent 5216a65 commit dfbe5fd

File tree

4 files changed

+24
-123
lines changed

4 files changed

+24
-123
lines changed

.github/workflows/posix.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ on:
1313

1414
env:
1515
OPENBLAS_COMMIT: "v0.3.30-349-gf6df9beb"
16-
MACOSX_DEPLOYMENT_TARGET: 10.9
1716

1817
jobs:
1918
build:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function before_build {
4747
which ${FC}
4848
${FC} --version
4949
local libdir=/opt/gfortran/gfortran-darwin-${PLAT}-native/lib
50+
export DYLD_LIBRARY_PATH=$libdir:$DYLD_LIBRARY_PATH
5051
export FFLAGS="-L${libdir} -Wl,-rpath,${libdir}"
5152

5253
# Deployment target set by gfortran_utils
@@ -159,8 +160,8 @@ function do_build_lib {
159160
Darwin-x86_64)
160161
local bitness=64
161162
local target="CORE2"
162-
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
163163
CFLAGS="$CFLAGS -arch x86_64"
164+
MACOSX_DEPLOYMENT_TARGET="10.9"
164165
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
165166
local dynamic_list="CORE2 NEHALEM SANDYBRIDGE HASWELL SKYLAKEX"
166167
;;
@@ -172,8 +173,8 @@ function do_build_lib {
172173
Linux-aarch64)
173174
local bitness=64
174175
local target="ARMV8"
175-
# manylinux2014 image uses gcc-10, which miscompiles ARMV8SVE and up
176176
if [ "$MB_ML_VER" == "2014" ]; then
177+
# manylinux2014 image uses gcc-10, which miscompiles ARMV8SVE and up
177178
echo setting DYNAMIC_LIST for manylinux2014 to ARMV8 only
178179
local dynamic_list="ARMV8"
179180
fi
@@ -184,7 +185,6 @@ function do_build_lib {
184185
CFLAGS="$CFLAGS -ftrapping-math -mmacos-version-min=11.0"
185186
MACOSX_DEPLOYMENT_TARGET="11.0"
186187
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
187-
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
188188
;;
189189
*-s390x)
190190
local bitness=64

tools/gfortran_utils.sh

Lines changed: 21 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -16,117 +16,32 @@
1616

1717
# Bash utilities for use with gfortran
1818

19-
ARCHIVE_SDIR="${ARCHIVE_SDIR:-archives}"
20-
21-
GF_UTIL_DIR=$(dirname "${BASH_SOURCE[0]}")
22-
23-
function get_distutils_platform {
24-
# Report platform as in form of distutils get_platform.
25-
# This is like the platform tag that pip will use.
26-
# Modify fat architecture tags on macOS to reflect compiled architecture
27-
28-
# Deprecate this function once get_distutils_platform_ex is used in all
29-
# downstream projects
30-
local plat=$1
31-
case $plat in
32-
i686|x86_64|arm64|universal2|intel|aarch64|s390x|ppc64le) ;;
33-
*) echo Did not recognize plat $plat; return 1 ;;
34-
esac
35-
local uname=${2:-$(uname)}
36-
if [ "$uname" != "Darwin" ]; then
37-
if [ "$plat" == "intel" ]; then
38-
echo plat=intel not allowed for Manylinux
39-
return 1
40-
fi
41-
echo "manylinux1_$plat"
42-
return
43-
fi
44-
# macOS 32-bit arch is i386
45-
[ "$plat" == "i686" ] && plat="i386"
46-
local target=$(echo $MACOSX_DEPLOYMENT_TARGET | tr .- _)
47-
echo "macosx_${target}_${plat}"
48-
}
49-
50-
function get_distutils_platform_ex {
51-
# Report platform as in form of distutils get_platform.
52-
# This is like the platform tag that pip will use.
53-
# Modify fat architecture tags on macOS to reflect compiled architecture
54-
# For non-darwin, report manylinux version
55-
local plat=$1
56-
local mb_ml_ver=${MB_ML_VER:-1}
57-
case $plat in
58-
i686|x86_64|arm64|universal2|intel|aarch64|s390x|ppc64le) ;;
59-
*) echo Did not recognize plat $plat; return 1 ;;
60-
esac
61-
local uname=${2:-$(uname)}
62-
if [ "$uname" != "Darwin" ]; then
63-
if [ "$plat" == "intel" ]; then
64-
echo plat=intel not allowed for Manylinux
65-
return 1
66-
fi
67-
echo "manylinux${mb_ml_ver}_${plat}"
68-
return
69-
fi
70-
# macOS 32-bit arch is i386
71-
[ "$plat" == "i686" ] && plat="i386"
72-
local target=$(echo $MACOSX_DEPLOYMENT_TARGET | tr .- _)
73-
echo "macosx_${target}_${plat}"
74-
}
75-
76-
function get_macosx_target {
77-
# Report MACOSX_DEPLOYMENT_TARGET as given by distutils get_platform.
78-
python3 -c "import sysconfig as s; print(s.get_config_vars()['MACOSX_DEPLOYMENT_TARGET'])"
79-
}
80-
81-
function check_gfortran {
82-
# Check that gfortran exists on the path
83-
if [ -z "$(which gfortran)" ]; then
84-
echo Missing gfortran
85-
exit 1
86-
fi
87-
}
88-
89-
function get_gf_lib_for_suf {
90-
local suffix=$1
91-
local prefix=$2
92-
local plat=${3:-$PLAT}
93-
local uname=${4:-$(uname)}
94-
if [ -z "$prefix" ]; then echo Prefix not defined; exit 1; fi
95-
local plat_tag=$(get_distutils_platform_ex $plat $uname)
96-
if [ -n "$suffix" ]; then suffix="-$suffix"; fi
97-
local fname="$prefix-${plat_tag}${suffix}.tar.gz"
98-
local out_fname="${ARCHIVE_SDIR}/$fname"
99-
[ -s $out_fname ] || (echo "$out_fname is empty"; exit 24)
100-
echo "$out_fname"
101-
}
102-
10319
if [ "$(uname)" == "Darwin" ]; then
104-
mac_target=${MACOSX_DEPLOYMENT_TARGET:-$(get_macosx_target)}
105-
export MACOSX_DEPLOYMENT_TARGET=$mac_target
106-
# Keep this for now as some builds might depend on this being
107-
# available before install_gfortran is called
108-
export GFORTRAN_SHA=c469a420d2d003112749dcdcbe3c684eef42127e
10920
# Set SDKROOT env variable if not set
11021
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
11122

11223
function download_and_unpack_gfortran {
113-
local arch=$1
114-
local type=$2
115-
curl -L -O https://github.com/isuruf/gcc/releases/download/gcc-11.3.0-2/gfortran-darwin-${arch}-${type}.tar.gz
116-
case ${arch}-${type} in
117-
arm64-native)
118-
export GFORTRAN_SHA=0d5c118e5966d0fb9e7ddb49321f63cac1397ce8
119-
;;
120-
arm64-cross)
121-
export GFORTRAN_SHA=527232845abc5af21f21ceacc46fb19c190fe804
122-
;;
123-
x86_64-native)
124-
export GFORTRAN_SHA=c469a420d2d003112749dcdcbe3c684eef42127e
125-
;;
126-
x86_64-cross)
127-
export GFORTRAN_SHA=107604e57db97a0ae3e7ca7f5dd722959752f0b3
128-
;;
129-
esac
24+
local arch=$1
25+
local type=$2
26+
curl -L -O https://github.com/isuruf/gcc/releases/download/gcc-11.3.0-2/gfortran-darwin-${arch}-${type}.tar.gz
27+
case ${arch}-${type} in
28+
arm64-native)
29+
export GFORTRAN_SHA=0d5c118e5966d0fb9e7ddb49321f63cac1397ce8
30+
;;
31+
arm64-cross)
32+
export GFORTRAN_SHA=527232845abc5af21f21ceacc46fb19c190fe804
33+
;;
34+
x86_64-native)
35+
export GFORTRAN_SHA=c469a420d2d003112749dcdcbe3c684eef42127e
36+
;;
37+
x86_64-cross)
38+
export GFORTRAN_SHA=107604e57db97a0ae3e7ca7f5dd722959752f0b3
39+
;;
40+
*)
41+
echo unknown ${arch}-${type}
42+
exit 1
43+
;;
44+
esac
13045
if [[ "$(shasum gfortran-darwin-${arch}-${type}.tar.gz)" != "${GFORTRAN_SHA} gfortran-darwin-${arch}-${type}.tar.gz" ]]; then
13146
echo "shasum mismatch for gfortran-darwin-${arch}-${type}"
13247
exit 1
@@ -140,7 +55,6 @@ if [ "$(uname)" == "Darwin" ]; then
14055
tar -xvf gfortran-darwin-${arch}-${type}.tar.gz
14156
rm gfortran-darwin-${arch}-${type}.tar.gz
14257
popd
143-
fi
14458
}
14559

14660
function install_arm64_cross_gfortran {
@@ -156,24 +70,13 @@ if [ "$(uname)" == "Darwin" ]; then
15670
}
15771
function install_gfortran {
15872
download_and_unpack_gfortran $(uname -m) native
159-
check_gfortran
16073
if [[ "${PLAT:-}" == "universal2"]]; then
16174
install_arm64_cross_gfortran
16275
fi
16376
}
16477

165-
function get_gf_lib {
166-
# Get lib with gfortran suffix
167-
get_gf_lib_for_suf "gf_${GFORTRAN_SHA:0:7}" $@
168-
}
16978
else
17079
function install_gfortran {
17180
# No-op - already installed on manylinux image
172-
check_gfortran
173-
}
174-
175-
function get_gf_lib {
176-
# Get library with no suffix
177-
get_gf_lib_for_suf "" $@
17881
}
17982
fi

0 commit comments

Comments
 (0)