Skip to content

Commit 69ecd81

Browse files
committed
specify MACOSX_DEPLOYMENT_TARGET=10.13 on macos-x86_64, cleanup
1 parent 85f1210 commit 69ecd81

File tree

2 files changed

+5
-93
lines changed

2 files changed

+5
-93
lines changed

tools/build_steps.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ function do_build_lib {
161161
CFLAGS="$CFLAGS -arch x86_64"
162162
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
163163
local dynamic_list="CORE2 NEHALEM SANDYBRIDGE HASWELL SKYLAKEX"
164+
MACOSX_DEPLOYMENT_TARGET="10.13"
164165
;;
165166
*-i686)
166167
local bitness=32

tools/gfortran_utils.sh

Lines changed: 4 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -16,68 +16,6 @@
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-
8119
function check_gfortran {
8220
# Check that gfortran exists on the path
8321
if [ -z "$(which gfortran)" ]; then
@@ -86,27 +24,7 @@ function check_gfortran {
8624
fi
8725
}
8826

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-
10327
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-
# Set SDKROOT env variable if not set
109-
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
11028

11129
function download_and_unpack_gfortran {
11230
local arch=$1
@@ -142,8 +60,10 @@ if [ "$(uname)" == "Darwin" ]; then
14260
popd
14361
if [[ "${type}" == "native" ]]; then
14462
# Link these into /usr/local so that there's no need to add rpath or -L
145-
for f in libgfortran.dylib libgfortran.5.dylib libgcc_s.1.dylib libgcc_s.1.1.dylib libquadmath.dylib libquadmath.0.dylib; do
146-
ln -sf /opt/gfortran-darwin-${arch}-${type}/lib/$f /usr/local/lib/$f
63+
for f in libgfortran.dylib libgfortran.5.dylib \
64+
libgcc_s.1.dylib libgcc_s.1.1.dylib libquadmath.dylib \
65+
libquadmath.0.dylib libgfortran.spec; do
66+
ln -sf /opt/gfortran-darwin-${arch}-${type}/lib/$f /usr/local/lib/$f
14767
done
14868
# Add it to PATH
14969
ln -sf /opt/gfortran-darwin-${arch}-${type}/bin/gfortran /usr/local/bin/gfortran
@@ -170,19 +90,10 @@ if [ "$(uname)" == "Darwin" ]; then
17090
fi
17191
}
17292

173-
function get_gf_lib {
174-
# Get lib with gfortran suffix
175-
get_gf_lib_for_suf "gf_${GFORTRAN_SHA:0:7}" $@
176-
}
177-
17893
else
17994
function install_gfortran {
18095
# No-op - already installed on manylinux image
18196
check_gfortran
18297
}
18398

184-
function get_gf_lib {
185-
# Get library with no suffix
186-
get_gf_lib_for_suf "" $@
187-
}
18899
fi

0 commit comments

Comments
 (0)