#3 Clean spec file
Opened 2 months ago by jstanek. Modified 2 months ago
rpms/ jstanek/wlroots pr/spec-cleanup  into  master

file modified
+32 -86

@@ -1,19 +1,9 @@ 

- %global commit  0.6.0

- %global gitdate %{nil}

- %global gitrel  %{nil}

- %global gitver  %{nil}

- # Keep the below around for possible snapshot times (was a must prior to 0.1)

- #global scommit #(c=#{commit}; echo ${c:0:7})

- #global gitrel  .#{gitdate}git#{scommit}

- #global gitver  -#{gitdate}git#{scommit}

- 

- 

- %global api_ver 3

- 

+ # Version of the .so library

+ %global abi_ver 3

  

  Name:           wlroots

  Version:        0.6.0

- Release:        1%{?gitrel}%{?dist}

+ Release:        1%{?dist}

  Summary:        A modular Wayland compositor library

  

  # Source files/overall project licensed as MIT, but

@@ -24,10 +14,9 @@ 

  # `wayland-scanner` binary during build and don't alter

  # the main license of the binaries linking with them by

  # the underlying licenses.

- 

  License:        MIT

  URL:            https://github.com/swaywm/%{name}

- Source0:        %{url}/archive/%{commit}.tar.gz#/%{name}-%{version}%{?gitver}.tar.gz

+ Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz

  # this file is a modification of examples/meson.build so as to:

  # - make it self-contained

  # - only has targets for examples known to compile well (cf. "examples) global)

@@ -35,54 +24,25 @@ 

  

  BuildRequires:  gcc

  BuildRequires:  meson >= 0.48.0

- # patch application

- #BuildRequires:  git

- 

+ BuildRequires:  pkgconfig(egl)

  BuildRequires:  pkgconfig(freerdp2)

- #                                   freerdp-devel

+ BuildRequires:  pkgconfig(gbm) >= 17.1.0

+ BuildRequires:  pkgconfig(glesv2)

  BuildRequires:  pkgconfig(libcap)

- #                                   libcap-devel

  BuildRequires:  pkgconfig(libdrm) >= 2.4.95

- #                                   libdrm-devel >= 2.4.95

- #                                   # transitively: mesa-libEGL-devel

  BuildRequires:  pkgconfig(libinput) >= 1.9.0

- #                                   libinput-devel >= 1.9.0

- BuildRequires:  pkgconfig(winpr2)

- #                                   libwinpr-devel

- BuildRequires:  pkgconfig(xkbcommon)

- #                                   libxkbcommon-devel

- #                                   # transitively: freerdp-devel

- BuildRequires:  pkgconfig(egl)

- #                                   mesa-libEGL-devel

- BuildRequires:  pkgconfig(glesv2)

- BuildRequires:  pkgconfig(gbm) >= 17.1.0

- #                                   mesa-libgbm-devel >= 17.1.0

- BuildRequires:  pkgconfig(pixman-1)

- #                                   pixman-devel

  BuildRequires:  pkgconfig(libudev)

- #                                   systemd-devel

+ BuildRequires:  pkgconfig(pixman-1)

  BuildRequires:  pkgconfig(wayland-client)

- BuildRequires:  pkgconfig(wayland-server) >= 1.16

- #                                   wayland-devel >= 1.16

- #                                   # transitively: freerdp-devel

  BuildRequires:  pkgconfig(wayland-protocols) >= 1.17

- #                                   wayland-protocols-devel >= 1.17

+ BuildRequires:  pkgconfig(wayland-server) >= 1.16

+ BuildRequires:  pkgconfig(winpr2)

  BuildRequires:  pkgconfig(xcb-icccm)

- #                                   xcb-util-wm-devel

- 

- # these are for examples only:

- #BuildRequires: pkgconfig(libpng)

- #                                   libpng

- #                                   for: examples/screencopy

- #BuildRequires: libavcoded libavformat libavutil

- #                                   not in Fedora

- #                                   for: examples/dmabuf-capture

- 

+ BuildRequires:  pkgconfig(xkbcommon)

  

  # only select examples are supported for being readily compilable (see SOURCE1)

- %global examples %{nil \

- } cat multi-pointer output-layout pointer rotation screencopy simple tablet touch

- 

+ %global examples \

+     cat multi-pointer output-layout pointer rotation screencopy simple tablet touch

  

  %description

  %{summary}.

@@ -90,64 +50,50 @@ 

  

  %package        devel

  Summary:        Development files for %{name}

- 

  Requires:       %{name}%{?_isa} == %{version}-%{release}

- Requires:       xcb-util-wm-devel%{?_isa}

- # these dependencies are fulfilled with automatic "pkgconfig(*)")

- #Requires:       libinput-devel#{?_isa} >= 1.9.0

- #Requires:       libxkbcommon-devel${?_isa}

- #Requires:       mesa-libEGL-devel${?_isa}

- #Requires:       pixman-devel#{?_isa}

- #Requires:       systemd-devel#{?_isa}

- #Requires:       wayland-devel#{?_isa} >= 1.16

- 

+ # not required per se, so not picked up automatically by RPM

+ Recommends:     pkgconfig(xcb-icccm)

  # for examples

  Suggests:       gcc

- Suggests:       libpng

- Suggests:       meson

+ Suggests:       meson >= 0.48.0

+ Suggests:       pkgconfig(libpng)

  

  %description    devel

  Development files for %{name}.

  

  

  %prep

- %setup -q -n %{name}-%{commit}

- #global __scm git_am

- #__scm_setup_git

- #autopatch -p1

+ %autosetup -p1

  

  

  %build

- 

- # Needed since xcb-errors is not packaged (yet?)

- %global __meson_auto_features auto

- %meson -Drootston=false -Dexamples=false

- %meson_build

+ # Disable options requiring extra/unpackaged dependencies

+ %{meson} -Drootston=false -Dexamples=false -Dxcb-errors=disabled

+ %{meson_build}

  

  

  %install

- %meson_install

+ %{meson_install}

  

- # %%doc && examples.

- %{__mkdir} -p %{buildroot}%{_pkgdocdir}/examples

- %{__cp} -p README.md %{buildroot}%{_pkgdocdir}

- examples=$(for e in %{examples}; do echo examples/$e.[ch]; done)

- %{__cp} -p ${examples} %{buildroot}%{_pkgdocdir}/examples

- %{__cp} -p %SOURCE1 %{buildroot}%{_pkgdocdir}/examples/meson.build

+ EXAMPLES=( %{examples} )  # Normalize whitespace by creating an array

+ for example in "${EXAMPLES[@]}"; do

+     install -pm0644 -Dt '%{buildroot}/%{_pkgdocdir}/examples' examples/"${example}".[ch]

+ done

+ install -pm0644 -D '%{SOURCE1}' '%{buildroot}/%{_pkgdocdir}/examples/meson.build'

  

  

  %check

- %meson_test

+ %{meson_test}

  

  

  %files

- %doc %dir %{_pkgdocdir}

- %doc %{_pkgdocdir}/README.md

  %license LICENSE

- %{_libdir}/lib%{name}.so.%{api_ver}*

+ %doc README.md

+ %doc %dir %{_pkgdocdir}

+ %{_libdir}/lib%{name}.so.%{abi_ver}*

  

  

- %files          devel

+ %files  devel

  %doc %{_pkgdocdir}/examples

  %{_includedir}/wlr

  %{_libdir}/lib%{name}.so

This is rather aggresive and opinionated cleanup of the spec file. Notable changes:

  • Remove remnants of packaging arbitrary git checkouts: No longer needed

  • Rename %api_ver to %abi_ver: The macro is used to track a SONAME version of the library. This should change on ABI change, not necessarily on API change.

  • Use simpler GitHub release URL.

  • Remove dependency-resolution comments from BR, sort BR: These comments were basically clutter, and can become incorrect in the future. Let's just let the DNF to do the package resolution as necessary ;). Also, sorted requires should be easier to navigate in.

  • Replace hard devel dependency for xcb-icccm with softer Recommends: I'm not really sure why this requirement was even there, as nothing in the -devel package actually requires it, but I suspect it should add the optional dependency not picked up automatically by RPM.
    I have changed it to Recommend (which should pull it by default, but not complain if it is removed later) and used the pkgconfig provide to pull it.

  • Replace as much macro-magic as possible: The examples installation was re-done to use less macro magic (%{nil}, %{__cp}).

As stated at the top, this is rather opinionated cleanup. Comments, questions and suggestions expected and welcome ☺.

Metadata