120 lines
4.6 KiB
RPMSpec
120 lines
4.6 KiB
RPMSpec
# 不输出debug信息,不产生debug包
|
||
%define debug_package %{nil}
|
||
# 定义openHarmony软件包的版本变量,所有包应该都是OpenHarmony-v3.2-Release
|
||
%global oh_version OpenHarmony-v3.2-Release
|
||
# 定义下编译根目录变量,此处用/root/rpmbuild/BUILD/distributed_build作为编译根目录
|
||
%global build_opt /opt/distributed-middleware-build
|
||
%global bundle_dir %{build_opt}/openeuler/compiler_gn/base/notification/eventhandler
|
||
|
||
# rpm包名称
|
||
Name: notification_eventhandler
|
||
# rpm包版本号
|
||
Version: 1.0.0
|
||
# rpm包Release号,每次修改需要+1,changelog同步修改
|
||
Release: 1
|
||
# rpm简介
|
||
Summary: C++ common basic library for distributed module construction and operation
|
||
# License openHarmony的应该都是Apache License 2.0
|
||
|
||
License: Apache License 2.0
|
||
# 软件包上游社区
|
||
Url: https://gitee.com/openharmony/notification_eventhandler
|
||
# tar包的下载地址,由于gitee下载路径是不带软件包名的,会导致和name不匹配,
|
||
# 所以此处在后面用注释方式修改spec识别的tar包名称,属于取巧,但无可奈何。
|
||
Source0: https://gitee.com/openharmony/notification_eventhandler/repository/archive/%{oh_version}.tar.gz #/%{name}-%{oh_version}.tar.gz
|
||
Source1: bundle.json
|
||
Source2: eventhandler.BUILD.gn
|
||
# 补丁定义
|
||
Patch0001: 0001-notification-eventhandler.patch
|
||
|
||
|
||
# 编译依赖,提交代码时需要分析依赖层级,从底往上提交代码。
|
||
BuildRequires: distributed-build, hilog, commonlibrary_c_utils
|
||
BuildRequires: python3-jinja2 python3-pyyaml
|
||
BuildRequires: libatomic libicu-devel libxml2-devel openssl-devel
|
||
|
||
Requires: hilog
|
||
# 软件包的详细描述
|
||
%description
|
||
Provide some commonly used C++ development tool classes for standard systems, This repository is compatible with compilation on the OpenEuler operating system
|
||
# 软件包编译前的准备阶段
|
||
|
||
%prep
|
||
# 解压tar包到commonlibrary_c_utils-OpenHarmony-v3.2-Release路径下
|
||
rm -rf %{_builddir}/*
|
||
%autosetup -p1 -n %{name}-%{oh_version}
|
||
|
||
cd %{_builddir}
|
||
mkdir -p %{_builddir}/base/notification
|
||
mv %{name}-%{oh_version} %{_builddir}/base/notification/eventhandler
|
||
|
||
mkdir %{name}-%{oh_version}
|
||
|
||
# build directory
|
||
cd %{_builddir}
|
||
cp -rf %{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/third_party %{_builddir}/
|
||
|
||
# 拷贝依赖的组件的gn文件
|
||
mkdir -p %{_builddir}/base/hiviewdfx
|
||
mkdir -p %{_builddir}/commonlibrary
|
||
|
||
cp -rf %{_builddir}/build/openeuler/compiler_gn/base/hiviewdfx/hilog %{_builddir}/base/hiviewdfx
|
||
cp -rf %{_builddir}/build/openeuler/compiler_gn/commonlibrary/c_utils %{_builddir}/commonlibrary
|
||
|
||
# 编译阶段
|
||
%build
|
||
cd %{_builddir}
|
||
# rm -rf %{_builddir}/out
|
||
|
||
%ifarch x86_64
|
||
bash build.sh --product-name openeuler --target-cpu x86_64
|
||
%endif
|
||
%ifarch aarch64
|
||
bash build.sh --product-name openeuler --target-cpu arm64
|
||
%endif
|
||
|
||
# 安装阶段
|
||
%install
|
||
install -d %{buildroot}/%{_includedir}/eventhandler
|
||
install -d %{buildroot}%{build_opt}/openeuler/compiler_gn/base/notification/eventhandler/
|
||
# 建so文件目录 /usr/lib64
|
||
install -d %{buildroot}/%{_libdir}
|
||
install -d %{buildroot}/%{bundle_dir}
|
||
|
||
install -m 0755 %{_builddir}/out/openeuler/packages/phone/system/lib64/libeventhandler_native.z.so %{buildroot}/%{_libdir}
|
||
install -m 0755 %{_builddir}/out/openeuler/packages/phone/system/lib64/platformsdk/libeventhandler.z.so %{buildroot}/%{_libdir}
|
||
|
||
# innerkits/linux-arm64/eventhandler
|
||
%ifarch aarch64
|
||
sdk_out_path="out/openeuler/innerkits/linux-arm64/eventhandler"
|
||
%endif
|
||
%ifarch x86_64
|
||
sdk_out_path="out/openeuler/innerkits/linux-x86_64/eventhandler"
|
||
%endif
|
||
|
||
cp -rf %{_builddir}/${sdk_out_path}/* %{buildroot}/%{bundle_dir}/
|
||
cp %{SOURCE1} %{buildroot}/%{bundle_dir}/
|
||
|
||
# 到源码路径下拷贝头文件及其目录到%{buildroot}/usr/include/eventhandler下,保持目录结构相同
|
||
install -m 554 %{_builddir}/base/notification/eventhandler/interfaces/inner_api/*.h %{buildroot}/%{_includedir}/eventhandler
|
||
|
||
#copy correct eventhandler BUILD.gn
|
||
cp %{SOURCE2} %{buildroot}%{build_opt}/openeuler/compiler_gn/base/notification/eventhandler/BUILD.gn
|
||
|
||
# rpm安装后需要安装到系统中的文件,及上面说的so和头文件
|
||
%files
|
||
%{_libdir}/*.so
|
||
%{_includedir}/eventhandler/*
|
||
%{bundle_dir}/*
|
||
%{build_opt}/*
|
||
# 变更日志
|
||
%changelog
|
||
* Thu Jun 15 2023 chrisshangguan <shangguanjingshi@huawei.com> - 1.0.0-1
|
||
- Init and adapt to openeuler
|
||
|