Skip to content

Commit

Permalink
M1 compat (#153)
Browse files Browse the repository at this point in the history
* Tidy up scripts to work on mac

* grep -> sed

* Update submodule
  • Loading branch information
XapaJIaMnu committed Sep 20, 2023
1 parent 3cbe86d commit a210037
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 3rd_party/bergamot-translator
23 changes: 20 additions & 3 deletions cmake/fix_ruy_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@ INCLUDE_PATH=I${SRC_PATH}/3rd_party/bergamot-translator/3rd_party/marian-dev/src

cd ${BUILD_DIR}

# mac sed is different from GNU sed...
# Find out the OS
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac

# Remove the extra include path
grep -R ${INCLUDE_PATH} | cut -d ":" -f1 | xargs sed -i "s\\-${INCLUDE_PATH}\\\\g"
# There's a /profiler in one of them that is not captured, so remove it manually
grep -R " /profiler " | cut -d ":" -f1 | xargs sed -i "s\\ /profiler \\\\g"
if [ "$machine" = "Mac" ]; then
grep -R ${INCLUDE_PATH} | cut -d ":" -f1 | xargs sed -i '' -e "s#-${INCLUDE_PATH}##g"
# There's a /profiler in one of them that is not captured, so remove it manually
grep -R " /profiler " | cut -d ":" -f1 | xargs sed -i '' -e "s# /profiler ##g"
else
grep -R ${INCLUDE_PATH} | cut -d ":" -f1 | xargs sed -i "s\\-${INCLUDE_PATH}\\\\g"
# There's a /profiler in one of them that is not captured, so remove it manually
grep -R " /profiler " | cut -d ":" -f1 | xargs sed -i "s\\ /profiler \\\\g"
fi
4 changes: 2 additions & 2 deletions dist/cpu_feature.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ "$machine" = "Linux" ]; then
elif grep -q ssse3 /proc/cpuinfo; then
echo "ssse3"
else
echo "old_or_non_x86"
echo `uname -m`
fi
elif [ "$machine" = "Mac" ]; then
if /usr/sbin/sysctl -n machdep.cpu.features machdep.cpu.leaf7_features | grep -q AVX512; then
Expand All @@ -32,7 +32,7 @@ elif [ "$machine" = "Mac" ]; then
elif /usr/sbin/sysctl -n machdep.cpu.features machdep.cpu.leaf7_features | grep -q SSSE3; then
echo "ssse3"
else
echo "old_or_non_x86"
echo `uname -m`
fi
else
echo "Unsupported platform"
Expand Down

0 comments on commit a210037

Please sign in to comment.