Building for different distributions

Our project is build for different distributions.
Now Centos and Redhat should be added.
openSUSE/SLE/Mandriva/Debian/Ubuntu/Fedora are already building successfully.

Our project is based on Qt and uses qmake for generating the Makefiles.

It seems that our SPEC file must be adjusted.
I tried:
##################################
<snip>
%if 0%{?fedora_version}

Requires: ld-linux.so.2

Requires: qt4
Requires: Mesa

Requires: VTK

Requires: tcl

Requires: tk

BuildRequires: Mesa-devel gcc-c++ libstdc+±devel lcms-devel qt4 qt4-devel python-devel
%endif

%if 0%{?redhat_version}

Requires: ld-linux.so.2

Requires: qt4
Requires: Mesa

Requires: VTK

Requires: tcl

Requires: tk

BuildRequires: Mesa-devel gcc-c++ libstdc+±devel lcms-devel qt4 qt4-devel python-devel
%endif

%if 0%{?centos_version}

Requires: ld-linux.so.2

Requires: qt4
Requires: Mesa

Requires: VTK

Requires: tcl

Requires: tk

BuildRequires: Mesa-devel gcc-c++ libstdc+±devel lcms-devel qt4 qt4-devel python-devel
%endif
<snip>
##################################

For Fedora everything is ok.
But redhat fails.
Centos only builds for i586 architecture.
On the failing distributions qmake is not found.

Questions:

What are the right %if lines ? Are they called different ? I tried:
%if 0%{?redhat_version}
%if 0%{?centos_version}

What are the right package names on redhat and centos ?
Is this ok and sufficient ? Is qmake in an additional package ?
Requires: qt4

What is the correct path for qmake on redhat and centos.
Our project will find qmake if it is in one of the following directories.
#!/bin/bash
################################

stuff to call qmake on different distributions

################################
if -x /usr/bin/qmake-qt4 ]; then
/usr/bin/qmake-qt4 $1 $2 $3 $4 $5 $6 $7 $8
exit
fi
if -x /usr/lib/qt4/bin/qmake-qt4 ]; then
/usr/lib/qt4/bin/qmake-qt4 $1 $2 $3 $4 $5 $6 $7 $8
exit
fi
if -x /usr/lib/qt4/bin/qmake ]; then
/usr/lib/qt4/bin/qmake $1 $2 $3 $4 $5 $6 $7 $8
exit
fi
qmake $1 $2 $3 $4 $5 $6 $7 $8

“osc meta prjconf RedHat:RHEL-5 | fgrep _version” says it’s “rhel_version”.

From the “osc ls -b RedHat:RHEL-5 -a x86_64 | grep --color=auto -i -e qmake -e qt” output I would say qt4-devel.

I could be wrong. But I would expect qmake/qmake-qt4 to be in the PATH of any distro.

Thank you,
rhel_version works.

But redhat and centos packages are only build successfully for the i586 architecture.
The x86_64 bit version fails.

qmake is not found there.
Is qmake on a different path on 64 bit.
Or do i need a different package than qt4-devel ?

If you are using that qmake installation path detection script you probably have the /usr/lib vs /usr/lib64 problem.
But again, I would be very surprised if qmake/qmake-qt4 isn’t available in /usr/bin (or some other path available in the $PATH). Perhaps it’s just a symlink to /usr/lib/qt4/bin/qmake-qt4, but it’s very hard for me to believe that it’s just available in a path not in $PATH.

I’m shure qmake is on different places on different distributinons and sometimes is not in $PATH.
This has been the reason for my “qmake detection script”.

I think a path to lib64 must be added because i586 on centos and redhat work and x86_64 fails.

Thus my final “qmake detection script” will look as follows


#!/bin/bash
################################

stuff to call qmake on different distributions

################################
if -x /usr/bin/qmake-qt4 ]; then
/usr/bin/qmake-qt4 $1 $2 $3 $4 $5 $6 $7 $8
exit
fi
if -x /usr/lib/qt4/bin/qmake-qt4 ]; then
/usr/lib/qt4/bin/qmake-qt4 $1 $2 $3 $4 $5 $6 $7 $8
exit
fi
if -x /usr/lib/qt4/bin/qmake ]; then
/usr/lib/qt4/bin/qmake $1 $2 $3 $4 $5 $6 $7 $8
exit
fi

added the following lines for rhel and centos x86_64

if -x /usr/lib64/qt4/bin/qmake-qt4 ]; then
/usr/lib64/qt4/bin/qmake-qt4 $1 $2 $3 $4 $5 $6 $7 $8
exit
fi
if -x /usr/lib64/qt4/bin/qmake ]; then
/usr/lib64/qt4/bin/qmake $1 $2 $3 $4 $5 $6 $7 $8
exit
fi
qmake $1 $2 $3 $4 $5 $6 $7 $8

As can be seen from the above script qmake will be found if it is in $PATH
But qmake will also be found if it is in the special path locations of some distributions.

At the moment i do not want to upload a new tarball (the detection script is in there) in order to fix the rhel/centos problem with x86_64.
This will be delayed up to our next release.

PS: Thanks for your advise.
rhel_version helped to solve half of my problems.
I hope the above extension to the “qmake detection script” will solve the remaining problem.

Hi
Does the %{__qmake} variable not work, which should detect the full
path?


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.12-0.7-default
up 0:30, 2 users, load average: 0.15, 0.13, 0.05
GPU GeForce 8600 GTS Silent - Driver Version: 256.35

> Does the %{__qmake} variable not work, which should detect the full
> path?

No, I didn’t even know about such an environment variable.
Where can i find a list of all environment variables available in the OBS ?

PS: My handmade solution works for all other distries and i think centos/rhel will work with the above extension.

Hi
This should probably help to find qmake
http://en.opensuse.org/Build_Service/cross_distribution_package_how_to


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.12-0.7-default
up 1:38, 2 users, load average: 0.23, 0.09, 0.02
GPU GeForce 8600 GTS Silent - Driver Version: 256.35

Thank you for the link.