8000 check shasum of gcc toolchain, get directories automatically · MacPython/gfortran-install@216da54 · GitHub
[go: up one dir, main page]

Skip to content

Commit 216da54

Browse files
committed
check shasum of gcc toolchain, get directories automatically
1 parent 95566e0 commit 216da54

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

gfortran_utils.sh

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,33 @@ if [ "$(uname)" == "Darwin" ]; then
9393
GFORTRAN_DMG="${GF_UTIL_DIR}/archives/gfortran-4.9.0-Mavericks.dmg"
9494
GFORTRAN_SHA="$(shasum $GFORTRAN_DMG)"
9595

96+
function install_arm64_cross_gfortran {
97+
curl -L -O https://github.com/isuruf/gcc/releases/download/gcc-10-arm-20210112/gfortran-darwin-arm64.tar.gz
98+
if [[ "$(shasum gfortran-darwin-arm64)" != "3b83b07aba20c089c980f631b75e22896e2f8a14 gfortran-darwin-arm64.tar.gz" ]]; then
99+
echo "shasum mismatch for gfortran-darwin-arm64"
100+
exit 1
101+
fi
102+
sudo mkdir -p /opt/
103+
sudo cp "gfortran-darwin-arm64.tar.gz" /opt/gfortran-darwin-arm64.tar.gz
104+
pushd /opt
105+
sudo tar -xvf gfortran-darwin-arm64.tar.gz
106+
sudo rm gfortran-darwin-arm64.tar.gz
107+
popd
108+
export FC_ARM64="$(find /opt/gfortran-darwin-arm64/bin -name "*-gfortran")"
109+
local libgfortran="$(find /opt/gfortran-darwin-arm64/lib -name libgfortran.dylib)"
110+
local libdir=$(dirname $libgfortran)
111+
112+
export FC_ARM64_LDFLAGS="-L$libdir -Wl,-rpath,$libdir"
113+
if [[ "${PLAT:-}" == "arm64" ]]; then
114+
export FC=$FC_ARM64
115+
fi
116+
}
96117
function install_gfortran {
97118
hdiutil attach -mountpoint /Volumes/gfortran $GFORTRAN_DMG
98119
sudo installer -pkg /Volumes/gfortran/gfortran.pkg -target /
99120
check_gfortran
100121
if [[ "${PLAT:-}" == "universal2" || "${PLAT:-}" == "arm64" ]]; then
101-
curl -L -O https://github.com/isuruf/gcc/releases/download/gcc-10-arm-20210112/gfortran-darwin-arm64.tar.gz
102-
sudo mkdir -p /opt/
103-
sudo cp gfortran-darwin-arm64.tar.gz /opt/gfortran-darwin-arm64.tar.gz
104-
pushd /opt
105-
sudo tar -xvf gfortran-darwin-arm64.tar.gz
106-
sudo rm gfortran-darwin-arm64.tar.gz
107-
popd
108-
export FC_ARM64="/opt/gfortran-darwin-arm64/bin/arm64-apple-darwin20.0.0-gfortran"
109-
local libdir="/opt/gfortran-darwin-arm64/lib/gcc/arm64-apple-darwin20.0.0/10.2.1"
110-
export FC_ARM64_LDFLAGS="-L$libdir -Wl,-rpath,$libdir" 5F4A ;
111-
if [[ "${PLAT:-}" == "arm64" ]]; then
112-
export FC=$FC_ARM64
113-
fi
122+
install_arm64_cross_gfortran
114123
fi
115124
}
116125

0 commit comments

Comments
 (0)
0