Build for OS X
From DirectFBWiki
So you've got a Mac running OS X and you've thought "hmmm... can this run on my machine?"
Well, the answer is yes and no. I have not been able to get 0.9.25.1 to build. However, I have been able to get 0.9.22 to build successfully.
But there are some caveats (aren't there always?)
| Table of contents |
Fink or MacPorts (aka Darwin Ports)
There are several libraries you may want for the build, like PNG and JPEG. Unfortunately, I was not able to get Fink to set the library up correctly. Your milage may vary.
MacPort's was far easier (in my view).
port install jpeg
port install libpng
port install libsdl
Because MacPort puts things in the "wrong" place (i.e. places that DirectFB doesn't understand), we have to tell it using the CPPFLAGS and the LDFLAGS option.
./configure CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" --enable-osx --enable-sdl=/opt/local/bin
This allows the configure routine to know to add these to the "standard" build flags.
Configure and Build
When you do a configure, be aware that the following should be included:
./configure CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" --enable-osx --enable-sdl=/opt/local/bin
Now on to see if the sucker works!
Testing... 1-2-3
Okay, download some test programs. How about DFBTutorials? You will find them on the DirectFB website under the downloads section.
Now type:
./configure
Rats! We get this message:
checking for directfb >= 0.9.11... Package directfb was not found in the pkg-config search path. Perhaps you should add the directory containing `directfb.pc' to the PKG_CONFIG_PATH environment variable No package 'directfb' found configure: error: Library requirements (directfb >= 0.9.11) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.
Isn't that nice? They even tell you how to fix it!
So this is what we do:
- Find out where 'directfb.pc' is located. This is easy:
sudo locate directfb.pc
I get the following:
/Users/lloyd/Downloads/6:19:06/DirectFB-0.9.25.1/directfb.pc /Users/lloyd/Downloads/6:19:06/DirectFB-0.9.25.1/directfb.pc.in /Users/lloyd/Downloads/6:22:06/DirectFB-0.9.22/directfb.pc /Users/lloyd/Downloads/6:22:06/DirectFB-0.9.22/directfb.pc.in /usr/local/lib/pkgconfig/directfb.pc
You want that last one (your's might vary a bit, but you will notice that the other's are where you downloaded DirectFB prior to the build).
Fix things by entering the following:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
THIS IS TEMPORARY To fix it right you need to put it in your shell startup script.
NOW when you do./configureit should just work. If not, then you typed something in wrong.
Do a make and you are done!
To test, do the following:
cd src/text ./text
The screen should go dark and the words "DirectFB RuleZ" should scroll across!
Tada!
Okay... That was fun... Now what?
Well, I plan to use OS X as a testbed for a PVR/DVR that I will write for a Linux box. What YOU will do with it is limited only by you imagination!
Cheers!
