Created
April 20, 2023 13:13
-
-
Save kwk/85c32a7a55cedd7e1685a33377f08522 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%set_build_flags \ | |
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \ | |
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \ | |
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \ | |
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \ | |
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 ; \ | |
CXX="${CXX:-%{__cxx}}" ; export CXX \ | |
%{?__llvm_pgo_instrumented_build_flags} | |
%__spec_build_pre %{___build_pre} \ | |
%{?_auto_set_build_flags:%{set_build_flags}} \ | |
%{?_generate_package_note_file} \ | |
%{?__llvm_pgo_instrumented_spec_build_pre} | |
# Overriding __spec_build_post macro from /usr/lib/rpm/macros | |
%__spec_build_post %{?__llvm_pgo_instrumented_spec_build_post} %{___build_post} | |
%__os_install_post \ | |
%{?__brp_ldconfig} \ | |
%{?__brp_compress} \ | |
%{!?__debug_package: \ | |
%{?__brp_strip} \ | |
%{?__brp_strip_comment_note} \ | |
} \ | |
%{?__brp_strip_lto} \ | |
%{?__brp_strip_static_archive} \ | |
%{?__brp_check_rpaths} \ | |
%{?__brp_mangle_shebangs} \ | |
%{?__brp_remove_la_files} \ | |
%{__os_install_post_python} \ | |
%{__llvm_pgo_instrumented_os_install_post} \ | |
%{nil} | |
%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}} \ | |
%{__llvm_pgo_instrumented_install} \ | |
%%install \ | |
%{nil} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# This script redefines the macros that we need to overwrite based on the macro | |
# bodies that we anticipate. | |
# Adds a backslash to each new line unless it is a %{nil} line | |
function add_backslash() { | |
sed '/^%{nil}/!s,$, \\,' | |
} | |
rpm --eval "%%set_build_flags %{macrobody:set_build_flags}" \ | |
| add_backslash | |
echo "%{?__llvm_pgo_instrumented_build_flags}" | |
echo "" | |
echo "" | |
rpm --eval "%%__spec_build_pre %{macrobody:__spec_build_pre}" \ | |
| add_backslash | |
echo "%{?__llvm_pgo_instrumented_spec_build_pre}" | |
echo "" | |
echo "" | |
cat <<EOF | |
# Overriding __spec_build_post macro from /usr/lib/rpm/macros | |
%__spec_build_post \ | |
%{?__llvm_pgo_instrumented_spec_build_post} \ | |
%{___build_post} | |
EOF | |
echo "" | |
echo "" | |
rpm --eval "%%__os_install_post %{macrobody:__os_install_post}" \ | |
| add_backslash \ | |
| sed 's/%{nil}/%{__llvm_pgo_instrumented_os_install_post} \\\n%{nil}/' | |
echo "" | |
echo "" | |
rpm --eval "%%install %{macrobody:install}" \ | |
| add_backslash \ | |
| sed 's/%%install/%{__llvm_pgo_instrumented_install} \\\n%%install/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment