add ko , macro

This commit is contained in:
yanansong 2023-12-12 10:22:28 +08:00
parent f89fae17ac
commit c5a7db19eb
2 changed files with 35 additions and 2 deletions

View File

@ -12,6 +12,8 @@
# limitations under the License.
%global debug_package %{nil}
%define with_eventhandler_lib 0
%define with_ko 1
Name: ft_utils
Version: 1.0.0
@ -21,11 +23,13 @@ Summary: common library
License: Apache-2.0
URL: https://gitee.com/openeuler/ft_utils
Source0: https://gitee.com/openeuler/ft_utils/repository/archive/ft_utils-1.0.0.tar.gz
Source1: https://gitee.com/openeuler/ft_utils/repository/archive/kernel_binder.tar.gz
BuildRequires: clang python3 python3-pip python-toml tar cmake ninja-build compiler-rt
BuildRequires: llvm-devel
BuildRequires: distributed-utils
BuildRequires: distributed-build
BuildRequires: kernel-devel
Requires: compiler-rt llvm-devel python3
Requires: distributed-utils
@ -33,13 +37,23 @@ Requires: distributed-utils
ft_utils module is a base commom library for ft_engine.
%prep
%autosetup -n %{name}-%{version} -p1
%setup -q -D -T -a 0 -c -n %{_builddir}
%setup -q -D -T -a 1 -c -n %{_builddir}
%build
%if 0%{?with_eventhandler_lib}
cd %{_builddir}/%{name}-%{version}
./build.sh
%endif
%if 0%{?with_ko}
cd %{_builddir}/kernel_binder
./project.sh makeall
%endif
%install
%if 0%{?with_eventhandler_lib}
mkdir -p %{buildroot}%{_libdir}
%ifarch x86_64
cp -pdf %{_builddir}/%{name}-%{version}/out/Debug/x64/common/common/lib*.so %{buildroot}%{_libdir}
@ -47,12 +61,31 @@ cp -pdf %{_builddir}/%{name}-%{version}/out/Debug/x64/common/common/lib*.so %{bu
%ifarch aarch64
cp -pdf %{_builddir}/%{name}-%{version}/out/Debug/aarch64/common/common/lib*.so %{buildroot}%{_libdir}
%endif
%endif
mkdir -p %{buildroot}/usr/include/ft/event_loop
cp -pdf %{_builddir}/%{name}-%{version}/event_loop/includes/*.h %{buildroot}/usr/include/ft/event_loop
%if 0%{?with_ko}
mkdir -p %{buildroot}/usr/share/sa
cp -pdf %{_builddir}/kernel_binder/binder/src/binder_linux.ko %{buildroot}/usr/share/sa
cp -pdf %{_builddir}/kernel_binder/ashmem/src/ashmem_linux.ko %{buildroot}/usr/share/sa
cp -pdf %{_builddir}/kernel_binder/ft.pp %{buildroot}/usr/share/sa
%endif
%clean
rm -rf %{buildroot}
%post
semodule -X 300 -i /usr/share/sa/ft.pp
insmod /usr/share/sa/ashmem_linux.ko
insmod /usr/share/sa/binder_linux.ko
%files
%{_libdir}/*
/usr/include/ft/event_loop/*
%if 0%{?with_ko}
/usr/share/sa/*
%endif
%changelog
* Mon Nov 6 2023 abc12133 <jinguoen@huawei.com> - 1.0.0-1

BIN
kernel_binder.tar.gz Normal file

Binary file not shown.