%define debug_package %{nil}
%global openHarmony_source_release OpenHarmony-v3.2-Release
%global dfs_service_dir %{_builddir}/foundation/filemanagement
%global build_opt /opt/distributed-middleware-build 

Name: dfs_service
Version: 1.0.0
Release: 1
Summary: The distributed file service.
License: Apache License 2.0
Url: https://gitee.com/openharmony/filemanagement_dfs_service
Source0: https://gitee.com/openharmony/filemanagement_dfs_service/repository/archive/%{openHarmony_source_release}.tar.gz #/filemanagement_dfs_service-%{openHarmony_source_release}.tar.gz
Patch0: 0001-cut-access_token-common_event-ability.patch

BuildRequires: distributed-build, libboundscheck, libatomic, distributed-utils
Requires: libboundscheck, libatomic, distributed-utils

%description
The distributed file service provides cross -device access capabilities that meet the POSIX specifications.

%prep
#clean %{_builddir}
rm -rf %{_builddir}/*

# build directory
cd %{_builddir}
cp -rp %{build_opt} %{_builddir}/build
[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
cp -r %{_builddir}/build/openeuler/vendor %{_builddir}/
cp -r %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}/

%setup -q -T -a 0 -c -n %{dfs_service_dir}
%patch0 -p1 -d %{dfs_service_dir}/dfs_service


%build
cd %{_builddir}
rm -rf %{_builddir}/out

%ifarch x86_64
./build.sh --product-name openeuler --target-cpu x86_64
%endif

%ifarch aarch64
./build.sh --product-name openeuler --target-cpu arm64
%endif

%install
install -d %{buildroot}/%{_libdir}

# prepare so
install -m 0755 %{_builddir}/out/openeuler/packages/phone/system/lib64/libdistributedfile*.so %{buildroot}/%{_libdir}

%files
%{_libdir}/*.so

%changelog
* Sun Jun 18 2023 hepeng <hepeng68@huawei.com> - 1.0.0-1
- Cut access_token, common_event, ability.
