#18 Add new cmake macros (backported to the cmake version in RHEL 8)
Closed 3 years ago by ngompa. Opened 3 years ago by ellert.
Unknown source new-cmake-macros  into  epel8

file added
+14
@@ -0,0 +1,14 @@

+ #!/bin/bash

+ 

+ # Implement "cmake -B <builddir> -S ." without using -B and -S

+ # Call as "cmakewrapper <cmake binary> <builddir> <cmake options>"

+ 

+ __cmake=$1

+ shift

+ __builddir=$1

+ shift

+ 

+ mkdir -p ${__builddir}

+ cd ${__builddir}

+ 

+ ${__cmake} "$@" ..

file modified
+9 -1
@@ -1,6 +1,6 @@

  Name:           epel-rpm-macros

  Version:        8

- Release:        14

+ Release:        15

  Summary:        Extra Packages for Enterprise Linux RPM macros

  

  Group:          System Environment/Base
@@ -14,6 +14,7 @@

  Source1:        macros.zzz-epel-override

  Source2:        gpgverify

  Source3:        pythondist.attr

+ Source4:        cmakewrapper

  Source9:        GPL

  

  BuildArch:      noarch
@@ -53,15 +54,22 @@

  install -Dpm 644 %{SOURCE3} \

      %{buildroot}%{_fileattrsdir}/pythondist.attr

  

+ install -Dpm 755 %{SOURCE4} \

+     %{buildroot}%{_rpmconfigdir}/cmakewrapper

+ 

  %files

  %license GPL

  /usr/lib/rpm/macros.d/macros.epel-rpm-macros

  /etc/rpm/macros.zzz-epel-override

+ %{_rpmconfigdir}/cmakewrapper

  %{_rpmconfigdir}/gpgverify

  %{_fileattrsdir}/pythondist.attr

  

  

  %changelog

+ * Wed Jul 29 2020 Mattias Ellert <mattias.ellert@physics.uu.se> - 8-15

+ - Add new cmake macros (backported to the cmake version in RHEL 8)

+ 

  * Sun Jun 28 2020 Artur Iwicki <fedora@svgames.pl> - 8-14

  - Add a Requires for fpc-srpm-macros

  

file modified
+26
@@ -82,3 +82,29 @@

  # qt5 macro removed from RHEL8 but needed to ensure qtwebengine, and 

  #  it's dependencies build on supported arches.

  %qt5_qtwebengine_arches %{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el

+ 

+ # Backport of additional cmake macros from Fedora

+ # The cmake macro is overridden in zzz-epel-overrides

+ %_cmake_shared_libs -DBUILD_SHARED_LIBS:BOOL=ON

+ %__ctest /usr/bin/ctest

+ %__cmake_in_source_build 1

+ %__cmake_builddir %{!?__cmake_in_source_build:%{_vpath_builddir}}%{?__cmake_in_source_build:.}

+ 

+ # The cmake version in RHEL 8 does not accept -jN and --verbose - can't use

+ # %__cmake --build "%{__cmake_builddir}" %{?_smp_mflags} --verbose

+ %cmake_build \

+   %make_build -C "%{__cmake_builddir}"

+ 

+ # The cmake version in RHEL 8 does not accept --install - can't use

+ # DESTDIR="%{buildroot}" %__cmake --install "%{__cmake_builddir}"

+ %cmake_install \

+   %make_install -C "%{__cmake_builddir}"

+ 

+ %ctest(:-:) \

+   cd "%{__cmake_builddir}" \

+   %__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} --verbose %{**} \

+   cd -

+ 

+ %cmake3_build %cmake_build

+ %cmake3_install %cmake_install

+ %ctest3 %ctest

file modified
+31
@@ -1,3 +1,34 @@

  # This file is used _only_ to override macros which exist in RHEL.

  # It should be used very sparingly.

  

+ # Override the cmake macro to support out-of-source builds

+ # The cmake version in RHEL 8 does not accept -B and -S flags

+ # Reimplement using a shell wrapper

+ %cmake \

+ %if 0%{?set_build_flags:1} \

+   %set_build_flags \

+ %else \

+   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \

+   CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \

+   FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \

+   FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \

+   %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \

+ %endif \

+ %if 0%{?__cmake_in_source_build:1} \

+   %__cmake \\\

+ %else \

+   %{_rpmconfigdir}/cmakewrapper %__cmake "%{__cmake_builddir}" \\\

+ %endif \

+         -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \\\

+         -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \\\

+         -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \\\

+         -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\

+         -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\

+         -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\

+         -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\

+         -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\

+         -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\

+ %if "%{?_lib}" == "lib64" \

+         %{?_cmake_lib_suffix64} \\\

+ %endif \

+         %{?_cmake_shared_libs}

This is kind of broken, since it doesn't correctly preserve working directory and doesn't handle the setting source and builddir distinctly separately... Though, I do have an implementation I'm about to submit as a PR that should work.

Pull-Request has been closed by ngompa

3 years ago