# Copyright (c) 2023 Huawei Technologies Co., Ltd. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

%define debug_package %{nil}
%define _debugsource_template %{nil}

Name:           ft_mmi
Version:        1.0.0
Release:        1%{?dist}
Summary:        This repository provides mmi for ft_engine.

License:        Apache-2.0
URL:            https://gitee.com/openeuler/ft_mmi
Source0:        https://gitee.com/openeuler/ft_mmi/repository/archive/ft_mmi-1.0.0.tar.gz

BuildRequires:  git gn ninja-build clang compiler-rt llvm-devel python3 python3-pip python-toml tar cmake systemd-devel libinput-devel cjson-devel
BuildRequires:  distributed-build distributed-beget distributedhardware_device_manager
BuildRequires:  commonlibrary_c_utils
BuildRequires:  notification_eventhandler
BuildRequires:  communication_ipc communication_dsoftbus
BuildRequires:  security_device_auth security_huks security_device_security_level security_dataclassification
BuildRequires:  systemabilitymgr_safwk systemabilitymgr_samgr

Requires:       compiler-rt llvm-devel python3 systemd-devel libinput-devel cjson-devel
Requires:       distributed-beget distributedhardware_device_manager
Requires:       commonlibrary_c_utils
Requires:       notification_eventhandler
Requires:       communication_ipc communication_dsoftbus
Requires:       security_device_auth security_huks security_device_security_level security_dataclassification
Requires:       systemabilitymgr_safwk systemabilitymgr_samgr

%description
ft_mmi module processes intput-event processing, and dispatches event to application. 
it provids traditional input methods, such as key, touch, keyboard, and mouse inputs.

%package devel
Summary: ft_mmi development files
Provides: ft_mmi-devel

%description devel
This package contains necessary header files for ft_mmi development.

%prep
%autosetup -n %{name}-%{version} -p1

%build
cd %{_builddir}/%{name}-%{version}
./build/prebuildrpm.sh -b release
./build.sh -b release

%install
mkdir -p %{buildroot}%{_libdir}
%ifarch x86_64
cp -pdf %{_builddir}/%{name}-%{version}/out/Release/x64/common/common/*.so %{buildroot}%{_libdir}
%endif
%ifarch aarch64
cp -pdf %{_builddir}/%{name}-%{version}/out/Release/aarch64/common/common/*.so %{buildroot}%{_libdir}
%endif

mkdir -p %{buildroot}/usr/local/share/ft
cp -pdf %{_builddir}/%{name}-%{version}/etc/mmi.xml %{buildroot}/usr/local/share/ft/mmi.xml

mkdir -p %{buildroot}%{_includedir}/mmi
cp -pdf %{_builddir}/%{name}-%{version}/input/interfaces/native/innerkits/proxy/include/*.h %{buildroot}%{_includedir}/mmi/
cp -pdf %{_builddir}/%{name}-%{version}/input/interfaces/native/innerkits/event/include/*.h %{buildroot}%{_includedir}/mmi/
cp -pdf %{_builddir}/%{name}-%{version}/input/util/common/include/error_multimodal.h %{buildroot}%{_includedir}/mmi/
cp -pdf %{_builddir}/%{name}-%{version}/input/util/common/include/proto.h %{buildroot}%{_includedir}/mmi/
cp -pdf %{_builddir}/%{name}-%{version}/input/util/common/include/struct_multimodal.h %{buildroot}%{_includedir}/mmi/

#Need to be deleted later
mkdir -p %{buildroot}/usr/local/include
cp %{buildroot}%{_includedir}/mmi %{buildroot}/usr/local/include -rf

%clean 
rm -rf %{buildroot}

%files
%{_libdir}/*
/usr/local/share/ft/*

%files devel
%{_libdir}/*
/usr/local/share/ft/*
%{_includedir}/*

#Need to be deleted later
/usr/local/include/*

%changelog
* Tue Oct 10 2023 xieyijun3 <xieyijun3@huawei.com> - 1.0.0-1
- 
