File efl.spec of Package efl

# spec file for package efl
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define sover 1
# build doc is disabled due to #897122 once the bug is resolved it can be re enabled
%define build_doc 0
# Build doc needs to be defined for build doc man to work
%define build_doc_man 0
%define gstreamer1_present 1
%define build_examples 1
%if !0%{?suse_version} || 0%{?is_opensuse}
%define physics_present 1
# Currently we don't need to build any  plugins and theres none that make
# sense to build
%define generic_players_present 0
%define xinput22_present 1
# fedora SLEs 12 don't support xine
%if !0%{?suse_version}
%define xine_present 0
%define xine_present 1
%ifarch %ix86 x86_64 aarch64 %{arml} ppc ppc64le
%if !0%{?suse_version} || 0%{?is_opensuse}
%define luajit_present 1
%if 0%{?is_opensuse}
%define poppler_present 1
%define poppler_present 0
%if 0%{?is_opensuse}
%ifarch !aarch64
%define vlc_present 1
%define vlc_present 0
%define vlc_present 0
%if 0%{?suse_version} > 1500 || 0%{?fedora_version} > 27 || 0%{?mageia} > 6
%define enable_wayland 1
# Build with an alternate package names for Mageia
%if 0%{?mageia}
%ifarch x86_64
%define _bit %(getconf LONG_BIT)
# If packages are targeted for anything other than openSUSE
%{?!icon_theme_cache_create_ghost:%define icon_theme_cache_create_ghost() touch %{buildroot}%{_datadir}/icons/%{1}/icon-theme.cache}
%{?!icon_theme_cache_post:%define icon_theme_cache_post() gtk-update-icon-cache %{_datadir}/icons/$1 &> /dev/null || :}
Name:           efl
Version:        1.24.2
Release:        0
# TODO: split package to separate packages and specify licenses correctly
Summary:        Enlightenment Foundation Libraries - set of libraries used (not only) by E17
License:        BSD-2-Clause AND LGPL-2.1-only AND Zlib
BuildRequires:  ImageMagick
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  gettext-devel
BuildRequires:  giflib-devel
BuildRequires:  glibc-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  libjpeg-devel
BuildRequires:  libraw-devel
BuildRequires:  libspectre-devel
BuildRequires:  meson >= 0.47
BuildRequires:  pkgconfig
BuildRequires:  python >= 2.5
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(check)
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(dri)
BuildRequires:  pkgconfig(egl)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(fribidi)
BuildRequires:  pkgconfig(glesv2)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gstreamer-1.0)
BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires:  pkgconfig(harfbuzz)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libexif)
BuildRequires:  pkgconfig(libopenjp2)
BuildRequires:  pkgconfig(libpng) >= 1.2.10
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(librsvg-2.0)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(libtiff-4)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(libwebp)
%if 0%{?luajit_present}
BuildRequires:  pkgconfig(luajit)
BuildRequires:  pkgconfig(lua5.1)
BuildRequires:  pkgconfig(mount)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(pixman-1)
BuildRequires:  pkgconfig(scim)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(sndfile)
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(tslib)
BuildRequires:  pkgconfig(valgrind)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcomposite)
BuildRequires:  pkgconfig(xcursor)
BuildRequires:  pkgconfig(xdamage)
BuildRequires:  pkgconfig(xdmcp)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xkbcommon-x11)
BuildRequires:  pkgconfig(xkbfile)
BuildRequires:  pkgconfig(xp)
BuildRequires:  pkgconfig(xproto)
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(xscrnsaver)
BuildRequires:  pkgconfig(xtst)
BuildRequires:  pkgconfig(zlib)
Recommends:     %{name}-lang
%if 0%{?luajit_present}
Recommends:     elua = %{version}
Provides:       ecore = %{version}
Obsoletes:      ecore < %{version}
Provides:       edje = %{version}
Obsoletes:      edje < %{version}
Provides:       edje-utils = %{version}
Obsoletes:      edje-utils < %{version}
Provides:       eet = %{version}
Obsoletes:      eet < %{version}
Provides:       eeze = %{version}
Obsoletes:      eeze < %{version}
Provides:       efreet = %{version}
Obsoletes:      efreet < %{version}
Provides:       eina = %{version}
Obsoletes:      eina < %{version}
Provides:       elementary = %{version}
Obsoletes:      elementary < %{version}
Provides:       embryo = %{version}
Obsoletes:      embryo < %{version}
Provides:       emotion = %{version}
Obsoletes:      emotion < %{version}
Provides:       ethumb = %{version}
Obsoletes:      ethumb < %{version}
Provides:       evas = %{version}
Obsoletes:      evas < %{version}

Provides:       libecore%{sover} = %{version}
Obsoletes:      libecore%{sover} < %{version}
Provides:       libector%{sover} = %{version}
Obsoletes:      libector%{sover} < %{version}
Provides:       libedje%{sover} = %{version}
Obsoletes:      libedje%{sover} < %{version}
Provides:       libeet%{sover} = %{version}
Obsoletes:      libeet%{sover} < %{version}
Provides:       libeeze%{sover} = %{version}
Obsoletes:      libeeze%{sover} < %{version}
Provides:       libefl%{sover} = %{version}
Obsoletes:      libefl%{sover} < %{version}
Provides:       libefreet%{sover} = %{version}
Obsoletes:      libefreet%{sover} < %{version}
Provides:       libefreet_mime%{sover} = %{version}
Obsoletes:      libefreet_mime%{sover} < %{version}
Provides:       libefreet_trash%{sover} = %{version}
Obsoletes:      libefreet_trash%{sover} < %{version}
Provides:       libeina%{sover} = %{version}
Obsoletes:      libeina%{sover} < %{version}
Provides:       libeio%{sover} = %{version}
Obsoletes:      libeio%{sover} < %{version}
Provides:       libeldbus%{sover} = %{version}
Obsoletes:      libeldbus%{sover} < %{version}
Provides:       libelementary%{sover} = %{version}
Obsoletes:      libelementary%{sover} < %{version}
Provides:       libelput%{sover} = %{version}
Obsoletes:      libelput%{sover} < %{version}
Provides:       libelua%{sover} = %{version}
Obsoletes:      libelua%{sover} < %{version}
Provides:       libembryo%{sover} = %{version}
Obsoletes:      libembryo%{sover} < %{version}
Provides:       libemile%{sover} = %{version}
Obsoletes:      libemile%{sover} < %{version}
Provides:       libemotion%{sover} = %{version}
Obsoletes:      libemotion%{sover} < %{version}
Provides:       libeo%{sover} = %{version}
Obsoletes:      libeo%{sover} < %{version}
Provides:       libeolian%{sover} = %{version}
Obsoletes:      libeolian%{sover} < %{version}
Provides:       libephysics%{sover} = %{version}
Obsoletes:      libephysics%{sover} < %{version}
Provides:       libethumb%{sover} = %{version}
Obsoletes:      libethumb%{sover} < %{version}
Provides:       libethumb_client%{sover} = %{version}
Obsoletes:      libethumb_client%{sover} < %{version}
Provides:       libevas%{sover} = %{version}
Obsoletes:      libevas%{sover} < %{version}
%if %{build_doc}
BuildRequires:  doxygen
%if %{poppler_present}
# boo#864299 need libpoppler-cpp0 for Leap / SLE
BuildRequires:  libpoppler-cpp0
BuildRequires:  libpoppler-devel
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%ifarch %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7l armv7hl armv6l armv6hl aarch64
BuildRequires:  valgrind
%if 0%{?physics_present}
BuildRequires:  pkgconfig(bullet) >= 2.80
%if %{vlc_present}
BuildRequires:  pkgconfig(libvlc)
%if %{xine_present}
BuildRequires:  pkgconfig(libxine)
%if 0%{?enable_wayland}
BuildRequires:  pkgconfig(gbm)
BuildRequires:  pkgconfig(libdrm) >= 2.4
BuildRequires:  pkgconfig(libinput) >= 0.6.0
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(wayland-client) >= 1.11.0
BuildRequires:  pkgconfig(wayland-cursor) >= 1.11.0
BuildRequires:  pkgconfig(wayland-egl)
BuildRequires:  pkgconfig(wayland-protocols) >= 1.10
BuildRequires:  pkgconfig(wayland-scanner) >= 1.11.0
BuildRequires:  pkgconfig(wayland-server) >= 1.11.0
BuildRequires:  pkgconfig(xkbcommon)
%if 0%{?suse_version}
BuildRequires:  fdupes

EFL is library collection providing various functionality used (not onyl)
by Enlightenment 17, Terminology, Tizen mobile platform and much more.


%package %{?mageia:-n %{_lib}%{name}-}devel
Summary:        Headers, pkgconfig files and other files for development with EFL
License:        BSD-2-Clause AND LGPL-2.1-only AND Zlib
Requires:       %{name} = %{version}
Requires:       gettext-devel
Requires:       giflib-devel
Requires:       glibc-devel
Requires:       pkgconfig(dbus-1)
Requires:       pkgconfig(dri)
Requires:       pkgconfig(egl)
Requires:       pkgconfig(fontconfig)
Requires:       pkgconfig(freetype2)
Requires:       pkgconfig(fribidi)
Requires:       pkgconfig(glesv2)
Requires:       pkgconfig(glib-2.0)
Requires:       pkgconfig(harfbuzz)
Requires:       pkgconfig(libcurl)
Requires:       pkgconfig(libexif)
Requires:       pkgconfig(libpng) >= 1.2.10
Requires:       pkgconfig(libpulse)
Requires:       pkgconfig(librsvg-2.0)
Requires:       pkgconfig(libtiff-4)
Requires:       pkgconfig(libudev)
%if 0%{?luajit_present}
Requires:       pkgconfig(luajit)
Requires:       pkgconfig(lua5.1)
Requires:       pkgconfig(openssl)
Requires:       pkgconfig(pixman-1)
Requires:       pkgconfig(sdl)
Requires:       pkgconfig(sndfile)
Requires:       pkgconfig(x11)
Requires:       pkgconfig(xcomposite)
Requires:       pkgconfig(xcursor)
Requires:       pkgconfig(xdmcp)
Requires:       pkgconfig(xext)
Requires:       pkgconfig(xi)
Requires:       pkgconfig(xinerama)
Requires:       pkgconfig(xp)
Requires:       pkgconfig(xproto)
Requires:       pkgconfig(xrandr)
Requires:       pkgconfig(xscrnsaver)
Requires:       pkgconfig(xtst)
Requires:       pkgconfig(zlib)
Provides:       %{?mageia:%{_lib}}ecore-devel = %{version}
Provides:       %{?mageia:%{_lib}}edbus-devel = %{version}
Provides:       %{?mageia:%{_lib}}edje-devel = %{version}
Provides:       %{?mageia:%{_lib}}eet-devel = %{version}
Provides:       %{?mageia:%{_lib}}eeze-devel = %{version}
Provides:       %{?mageia:%{_lib}}efreet-devel = %{version}
Provides:       %{?mageia:%{_lib}}eina-devel = %{version}
Provides:       %{?mageia:%{_lib}}eio-devel = %{version}
Provides:       %{?mageia:%{_lib}}elementary-devel = %{version}
Provides:       %{?mageia:%{_lib}}embryo-devel = %{version}
Provides:       %{?mageia:%{_lib}}emotion-devel = %{version}
Provides:       %{?mageia:%{_lib}}emotion-generic-players-devel = %{version}
Provides:       %{?mageia:%{_lib}}eo-devel = %{version}
Provides:       %{?mageia:%{_lib}}ethumb-devel = %{version}
Provides:       %{?mageia:%{_lib}}evas-devel = %{version}
Provides:       %{?mageia:%{_lib}}evas-generic-loaders-devel = %{version}
Obsoletes:      %{?mageia:%{_lib}}ecore-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}edbus-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}edje-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}eet-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}eeze-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}efreet-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}eina-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}eio-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}elementary-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}embryo-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}emotion-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}emotion-generic-players-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}eo-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}ethumb-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}evas-devel < %{version}
Obsoletes:      %{?mageia:%{_lib}}evas-generic-loaders-devel < %{version}
%if %{xine_present}
Requires:       pkgconfig(libxine)
%if %{gstreamer1_present}
Requires:       pkgconfig(gstreamer-1.0)
Requires:       pkgconfig(gstreamer-plugins-base-1.0)
%if 0%{?physics_present}
Requires:       pkgconfig(bullet)
%if 0%{?physics_present}
Provides:       %{?mageia:%{_lib}}ephysics-devel = %{version}
Obsoletes:      %{?mageia:%{_lib}}ephysics-devel < %{version}

%description %{?mageia:-n %{_lib}%{name}-}devel
Headers, pkgconfig files and other files needed for development with EFL.

%if %{build_examples}
%package -n elementary-examples
Summary:        Elementary examples
License:        LGPL-2.1-only

%description -n elementary-examples
Examples of usage of Elementary library.

%package -n elua
Summary:        LuaJIT bindings for the efl
License:        LGPL-2.1-only
Requires:       efl = %{version}

%description -n elua
A set of efl bindings for the LuaJIT environment.

%package -n evas-generic-loaders
Summary:        Set of generic loaders for Evas
License:        GPL-2.0-or-later

%description -n evas-generic-loaders
Set of generic loaders allowing to open XCF, PDF, PS, RAW,

Useful only for evas library.

This part of the Enlightenment Foundation Libraries.

%if %{generic_players_present}
%package -n emotion-generic-players
Summary:        Set of generic players for Emotion
License:        GPL-2.0-or-later

%description -n emotion-generic-players
Set of generic players (currently VLC is supported) allowing to open video
files through emotion.

Useful only for emotion library.

This part of the Enlightenment Foundation Libraries.

%if %{build_doc}
%if %{build_doc_man}
%package doc-man
Summary:        EFL reference man pages
License:        BSD-2-Clause

%description doc-man
Documentation in form of man pages describing EFL API.
%endif #build_doc_man

%package doc-html
Summary:        EFL reference man pages
License:        BSD-2-Clause

%description doc-html
Documentation in form of HTML pages describing EFL API.
%endif #build_doc

%if %{build_examples}
%package examples
Summary:        Examples of EFL usage
License:        BSD-2-Clause AND LGPL-2.1-only AND Zlib

%description examples
Examples usage of the EFL library.

%package testsuite
Summary:        EFL testsuite
License:        BSD-2-Clause AND LGPL-2.1-only AND Zlib
Requires:       lib%{?mageia:%{?_bit}}efreet%{sover} = %{version}

%description testsuite
Testsuite of EFL package.

%package -n enlightenment-theme-upstream
Version:        0.21.0
Release:        0
Summary:        Default Enlightenment theme
License:        BSD-2-Clause AND LGPL-2.1-only
Conflicts:      otherproviders(enlightenment-theme-dft)
Provides:       enlightenment-theme = 0.1
Provides:       enlightenment-theme-dft

%description  -n enlightenment-theme-upstream
For use with upstream branding, when using openSUSE themes, when using
openSUSE themes Use the Dark theme instead.

%package -n enlightenment-theme-dark
Version:        0.21.0
Release:        0
Summary:        Default Enlightenment theme(Dark)
License:        BSD-2-Clause AND LGPL-2.1-only
Provides:       enlightenment-theme

%description  -n enlightenment-theme-dark
The default theme for enlightenment install when using openSUSE branding.

%package -n enlightenment-x-dark-icon-theme
Version:        0.21.0
Release:        0
Summary:        A compatible icon theme
License:        GPL-3.0-only

%description -n enlightenment-x-dark-icon-theme
Setting this icon theme as your application icon theme in enlightenment will
make all your applications use the same icon set as the enlightenment
dark (upstream) theme.

Icon themes to match the openSUSE Enlightenment themes are also available.

%setup -q
%autopatch -p1
# remove __DATE__ and __TIME__
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
FAKE_DOCDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%a %%b %%d %%Y')
sed -e "s/__TIME__/$FAKE_BUILDTIME/g" \
    -e "s/__DATE__/$FAKE_BUILDDATE/g" \
    -i $(grep -rl '__TIME__\|__DATE__') || :

%if 0%{?enable_wayland}
INCLUDEDIR="-I$(pkg-config --variable=includedir wayland-server)"
INCLUDEDIR+=" -I$(pkg-config --variable=includedir xkbcommon)"
INCLUDEDIR+=" -I$(pkg-config --variable=includedir libinput)"

# efl intentionally compares string pointers in alot of places rather then strings this stops obs complaining
export CFLAGS="%{optflags}%{?mageia: -g} -Wno-address %{?enable_wayland:$INCLUDEDIR}"

%meson \
%if 0%{?physics_present}
    -Dphysics=true \
%if !0%{?poppler_present}
    -Devas-loaders-disabler=pdf,webp \
    -Dharfbuzz=true \
%if 0%{?xinput22_present}
    -Dxinput22=true \
%if 0%{?xine_present}
    -Demotion-loaders-disabler=gstreamer,gstreamer1,libvlc \
    -Dsystemd=true \
    -Dfb=true \
%if 0%{?enable_wayland}
    -Ddrm=true \
    -Dwl=true \
    -Dopengl=es-egl \
%if !0%{?luajit_present}
    -Delua=false \
    -Dlua-interpreter=lua \
%if %{build_examples}
    -Dbuild-examples=true \
    -Dbuild-examples=false \



# delete binary with suid bit set :D
rm -f "%{buildroot}/%{_bindir}/eeze_scanner"

%if %{build_doc}
%if %{build_doc_man}
# copy documentation manually
echo "Copying MAN pages"
/bin/cp -vr doc/man %{buildroot}%{_datadir}/
%endif #build_doc_man

# fix line endings
find doc/html -name '*.eps' | xargs sed -i 's@\r@\n@g'
# remove duplicates
%if 0%{?suse_version}
%fdupes -s doc/html
%if %{build_doc_man}
%fdupes -s %{buildroot}%{_mandir}/
%endif #build_doc_man
%endif #build_doc

# fix permissions
#%if %{build_examples} || %{build_doc_man}
#find \
#%if %{build_doc_man}
#     %{buildroot}%{_mandir} \
#     doc \
#%if %{build_examples}
#     %{buildroot}%{_datadir}/*/examples \
#     -type d -exec chmod 0755 {} \;
#find \
#%if %{build_doc_man}
#     %{buildroot}%{_mandir} \
#     doc \
#%if %{build_examples}
#     %{buildroot}%{_datadir}/*/examples \
#    -type f -exec chmod 0644 {} \;

# python gdb pretty printers shouldn't have execute permissions.
chmod 0644 %{buildroot}%{_datadir}/eo/gdb/

# create theme version for dark package
cp %{buildroot}%{_datadir}/elementary/themes/default.edj %{buildroot}%{_datadir}/elementary/themes/dark.edj

# move icons as openSUSE also ships
mv %{buildroot}/%{_datadir}/icons/Enlightenment-X %{buildroot}/%{_datadir}/icons/Enlightenment-X-dark
touch %{buildroot}%{_datadir}/icons/Enlightenment-X-dark/icon-theme.cache

find %{buildroot} -type f -name "*.la" -delete -print

%if 0%{?suse_version}
%{suse_update_desktop_file \
    -N "Elementary Configuration" -G "Elementary Configuration" -r elementary_config Enlightenment Settings DesktopSettings}
%{suse_update_desktop_file \
  -N "Elementary Performance" -G "Elementary Performance" -r elementary_perf Enlightenment Development IDE}
%{suse_update_desktop_file \
  -N "Elementary Test" -G "Elementary Test" -r elementary_test Enlightenment Development IDE}
%fdupes -s %{buildroot}%{_datadir}/icons/Enlightenment-X-dark
%fdupes -s %{buildroot}%{_datadir}/%{name}/examples

%find_lang %{name}

%if !0%{?mageia}
%systemd_user_post ethumb.service

%if !0%{?mageia}
%systemd_user_preun ethumb.service

%if !0%{?mageia}
%systemd_user_postun ethumb.service

%{!?suse_version:%files -f %{name}.lang}
%exclude %{_bindir}/elementary_codegen
%exclude %{_bindir}/elementary_test
# evas generic loaders
%exclude %{_libdir}/evas/utils/
%exclude %{_libdir}/*
%exclude %{_datadir}/ecore_x/checkme
%exclude %{_datadir}/evas/checkme
%exclude %{_datadir}/elementary/themes/*

#%if %{build_examples}
#%exclude %{_datadir}/*/examples

%if %{generic_players_present}
%exclude %{_libdir}/emotion/generic_players/


%if 0%{?enable_wayland}

%if 0%{?suse_version}
%files lang -f %{name}.lang

%files %{?mageia:-n %{_lib}%{name}-}devel
%if 0%{?enable_wayland}
%if 0%{?luajit_present}
# C++ headers

%if 0%{?physics_present}
%if 0%{?enable_wayland}

%files -n elua

%files -n enlightenment-theme-upstream

%files -n enlightenment-theme-dark

%files -n enlightenment-x-dark-icon-theme
%ghost %{_datadir}/icons/Enlightenment-X-dark/icon-theme.cache

%files -n evas-generic-loaders

%if %{generic_players_present}
%files -n emotion-generic-players

%if %{build_doc}
%if %{build_doc_man}
%files doc-man
%endif #build_doc

%files doc-html
%doc doc/html/*

%endif #build_doc

%if %{build_examples}
%files examples
#%exclude %{_datadir}/elementary/examples

%files testsuite
%if %{build_examples}