Page 1 of 2

[RESOLVED] - rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/02 15:04:26
by warron.french
I need to take Firefox-52.5.1 using the SRC rpm from Red Hat and give it a new name, so that it is NOT upgradable, and place it in a different directory such as /opt.

I can do this by modifying the provided SPEC file (firefox.spec) from the src RPM- firefox-52.5.1-1.el7_4.src.rpm. Can't I?

I know that the SPEC file does not contain an Arch or even an ExclusiveArch attribute up in the preamble.
I also know that I can simply execute the rpmbuild command to have it attempt build the x86_64 RPM that I need as well, without making any changes to the SPEC to apply the Arch or ExclusiveArch into the SPEC file. Or am I incorrect?

I have already executed the rpmbuild command:

Code: Select all

rpmbuild -vv -bb rpmbuild/SPECS/firefox.spec
And run into a problem I did not quite expect.

I looked for the %{name} tag, but I could not find it in the firefox.spec file; I would like to change it to be firefox52, instead of simply firefox, that way I can identify the package uniquely.

I know I am on the correct track, but the little pieces I know and understand are not helpful in this RPM build. ;)

Sorry for all the of the requests for help,

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/02 15:18:11
by TrevorH
Start by rebuilding the SRPM unmodified so that you know that whatever goes wrong is a problem with your build environment. Fix the problems until it builds then substitute your modified package after that.

It's recommended to use mock instead of rpmbuild. If you use rpmbuild then you have to install all prereqs onto your build system. If you use mock it prepares a clean chroot with only the bare minimum of things in it and builds in a clean environment. It also means that undoing it and freeing disk space is as easy as mock --scrub all. You build your SRPM with rpmbuild as normal then pass it into mock using e.g. mock --rebuild /path/to/current.src.rpm

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/02 19:06:02
by warron.french
I was incorrect about the %{name} tag, I did find it eventually. It turns out that the tag I needed to look for was %{Name} with a capital N.

I am still looking into placing the firefox into a directory like /opt/firefox52.

Does anyone know if changing %{Name} is enough or not?

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/02 19:10:18
by warron.french
TrevorH wrote:
2019/05/02 15:18:11
Start by rebuilding the SRPM unmodified so that you know that whatever goes wrong is a problem with your build environment. Fix the problems until it builds then substitute your modified package after that.

It's recommended to use mock instead of rpmbuild. If you use rpmbuild then you have to install all prereqs onto your build system. If you use mock it prepares a clean chroot with only the bare minimum of things in it and builds in a clean environment. It also means that undoing it and freeing disk space is as easy as mock --scrub all. You build your SRPM with rpmbuild as normal then pass it into mock using e.g. mock --rebuild /path/to/current.src.rpm
I am running into this error:

Code: Select all

checking for the target C++ compiler... not found
DEBUG: _cxx: Trying /usr/bin/g++
ERROR: Cannot find the target C++ compiler
*** Fix above errors and then restart with\
               "make -f client.mk build"
make[2]: *** [configure] Error 1
make[2]: Leaving directory `/home/build/rpmbuild/BUILD/firefox52-52.5.1/firefox-52.5.1esr'
make[1]: *** [/home/build/rpmbuild/BUILD/firefox52-52.5.1/firefox-52.5.1esr/objdir/Makefile] Error 2
make[1]: Leaving directory `/home/build/rpmbuild/BUILD/firefox52-52.5.1/firefox-52.5.1esr'
make: *** [build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.csY8I6 (%build)
But I already have the package gcc installed on my machine. Do I need to look for what provides '/usr/bin/g++' ?

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/02 20:49:02
by warron.french
Good news, I got past the C++ compiler not found. I just had to install the gcc-c++ package to provide the namesake binary.

So, I am moving forward a little bit.

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/03 00:58:31
by TrevorH
This is exactly why you should use mock. It will install all BuildRequires: for you.

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/03 12:23:33
by warron.french
TrevorH wrote:
2019/05/03 00:58:31
This is exactly why you should use mock. It will install all BuildRequires: for you.
Ah! OK.

Any idea on how to tell the build to place Firefox into a different directory, like /opt/firefox52?

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/03 16:14:36
by TrevorH
That would be controlled in the spec file.

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/20 19:18:11
by warron.french
TrevorH,
do you know where I can find the build instructions for Firefox-52.y.z?

Re: rpmbuild Firefox from SPEC into different directory

Posted: 2019/05/20 20:37:26
by TrevorH
If it doesn't just build using mock --rebuild /path/to/firefox-52.x.y.src.rpm then no, sorry.