%ifarch armv7l
%setup -T -D -a 1002
%setup -T -D -a 1003
+# Detect interpreter name from cross-gcc
+LD_INTERPRETER=$(patchelf --print-interpreter /emul/usr/bin/gcc)
+LD_RPATH=$(patchelf --print-rpath /emul/usr/bin/gcc)
+
for file in $( find ./Tools -name "dotnet" )
do
- patchelf --set-interpreter /emul/lib64/ld-linux-x86-64.so.2 $file
- patchelf --set-rpath /emul/usr/lib64/:%{_builddir}/%{name}-%{version}/libicu/ $file
+ patchelf --set-interpreter ${LD_INTERPRETER} ${file}
+ patchelf --set-rpath ${LD_RPATH}:%{_builddir}/%{name}-%{version}/libicu/ ${file}
done
for file in $( find ./Tools ./libicu -iname "*.so" -or -iname "*.so.*" )
do
- patchelf --set-rpath /emul/usr/lib64/:%{_builddir}/%{name}-%{version}/libicu/ $file
+ patchelf --set-rpath ${LD_RPATH}:%{_builddir}/%{name}-%{version}/libicu/ ${file}
done
%endif
%endif
%build
+# Detect paths to toolchain headers in universal way
+export GCC_INSTALL_DIR=$(gcc -print-search-dirs | sed -ne '/install: /s/install: //p')
+export LLVM_LIBDIR=$(llvm-config --libdir)
+export LLVM_INCLUDEDIR=$(llvm-config --includedir)
+export GPP_INCLUDE_PATHS=$(cpp -xc++ -v < /dev/null 2>&1 | \
+ awk '/search starts here:/{flag=1;next}/End of search list/{flag=0}flag' | \
+ sed -e "s/^ //" | tr '\n' ':' | sed -e 's/.$//')
+export CLANG_INCLUDE_PATHS=$(clang++ -E -xc++ - -v < /dev/null 2>&1 | \
+ awk '/search starts here:/{flag=1;next}/End of search list/{flag=0}flag' | \
+ sed -e "s/^ //" | tr '\n' ':' | sed -e 's/.$//')
+export CLANG_HEADERS=$(clang++ -print-search-dirs 2>&1 | sed -ne '/libraries: /s/libraries: =//p' | sed -ne 's|:.*|/include|p')
+
# NOTHING to build
-%ifarch x86_64
-# Even though build architectur is x86_64, it will be running on arm board.
-# So we need to pass the arch argument as arm.
-%define _barch %{?cross:%{cross}}%{!?cross:x64}
%if 0%{skipnative}
%else
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/:/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/
-export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib64/:/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/
-export CFLAGS="-B/usr/local/lib64/ -B/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/ -Wno-deprecated-declarations"
-export CPPFLAGS="-B/usr/local/lib64/ -B/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/ -Wno-deprecated-declarations"
-export CXXFLAGS="-B/usr/local/lib64/ -B/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/ -Wno-deprecated-declarations"
-export CPLUS_INCLUDE_PATH="/usr/local/include/llvm/:/usr/local/include/llvm-c/:/usr/local/lib64/clang/3.8.1/include/:/usr/include/:/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/include/:/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/include/c++/:/usr/lib64/gcc/x86_64-tizen-linux-gnu/4.9.2/include/c++/x86_64-tizen-linux-gnu/"
-export C_INCLUDE_PATH="/usr/local/include/llvm-c/:/usr/include/"
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LLVM_LIBDIR}:${GCC_INSTALL_DIR}
+export LIBRARY_PATH=$LIBRARY_PATH:${LLVM_LIBDIR}:${GCC_INSTALL_DIR}
+export CFLAGS=" -B${LLVM_LIBDIR} -B${GCC_INSTALL_DIR} -Wno-deprecated-declarations "
+export CPPFLAGS=" -B${LLVM_LIBDIR} -B${GCC_INSTALL_DIR} -Wno-deprecated-declarations "
+export CXXFLAGS=" -B${LLVM_LIBDIR} -B${GCC_INSTALL_DIR} -Wno-deprecated-declarations "
+export CPLUS_INCLUDE_PATH="${LLVM_INCLUDEDIR}/llvm/:${LLVM_INCLUDEDIR}/llvm-c/:${CLANG_HEADERS}:${GPP_INCLUDE_PATHS}:${CLANG_INCLUDE_PATHS}"
+export C_INCLUDE_PATH="${LLVM_INCLUDEDIR}/llvm-c/:%{_includedir}"
%endif
+%ifarch x86_64
+# Even though build architectur is x86_64, it will be running on arm board.
+# So we need to pass the arch argument as arm.
+%define _barch %{?cross:%{cross}}%{!?cross:x64}
+
%else
%ifarch aarch64
%define _barch arm64
-%if 0%{skipnative}
-%else
-# BEWARE: NOT EVER TESTED.
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/gcc/aarch64-tizen-linux/4.9
-export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib64/gcc/aarch64-tizen-linux-gnueabi/4.9
-export CFLAGS="-B/usr/lib64/llvm/ -B/usr/lib64/gcc/aarch64-tizen-linux-gnueabi/4.9/"
-export CPPFLAGS="-B/usr/lib64/llvm/ -B/usr/lib64/gcc/aarch64-tizen-linux-gnueabi/4.9/"
-export CXXFLAGS="-B/usr/lib64/llvm/ -B/usr/lib64/gcc/aarch64-tizen-linux-gnueabi/4.9/"
-export CPLUS_INCLUDE_PATH="/usr/include/llvm/:/usr/include/llvm-c/:/usr/include/c++/4.9/:/usr/include/c++/4.9/backward:/usr/include/c++/4.9/aarch64-tizen-linux-gnueabi/:/usr/local/include:/usr/lib/clang/3.6.0/include/:/usr/include/"
-export C_INCLUDE_PATH="/usr/include/llvm-c/:/usr/include/"
-%endif
-
%else
%ifarch i586
%define _barch x86
-%if 0%{skipnative}
-%else
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gcc/i586-tizen-linux/4.9
-export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/gcc/i586-tizen-linux/4.9
-export CFLAGS="-B/usr/lib/llvm/ -B/usr/lib/gcc/i586-tizen-linux/4.9/"
-export CPPFLAGS="-B/usr/lib/llvm/ -B/usr/lib/gcc/i586-tizen-linux/4.9/"
-export CXXFLAGS="-B/usr/lib/llvm/ -B/usr/lib/gcc/i586-tizen-linux/4.9/"
-export CPLUS_INCLUDE_PATH="/usr/include/llvm/:/usr/include/llvm-c/:/usr/include/c++/4.9/:/usr/include/c++/4.9/backward:/usr/include/c++/4.9/i586-tizen-linux/:/usr/local/include:/usr/lib/clang/3.6.0/include/:/usr/include/"
-export C_INCLUDE_PATH="/usr/include/llvm-c/:/usr/include/"
-%endif
-
%else
%ifarch armv7l
%define _barch armel
%if 0%{skipnative}
%else
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2
-export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2
-export CFLAGS="-U__GNUC_MINOR__ -D__GNUC_MINOR__=3 -B/usr/local/lib/ -B/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/ -Wno-deprecated-declarations -O2 --param=ssp-buffer-size=32 -fdiagnostics-color=never -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -Wp,-D__SOFTFP__ -Wno-error=inline-asm -integrated-as -Wno-ignored-attributes -Wno-switch-enum -Wno-switch -Wno-error=switch -Wno-error=switch-enum -w"
-export CPPFLAGS="-U__GNUC_MINOR__ -D__GNUC_MINOR__=3 -B/usr/local/lib/ -B/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/ -Wno-deprecated-declarations -O2 --param=ssp-buffer-size=32 -fdiagnostics-color=never -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -Wp,-D__SOFTFP__ -Wno-error=inline-asm -integrated-as -Wno-ignored-attributes -Wno-switch-enum -Wno-switch -Wno-error=switch -Wno-error=switch-enum -w"
-export CXXFLAGS="-U__GNUC_MINOR__ -D__GNUC_MINOR__=3 -B/usr/local/lib/ -B/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/ -Wno-deprecated-declarations -O2 --param=ssp-buffer-size=32 -fdiagnostics-color=never -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -Wp,-D__SOFTFP__ -Wno-error=inline-asm -integrated-as -Wno-ignored-attributes -Wno-switch-enum -Wno-switch -Wno-error=switch -Wno-error=switch-enum -w"
-export CPLUS_INCLUDE_PATH="/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/:/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/armv7l-tizen-linux-gnueabi/:/usr/local/include/llvm/:/usr/local/include/llvm-c/:/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/:/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/backward:/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/armv7l-tizen-linux-gnueabi/:/usr/local/include:/usr/include/"
-export C_INCLUDE_PATH="/usr/local/include/llvm-c/:/usr/include/"
+export CFLAGS="${CFLAGS} -U__GNUC_MINOR__ -D__GNUC_MINOR__=3 -O2 --param=ssp-buffer-size=32 -fdiagnostics-color=never -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -Wp,-D__SOFTFP__ -Wno-error=inline-asm -integrated-as -Wno-ignored-attributes -Wno-switch-enum -Wno-switch -Wno-error=switch -Wno-error=switch-enum -w"
+export CPPFLAGS="${CPPFLAGS} -U__GNUC_MINOR__ -D__GNUC_MINOR__=3 -O2 --param=ssp-buffer-size=32 -fdiagnostics-color=never -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -Wp,-D__SOFTFP__ -Wno-error=inline-asm -integrated-as -Wno-ignored-attributes -Wno-switch-enum -Wno-switch -Wno-error=switch -Wno-error=switch-enum -w"
+export CXXFLAGS="${CXXFLAGS} -U__GNUC_MINOR__ -D__GNUC_MINOR__=3 -O2 --param=ssp-buffer-size=32 -fdiagnostics-color=never -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -Wp,-D__SOFTFP__ -Wno-error=inline-asm -integrated-as -Wno-ignored-attributes -Wno-switch-enum -Wno-switch -Wno-error=switch -Wno-error=switch-enum -w"
%endif
%else