# Per-platform rpm configuration file. %_vendor openEuler %_os linux %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu} #============================================================================== # ---- configure macros. note that most of these are inherited # from the defaults. # %_localstatedir /var %_pkgdocdir %{_docdir}/%{name} %_docdir_fmt %%{NAME} %_fmoddir %{_libdir}/gfortran/modules %_enable_debug_packages 1 #%_include_minidebuginfo 1 %_include_gdb_index 1 %_debugsource_packages 1 #%_debuginfo_subpackages 1 %_build_id_links none #============================================================================== # ---- compiler flags. %build_cflags %{optflags} %build_cxxflags %{optflags} %build_fflags %{optflags} -I%{_fmoddir} %build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %set_build_flags \ CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \ FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \ LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS #For backwards compatibility only. %__global_cflags %{build_cflags} %__global_cxxflags %{build_cxxflags} %__global_fflags %{build_fflags} %__global_fcflags %{build_fflags} %__global_ldflags %{build_ldflags} #============================================================================== # ---- configure and makeinstall. %_configure_gnuconfig_hack 1 %_configure_libtool_hardening_hack 1 %configure \ %{set_build_flags}; \ [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \ [ -f /usr/lib/rpm/openEuler/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/openEuler/$(basename $i) $i ; \ done ; \ [ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \ for i in $(find . -name ltmain.sh) ; do \ %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i \ done ; \ %{_configure} --build=%{_build} --host=%{_host} \\\ --program-prefix=%{?_program_prefix} \\\ --disable-dependency-tracking \\\ %{?_configure_disable_silent_rules:--disable-silent-rules} \\\ --prefix=%{_prefix} \\\ --exec-prefix=%{_exec_prefix} \\\ --bindir=%{_bindir} \\\ --sbindir=%{_sbindir} \\\ --sysconfdir=%{_sysconfdir} \\\ --datadir=%{_datadir} \\\ --includedir=%{_includedir} \\\ --libdir=%{_libdir} \\\ --libexecdir=%{_libexecdir} \\\ --localstatedir=%{_localstatedir} \\\ --sharedstatedir=%{_sharedstatedir} \\\ --mandir=%{_mandir} \\\ --infodir=%{_infodir} # ---- Build policy macros. %__spec_install_pre %{___build_pre}\ [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\ mkdir -p `dirname "$RPM_BUILD_ROOT"`\ mkdir "$RPM_BUILD_ROOT"\ %{nil} # ---- Expanded at end of %install scriptlet. %__arch_install_post /usr/lib/rpm/check-buildroot # Build root policy macros. Standard naming: # convert all '-' in basename to '_', add two leading underscores. %__brp_ldconfig /usr/lib/rpm/openEuler/brp-ldconfig %__brp_compress /usr/lib/rpm/brp-compress %__brp_strip /usr/lib/rpm/brp-strip %{__strip} %__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} %__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip} %__brp_python_bytecompile /usr/lib/rpm/brp-python-bytecompile "%{__python}" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}" %__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink %__os_install_post \ %{?__brp_ldconfig} \ %{?__brp_compress} \ %{!?__debug_package:\ %{?__brp_strip} \ %{?__brp_strip_comment_note} \ } \ %{?__brp_strip_static_archive} \ %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \ %{?__brp_python_hardlink} \ %{nil} %__spec_install_post\ %{?__debug_package:%{__debug_install_post}}\ %{__arch_install_post}\ %{__os_install_post}\ %{nil} %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\ %%install\ %{nil} # # Should missing buildids terminate a build? %_missing_build_ids_terminate_build 1 # ## Automatically compile python files %py_auto_byte_compile 1 # ## Should python bytecompilation errors terminate a build? %_python_bytecompile_errors_terminate_build 1 ## Should python bytecompilation compile outisde python specific directories? %_python_bytecompile_extra 1 # Use SHA-256 for FILEDIGESTS instead of default MD5 %_source_filedigest_algorithm 8 %_binary_filedigest_algorithm 8 # Use XZ compression for binary payloads %_binary_payload w2.xzdio # secure options for rpmbuild # # #hardened options %_hardening_cflags -specs=/usr/lib/rpm/%{_vendor}/openEuler-hardened-cc1 %_hardening_ldflags -Wl,-z,now -specs=/usr/lib/rpm/%{_vendor}/openEuler-hardened-ld # Use "%undefine _hardened_build" to disable. %_hardened_build 1 %_hardened_cflags %{?_hardened_build:%{_hardening_cflags}} %_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}} #secure options pie %_sec_opt_build 1 #Use "%undefine _sec_opt_build" to disable. #Use "%undefine _pie_build" to disable. %_pie_build 1 %_pie_pre_cflags -specs=/usr/lib/rpm/%{_vendor}/openEuler-pie-cc1 %_pie_pre_ldflags -Wl,-z,now -specs=/usr/lib/rpm/%{_vendor}/openEuler-pie-ld %_pie_cflags %{?_sec_opt_build:?_pie_build:%{_pie_pre_cflags}} %_pie_ldflags %{?_sec_opt_build:?_pie_build:%{_pie_pre_ldflags}} #Use "%undefine _fs_build" to disable. %_fs_build 1 %_fs_pre_cflags -specs=/usr/lib/rpm/%{_vendor}/openEuler-fs-cc1 %_fs_cflags %{?_fs_build:%{_fs_pre_cflags}} # Fail linking if there are undefined symbols. Required for proper # ELF symbol versioning support. Disabled by default. # Use "%define _ld_strict_symbol_defs 1" to enable. #%_ld_strict_symbol_defs 1 %_ld_symbols_flags %{?_ld_strict_symbol_defs:-Wl,-z,defs} # use "%define _ld_as_needed 1" to enable. #%_ld_as_needed 1 %_ld_as_needed_flags %{?_ld_as_needed:-Wl,--as-needed} %__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches %{_hardened_cflags} # Automatically trim changelog entries after 2 years %_changelog_trimtime %{lua:print(os.time() - 2 * 365 * 86400)} #============================================================================== # ---- Generic auto req/prov filtering macros # prevent anything matching from being scanned for provides %filter_provides_in(P) %{expand: \ %global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \ } # prevent anything matching from being scanned for requires %filter_requires_in(P) %{expand: \ %global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \ } # filter anything matching out of the provides stream %filter_from_provides() %{expand: \ %global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \ } # filter anything matching out of the requires stream %filter_from_requires() %{expand: \ %global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \ } # actually set up the filtering bits %filter_setup %{expand: \ %global _use_internal_dependency_generator 0 \ %global __deploop() while read FILE; do echo "${FILE}" | /usr/lib/rpm/rpmdeps -%{1}; done | /bin/sort -u \ %global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \ %global __find_requires /bin/sh -c "%{?__filter_req_cmd} %{__deploop R} %{?__filter_from_req}" \ } # compare two versions, returns -1, 0, 1, ~~~ %rpm_vercmp() %{lua:print(rpm.expand('%1') == '~~~' and '~~~' or rpm.vercmp(rpm.expand('%1'), rpm.expand('%2')))} # expand to the installed version of a package/provides %pkg_version() %(LC_ALL=C rpm -q --whatprovides --qf "%%{version}" "%1" | sed -e "s/^no package provides .*/~~~/") # compare the installed version to a value. returns -1, 0, 1, ~~~ %pkg_version_cmp() %{expand:%{expand:%%%%{rpm_vercmp %%{pkg_version %1} %%2}}} # convenience/readability %pkg_vcmp() (%{expand:%%{pkg_version_cmp %1 %3}} %2 0) #arches macros %generic_arches %{ix86} x86_64 %{arm} aarch64 %ldc_arches %{generic_arches} %valgrind_arches %{generic_arches} %nodejs_arches %{generic_arches} %ldc_arches %{generic_arches} %mono_arches %{generic_arches} %fpc_arches %{generic_arches} %ghc_arches_with_ghci %{generic_arches} %ghc_arches %{generic_arches} %GNAT_arches %{GPRbuild_arches} %{generic_arches} %GPRbuild_arches %{generic_arches} %nim_arches %{generic_arches} %nodejs_arches %{generic_arches} %ocaml_native_compiler %{generic_arches} %ocaml_natdynlink %{generic_arches} %ocaml_native_profiling %{generic_arches} %openblas_arches %{generic_arches} #%ldconfig /sbin/ldconfig %ldconfig_post(n:) %{?ldconfig:%post -p %ldconfig %{?*} %{-n:-n %{-n*}}\ %end} %ldconfig_postun(n:) %{?ldconfig:%postun -p %ldconfig %{?*} %{-n:-n %{-n*}}\ %end} %ldconfig_scriptlets(n:) %{?ldconfig:\ %ldconfig_post %{?*} %{-n:-n %{-n*}}\ %ldconfig_postun %{?*} %{-n:-n %{-n*}}\ } # Some miscellaneous macros %_metainfodir %{_datadir}/metainfo %rpmmacrodir /usr/lib/rpm/macros.d # arches that mono builds on %_monogacdir %{_monodir}/gac %_monodir %{_prefix}/lib/mono # ---- VPATH default settings %_vpath_builddir %_target_platform %_vpath_srcdir . # ---- custom macros %disable_rpath \ sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool \ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %delete_la_and_a \ find $RPM_BUILD_ROOT -type f -name "*.la" -delete \ find $RPM_BUILD_ROOT -type f -name "*.a" -delete %delete_la find $RPM_BUILD_ROOT -type f -name "*.la" -delete %chrpath_delete find $RPM_BUILD_ROOT/ -type f -exec file {} ';' | grep "\" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {} %package_help \ %package help \ Summary: Documents for %{name} \ Buildarch: noarch \ Requires: man info \ \ %description help \ Man pages and other related documents for %{name}. #%sbin_installinfo_rm bc.info #%sbin_installinfo_rm bc.info.gz %install_info() \ /sbin/install-info %1 %{_infodir}/dir || : %install_info_rm() \ /sbin/install-info --remove %1 %{_infodir}/dir || : # macros that used for perl %__perl /usr/bin/perl %requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)