Skip to content

Commit 4875420

Browse files
committed
πŸ§‘β€πŸ’» Update Sim, fix Mac native gcc
1 parent b79f7f2 commit 4875420

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

β€Žbuildroot/bin/mac_gcc

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,29 @@
1010
which port >/dev/null && HAS_MACPORTS=1
1111
which brew >/dev/null && HAS_HOMEBREW=1
1212

13-
MACPORTS_PATH=$(dirname "$(which port)")
13+
if ((HAS_MACPORTS)); then
14+
MACPORTS_PATH=$(dirname "$(which port)")
15+
cd $MACPORTS_PATH
16+
sudo rm -f cpp gcc g++ cc ld
17+
cd -
18+
fi
19+
1420
if ((HAS_HOMEBREW)); then
1521
HOMEBREW_PATH="$(brew --prefix)/bin"
22+
cd $HOMEBREW_PATH
23+
rm -f cpp gcc g++ cc ld
24+
cd -
1625
fi
1726

1827
if [[ $1 == "apple" || $1 == "darwin" || $1 == "system" ]]; then
1928

20-
if ((HAS_MACPORTS)); then
21-
cd $MACPORTS_PATH
22-
sudo rm -f gcc g++ cc ld
23-
cd -
24-
fi
25-
26-
if ((HAS_HOMEBREW)); then
27-
cd $HOMEBREW_PATH
28-
sudo rm -f gcc g++ cc
29-
cd -
30-
fi
29+
# Nothing to do
3130

3231
elif [[ $1 =~ ".*ports" ]]; then
3332

3433
((HAS_MACPORTS)) || { echo "MacPorts is not installed"; exit 1; }
3534

36-
GCCV=$( find $MACPORTS_PATH -name "gcc-mp-*" | sort -r | head -1 | sed 's/.*gcc-mp-//' )
35+
GCCV=$( find $MACPORTS_PATH -name "cpp-mp-*" | sort -r | head -1 | sed 's/.*cpp-mp-//' )
3736
[[ $GCCV -ge 11 ]] || GCCV=14
3837

3938
getport() { port installed $1 | grep $1 || sudo port install $1; }
@@ -42,7 +41,7 @@ elif [[ $1 =~ ".*ports" ]]; then
4241
getports "gcc$GCCV" glm mesa libsdl2 libsdl2_net
4342

4443
cd $MACPORTS_PATH
45-
sudo rm -f gcc g++ cc ld
44+
sudo ln -s "cpp-mp-$GCCV" cpp
4645
sudo ln -s "gcc-mp-$GCCV" gcc
4746
sudo ln -s "g++-mp-$GCCV" g++
4847
sudo ln -s g++ cc
@@ -53,16 +52,22 @@ elif [[ $1 =~ ".*brew" ]]; then
5352

5453
((HAS_HOMEBREW)) || { echo "Homebrew is not installed"; exit 1; }
5554

56-
GCCV=$( find $HOMEBREW_PATH -name "gcc-*" | sort -r | head -1 | sed 's/.*gcc-//' )
57-
[[ $GCCV -ge 11 ]] || { brew install gcc@14 ; GCCV=14 }
55+
GCCV=$( find $HOMEBREW_PATH -name "cpp-*" | sort -r | head -1 | sed 's/.*cpp-//' )
56+
[[ $GCCV -ge 11 ]] || brew install gcc
57+
GCCV=$( find $HOMEBREW_PATH -name "cpp-*" | sort -r | head -1 | sed 's/.*cpp-//' )
5858

5959
brew install glm mesa sdl2 sdl2_net
6060

6161
cd $HOMEBREW_PATH
62-
sudo rm -f gcc g++ cc
63-
sudo ln -s "gcc-$GCCV" gcc
64-
sudo ln -s "g++-$GCCV" g++
65-
sudo ln -s g++ cc
62+
ln -s "cpp-$GCCV" cpp
63+
ln -s "gcc-$GCCV" gcc
64+
ln -s "g++-$GCCV" g++
65+
ln -s g++ cc
66+
if [[ -f "$MACPORTS_PATH/ld-classic" ]]; then
67+
ln -s "$MACPORTS_PATH/ld-classic" ld
68+
else
69+
echo "MacPorts may be required for a compatible 'ld' linker!"
70+
fi
6671
cd -
6772

6873
else

β€Žini/native.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
5858
lib_compat_mode = off
5959
build_src_filter = ${common.default_src_filter} +<src/HAL/NATIVE_SIM>
6060
lib_deps = ${common.lib_deps}
61-
MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/dd9c41f1b2.zip
61+
MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/af62611296.zip
6262
Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip
6363
LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip
6464
extra_scripts = ${common.extra_scripts}
@@ -115,7 +115,7 @@ build_flags = -g2
115115
-DHAS_LIBBSD
116116
-I/opt/local/include
117117
-I/opt/local/include/freetype2
118-
-I/opt/local/include/SDL2/
118+
-I/opt/local/include/SDL2
119119
-L/opt/local/lib
120120
-Wl,-framework,OpenGl
121121
-Wl,-framework,CoreFoundation

0 commit comments

Comments
Β (0)