Last active
April 20, 2023 12:29
-
-
Save kwk/11dd40571599f407478b6dacf756d5fa to your computer and use it in GitHub Desktop.
Redfine macros upon installation.
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
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_macros | |
%global toolchain clang | |
Name: myapp | |
Version: 1.0.0 | |
Release: 1%{?dist} | |
Summary: A simple "Hello, World!" application. | |
License: Apache-2.0 | |
URL: https://github.com/kwk/hello-world | |
Source0: myapp-%{version}.tar.bz2 | |
BuildRequires: clang | |
BuildRequires: cmake | |
BuildRequires: git | |
%description | |
A simple "Hello, World!" application. | |
%prep | |
%autosetup -S git | |
%build | |
%cmake -DCMAKE_BUILD_TYPE=Release | |
%cmake_build | |
%install | |
%cmake_install | |
mkdir -p %{buildroot}/%{_rpmmacrodir} | |
touch %{buildroot}/%{_rpmmacrodir}/macros.my-package | |
%check | |
test "`%{buildroot}/%{_bindir}/myapp`" = "Hello, World!" | |
%triggerin -- redhat-rpm-config | |
echo "%%__os_install_post \\" > %{_rpmmacrodir}/macros.my-package | |
rpm --eval "%%{macrobody:__os_install_post}" \ | |
| sed '/^%%{nil}/!s,$, \\,' \ | |
| sed 's/%%{nil}/%%{__llvm_pgo_instrumented_os_install_post} \\\n%%{nil}/' >> %{_rpmmacrodir}/macros.my-package | |
%files | |
%license LICENSE | |
%{_rpmmacrodir}/macros.my-package | |
%{_bindir}/myapp | |
%changelog | |
* Wed Mar 1 2023 john doe [email protected]> - 1.0.0-1 | |
- Building step1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment