Skip to content

Commit b0f2bd0

Browse files
committedAug 7, 2017
Merge remote-tracking branch 'arduino/osx_and_arm_support'
2 parents f1d4da0 + cad500a commit b0f2bd0

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed
 

‎package-arduino-preprocessor.bash

+20-11
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ mkdir objdir
3535
export OS=`uname -o || uname`
3636
export TARGET_OS=$OS
3737

38+
START_GROUP=--Wl,--start-group
39+
END_GROUP=--Wl,--end-group
40+
3841
function fetch_llvm {
3942
fetched=`basename $1`
4043
if [ ! -f "$fetched" ]; then
@@ -64,10 +67,12 @@ if [[ $OS == "GNU/Linux" ]] ; then
6467
if [[ $MACHINE == "x86_64" ]] ; then
6568
fetch_llvm https://github.com/cmaglie/llvm-clang-build-scripts/releases/download/4.0.0/llvm-clang-4.0.0-ubuntu-14.04.5-x86_64.tar.xz
6669
OUTPUT_TAG=x86_64-pc-linux-gnu
67-
# elif [[ $MACHINE == "i686" ]] ; then
68-
# OUTPUT_TAG=i686-pc-linux-gnu
69-
# elif [[ $MACHINE == "armv7l" ]] ; then
70-
# OUTPUT_TAG=armhf-pc-linux-gnu
70+
elif [[ $MACHINE == "i686" ]] ; then
71+
OUTPUT_TAG=i686-pc-linux-gnu
72+
fetch_llvm https://github.com/cmaglie/llvm-clang-build-scripts/releases/download/4.0.0/llvm-clang-4.0.0-ubuntu-14.04.5-i686.tar.xz
73+
elif [[ $MACHINE == "armv7l" ]] ; then
74+
OUTPUT_TAG=armhf-pc-linux-gnu
75+
fetch_llvm https://github.com/cmaglie/llvm-clang-build-scripts/releases/download/4.0.0/llvm-clang-4.0.0-linux-arm.tar.xz
7176
else
7277
echo Linux Machine not supported: $MACHINE
7378
exit 1
@@ -90,12 +95,16 @@ elif [[ $OS == "Msys" || $OS == "Cygwin" ]] ; then
9095
#sed -i "s/^#define _GLIBCXX_USE_FLOAT128 1$/\/\/#define _GLIBCXX_USE_FLOAT128 1/" include/bits/c++config.h
9196
#CXXFLAGS="-Iinclude -I$GCC_INCLUDE/c++ -I$GCC_INCLUDE/c++/$OUTPUT_TAG -I$GCC_INCLUDE/c++/backward -I$GCC_INCLUDE"
9297

93-
#elif [[ $OS == "Darwin" ]] ; then
94-
#
95-
# export PATH=/opt/local/libexec/gnubin/:/opt/local/bin:$PATH
96-
# export CC="gcc -arch i386 -mmacosx-version-min=10.5"
97-
# export CXX="g++ -arch i386 -mmacosx-version-min=10.5"
98-
# OUTPUT_TAG=i386-apple-darwin11
98+
elif [[ $OS == "Darwin" ]] ; then
99+
100+
#export PATH=/opt/local/libexec/gnubin/:/opt/local/bin:$PATH
101+
export CC="gcc -arch x86_64 -mmacosx-version-min=10.9"
102+
export CXX="g++ -arch x86_64 -mmacosx-version-min=10.9"
103+
OUTPUT_TAG=x86_64-apple-darwin11
104+
export CXXFLAGS="-stdlib=libc++ -std=c++11"
105+
fetch_llvm https://github.com/cmaglie/llvm-clang-build-scripts/releases/download/4.0.0/llvm-clang-4.0.0-macosx-10.9-x86_64.tar.bz2
106+
START_GROUP=""
107+
END_GROUP=""
99108

100109
else
101110

@@ -114,7 +123,7 @@ LDFLAGS="`clang/bin/llvm-config --ldflags` -static-libstdc++"
114123
LLVMLIBS=`clang/bin/llvm-config --libs --system-libs`
115124
CLANGLIBS=`ls clang/lib/libclang*.a | sed s/.*libclang/-lclang/ | sed s/.a$//`
116125
SOURCES="main.cpp ArduinoDiagnosticConsumer.cpp CommandLine.cpp IdentifiersList.cpp CodeCompletion.cpp"
117-
$CXX $SOURCES -o objdir/arduino-preprocessor $CXXFLAGS $LDFLAGS -Wl,--start-group $LLVMLIBS $CLANGLIBS -Wl,--end-group
126+
$CXX $SOURCES -o objdir/arduino-preprocessor $CXXFLAGS $LDFLAGS $START_GROUP $LLVMLIBS $CLANGLIBS $END_GROUP
118127
strip objdir/*
119128

120129
rm -f arduino-preprocessor-${OUTPUT_VERSION}-${OUTPUT_TAG}.tar.bz2

0 commit comments

Comments
 (0)
Please sign in to comment.