Skip to content

Instantly share code, notes, and snippets.

@anaselli
Last active June 20, 2021 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anaselli/00335b487b2885602851a5c3014f01a3 to your computer and use it in GitHub Desktop.
Save anaselli/00335b487b2885602851a5c3014f01a3 to your computer and use it in GitHub Desktop.
attempt to get a libyui spec for building all
%define major 15
%define libname %mklibname yui %{major}
%define develname %mklibname yui -d
%define libyui_tar_version master
#--------------------------------------------------------
# Package libyui-ncurses
%define yui_ncurses_name libyui-ncurses
%define libyui_ncurses_name %mklibname yui %{major}-ncurses
%define libyui_ncurses_develname %mklibname yui-ncurses -d
#--------------------------------------------------------
# Package libyui-qt
%define yui_qt_name libyui-qt
%define libyui_qt_name %mklibname yui %{major}-qt
%define libyui_qt_develname %mklibname -d yui-qt
#--------------------------------------------------------
# Package libyui-mga (additional and external source)
%define yui_mga_name libyui-mga
%define libyui_mga_tar_version master
%define libyui_mga_version 1.2.0
%define libyui_mga_name %mklibname yui %{major}-mga
%define libyui_mga_develname %mklibname -d yui-mga
#--------------------------------------------------------
Name: libyui
Version: 4.2.14
Release: %mkrel 1
Summary: YaST2 User Interface Engine
Group: System/Libraries
License: LGPLv2+
URL: https://github.com/libyui/libyui
Source0: https://github.com/libyui/libyui/archive/v%{version}/%{name}-%{libyui_tar_version}.tar.bz2
#building with libyui-mga inside to get rid of libyui-bindings dependency of it
Source1: https://github.com/manatools/libyui-mga/archive/v%{version}/%{yui_mga_name}-%{libyui_mga_tar_version}.tar.bz2
Patch0: 00bindings_perl_pthread_dep.patch
Patch1: 01pkgconfig_dir.patch
Patch2: 02bindings_python_with_MGA.patch
BuildRequires: cmake
BuildRequires: boost-devel
BuildRequires: libtool
BuildRequires: perl-devel
BuildRequires: pkgconfig(ruby)
BuildRequires: ruby-RubyGems
BuildRequires: swig
BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Svg)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5X11Extras)
BuildRequires: pkgconfig(ncursesw)
BuildRequires: pkgconfig(ncurses)
%description
libYUI is a library written entirely in C++ to provide an abstraction layer
for Qt, GTK and ncurses UI frameworks. This means that a single code in YUI
can be used to produce outputs using any of the 3 UI frameworks listed above.
This library was (and still is) used to create the YaST2 User Interface.
#----------------------------------------------------------
# libyui
%package -n %libname
Summary: YaST2 User Interface Engine
Group: System/Libraries
Provides: %{name} = %{version}-%{release}
%description -n %libname
This package contains the library needed to run programs
dynamically linked with libyui.
%files -n %libname
%doc COPYING* README.md
%dir %{_libdir}/yui
%dir %{_datadir}/libyui
%{_libdir}/lib*yui.so.%{major}{,.*}
#----------------------------------------------------------
# libyui-devel
%package -n %develname
Summary: libYUI, YaST2 User Interface Engine - header files
Group: Development/C++
Requires: %{libname} >= %{version}
Requires: boost-devel
Provides: %{name}-devel = %{version}-%{release}
Provides: yui-devel = %{version}-%{release}
%description -n %develname
This is the development package for libyui user interface engine
that provides the abstraction from graphical user interfaces (Qt, Gtk)
and text based user interfaces (ncurses).
%files -n %develname
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/libyui.pc
%{_includedir}/yui
%{_datadir}/libyui/buildtools
#----------------------------------------------------------
# libyui-mga
%package -n %libyui_mga_name
Summary: UI abstraction library - Mageia extension widget base plugin
Group: System/Libraries
Requires: libyui
Provides: %{yui_mga_name} = %{libyui_mga_version}-%{release}
%description -n %libyui_mga_name
This package contains the library needed to run programs
dynamically linked with libyui-mga.
%files -n %libyui_mga_name
%doc %{yui_mga_name}/COPYING* %{yui_mga_name}/README.md
%dir %{_libdir}/yui/mga
%{_libdir}/lib*yui-mga.so.%{major}{,.*}
#-----------------------------------------------------------------------
# libyui-mga-devel
%package -n %libyui_mga_develname
Summary: UI abstraction library - Mageia extension widget base plugin header files
Group: Development/C++
Requires: libyui-devel
Requires: %{yui_mga_name} = %{libyui_mga_version}-%{release}
%description -n %libyui_mga_develname
This package provides headers files for libyui-mga development.
%files -n %libyui_mga_develname
%{_includedir}/yui/mga
%{_libdir}/libyui-mga.so
%{_libdir}/pkgconfig/libyui-mga.pc
#-----------------------------------------------------------------------
# libyui-qt
%package -n %libyui_qt_name
Summary: Libyui - Qt (graphical) user interface
Group: System/Libraries
Requires: libyui
Requires: %{_lib}qt5x11extras5
Provides: %{yui_qt_name} = %{version}-%{release}
Provides: libyui%{major}-qt = %{version}-%{release}
%description -n %libyui_qt_name
This package contains the Qt (graphical) user interface component
for libyui.
%files -n %libyui_qt_name
%doc COPYING*
%{_libdir}/yui/libyui-qt.so.%{major}{,.*}
#-----------------------------------------------------------------------
# libyui-qt-devel
%package -n %libyui_qt_develname
Summary: Libyui - Qt (graphical) user interface header files
Group: Development/KDE and Qt
Requires: libyui-devel
Requires: %{yui_qt_name} = %{version}-%{release}
Provides: yui-qt-devel = %{version}-%{release}
%description -n %libyui_qt_develname
This package contains the header files for the Qt based
user interface component for libyui.
This package is not needed to develop libyui-based applications,
only to develop extensions for libyui-qt.
%files -n %libyui_qt_develname
%{_includedir}/yui/qt
%{_libdir}/yui/libyui-qt*.so
%{_libdir}/pkgconfig/libyui-qt.pc
#-----------------------------------------------------------------------
# libyui-ncurses
%package -n %libyui_ncurses_name
Summary: Libyui - NCurses (text based) user interface
Group: System/Libraries
Requires: libyui
Provides: %{yui_ncurses_name} = %{version}-%{release}
Provides: libyui%{major}-ncurses = %{version}-%{release}
%description -n %libyui_ncurses_name
This package contains the NCurses (text based) user interface
component for libyui.
%files -n %libyui_ncurses_name
%doc COPYING*
%{_libdir}/yui/libyui-ncurses.so.%{major}{,.*}
#-----------------------------------------------------------------------
# libyui-ncurses-devel
%package -n %libyui_ncurses_develname
Summary: Libyui - Header fles for the NCurses (text based) user interface
Group: Development/Other
Requires: libyui-devel
Requires: %{yui_ncurses_name} = %{version}-%{release}
Provides: yui-ncurses-devel = %{version}-%{release}
%description -n %libyui_ncurses_develname
This package contains the header files for the NCurses
(text based) user interface component for libyui.
This package is not needed to develop libyui-based applications,
only to develop extensions for libyui-ncurses.
%files -n %libyui_ncurses_develname
%{_libdir}/yui/libyui-ncurses*.so
%{_includedir}/yui/ncurses
%{_libdir}/pkgconfig/libyui-ncurses.pc
#----------------------------------------------------------
# libyui-ncurses-tools
%package -n %{yui_ncurses_name}-tools
Summary: Libyui - tools for the NCurses (text based) user interface
Group: System/Libraries
# conflict with libyui-ncurses8, /usr/bin/libyui-terminal was originally there
Conflicts: %mklibname yui 8-ncurses
Requires: screen
%description -n %{yui_ncurses_name}-tools
This package contains tools for the NCurses (text based)
user interface component for libyui:
libyui-terminal - useful for testing on headless machines
%files -n %{yui_ncurses_name}-tools
%{_bindir}/libyui-terminal
#----------------------------------------------------------
# ruby-yui
%package -n ruby-yui
License: GPLv2+
Summary: Ruby bindings for libyui
Group: Development/Ruby
%description -n ruby-yui
This package provides Ruby language bindings to access functions of
libyui - the YaST User Interface engine that provides the
abstraction from graphical user interfaces (Qt, Gtk) and text based
user interfaces (ncurses).
%files -n ruby-yui
%doc libyui-bindings/swig/ruby/examples/*.rb
%{ruby_vendorarchdir}/_yui.so
#----------------------------------------------------------
# python3-yui
%package -n python3-yui
License: GPLv2+
Summary: Python 3 bindings for libyui
Group: Development/Python
%{?python_provide:%python_provide python3-yui}
%description -n python3-yui
This package provides Python 3 language bindings to access functions of
libyui - the YaST User Interface engine that provides the
abstraction from graphical user interfaces (Qt, Gtk) and text based
user interfaces (ncurses).
%files -n python3-yui
%doc libyui-bindings/swig/python/examples/*.py
%{python3_sitearch}/_yui.so
%{python3_sitearch}/yui.*
%{python3_sitearch}/__pycache__/*
#----------------------------------------------------------
# perl-yui
%package -n perl-yui
License: GPLv2+
Summary: Perl bindings for libyui
Group: Development/Perl
%description -n perl-yui
This package provides Perl language bindings to access functions of
libyui - the YaST User Interface engine that provides the
abstraction from graphical user interfaces (Qt, Gtk) and text based
user interfaces (ncurses).
%files -n perl-yui
%doc libyui-bindings/swig/perl/examples/*.pl
%{perl_vendorarch}/yui.so
%{perl_vendorlib}/yui.pm
#----------------------------------------------------------
%prep
%autosetup -D -a 1 -p1 -n %{name}-%{libyui_tar_version}
%build
# rename to project name without version
mv %{yui_mga_name}-%{libyui_mga_tar_version} %{yui_mga_name}
# Let's pass cmake definitions to all the project to simplify building in a loop
for pkgname in libyui libyui-qt libyui-ncurses libyui-mga libyui-bindings ;do
pushd $pkgname
%cmake -DBUILD_WITH_LIBYUI_SOURCE=on \
-DBUILD_EXAMPLES=off \
-DWITH_MGA=on \
-DPYTHON_EXECUTABLE=%{__python3} \
-DPYTHON_INCLUDE_DIR=%{py3_incdir} \
-DPYTHON_SITEDIR=%{python3_sitearch} \
-DPYTHON_LIB_DIR=%{_libdir}/python%{python3_version}
%cmake_build
popd
done
%install
for pkgname in libyui libyui-qt libyui-ncurses libyui-mga libyui-bindings ;do
pushd $pkgname
%cmake_install
popd
done
install -m0755 -d %{buildroot}%{_libdir}/yui
install -m0755 -d %{buildroot}%{_libdir}/yui/mga
find %{buildroot} -name "*.la" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment