From: Marcin Krol Date: Thu, 20 Feb 2025 01:11:09 +0000 (+0100) Subject: - merged 2.045 from PLD X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=d23ef2dcd3c7d72624c7986a1713f165a54379aa;p=packages%2Frpm-tld-macros.git - merged 2.045 from PLD --- diff --git a/macros.erlang b/macros.erlang new file mode 100644 index 0000000..7724c11 --- /dev/null +++ b/macros.erlang @@ -0,0 +1,12 @@ +# BuildRequires: rpmbuild(macros) >= 2.035 + +%__erl /usr/bin/erl +%__mix /usr/bin/mix +%__rebar /usr/bin/rebar + +# BuildRequires: erlang >= 2:17 + +%erlang_otp %{expand:%%global erlang_otp %(rpm -q --qf '%{V}' erlang | cut -d. -f1)}%erlang_otp + +%erlang_requires %{expand:%%global erlang_requires Requires: erlang(OTP) = %erlang_otp\\\ +Requires: erlang >= %(rpm -q --qf='%|E?{%{E}:}|%{V}' erlang|cut -d. -f1,2)}%erlang_requires diff --git a/macros.python b/macros.python index ef8b744..36e26e7 100644 --- a/macros.python +++ b/macros.python @@ -103,6 +103,40 @@ --root=$RPM_BUILD_ROOT \ } +# macros for pyproject.toml based builds +%py3_build_pyproject { \ + LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \ + CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \ + CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \ + %{?__cc:CC="%{__cc}"; export CC;} \ + %{?__cxx:CXX="%{__cxx}"; export CXX;} \ + %{__python3} \ + -m build \ + --wheel \ + --no-isolation \ + --outdir build-3 \ +} + +# "shrink" filter to keep this macro without newlines, +# so it could be used as make arguments +%py3_install_pyproject_opts() %{shrink: \ + --prefix=%{_prefix} \ + --compile-bytecode=2 \ +} + +%py3_install_pyproject { \ + LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \ + CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \ + CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \ + %{?__cc:CC="%{__cc}"; export CC;} \ + %{?__cxx:CXX="%{__cxx}"; export CXX;} \ + %{__python3} \ + -m installer \ + --destdir=$RPM_BUILD_ROOT \ + %{py3_install_pyproject_opts} \ + build-3/*.whl \ +} + # Hardlink binary identical .pyc and .pyo files %__spec_install_post_py_hardlink {\ %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \ diff --git a/macros.tld b/macros.tld index d993c2b..c7663f3 100644 --- a/macros.tld +++ b/macros.tld @@ -21,16 +21,12 @@ # ---- configure macros. note that most of these are inherited # from the defaults. # -%_sharedstatedir /var/lib -%_localstatedir /var %_localedir %{_datadir}/locale %_lispdir %{_datadir}/emacs/site-lisp %_initddir %{_sysconfdir}/rc.d/init.d %_metainfodir %{_datadir}/metainfo -%_defaultdocdir %{_usr}/share/doc - %_fmoddir %{_libdir}/gfortran/modules # Location of autoconf macros @@ -51,9 +47,6 @@ # Location of pixmaps for applnk/desktop files %_pixmapsdir /usr/share/pixmaps -# Location of themable icons for applnk/desktop files -%_iconsdir /usr/share/icons - # Location of fonts directories %_fontsdir /usr/share/fonts @@ -75,9 +68,6 @@ # Example files, programs, scripts... %_examplesdir /usr/src/examples -# SysV-style initscripts dir -%_initddir /etc/rc.d/init.d - # Executed at after copying %doc to DOCDIR, with $DOCDIR set # TODO: teach rpm.org that compressed %doc is the same thing as uncompressed #__compress_doc %{_rpmconfigdir}/compress-doc%{?_noautocompressdoc: --noautocompressdoc='%{_noautocompressdoc}'} @@ -140,16 +130,6 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %files debugsource -f debugsourcefiles.list\ %{nil} -%debug_package \ -%ifnarch noarch\ -%global __debug_package 1\ -%_debuginfo_template\ -%if 0%{?_debugsource_packages}\ -%_debugsource_template\ -%endif\ -%endif\ -%{nil} - #--------------------------------------------------------------------- # Overwrite RPM macros with TLD specific one here. @@ -157,6 +137,8 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %__lua %{_bindir}/lua %__rc %{_bindir}/rc %__xar %{_bindir}/xar +%__rm /bin/rm --interactive=never + %_source_payload w9.gzdio %_binary_payload w6.xzdio @@ -167,8 +149,8 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %_upgrade_tag name # Disable automatic dependencies on symlinks for now (debuginfo packages pull too many deps) -%_check_symlink_deps 0 - +%_check_symlink_deps 0 + # Do not generate executable() dependencies for scriptlets, # as it may give false positives, for example: # [ ! -x /bin/prog ] || /bin/prog @@ -179,15 +161,10 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %_use_internal_dependency_generator 1 %_duplicate_files_terminate_build 1 -%_files_listed_twice_terminate_build 1 %_unpackaged_files_terminate_build 0 -%_unpackaged_subdirs_terminate_build 0 -# -# Export package NEVRA (stamped with install tid) info for HRMIB on this path. -# -# XXX Note: escaped %% for use in headerSprintf() -%_hrmib_path /var/cache/hrmib/%{___NVRA} +# Make files in .src.rpm owned by root, but preserve permissions +%_srcdefattr (-,root,root,-) #----------------------------------------------------------------- # CFLAGS and LDFLAGS used to build @@ -233,8 +210,6 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %cc_version %{expand:%%global cc_version %(%{__cc} -dumpversion 2>/dev/null || echo 0.0)}%cc_version %cxx_version %{expand:%%global cxx_version %(%{__cxx} -dumpversion 2>/dev/null || echo 0.0)}%cxx_version -%__rm /bin/rm --interactive=never - # Build system path macros. %__autoconf autoconf %{?debug:-Wall} %__automake automake -a -c -f --foreign @@ -248,6 +223,8 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ # if you want to disable parallel build do: # echo '%__jobs %{nil}' >> ~/.rpmmacros %__jobs %{expand:%%global __jobs %(_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN); [ "$_NCPUS" -gt 3 ] && echo $(($_NCPUS / 2)))%%{nil}}%__jobs +%_smp_build_ncpus %{__jobs} +%_smp_build_nthreads %{__jobs} # expands to -jN if %__jobs has a value %_smp_mflags %{expand:%%global _smp_mflags %(jobs=%{__jobs}; echo ${jobs:+-j$jobs}%%{nil})}%_smp_mflags @@ -258,13 +235,11 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %__cmake /usr/bin/cmake %__meson /usr/bin/meson %__meson_wrap_mode nodownload -%__ninja /usr/bin/ninja -%__ninja_common_opts -v %{?_smp_mflags} -%__gettextize { \ - gettextize --copy --force --no-changelog; \ - if [ ! -f po/Makevars ]; then \ - cp -f po/Makevars{.template,}; \ +%__gettextize(d:) { \ + gettextize --copy --force --no-changelog %{?-d:--po-dir='%{-d*}'}; \ + if [ ! -f %{!?-d:po}%{?-d:'%{-d*}'}/Makevars ]; then \ + cp -f %{!?-d:po}%{?-d:'%{-d*}'}/Makevars{.template,}; \ fi; \ } @@ -305,6 +280,8 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %_tmppath %(echo "${TMPDIR:-/var/tmp}") %tmpdir %{_tmppath} +# Left for compatibility with rpm < 4.20 +# These are not user overridable in rpm >= 4.20. %_buildrootdir %{_tmppath} %buildroot %{_buildrootdir}/%{name}-%{version}-%{_arch}-root-%(id -u -n) @@ -363,12 +340,15 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ split("%{?filterout} %{?filterout_c} %{?filterout_ld}",F); %{filter_out} }') +%build_cflags %{rpmcflags} +%build_fflags %{rpmcflags} %{?_fmoddir:-I%{_fmoddir}} %rpmcxxflags %(awk 'BEGIN { split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I); split("%{?filterout} %{?filterout_cxx} %{?filterout_ld}",F); %{filter_out} }') +%build_cxxflags %{rpmcxxflags} %rpmcppflags %(awk 'BEGIN { split("%{?debug:%debugcppflags}%{!?debug:%optcppflags}%{?debuginfocppflags}",I); @@ -381,6 +361,7 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ split("%{?filterout_ld}",F) %{filter_out} }') +%build_ldflags %{rpmldflags} # rpmldflags with stripped -Wl, -- in the form flags have to be passed to 'ld' # but, don't use it, better use gcc as linker @@ -396,6 +377,21 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ }; }') +%set_build_flags \ + if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ + LC_ALL=C.UTF-8 ; \ + %{?__cc:CC="%{__cc}" ; export CC ; } \ + %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ + %{?__cpp:CPP="%{__cpp}" ; export CPP ; } \ + CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ + FCFLAGS="${FCFLAGS:-%rpmcflags}" ; export FCFLAGS ; \ + CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" ; export CPPFLAGS ; \ + LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ + RUSTC="${RUSTC:-%__rustc}" ; export RUSTC ; \ + RUSTFLAGS="${RUSTFLAGS:-%rpmrustflags}" ; export RUSTFLAGS + #----------------------------------------------------------------- # # Generate a command which cleans environment, leaving only the @@ -446,18 +442,39 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %{nil} #----------------------------------------------------------------- +%configuredir . +%configureshell %{nil} + %configure2_13 { \ - if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ - LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \ - CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \ - CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \ - FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \ - FCFLAGS="${FCFLAGS:-%rpmcflags}" ; export FCFLAGS ; \ - CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" ; export CPPFLAGS ; \ - %{?__cc:CC="%{__cc}" ; export CC ; } \ - %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \ - %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \ + %{set_build_flags}; \ + %{?configureshell:%{configureshell}} %{configuredir}/configure \ + --host=%{_target_platform} \ + --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} \ + --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \ + %{dependencytracking} \ +} + +#---------------------------------------------------------------- +#%configure_cache 0 +%configure_cache_file %{buildroot}.configure.cache + +%configure { \ + %{set_build_flags}; \ + %{?configureshell:%{configureshell}} %{configuredir}/configure \ --host=%{_target_platform} \ + --build=%{_target_platform} \ --prefix=%{_prefix} \ --exec-prefix=%{_exec_prefix} \ --bindir=%{_bindir} \ @@ -473,6 +490,7 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ --infodir=%{_infodir} \ --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \ %{dependencytracking} \ + %{?configure_cache:--cache-file=%{configure_cache_file}} \ } # Note: pass only standard cmake macros here. @@ -485,10 +503,8 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ # in different way (e.g. expect them to be always relative or always # absolute). %cmake \ -%{?__cc:CC="${CC:-%{__cc}}"} \\\ -%{?__cxx:CXX="${CXX:-%{__cxx}}"} \\\ -CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\ -%{__cmake} \\\ + %{set_build_flags}; \ + %{__cmake} \\\ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\ -DCMAKE_BUILD_TYPE=%{!?debug:TLD}%{?debug:Debug} \\\ -DCMAKE_SYSTEM_NAME=Linux \\\ @@ -547,87 +563,11 @@ CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\ # waf. see waf.spec (since 1.336) %waf { \ -CC="%{__cc}" \ -CXX="%{__cxx}" \ -CPP="%{__cpp}" \ -CFLAGS="%{rpmcflags}" \ -CXXFLAGS="%{rpmcxxflags}" \ +%{set_build_flags}; \ LINKFLAGS="%{rpmldflags}" \ %{__waf} \ } -# meson (since 1.727) -%meson { \ -%{?__cc:CC="${CC:-%{__cc}}"} \ -%{?__cxx:CXX="${CXX:-%{__cxx}}"} \ -CFLAGS="${CFLAGS:-%{rpmcflags}}" \ -CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \ -CXXFLAGS="${CXXFLAGS:-%{rpmcxxflags}}" \ -LDFLAGS="${LDFLAGS:-%{rpmldflags}}" \ -RUSTC="${RUSTC:-%{__rustc}}" \ -RUSTFLAGS="${RUSTFLAGS:-%{rpmrustflags} --target %rust_target}" \ -LC_ALL=C.UTF-8 %{__meson} \ - --buildtype=plain \ - --bindir=%{_bindir} \ - --datadir=%{_datadir} \ - --includedir=%{_includedir} \ - --infodir=%{_infodir} \ - --libdir=%{_libdir} \ - --libexecdir=%{_libexecdir} \ - --localedir=%{_localedir} \ - --localstatedir=%{_localstatedir} \ - --mandir=%{_mandir} \ - --prefix=%{_prefix} \ - --sbindir=%{_sbindir} \ - --sharedstatedir=%{_sharedstatedir} \ - --sysconfdir=%{_sysconfdir} \ - --wrap-mode=%{__meson_wrap_mode} \ - --default-library='both' \ -} - -%___meson_deprecate() {echo >&2 "DEPRECATED: %%%1 must be replaced with %%%2"; %{expand:%%%2} } -%meson_build %___meson_deprecate meson_build ninja_build -%meson_install %___meson_deprecate meson_install ninja_install -%meson_test %___meson_deprecate meson_test ninja_test - -# ninja (since 1.736) -%ninja_build LC_ALL=C.UTF-8 %{__ninja} %{__ninja_common_opts} -%ninja_install LC_ALL=C.UTF-8 DESTDIR=%{buildroot} %{__ninja} install %{__ninja_common_opts} -%ninja_test LC_ALL=C.UTF-8 %{__ninja} test %{__ninja_common_opts} - -#---------------------------------------------------------------- -#%configure_cache 0 -%configure_cache_file %{buildroot}.configure.cache - -%configure {./configure \ - LDFLAGS="${LDFLAGS:-%rpmldflags}" \ - CFLAGS="${CFLAGS:-%rpmcflags}" \ - CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \ - FFLAGS="${FFLAGS:-%rpmcflags}" \ - FCFLAGS="${FCFLAGS:-%rpmcflags}" \ - CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" \ - %{?__cc:CC="%{__cc}"} \ - %{?__cxx:CXX="%{__cxx}"} \ - --host=%{_target_platform} \ - --build=%{_target_platform} \ - --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} \ - --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \ - %{dependencytracking} \ - %{?configure_cache:--cache-file=%{configure_cache_file}} \ -} - # Simple macros to simplify adding bconded options to configure scripts. # Each macro requires bcond name and accepts optional option name, if option # isn't specified bcond name is used as option name. Options returning @@ -679,14 +619,6 @@ LC_ALL=C.UTF-8 %{__meson} \ #----------------------------------------------------------------- -# overload to insert debuginfo package -%prep \ -%if 0%{?_enable_debug_packages}\ -%{debug_package}\ -%endif\ -%%prep\ -%{nil} - %_build_id_links %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1:alldebug}%{?__dic_0:none}%{expand:%%undefine __dic_%{?_enable_debug_packages}} # If non-empty "debug" macro defined, add "dbg" suffix to release number diff --git a/macros.vpath b/macros.vpath new file mode 100644 index 0000000..6155103 --- /dev/null +++ b/macros.vpath @@ -0,0 +1,7 @@ +# ---- VPATH default settings + +# directory where CMakeLists.txt/meson.build/etc. are placed +%_vpath_srcdir . + +# directory (doesn't need to exist) where all generated build files will be placed +%_vpath_builddir build diff --git a/rpm-tld-macros.spec b/rpm-tld-macros.spec index 7d82b8d..a60ac7d 100644 --- a/rpm-tld-macros.spec +++ b/rpm-tld-macros.spec @@ -1,4 +1,4 @@ -%define rpm_macros_rev 2.035 +%define rpm_macros_rev 2.045 %define find_lang_rev 1.42 # split into individual X_prov_ver if there is a reason to desync %define prov_ver 4.15 @@ -57,9 +57,9 @@ Source58: macros.qt Source59: macros.erlang Source60: macros.gstreamer Source61: attr.gstreamer - Source62: kmod-deps.sh Source63: attr.mono +Source64: macros.vpath BuildRequires: rpm >= 4.4.9-56 BuildRequires: sed >= 4.0 Obsoletes: rpm-macros < 1.254 @@ -91,6 +91,10 @@ Provides: rpmbuild(find_lang) = %{find_lang_rev} Provides: rpmbuild(macros) = %{rpm_macros_rev} Obsoletes: rpm-build-macros < 1.745 Conflicts: gettext-devel < 0.11 +# ensure not using meson without meson-related macros in package +Conflicts: meson < 1.6.1-3 +# ensure not using ninja without ninja-related macros in package +Conflicts: ninja < 1.12.1-2 # macros.d/* Conflicts: rpm-build < 4.5-90 # php-config --sysconfdir @@ -245,6 +249,7 @@ cp -p %{SOURCE59} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.erlang cp -p %{SOURCE60} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.gstreamer cp -p %{SOURCE61} $RPM_BUILD_ROOT%{_usrlibrpm}/fileattrs/gstreamer.attr cp -p %{SOURCE63} $RPM_BUILD_ROOT%{_usrlibrpm}/fileattrs/mono.attr +cp -p %{SOURCE64} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.vpath %clean rm -rf $RPM_BUILD_ROOT @@ -285,6 +290,7 @@ rm -rf $RPM_BUILD_ROOT %{_usrlibrpm}/macros.d/macros.systemd %{_usrlibrpm}/macros.d/macros.tcl %{_usrlibrpm}/macros.d/macros.upstart +%{_usrlibrpm}/macros.d/macros.vpath %{_usrlibrpm}/macros.d/macros.webapp %{_usrlibrpm}/macros.d/macros.xmms %{_usrlibrpm}/macros.d/macros.xorg