%define debug_package %{nil} %global source_dsoftbus_standard dsoftbus_standard %global release_dsoftbus_standard v3.1.2.2-release %global source_embedded_ipc embedded-ipc %global release_embedded_ipc v1.0.1-release %global source_commonlibrary_c_utils commonlibrary_c_utils %global source_security_device_auth security_device_auth %global source_security_huks security_huks %global source_third_party_libcoap third_party_libcoap %global source_third_party_mbedtls third_party_mbedtls %global source_build build %global release_build OpenHarmony-v3.0.2-LTS %global openHarmony_source_release OpenHarmony-v3.1.2-Release Name: dsoftbus Version: 1.0.0 Release: 9 Summary: openEuler embedded softbus capability support License: Apache License 2.0 Url: https://openeuler.gitee.io/yocto-meta-openeuler/features/distributed_softbus.html Source0: https://gitee.com/openeuler/%{source_dsoftbus_standard}/repository/archive/%{release_dsoftbus_standard}.tar.gz #/%{source_dsoftbus_standard}-%{release_dsoftbus_standard}.tar.gz Source1: https://gitee.com/openeuler/%{source_embedded_ipc}/repository/archive/%{release_embedded_ipc}.tar.gz #/%{source_embedded_ipc}-%{release_embedded_ipc}.tar.gz Source2: https://gitee.com/openharmony/%{source_commonlibrary_c_utils}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_commonlibrary_c_utils}-%{openHarmony_source_release}.tar.gz Source3: https://gitee.com/openharmony/%{source_security_device_auth}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_security_device_auth}-%{openHarmony_source_release}.tar.gz Source4: https://gitee.com/openharmony/%{source_security_huks}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_security_huks}-%{openHarmony_source_release}.tar.gz Source5: https://gitee.com/openharmony/%{source_third_party_libcoap}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_third_party_libcoap}-%{openHarmony_source_release}.tar.gz Source6: https://gitee.com/openharmony/%{source_third_party_mbedtls}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_third_party_mbedtls}-%{openHarmony_source_release}.tar.gz Source7: https://gitee.com/openharmony/%{source_build}/repository/archive/%{release_build}.tar.gz #/%{source_build}-%{release_build}.tar.gz Patch0000: build-0001-add-dsoftbus-build-support-for-embedded-env.patch Patch0001: build-0002-support-hichian-for-openeuler.patch Patch0002: build-0003-add-deviceauth-ipc-sdk-compile.patch Patch0003: build-0004-change-set-for-obs-build.patch Patch0100: dsoftbus-standard-0001-simplify-dependency-for-dsoftbus-standard.patch Patch0200: security-device-auth-0001-deviceauth-for-openeuler.patch Patch0201: security-device-auth-0002-deviceauth-ipc-service.patch Patch0202: security-device-auth-0003-simplify-dependency-on-third-party-packages.patch Patch0300: security-huks-0001-support-huks-for-openeuler.patch Patch0301: security-huks-0002-simplify-dependency-on-third-party-packages.patch Patch0302: security-huks-0003-fix-discarded-qualifiers-error.patch Patch0400: commonlibrary-c-utils-0001-Adaptation-for-dsoftbus.patch Patch0401: libboundscheck-0001-Adaptation-for-dsoftbus.patch Patch0402: third-party-cjson-0001-adapter-cjson-in-openEuler-for-softbus.patch Patch0403: third-party-mbedtls-0001-Adaptation-for-dsoftbus.patch Patch0404: third-party-mbedtls-0002-fix-CVE-2021-43666.patch Patch0405: third-party-mbedtls-0002-fix-CVE-2021-45451.patch Patch0500: depend-0001-add-productdefine-for-openeuler.patch Patch0501: depend-0002-add-depend-for-openeuler.patch BuildRequires: gcc, g++, cmake, python, zip, unzip, ninja-build, git, libboundscheck, cjson-devel, openssl-devel, gn %description OpenEuler supports distributed softbus capability, which is part of openEuler's embedded capability %prep # Create the directories needed for the build dsoftbus_build_dir="%{_builddir}/dsoftbus_build" dsoftbus_prebuilts_build_tools="${dsoftbus_build_dir}/prebuilts/build-tools/linux-x86/bin" dsoftbus_thirdparty="${dsoftbus_build_dir}/third_party" dsoftbus_utils="${dsoftbus_build_dir}/utils" dsoftbus_src="${dsoftbus_build_dir}/foundation/communication" dsoftbus_hichain="${dsoftbus_build_dir}/base/security" dsoftbus_bounds_checking="${dsoftbus_thirdparty}/bounds_checking_function" dsoftbus_productdefine="${dsoftbus_build_dir}/productdefine" dsoftbus_depend="${dsoftbus_build_dir}/depend" mkdir -p ${dsoftbus_prebuilts_build_tools} mkdir -p ${dsoftbus_thirdparty} mkdir -p ${dsoftbus_utils} mkdir -p ${dsoftbus_src} mkdir -p ${dsoftbus_hichain} mkdir -p ${dsoftbus_bounds_checking} mkdir -p ${dsoftbus_productdefine} mkdir -p ${dsoftbus_depend} # Decompressing the compressed package %setup -q -T -D -b 0 -n %{source_dsoftbus_standard}-%{release_dsoftbus_standard} %setup -q -T -D -b 1 -n %{source_embedded_ipc}-%{release_embedded_ipc} %setup -q -T -D -b 2 -n %{source_commonlibrary_c_utils}-%{openHarmony_source_release} %setup -q -T -D -b 3 -n %{source_security_device_auth}-%{openHarmony_source_release} %setup -q -T -D -b 4 -n %{source_security_huks}-%{openHarmony_source_release} %setup -q -T -D -b 5 -n %{source_third_party_libcoap}-%{openHarmony_source_release} %setup -q -T -D -b 6 -n %{source_third_party_mbedtls}-%{openHarmony_source_release} %setup -q -T -D -b 7 -n %{source_build}-%{release_build} cd %{_builddir} mv %{source_dsoftbus_standard}-%{release_dsoftbus_standard} %{source_dsoftbus_standard} mv %{source_embedded_ipc}-%{release_embedded_ipc} %{source_embedded_ipc} #copy gn gn_dir=$(which gn) cp ${gn_dir[0]} ${dsoftbus_prebuilts_build_tools} # copy ninja ninja_dir=$(which ninja) cp ${ninja_dir[0]} ${dsoftbus_prebuilts_build_tools} # unpack third_party mv %{_builddir}/%{source_build}-%{release_build} ${dsoftbus_build_dir}/build mkdir %{_builddir}/%{source_build}-%{release_build} mv %{_builddir}/%{source_third_party_libcoap}-%{openHarmony_source_release} ${dsoftbus_thirdparty}/libcoap mv %{_builddir}/%{source_third_party_mbedtls}-%{openHarmony_source_release} ${dsoftbus_thirdparty}/mbedtls mkdir -p ${dsoftbus_thirdparty}/cJSON # unpack hichain mv %{_builddir}/%{source_security_huks}-%{openHarmony_source_release} ${dsoftbus_hichain}/huks mv %{_builddir}/%{source_security_device_auth}-%{openHarmony_source_release} ${dsoftbus_hichain}/deviceauth # unpack utils mv %{_builddir}/%{source_commonlibrary_c_utils}-%{openHarmony_source_release} ${dsoftbus_utils}/native # do patch %patch0 -p1 -d ${dsoftbus_build_dir}/build %patch1 -p1 -d ${dsoftbus_build_dir}/build %patch2 -p1 -d ${dsoftbus_build_dir}/build %patch3 -p1 -d ${dsoftbus_build_dir}/build %patch100 -p1 -d %{_builddir}/%{source_dsoftbus_standard} %patch200 -p1 -d ${dsoftbus_hichain}/deviceauth %patch201 -p1 -d ${dsoftbus_hichain}/deviceauth %patch202 -p1 -d ${dsoftbus_hichain}/deviceauth %patch300 -p1 -d ${dsoftbus_hichain}/huks %patch301 -p1 -d ${dsoftbus_hichain}/huks %patch302 -p1 -d ${dsoftbus_hichain}/huks %patch400 -p1 -d ${dsoftbus_utils}/native %patch401 -p1 -d ${dsoftbus_thirdparty}/bounds_checking_function %patch402 -p1 -d ${dsoftbus_thirdparty}/cJSON %patch403 -p1 -d ${dsoftbus_thirdparty}/mbedtls %patch404 -p1 -d ${dsoftbus_thirdparty}/mbedtls %patch405 -p1 -d ${dsoftbus_thirdparty}/mbedtls %patch500 -p1 -d ${dsoftbus_productdefine} %patch501 -p1 -d ${dsoftbus_depend} # init gn root ln -s ${dsoftbus_build_dir}/build/build_scripts/build.sh ${dsoftbus_build_dir}/build.sh ln -s ${dsoftbus_build_dir}/build/core/gn/dotfile.gn ${dsoftbus_build_dir}/.gn # link selfcode ln -s %{_builddir}/embedded-ipc ${dsoftbus_build_dir}/depend/ipc ln -s %{_builddir}/dsoftbus_standard ${dsoftbus_src}/dsoftbus # link toolchain toolchain_path="/usr1/openeuler/gcc/openeuler_gcc_arm64le" ln -s ${toolchain_path} ${dsoftbus_build_dir}/toolchain # copy libboundscheck file mkdir ${dsoftbus_thirdparty}/bounds_checking_function/include cp /usr/include/securec*.h ${dsoftbus_thirdparty}/bounds_checking_function/include/ # link cjson cjson_devel_include="/usr/include/cjson/cJSON.h" ln -s ${cjson_devel_include} ${dsoftbus_thirdparty}/cJSON/cJSON.h %ifarch x86_64 sed -i 's/"target_cpu": "arm64"/"target_cpu": "x86_64"/' ${dsoftbus_productdefine}/common/device/openEuler.json %endif %build rm -rf %{_builddir}/dsoftbus_build/out cd %{_builddir}/dsoftbus_build ./build.sh --product-name openEuler %install dsoftbus_build_dir="%{_builddir}/dsoftbus_build" %ifarch x86_64 dsoftbus_release_dir_name="ohos-x86_64-release" %endif %ifarch aarch64 dsoftbus_release_dir_name="ohos-arm64-release" %endif install -d %{buildroot}/%{_includedir}/dsoftbus install -d %{buildroot}/%{_libdir} install -d %{buildroot}/%{_bindir} install -d %{buildroot}/data/data/deviceauth/ # prepare so install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/common/common/*.so %{buildroot}/%{_libdir} install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/*.so %{buildroot}/%{_libdir} install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/huks/*.so %{buildroot}/%{_libdir} install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/deviceauth_standard/*.so %{buildroot}/%{_libdir} # prepare bin install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/softbus_server_main %{buildroot}/%{_bindir} # prepare head files install -m 554 \ ${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/discovery/*.h \ ${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/common/*.h \ ${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/bus_center/*.h \ ${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/transport/*.h \ ${dsoftbus_build_dir}/foundation/communication/dsoftbus/core/common/include/softbus_errcode.h \ ${dsoftbus_build_dir}/base/security/deviceauth/interfaces/innerkits/*.h \ ${dsoftbus_build_dir}/third_party/cJSON/*.h \ ${dsoftbus_build_dir}/third_party/bounds_checking_function/include/*.h \ ${dsoftbus_build_dir}/depend/syspara/include/*.h \ %{buildroot}/%{_includedir}/dsoftbus # strip symbol table find %{buildroot} -type f -name "*.so" -exec strip '{}' ';' find %{buildroot} -type f -name "softbus_server_main" -exec strip '{}' ';' %files %{_includedir}/dsoftbus/* %{_bindir}/softbus_server_main %{_libdir}/*.so /data/data %changelog * Fri Mar 3 2023 liheavy - 1.0.0-9 - Old rpm package missing file parameter.h, add it to the rpm package * Wed Mar 1 2023 liheavy - 1.0.0-8 - Add strip * Wed Feb 8 2023 liheavy - 1.0.0-7 - fix security huks discarded qualifiers error * Fri Dec 30 2022 liheavy - 1.0.0-6 - update version of dsoftbus_standard and embedded-ipc * Mon Dec 19 2022 beiling.xie - 1.0.0-5 - The dependency path of the third-party is optimized * Mon Dec 19 2022 beiling.xie - 1.0.0-4 - rename patch for each modules * Wed Nov 30 2022 liheavy - 1.0.0-3 - Disassemble yocto-embedded-tools and replace cjson, ninja, gn, openssl, libboundscheck - with openEuler software package * Wed Nov 23 2022 xuchongyu - 1.0.0-2 - add URL,change branch of libboundscheck to 22.03-LTS-SP1 * Tue Nov 22 2022 xuchongyu - 1.0.0-1 - init dsoftbus