What is the best practice to use both gcc and clang flags macros in %check?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In my case on rpms/simde, I want to compile the testing source in
"both" gcc and clang changing the toolchain macro in the %check
section.

I am seeing this file to use toolchain macro.
https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/macros#_44
> # %global toolchain clang

In this case what is the best practice to use %{optflags},
%{build_cflags}, %{build_cxxflags} macros?
Because after setting `%global toolchain clang` in the %check section,
these macros are empty.

Here is the simde.spec having both gcc and clang built test cases in
the%check section.
https://src.fedoraproject.org/fork/jaruga/rpms/simde/blob/wip/clang-flto-ftbfs/f/simde.spec#_136

```
%check
...
echo "=== 1.2. tests on gcc with flags ==="
mkdir test/build-gcc-with-flags
pushd test/build-gcc-with-flags
CC=gcc CXX=g++ cmake \
  -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
  -DCMAKE_C_FLAGS="%{build_cflags}" \
  -DCMAKE_CXX_FLAGS="%{build_cxxflags}" \
  ..
...
%global toolchain clang
...
echo "=== 2.2. tests on clang with flags ==="
mkdir test/build-clang-with-flags
pushd test/build-clang-with-flags
CC=clang CXX=clang++ cmake \
  -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
  -DCMAKE_C_FLAGS="${build_cflags}" \ # <= ${build_cflags} is empty!
  -DCMAKE_CXX_FLAGS="${build_cxxflags}" \ # <= ${build_cxxflags} is empty!
  ..
```

The scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=48755502

Thanks.

-- 
Jun | He - His - Him
_______________________________________________
packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/packaging@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux