0

I'd would like to transition an existing *.spec file from the fedora style %cmake* commands to the alternate %cmake3 based one (eg. Amazon Linux 2).

What should I replace an existing %cmake_build with ?

Minimal reproducible example:

 % cat Dockerfile
FROM public.ecr.aws/lambda/dotnet:7
WORKDIR /tmp
RUN curl -O https://kojipkgs.fedoraproject.org//packages/dcmtk/3.6.7/3.fc39/src/dcmtk-3.6.7-3.fc39.src.rpm
RUN yum -y update && yum -y install rpm-build make gcc-c++ cmake3 libjpeg-devel \
 libpng-devel libtiff-devel libxml2-devel openssl-devel zlib-devel doxygen \
 git-core
RUN rpm -i dcmtk-3.6.7-3.fc39.src.rpm
WORKDIR /root/rpmbuild/SPECS/
RUN sed -e '/0017-Increase-sleep-for-tests.patch/ s/^#*/#/' -i dcmtk.spec
RUN sed -e 's/BuildRequires: cmake/BuildRequires: cmake3/g' -i dcmtk.spec
RUN sed -e 's/%cmake /%cmake3 /g' -i dcmtk.spec
RUN rpmbuild -ba dcmtk.spec

Gives:

% docker build .
[...]
-- Build files have been written to: /root/rpmbuild/BUILD/dcmtk-3.6.7
+ %cmake_build
/var/tmp/rpm-tmp.p5JL4r: line 70: fg: no job control
error: Bad exit status from /var/tmp/rpm-tmp.p5JL4r (%build)

And I do not see any cmake3_build command in:

# grep build /usr/lib/rpm/macros.d/macros.cmake3

1 Answer 1

0

Right now, I used the following approach, seems to work out just fine:

RUN sed -e 's/%cmake_build/make %{?_smp_mflags}/g' -i dcmtk.spec
RUN sed -e 's/%cmake_install/make install DESTDIR=$RPM_BUILD_ROOT/g' -i dcmtk.spec
RUN sed -e 's/%ctest/make test/g' -i dcmtk.spec

Hope this help

For reference:

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.