2022-04-22 11:48:47 +00:00
|
|
|
#!/bin/sh -eux
|
2021-02-10 13:48:42 +00:00
|
|
|
|
2022-04-22 11:48:47 +00:00
|
|
|
set pipefail
|
2021-02-10 13:48:42 +00:00
|
|
|
|
|
|
|
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
|
|
|
|
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
|
|
|
|
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
|
|
|
|
|
|
|
|
|
|
|
|
# Test a c program
|
|
|
|
clang $cflags -c hello.c -o hello.o
|
|
|
|
clang $cflags -c main.c -o main.o
|
|
|
|
clang $ldflags -o hello main.o hello.o
|
|
|
|
./hello | grep "Hello World"
|
|
|
|
|
|
|
|
# Test a cxx program
|
|
|
|
clang++ $cxxflags -c hello.cpp -o hello-cpp.o
|
|
|
|
clang++ $cxxflags -c main.cpp -o main-cpp.o
|
|
|
|
clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
|
|
|
|
./hello-cpp | grep "Hello World"
|