2021-10-18 14:01:51 +00:00
|
|
|
#!/bin/sh -eux
|
2021-04-14 02:01:54 +00:00
|
|
|
|
2021-10-18 14:01:51 +00:00
|
|
|
set pipefail
|
2021-04-14 02:01:54 +00:00
|
|
|
|
2021-05-19 01:25:57 +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}`
|
2021-04-14 02:01:54 +00:00
|
|
|
|
|
|
|
|
2021-05-19 01:25:57 +00:00
|
|
|
# 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"
|
2021-04-14 02:01:54 +00:00
|
|
|
|
2021-05-19 01:25:57 +00:00
|
|
|
# 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"
|