rpmbuild with rpmrc

RPM_DIR=`pwd`/rpm
echo "%_topdir $RPM_DIR" > rpmmacros
echo "macrofiles:     /usr/lib/rpm/macros:/usr/lib/rpm/%{_target}/macros:/usr/lib/rpm/redhat/macros:/etc/rpm/macros.*:/etc/rpm/macros:/etc/rpm/%{_target}/macros:~/.rpmmacros:rpmmacros" > rpmrc

mkdir -p $RPM_DIR/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

rpmbuild --rcfile rpmrc --rebuild some.source.rpm

rpmbuild --rcfile rpmrc --define 'dist .el5' -without java -without python \
 --target=x86_64 -ba rpm/SPECS/protobuf.spec
or redefine topdir as
rpmbuild --define "_topdir /home/user/rpmdir" --define 'dist .el5' \
 -without java -without python  --target=x86_64 -ba rpm/SPECS/protobuf.spec

use one thread to build for easy debugging
$ cat ~/.rpmmacros 
%_smp_mflags  -j1

No comments: