3429bf6 macros: add new distribution-specific macros for package configurations

2 files Authored by amitshah 2 years ago, Committed by Amit Shah 2 years ago,
    macros: add new distribution-specific macros for package configurations
    
    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.
    
    The macros here have been tested with local builds of clang and gdb.
    Once this change is merged, I will submit updates to a few packages.
    
    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="%{distro_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}
    +%{distro_name} %{version}-%{release}
     _FOO
    
     # Remove the info and other generated files added by the FSF release
    ```
    
    Signed-off-by: Amit Shah <amitshah@fedoraproject.org>
    
        
file added
+50
file modified
+3 -1