diff --git a/bundle.json b/eventhandler.bundle.json similarity index 100% rename from bundle.json rename to eventhandler.bundle.json diff --git a/notification_eventhandler.spec b/notification_eventhandler.spec index 9210cf0..d4816a0 100644 --- a/notification_eventhandler.spec +++ b/notification_eventhandler.spec @@ -5,6 +5,7 @@ # 定义下编译根目录变量,此处用/root/rpmbuild/BUILD/distributed_build作为编译根目录 %global build_opt /opt/distributed-middleware-build %global bundle_dir %{build_opt}/openeuler/compiler_gn/base/notification/eventhandler +%global eventhandler_path %{_builddir}/base/notification # rpm包名称 Name: notification_eventhandler @@ -21,9 +22,9 @@ 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 +Source1: https://gitee.com/openharmony/notification_eventhandler/repository/archive/%{oh_version}.tar.gz #/%{name}-%{oh_version}.tar.gz +Source2: eventhandler.bundle.json +Source3: eventhandler.BUILD.gn # 补丁定义 Patch0001: 0001-notification-eventhandler.patch @@ -42,16 +43,7 @@ Provide some commonly used C++ development tool classes for standard systems, Th %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 @@ -59,6 +51,13 @@ cp -rf %{build_opt} %{_builddir}/build cp -r %{_builddir}/build/openeuler/vendor %{_builddir}/ cp -r %{_builddir}/build/openeuler/compiler_gn/third_party %{_builddir}/ +# 统一用setup,不用autosetup,distributed-build除外 +mkdir -p %{eventhandler_path} +%setup -q -D -T -a 1 -c -n %{eventhandler_path} +mv %{name}-%{oh_version} %{eventhandler_path}/eventhandler +# patch命令统一使用-P来指定第几个patch +%patch -P1 -p1 -d %{eventhandler_path}/eventhandler + # 拷贝依赖的组件的gn文件 mkdir -p %{_builddir}/base/hiviewdfx mkdir -p %{_builddir}/commonlibrary @@ -68,50 +67,50 @@ cp -rf %{_builddir}/build/openeuler/compiler_gn/commonlibrary/c_utils %{_builddi # 编译阶段 %build -cd %{_builddir} -# rm -rf %{_builddir}/out - +rm -rf %{_builddir}/out %ifarch x86_64 -bash build.sh --product-name openeuler --target-cpu x86_64 +bash %{_builddir}/build.sh --product-name openeuler --target-cpu x86_64 %endif %ifarch aarch64 -bash build.sh --product-name openeuler --target-cpu arm64 +bash %{_builddir}/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/ +install -d -m 0755 %{buildroot}/%{_includedir}/eventhandler +install -d -m 0755 %{buildroot}/%{bundle_dir}/ # 建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} +install -d -m 0755 %{buildroot}/%{_libdir} # innerkits/linux-arm64/eventhandler %ifarch aarch64 -sdk_out_path="out/openeuler/innerkits/linux-arm64/eventhandler" +%define module_out_path out/openeuler/linux_clang_arm64 %endif %ifarch x86_64 -sdk_out_path="out/openeuler/innerkits/linux-x86_64/eventhandler" +%define module_out_path out/openeuler/linux_clang_x86_64 %endif -cp -rf %{_builddir}/${sdk_out_path}/* %{buildroot}/%{bundle_dir}/ -cp %{SOURCE1} %{buildroot}/%{bundle_dir}/ +#copy shared library files +%define so_out_path %{module_out_path}/notification/eventhandler +install -m 0755 %{_builddir}/%{so_out_path}/libeventhandler_native.z.so %{buildroot}/%{_libdir} +install -m 0755 %{_builddir}/%{so_out_path}/libeventhandler.z.so %{buildroot}/%{_libdir} + +# %define sdk_out_path %{module_out_path}/eventhandler +# cp -rf %{_builddir}/${sdk_out_path}/* %{buildroot}/%{bundle_dir}/ +cp -rf %{SOURCE2} %{buildroot}/%{bundle_dir}/bundle.json # 到源码路径下拷贝头文件及其目录到%{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 +cp -rf %{SOURCE3} %{buildroot}%{bundle_dir}/BUILD.gn # rpm安装后需要安装到系统中的文件,及上面说的so和头文件 %files %{_libdir}/*.so %{_includedir}/eventhandler/* %{bundle_dir}/* -%{build_opt}/* + # 变更日志 %changelog * Thu Jun 15 2023 chrisshangguan - 1.0.0-1