Help writing spec file

Hello. I am trying to build gnome-console on fedora.
I am encountering an error 0001 when building the package.

spec file:

%define glib2_version 2.52.0
%define gtk3_version 3.24.0
%define vte_version 0.64.0
%define desktop_file_utils_version 0.2.90

Name:    console
Version: 0.4.0
Release: 1%{?dist}
Summary: A simple user-friendly terminal emulator for the GNOME desktop.

License: GPLv3+
URL:     https://gitlab.gnome.org/GNOME/console
Source0: https://gitlab.gnome.org/GNOME/console/-/archive/%{version}/console-%{version}.tar.bz2



BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
BuildRequires: pkgconfig(gsettings-desktop-schemas)
BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version}
BuildRequires: pkgconfig(libpcre2-8)
BuildRequires: pkgconfig(vte-2.91) >= %{vte_version}
BuildRequires: desktop-file-utils >= %{desktop_file_utils_version}
BuildRequires: gcc-c++
BuildRequires: gnome-shell
BuildRequires: meson
BuildRequires: sassc
BuildRequires: pkgconfig(libnautilus-extension)

Requires: dbus
Requires: glib2%{?_isa} >= %{glib2_version}
Requires: gsettings-desktop-schemas
Requires: gtk3%{?_isa} >= %{gtk3_version}
Requires: vte291%{?_isa} >= %{vte_version}
Requires: libhandy

%description
A simple user-friendly terminal emulator for the GNOME desktop.



%prep
%setup 

%build
%meson 

%meson_build

%install
%meson_install
%find_lang kgx --with-gnome


%check
desktop-file-validate %{buildroot}%{_datadir}/applications/org.gnome.zbrown.KingsCross.desktop
%meson_test

%files -f kgx.lang
%{_bindir}/kgx
%{_datadir}/metainfo/org.gnome.zbrown.KingsCross.metainfo.xml
%{_datadir}/applications/org.gnome.zbrown.KingsCross.desktop
%{_datadir}/dbus-1/services/org.gnome.zbrown.KingsCross.service
%{_datadir}/glib-2.0/schemas/org.gnome.zbrown.KingsCross.gschema.xml
%{_datadir}/icons/hicolor/scalable/apps/org.gnome.zbrown.KingsCross.svg
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.zbrown.KingsCross-symbolic.svg

%dir %{_libdir}/kgx
%{_libdir}/kgx/libkgx.so
%{_libdir}/nautilus/extensions-3.0/libkgx-nautilus.so





%changelog
* experimental

Error:

Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.j1YLM3
+ umask 022
+ cd /tmp/rpkg/gnome-console-2-nxix8wus
+ '[' /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64 '!=' / ']'
+ rm -rf /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64
++ dirname /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64
+ mkdir -p /tmp/rpkg/gnome-console-2-nxix8wus
+ mkdir /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64
+ cd console-0.4.0
+ DESTDIR=/tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64
+ /usr/bin/meson install -C redhat-linux-build --no-rebuild
Installing data/org.gnome.zbrown.KingsCross.desktop to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/share/applications
Installing data/org.gnome.zbrown.KingsCross.metainfo.xml to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/share/metainfo
Installing src/libkgx.so to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/lib64/kgx
Installing src/kgx to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/bin
Installing nautilus/libkgx-nautilus.so to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/lib64/nautilus/extensions-3.0
Installing /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0/redhat-linux-build/data/org.gnome.zbrown.KingsCross.gschema.xml to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/share/glib-2.0/schemas
Installing /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0/redhat-linux-build/data/org.gnome.zbrown.KingsCross.service to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/share/dbus-1/services
Installing /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0/data/org.gnome.zbrown.KingsCross.svg to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/share/icons/hicolor/scalable/apps
Installing /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0/data/org.gnome.zbrown.KingsCross-symbolic.svg to /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/share/icons/hicolor/symbolic/apps
Running custom install script '/usr/bin/meson --internal gettext install --subdir=po --localedir=share/locale --pkgname=kgx'
Running custom install script '/tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0/build-aux/meson/postinstall.py'
+ /usr/lib/rpm/find-lang.sh /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64 kgx --with-gnome
+ /usr/bin/find-debuginfo -j4 --strict-build-id -m -i --build-id-seed 0.4.0-1.fc35 --unique-debug-suffix -0.4.0-1.fc35.x86_64 --unique-debug-src-base console-0.4.0-1.fc35.x86_64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 -S debugsourcefiles.list /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0
extracting debug info from /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/lib64/kgx/libkgx.so
extracting debug info from /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/lib64/nautilus/extensions-3.0/libkgx-nautilus.so
extracting debug info from /tmp/rpkg/gnome-console-2-nxix8wus/console-0.4.0-1.fc35.x86_64/usr/bin/kgx
original debug info size: 768kB, size after compression: 636kB
/usr/bin/sepdebugcrcfix: Updated 3 CRC32s, 0 CRC32s did match.
1295 blocks
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/check-rpaths
*******************************************************************************
*
* WARNING: 'check-rpaths' detected a broken RPATH OR RUNPATH and will cause
*          'rpmbuild' to fail. To ignore these errors, you can set the
*          '$QA_RPATHS' environment variable which is a bitmask allowing the
*          values below. The current value of QA_RPATHS is 0x0000.
*
*    0x0001 ... standard RPATHs (e.g. /usr/lib); such RPATHs are a minor
*               issue but are introducing redundant searchpaths without
*               providing a benefit. They can also cause errors in multilib
*               environments.
*    0x0002 ... invalid RPATHs; these are RPATHs which are neither absolute
*               nor relative filenames and can therefore be a SECURITY risk
*    0x0004 ... insecure RPATHs; these are relative RPATHs which are a
*               SECURITY risk
*    0x0008 ... the special '$ORIGIN' RPATHs are appearing after other
*               RPATHs; this is just a minor issue but usually unwanted
*    0x0010 ... the RPATH is empty; there is no reason for such RPATHs
*               and they cause unneeded work while loading libraries
*    0x0020 ... an RPATH references '..' of an absolute path; this will break
*               the functionality when the path before '..' is a symlink
*          
*
* Examples:
* - to ignore standard and empty RPATHs, execute 'rpmbuild' like
*   $ QA_RPATHS=$(( 0x0001|0x0010 )) rpmbuild my-package.src.rpm
* - to check existing files, set $RPM_BUILD_ROOT and execute check-rpaths like
*   $ RPM_BUILD_ROOT=<top-dir> /usr/lib/rpm/check-rpaths
*  
*******************************************************************************
ERROR   0001: file '/usr/lib64/kgx/libkgx.so' contains a standard  '/usr/lib64' in [/usr/lib64/kgx:/usr/lib64]
error: Bad exit status from /var/tmp/rpm-tmp.j1YLM3 (%install)


RPM build errors:
    bad date in %changelog: experimental
    Bad exit status from /var/tmp/rpm-tmp.j1YLM3 (%install)
1 Like

Hello @arun54321

I’m not an expert.
For more context read here: RPATH handling · Wiki · CMake / Community · GitLab

BTW, while packaging stuff, packagers ask for help upstream if there are particular issues compiling stuff with RPM macros and so on.

However, looking at the console repository, you will find that upstream already handled the issue: meson: Drop rpath (0bcc84d6) · Commits · GNOME / Console · GitLab

So, since you are using the 0.4.0 version, that is not the last one (indeed the last one is 42.beta, that requires libhandy >= 1.5, and on Fedora 35 we have 1.4, so this would require an extra effort), well, you can patch the src/meson.build and include a patch in the SPEC file:

i.e.

cd ~/rpmbuild/BUILD/console-0.4.0
cp src/meson.build src/meson.build.orig
vi src/meson.build
git diff src/meson.build.orig src/meson.build > ~/rpmbuild/SOURCES/00rpath.patch

In the spec file add a line like
Patch0: 00rpath.patch
after Source0, and in the %prep section
%autosetup -p1

In addition take into account that at a first glance these buildrequires should be added:

BuildRequires: libhandy-devel
BuildRequires: libgtop2-devel
2 Likes