Search code examples
linuxrpmprefixrpmbuild

rpmbuild is building my target directory in /usr/local not where I specified


My rpmbuild is supposed to happen in /include, /lib, and /share, I have specified this in the spec file. But when in the BUILDROOT directory, it is creating in /usr/local/include, /usr/local/lib, /usr/local/share instead. And then is throwing an error (obviously) because I am looking for the files in the previous location.

Why would this happen? Nowhere am I specifying /usr/local, then why does it take this location?

This is my .spec file:-

%define        __spec_install_post %{nil}
%define          debug_package %{nil}
%define        __os_install_post %{_dbpath}/brp-compress


Summary: test
Name: TEST
Version: 1.0
Release: 1
License: MYORG
Group: Development/Tools
SOURCE0 : %{name}.tar.gz
%define pbs_prefix /opt/dir1/TEST

BuildRoot: %{_topdir}/%{name}

%description
%{summary}

%prep
%setup -q

%build
./configure --with-prefix=/opt/dir1/TEST --with-drms-dir=/opt/dir1

%install
rm -rf %{buildroot}
mkdir -p  %{buildroot}

%make_install

%clean 
rm -rf %{buildroot}

%files  
/opt/dir1/TEST/include/*
/opt/dir1/TEST/lib/*
/opt/dir1/TEST/share/*

My ~/.rpmmacros file is:-

%_topdir   %(echo $HOME)/rpmbuild
%_tmppath  %{_topdir}/tmp

I want to build so that my TEST-1.0-1x86_64/ has /include, /lib and /share not /usr/local/...


Solution

  • The --prefix option sets your path. Not --with-prefix.