]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- 1.511
[packages/rpm-build-macros.git] / rpm.macros
index b6abb758f95642d1d216d54a0814f53d2106cdda..41f919cf86dddb32bad370bd906201a04c58afab 100644 (file)
@@ -9,16 +9,28 @@
 %kgcc_package  gcc
 
 # compiler version
-%cc_version            %{expand:%%global cc_version %(%{__cc} -dumpversion || echo ERROR)}%cc_version
+%cc_version    %{expand:%%global cc_version %(%{__cc} -dumpversion || echo ERROR)}%cc_version
 %cxx_version   %{expand:%%global cxx_version %(%{__cxx} -dumpversion || echo ERROR)}%cxx_version
 
-%__rm                  /bin/rm --interactive=never
+%__rm          /bin/rm --interactive=never
 
 # Build system path macros.
+%__autoconf    autoconf %{?debug:-Wall}
+%__automake    automake -a -c -f --foreign
+%__autopoint   autopoint --force
+
+# add parallel build flags: -jN
+#
+# if you want to disable parallel build do (replace %% with %)
+# echo '%%_smp_mflags %%{nil}' >> ~/.rpmmacros
 #
-%__autoconf            autoconf %{?debug:-Wall}
-%__automake            automake -a -c -f --foreign
-%__autopoint           autopoint --force
+%__make                make %{?_smp_mflags}
+%__scons       scons %{?_smp_mflags}
+%__waf         waf %{?_smp_mflags}
+%__cmake       cmake %{?_smp_mflags}
+
+%_smp_mflags %(_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN); \\\
+                               [ "$_NCPUS" -gt 1 ] && echo "-j$(($_NCPUS * 2))")
 
 %__gettextize { \
        if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
 #      and that both p and q are package names (i.e. no version/release).
 %_dependency_whiteout  %{nil}
 
-%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
-       && RPM_BUILD_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN); \\\
-       [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$(($RPM_BUILD_NCPUS * 2))")
-
 #-----------------------------------------------------------------
 #
 # (re)definition of %{rpm*flags} with %filterout_* support
@@ -809,6 +817,25 @@ fi \
 # Software written in Python language require Python with main version
 %pyrequires_eq() Requires:     %1
 
+# Python 3.x
+# python main version
+%__python3                     python3.0
+%py3_ver                       %{expand:%%global py3_ver %(%{__python3} -c "import sys; print(sys.version[:3])" 2>/dev/null || echo ERROR)}%py3_ver
+
+# directories
+%py3_prefix            %{expand:%%global py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo ERROR)}%py3_prefix
+%py3_libdir            %{py3_prefix}/%{_lib}/python%{py3_ver}
+%py3_scriptdir %{py3_prefix}/share/python%{py3_ver}
+%py3_incdir            /usr/include/python%{py3_ver}
+%py3_sitedir           %{py3_libdir}/site-packages
+%py3_sitescriptdir %{py3_scriptdir}/site-packages
+%py3_dyndir            %{py3_libdir}/lib-dynload
+
+# pure python modules compilation
+%py3_comp              %{__python3} -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
+
+%py3_ocomp             %{__python3} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
+
 # Hardlink binary identical .pyc and .pyo files
 %__spec_install_post_py_hardlink {\
 %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
@@ -835,6 +862,12 @@ for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
 done \
 %{nil}
 
+%py3_postclean() \
+for d in %{py3_sitescriptdir} %{py3_sitedir} %*; do \
+ [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
+done \
+%{nil}
+
 # depmod macro
 %depmod() { \
 umask 022; \
This page took 0.02965 seconds and 4 git commands to generate.