macros: add new distribution-specific macros for package configurations
This commit is based on https://src.fedoraproject.org/rpms/fedora-release/pull-request/223 , customized for CentOS. Define macros for commonly-used strings/urls to distinguish distributions. Spec files have lots of `%{?fedora:}` and `%{?rhel}` conditionals which can be defined in one place. Amazon Linux is a new downstream distribution of Fedora that will add its own definitions as well, so consolidate all of these in a new macros file. As examples, this is how clang.spec and gdb.spec will look after this change: clang.spec: ``` @@ -358,7 +360,7 @@ CFLAGS="$CFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized" \ -DCLANG_BUILD_EXAMPLES:BOOL=OFF \ -DBUILD_SHARED_LIBS=OFF \ - -DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}" \ + -DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \ %ifarch %{arm} -DCLANG_DEFAULT_LINKER=lld \ %endif ``` gdb.spec: ``` -# Change the version that gets printed at GDB startup, so it is RH specific. +# Change the version that gets printed at GDB startup, so it is distro-specific. cat > gdb/version.in << _FOO -%if 0%{!?rhel:1} -Fedora %{version}-%{release} -%else # !0%{!?rhel:1} -Red Hat Enterprise Linux %{version}-%{release} -%endif # !0%{!?rhel:1} +%{?dist_name} %{version}-%{release} _FOO # Remove the info and other generated files added by the FSF release ``` Signed-off-by:Amit Shah <amitshah@fedoraproject.org>
parent
eca70958
-
Owner
Note that if CentOS doesn't want to deviate from the current "Red Hat" branding in help messages, e.g, when issuing
gcc --versionorclang --version, it's better to define these dist macros with "Red Hat" instead of "CentOS".I'll leave that for the maintainers to decide.
-
Owner
rhbz#2112392
Please register or sign in to comment