How to set the rpmbuild destination folder

后端 未结 5 883
孤街浪徒
孤街浪徒 2021-02-07 04:16

I noticed rpmbuild (-bb and --buildroot options) creates the .rpm in different locations depending of what OS are you using:

  • GNU/Linux Ubuntu <= 9.04: /usr/src/
5条回答
  •  醉酒成梦
    2021-02-07 04:34

    For me the solution was to set _topdir to a subdirectory called rpmbuild inside my project. I also set a few macros, to control the .rpm path:

    rpm:
    rpmbuild -bb package.spec -D "_topdir $(shell pwd)/rpmbuild"  -D "SRC $(shell pwd)" -D "NAME $(NAME)" -D "ARCH $(ARCH)" -D "VERSION $(VERSION)" -D "RELEASE $(RELEASE)"
    mv rpmbuild/RPMS/$(ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(ARCH).rpm ./
    rm -rf rpmbuild
    

    Then I use make to generate the .rpm file and move it. I prefer rpmbuild to operate inside its directory.

    make rpm
    

    package.spec is using these macros, e.g.

    Name:           %{NAME_PACKAGE}
    

提交回复
热议问题