Trying to package qdldl: mv: cannot move ... Permission denied

I am trying to package qdldl.

qdldl tried to install /usr/lib/cmake/qdldl.
So I think the correct way should be /usr/lib64/cmake/qdldl.

So I use,

%if "%{_libdir}" != "%{_prefix}/lib"
mv %{buildroot}%{_prefix}/lib/cmake/qdldl/ %{_libdir} 

just under %cmake_install.

However, I got mv: cannot move ‘/home/abuild/rpmbuild/BUILDROOT/qdldl-0.1.5-0.x86_64/usr/lib/cmake/qdldl/’ to ‘/usr/lib64/qdldl’: Permission denied

How to fix this?
Thank you.

When I’m not sure I always look in the local system to see what’s present and then look on OBS as to how it was done :wink:

For example I see /usr/lib64/cmake/openblas;

Looks like they use defines to get it into the correct location…

I have look into the openblas that you link, from what I understand, it seems that they hide the full directory under %define is that right?
So I tried it as well, but same error.

I ended up with this, but same error.

%define p_name   qdldl
%define p_libdir /lib
%define p_cmakedir %{buildroot}%{_prefix}%{p_libdir}/cmake/%{p_name}


%if "%{_libdir}" != "%{_prefix}/lib"
mv %{p_cmakedir} %{_libdir} 


I patch the cmake file instead