diff --git a/buildflags.md b/buildflags.md index 106f9f5..cb5d2d9 100644 --- a/buildflags.md +++ b/buildflags.md @@ -6,7 +6,7 @@ and how to use them. # Using RPM build flags The %set_build_flags macro sets the environment variables `CFLAGS`, -`CXXFLAGS`, `FFLAGS`, `FCFLAGS`, `LDFLAGS` and `LT_SYS_LIBRARY_PATH` to +`CXXFLAGS`, `FFLAGS`, `FCFLAGS`, `VALAFLAGS`, `LDFLAGS` and `LT_SYS_LIBRARY_PATH` to the value of their corresponding rpm macros. `%set_build_flags` is automatically called prior to the `%build`, `%check`, and `%install` phases so these flags can be used by makefiles and other build tools. @@ -43,6 +43,7 @@ Individual build flags are also available through RPM macros: the `CXXFLAGS` shell variable). * `%{build_fflags}` for `FFLAGS` (the Fortran compiler flags, also known as the `FCFLAGS` variable). +* `%{build_valaflags}` for `VALAFLAGS` (the Vala compiler flags) * `%{build_ldflags}` for the linker (`ld`) flags, usually known as `LDFLAGS`. Note that the contents quote linker arguments using `-Wl`, so this variable is intended for use with the `gcc` compiler @@ -493,6 +494,13 @@ tuning in the `gcc` package. These settings are: beneficial for a broad range of current CPUs. * **aarch64** does not have any architecture-specific tuning. +### Vala-specific compiler flags + + * `-g`: causes valac to emit `#line` directives in the generated C + source code. This improves backtrace generation by causing gdb to + point to Vala source file and line number instead of the generated C + source when possible. + # Individual linker flags Linker flags end up in the environment variable `LDFLAGS`. diff --git a/macros b/macros index 4a554b9..59c3c0c 100644 --- a/macros +++ b/macros @@ -65,6 +65,9 @@ # the corresponding variable names. %build_fflags %{optflags} -I%{_fmoddir} +# Vala compiler flags. This is used to set VALAFLAGS. +%build_valaflags -g + # When clang is used as a linker driver, it does not auto-detect the LTO # bytecode and neither does bfd, so we need to explicitly pass the -flto # flag when linking. @@ -78,8 +81,8 @@ %build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] %{_build_id_flags} %{?_package_note_flags} # Expands to shell code to set the compiler/linker environment -# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have -# not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already +# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, VALAFLAGS, LDFLAGS if they +# have not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already # been set implicitly at the start of the %%build section. # LT_SYS_LIBRARY_PATH is used by libtool script. %set_build_flags \ @@ -87,6 +90,7 @@ CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \ FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \ + VALAFLAGS="${VALAFLAGS:-%{build_valaflags}}" ; export VALAFLAGS ; \ LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \ LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH ; \ CC="${CC:-%{__cc}}" ; export CC ; \