Installing Harbour, Qt and hbQt on osx

Now that we have a working osx Harbour setup, it is time to add other pieces. My goal is to port a software that runs on Windows under hbQt to Mac (and linux).

So, as the first step, I install the brew package manager, that will handle the setup of external software for me.

To install brew it is necessary to run a script that is downloaded from the web. I report it here but PLEASE do check on its website (http://brew.sh/) it if it is still valid when you will work on it.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

The script will ask for confirmation and for sudo password.

When ready, we can install Qt5.

brew install qt5
brew linkapps qt5

As for today, it will install Qt 5.6.1. With the second line Qt5 bundled applications are installed in Launchpad.

It’s time to download and compile hbQt, but before I want to update my env setup and I do as usual with a script file set_harbour561.sh:

PATH=/usr/local/opt/qt5/bin/:~/harbour/bin/darwin/clang:$PATH
export QT_PLUGIN_PATH=/usr/local/opt/qt5/plugins/
export HB_WITH_QT=/usr/local/opt/qt5/include/
## rem HB_QT_MAJOR_VER can probably become deprecated in next
## rem Harbour/qtcontribs releases.
export HB_QT_MAJOR_VER=5

and I update the env variables with
. set_harbour561.sh

and then I checkout the sources

cd /harbour
svn checkout http://svn.code.sf.net/p/qtcontribs/code/trunk addons

Before compiling hbQt we need to compile a contrib of Harbour, since it depends on Qt and some hbQt programs depend on it. So compile the contribs:

cd <path>/harbour/contribs
make

Then move to the addons directory:

cd <path>/harbour/addons

We need to modify qtcontribs.hbp, since some Qt modules are not available on osx. So add a # in front of the line of:
hbqtdeclarative.hbp
and
hbqt/qtwebkit/hbqtwebkit.hbp

and finally build hbQt:

hbmk2 -jobs=4 qtcontribs.hbp

We are now ready to start hbide and hbdbu programs but you need to access osx gui to be able to use them. Both work as they should but during my tests I found some discrepancies about fonts, layout and GUI: Qt does its best to adapt one codebase to the GUI peculiarities of each GUI but sometimes the result is not perfect and one form dialog that is perfect on windows can have problems on osx.

Will see in another post.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>