]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.spec: prepare for out-of-source build
authorKefu Chai <kchai@redhat.com>
Thu, 4 Mar 2021 04:56:11 +0000 (12:56 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 9 Mar 2021 11:13:19 +0000 (19:13 +0800)
see also
https://fedoraproject.org/wiki/Changes/CMake_to_do_out-of-source_builds

Signed-off-by: Kefu Chai <kchai@redhat.com>
ceph.spec.in

index bff4eaba3df07c8afb3324581c71aba8414e4442..88e5baa0ccabf34e5e59a8b080025976f12e3ad4 100644 (file)
@@ -1230,8 +1230,11 @@ export CXXFLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//g')
 
 env | sort
 
-mkdir build
-cd build
+%{?!_vpath_builddir:%global _vpath_builddir %{_target_platform}}
+
+# TODO: drop this step once we can use `cmake -B`
+mkdir -p %{_vpath_builddir}
+pushd %{_vpath_builddir}
 cmake .. \
     -DCMAKE_INSTALL_PREFIX=%{_prefix} \
     -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
@@ -1319,16 +1322,19 @@ make %{_smp_mflags}
 %make_build
 %endif
 
+popd
+
 %if 0%{with make_check}
 %check
 # run in-tree unittests
-cd build
+pushd %{_vpath_builddir}
 ctest %{_smp_mflags}
+popd
 %endif
 
 
 %install
-pushd build
+pushd %{_vpath_builddir}
 %make_install
 # we have dropped sysvinit bits
 rm -f %{buildroot}/%{_sysconfdir}/init.d/ceph