6c095b8
#!/bin/bash
6c095b8
6c095b8
set -ex pipefail
6c095b8
6c095b8
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
6c095b8
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
6c095b8
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
6c095b8
6c095b8
6c095b8
# Test a c program
6c095b8
clang $cflags -c hello.c -o hello.o
6c095b8
clang $cflags -c main.c -o main.o
6c095b8
clang $ldflags -o hello main.o hello.o
6c095b8
./hello | grep "Hello World"
6c095b8
6c095b8
# Test a cxx program
6c095b8
clang++ $cxxflags -c hello.cpp -o hello-cpp.o
6c095b8
clang++ $cxxflags -c main.cpp -o main-cpp.o
6c095b8
clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
6c095b8
./hello-cpp | grep "Hello World"