Getting Started/Build/Mac OS X/MacPorts: Difference between revisions
Neverendingo (talk | contribs) m (Text replace - "</code>" to "</syntaxhighlight>") |
|||
(10 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
==Introduction== | ==Introduction== | ||
The process described here is one of many ways to set up a KDE development environment on Mac OS X. It sets up a MacPorts installation to provide the required dependencies and uses this to then build a KDE | The process described here is one of many ways to set up a KDE development environment on Mac OS X. It sets up a MacPorts installation to provide the required dependencies and uses this to then build a KDE kf5 development environment. This approach has the big advantage of using MacPorts to build, install and keep updated the base system and libraries required with minimal effort and without touching the base OSX system install. | ||
It also gives you the choice of installing and running the latest stable KDE SC for everyday use while still developing on the unstable trunk. | It also gives you the choice of installing and running the latest stable KDE SC for everyday use while still developing on the unstable trunk. | ||
Line 19: | Line 19: | ||
==Install XCode and X11.== | ==Install XCode and X11.== | ||
Install Apple's XCode developer tools either from your OS X install disks or download from http://developer.apple.com/technologies/xcode.html. | Install Apple's XCode developer tools either from your OS X install disks or download from http://developer.apple.com/technologies/xcode.html or install from the OSX App Store. | ||
If you are running Tiger you will also need to install Apple's X11 from your OS X Install disks. Snow Leopard and Leopard come with it installed by default. | If you are running Tiger you will also need to install Apple's X11 from your OS X Install disks. Snow Leopard and Leopard come with it installed by default. | ||
Line 58: | Line 58: | ||
Install a package, the -v is needed to see the build output: | Install a package, the -v is needed to see the build output: | ||
sudo port -v install <package> | sudo port -v install <package> | ||
To enable a parallel build, which is encouraged, define the number `N` of processes | |||
sudo port -v install <package> build.jobs=N | |||
List the contents of an installed package | List the contents of an installed package | ||
Line 84: | Line 87: | ||
[https://trac.macports.org/wiki/FAQ#gui GUI frontends] are available if you prefer. | [https://trac.macports.org/wiki/FAQ#gui GUI frontends] are available if you prefer. | ||
==Installing the base requirements== | ==Installing the base requirements for KDE Frameworks== | ||
NOTE: This section is WIP for now. | |||
To install the requirements to build kde frameworks only a few items are needed (and their dependencies). These are: | |||
* Qt (installer from qt.io will work, qt5-mac needs fixes: https://trac.macports.org/ticket/46129) | |||
* cmake | |||
* git | |||
* p5.XX-libwww-perl and p5.XX-xml-parser XX should be the same or higher version than what's installed already by Apple to avoid issues. This is only required if you're going to build with kdesrc-build though, which is recommended. | |||
Dependencies include: | |||
* wget | |||
* automake | |||
* autoconf | |||
* cppcheck | |||
* lcov | |||
* docbook-xml | |||
* docbook-xsl | |||
* giflib | |||
* boost | |||
* bzr | |||
* shared-mime-info | |||
* libgcrypt | |||
Installing these with sudo port install should give you the dependencies you'll need to build the frameworks and applications, though some applications may have more dependencies of course. | |||
On my machine I've used the following .kdesrc-buildrc file to build the frameworks and a handful of kdeedu applications: | |||
global | |||
qtdir /Users/jeremywhiting/Qt/5.4/clang_64/ | |||
source-dir /Users/jeremywhiting/devel/kde/src | |||
build-dir /Users/jeremywhiting/devel/kde/build | |||
kdedir /usr/local | |||
git-repository-base kde-projects kde: | |||
cxxflags -pipe -DQT_STRICT_ITERATORS -DQURL_NO_CAST_FROM_STRING -DQT_NO_HTTP -DQT_NO_FTP -Wformat -Werror=format-security -Werror=return-type -Wno-variadic-macros | |||
cmake-options -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_DISABLE_FIND_PACKAGE_X11=ON | |||
make-options -j8 | |||
branch-group kf5-qt5 | |||
end global | |||
include devel/kde/src/extragear/utils/kdesrc-build/kf5-qt5-build-include | |||
==Installing the base requirements for KDE4== | |||
You can choose to find and install each requirement on your own, or if you have less time and plenty of disk space you can just install the stable KDE SC and let it pull all the dependencies in for you. | You can choose to find and install each requirement on your own, or if you have less time and plenty of disk space you can just install the stable KDE SC and let it pull all the dependencies in for you. | ||
If you have plenty of time, just choose to install one of the major KDE packages and leave it running for 24-48 hours, kdesdk4 seems the obvious choice: | If you have plenty of time, just choose to install one of the major KDE packages and leave it running for 24-48 hours (if parallel build is not enabled; it can come down to 12 hours), kdesdk4 seems the obvious choice: | ||
sudo port -v install kdesdk4 | sudo port -v install kdesdk4 | ||
sudo port -v install dialog | |||
sudo perl -MCPAN -e 'install Bundle::LWP' | |||
This will resolve all the dependencies and compile and install everything you need including development tools like subversion and cmake. | This will resolve all the dependencies and compile and install everything you need including development tools like subversion and cmake. | ||
Line 484: | Line 530: | ||
cd ~/kde/src/trunk | cd ~/kde/src/trunk | ||
svn co svn+ssh://[email protected]/home/kde/trunk/kdesupport | svn co svn+ssh://[email protected]/home/kde/trunk/kdesupport | ||
===Edit 07/2012 === | |||
I haven't luck with this method on lion | |||
I have had best luck by downloading the KDEsrc from their homepage kdesrc-build 1.15.1 http://kdesrc-build.kde.org/releases/kdesrc-build-1.15.1.php | |||
once downloaded i placed the kdesrc-build folder in ~/src when running the . ~/src/kdesrc-build-setup use the default variables | |||
you can then run ./kdesrc-build | |||
these are the ports packages that i have installed thus far.. if you get a error about libtoolize you need to use the glibtoolize in the /opt/local/bin/ folder | |||
you would achieve this with these commands | |||
sudo mv /usr/local/bin/libtoolize /usr/local/bin/xlibtoolize | |||
sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/libtoolize | |||
once that piece compiles you will need to use the native libtoolize so | |||
sudo rm -r /usr/local/bin/libtoolize | |||
sudo mv /usr/local/bin/xlibtoolize /usr/local/bin/libtoolize | |||
and continue compiling.. | |||
these are my installed ports packages: | |||
a52dec @0.7.4_0 (active) | |||
akonadi @1.7.2_0 (active) | |||
antlr @2.7.7_1 (active) | |||
aspell @0.60.6_4+nonls (active) | |||
aspell-dict-en @7.1_0 (active) | |||
atk @2.2.0_1 (active) | |||
attica @0.4.0_0 (active) | |||
autoconf @2.69_0 (active) | |||
automake @1.12.1_0 (active) | |||
automoc @0.9.88_3 (active) | |||
avahi @0.6.31_2+gtk+python27 (active) | |||
BGHUDAppKit @0.7_1 (active) | |||
bison @2.5.1_0 (active) | |||
boost @1.49.0_0 (active) | |||
bzip2 @1.0.6_0 (active) | |||
cairo @1.12.2_0+x11 (active) | |||
clucene @0.9.21b_0 (active) | |||
cmake @2.8.8_1 (active) | |||
coreutils @8.17_0 (active) | |||
cppunit @1.12.1_0 (active) | |||
curl @7.26.0_0+ssl (active) | |||
curl-ca-bundle @7.26.0_1 (active) | |||
cyrus-sasl2 @2.1.25_1+kerberos (active) | |||
db46 @4.6.21_6 (active) | |||
dbus @1.4.20_1+startupitem (active) | |||
dbus-glib @0.100_0 (active) | |||
dbus-python27 @0.84.0_0 (active) | |||
dbusmenu-qt @0.9.0_0 (active) | |||
dialog @1.1-20120215_0 (active) | |||
dirac @1.0.2_1 (active) | |||
docbook-xml @5.0_0 (active) | |||
docbook-xml-4.1.2 @4.1.2_1 (active) | |||
docbook-xml-4.2 @4.2_0 (active) | |||
docbook-xml-4.3 @4.3_0 (active) | |||
docbook-xml-4.4 @4.4_0 (active) | |||
docbook-xml-4.5 @4.5_0 (active) | |||
docbook-xml-5.0 @5.0_0 (active) | |||
docbook-xsl @1.76.1_1 (active) | |||
docbook-xsl-ns @1.76.1_0 (active) | |||
eggdbus @0.6_1 (active) | |||
enchant @1.6.0_1 (active) | |||
exiv2 @0.22_0 (active) | |||
expat @2.1.0_0 (active) | |||
faad2 @2.7_0 (active) | |||
ffmpeg @0.7.11_1+mmx (active) | |||
fftw-3 @3.3.2_0 (active) | |||
flac @1.2.1_1 (active) | |||
flex @2.5.35_1 (active) | |||
fontconfig @2.9.0_1 (active) | |||
freetype @2.4.10_0 (active) | |||
gawk @4.0.0_0 (active) | |||
gdbm @1.10_1 (active) | |||
gdk-pixbuf2 @2.26.1_1 (active) | |||
getopt @1.1.4_1 (active) | |||
gettext @0.18.1.1_2 (active) | |||
ghostscript @9.05_2 (active) | |||
giflib @4.2.0_2+x11 (active) | |||
glib2 @2.32.3_1 (active) | |||
gmake @3.82_0 (active) | |||
gmp @5.0.4_1 (active) | |||
gnome-common @2.28.0_0 (active) | |||
gnome-doc-utils @0.20.6_0+python27 (active) | |||
gnupg @1.4.12_0 (active) | |||
gnutls @2.12.19_0 (active) | |||
gpgme @1.3.1_0 (active) | |||
grantlee @0.2.0_0 (active) | |||
gtk-doc @1.18_0+python27 (active) | |||
gtk2 @2.24.10_2+x11 (active) | |||
help2man @1.40.10_0 (active) | |||
hicolor-icon-theme @0.12_0 (active) | |||
hunspell @1.3.2_0 (active) | |||
icu @4.8.1_0 (active) | |||
ilmbase @1.0.2_0 (active) | |||
ImageMagick @6.7.8-0_0+q16 (active) | |||
intltool @0.50.2_0 (active) | |||
iso-codes @3.35_0 (active) | |||
jasper @1.900.1_9 (active) | |||
jbig2dec @0.11_1 (active) | |||
jbigkit @2.0_2 (active) | |||
jpeg @8d_0 (active) | |||
kate @4.8.3_0 (active) | |||
kde4-baseapps @4.8.3_0 (active) | |||
kde4-runtime @4.8.3_1 (active) | |||
kdelibs4 @4.8.3_2 (active) | |||
kdepimlibs4 @4.8.3_0 (active) | |||
kdesdk4 @4.8.3_0 (active) | |||
kerberos5 @1.7.2_0 (active) | |||
konsole @4.8.3_0 (active) | |||
lame @3.99_1 (active) | |||
lcms @1.19_2 (active) | |||
lcms2 @2.3_0 (active) | |||
libart_lgpl @2.3.21_0 (active) | |||
libassuan @2.0.2_0 (active) | |||
libcddb @1.3.2_1 (active) | |||
libcdio @0.83_0 (active) | |||
libdaemon @0.14_0 (active) | |||
libdca @0.0.5_0 (active) | |||
libdmtx @0.7.2_1 (active) | |||
libdvdcss @1.2.11_0 (active) | |||
libdvdnav @4.1.3_0 (active) | |||
libdvdread @4.2.0_0 (active) | |||
libedit @20120601-3.0_0 (active) | |||
libffi @3.0.11_0 (active) | |||
libgcrypt @1.5.0_0 (active) | |||
libglade2 @2.6.4_5 (active) | |||
libgpg-error @1.10_0 (active) | |||
libical @0.43_1 (active) | |||
libiconv @1.14_0 (active) | |||
libid3tag @0.15.1b_2 (active) | |||
libidn @1.25_0 (active) | |||
libiodbc @3.52.8_1 (active) | |||
libmad @0.15.1b_3 (active) | |||
libmatroska @1.3.0_0 (active) | |||
libmng @1.0.10_2 (active) | |||
libmodplug @0.8.8.4_0 (active) | |||
libmpcdec @1.2.6_0 (active) | |||
libogg @1.3.0_1 (active) | |||
libpaper @1.1.24_0 (active) | |||
libpixman @0.26.2_0 (active) | |||
libpng @1.4.11_0 (active) | |||
libsdl @1.2.15_0+x11 (active) | |||
libsigsegv @2.9_0 (active) | |||
libsndfile @1.0.25_0 (active) | |||
libssh @0.5.2_0 (active) | |||
libtasn1 @2.11_0 (active) | |||
libtheora @1.1.1_1 (active) | |||
libtool @2.4.2_2 (active) | |||
libusb @1.0.9_0 (active) | |||
libusb-compat @0.1.4_0 (active) | |||
libvorbis @1.3.3_0 (active) | |||
libvpx @1.1.0_0 (active) | |||
libxml2 @2.7.8_0 (active) | |||
libxslt @1.1.26_0 (active) | |||
lua @5.1.4_4 (active) | |||
lzo2 @2.05_1 (active) | |||
m4 @1.4.16_0 (active) | |||
mhash @0.9.9.9_0 (active) | |||
mpfr @3.1.0-p3_1 (active) | |||
mysql5 @5.1.63_0 (active) | |||
mysql5-server @5.1.63_0 (active) | |||
mysql55 @5.5.25_0 (active) | |||
mysql55-server @5.5.25_0 (active) | |||
mysql_select @0.1.2_0 (active) | |||
ncurses @5.9_1 (active) | |||
nosetests_select @0.1_0 (active) | |||
openexr @1.7.0_0 (active) | |||
openjpeg @1.5.0_2 (active) | |||
openldap @2.4.21_5 (active) | |||
openslp @1.2.1_2 (active) | |||
openssl @1.0.1c_0 (active) | |||
orc @0.4.16_0 (active) | |||
ossp-uuid @1.6.2_0 (active) | |||
oxygen-icons @4.8.3_0 (active) | |||
p5-xml-parser @2.400.0_4 (active) | |||
p5.12-getopt-long @2.380.0_3 (active) | |||
p5.12-locale-gettext @1.50.0_7 (active) | |||
p5.12-pathtools @3.330.0_3 (active) | |||
p5.12-scalar-list-utils @1.230.0_3 (active) | |||
p5.12-xml-parser @2.400.0_4 (active) | |||
pango @1.30.1_0+x11 (active) | |||
pcre @8.30_1 (active) | |||
perl5 @5.12.4_0+perl5_12 (active) | |||
perl5.12 @5.12.4_1 (active) | |||
phonon @4.6.0_0 (active) | |||
pkgconfig @0.26_1 (active) | |||
policykit @0.103_1 (active) | |||
polkit-qt @0.103.0_0 (active) | |||
popt @1.16_0 (active) | |||
postgresql92 @9.2beta2_0 (active) | |||
postgresql_select @0.1_0 (active) | |||
prison @1.0_0 (active) | |||
pth @2.0.7_0 (active) | |||
py-xattr @0.6.1_0 | |||
py24-distribute @0.6.27_0 (active) | |||
py27-cairo @1.8.10_1 (active) | |||
py27-distribute @0.6.27_0 (active) | |||
py27-gdbm @2.7.3_0 (active) | |||
py27-gobject @2.26.0_3 (active) | |||
py27-gtk @2.22.0_1+x11 (active) | |||
py27-libxml2 @2.7.8_0 (active) | |||
py27-nose @1.1.2_2 (active) | |||
py27-numpy @1.6.2_0 (active) | |||
py27-py @1.1.1_0 (active) | |||
python24 @2.4.6_10 (active) | |||
python27 @2.7.3_0 (active) | |||
python_select @0.3_1 (active) | |||
qca @2.0.3_0 (active) | |||
qimageblitz @0.0.6_0 (active) | |||
qjson @0.7.1_1 (active) | |||
qrencode @3.1.1_1 (active) | |||
qt4-mac @4.8.2_0+quartz (active) | |||
raptor2 @2.0.7_0 (active) | |||
rarian @0.8.1_0 (active) | |||
rasqal @0.9.28_0 (active) | |||
readline @6.2.000_0 (active) | |||
redland @1.0.15_0+db46 (active) | |||
samba3 @3.6.6_0 (active) | |||
schroedinger @1.0.11_0 (active) | |||
shared-desktop-ontologies @0.9.0_0 (active) | |||
shared-mime-info @1.0_0 (active) | |||
soprano @2.7.4_0 (active) | |||
speex @1.2rc1_0 (active) | |||
sqlite3 @3.7.13_0 (active) | |||
strigi @0.7.5_2 (active) | |||
taglib @1.7.2_0 (active) | |||
tcl @8.5.11_0 (active) | |||
tcp_wrappers @20_2 (active) | |||
texinfo @4.13_2 (active) | |||
tiff @3.9.5_0 (active) | |||
tk @8.5.11_0 (active) | |||
twolame @0.3.13_1 (active) | |||
urw-fonts @1.0.7pre44_0 (active) | |||
virtuoso @6.1.5_0 (active) | |||
VLC-devel @2.0.99_0+ffmpeg+mod+mpc+osd+qtkit+quartz (active) | |||
webp @0.1.3_0 (active) | |||
x264 @20111210_0 (active) | |||
xattr @0.1_2 (active) | |||
Xft2 @2.3.0_0 (active) | |||
xmlcatmgr @2.2_1 (active) | |||
xorg-compositeproto @0.4.2_0 (active) | |||
xorg-damageproto @1.2.1_0 (active) | |||
xorg-fixesproto @5.0_0 (active) | |||
xorg-inputproto @2.2_0 (active) | |||
xorg-kbproto @1.0.6_0 (active) | |||
xorg-libice @1.0.8_0 (active) | |||
xorg-libpthread-stubs @0.3_0 (active) | |||
xorg-libsm @1.2.1_0 (active) | |||
xorg-libX11 @1.5.0_0 (active) | |||
xorg-libXau @1.0.7_0 (active) | |||
xorg-libxcb @1.8.1_2+python27 (active) | |||
xorg-libXcomposite @0.4.3_0 (active) | |||
xorg-libXcursor @1.1.13_0 (active) | |||
xorg-libXdamage @1.1.3_0 (active) | |||
xorg-libXdmcp @1.1.1_0 (active) | |||
xorg-libXext @1.3.1_0 (active) | |||
xorg-libXfixes @5.0_0 (active) | |||
xorg-libXi @1.6.1_0 (active) | |||
xorg-libXinerama @1.1.2_0 (active) | |||
xorg-libXrandr @1.3.2_0 (active) | |||
xorg-libXScrnSaver @1.2.2_0 (active) | |||
xorg-libXt @1.1.3_0 (active) | |||
xorg-randrproto @1.3.2_0 (active) | |||
xorg-renderproto @0.11.1_0 (active) | |||
xorg-scrnsaverproto @1.2.2_0 (active) | |||
xorg-xcb-proto @1.7.1_0+python27 (active) | |||
xorg-xcb-util @0.3.9_0 (active) | |||
xorg-xextproto @7.2.1_0 (active) | |||
xorg-xineramaproto @1.2.1_0 (active) | |||
xorg-xproto @7.0.23_0 (active) | |||
xrender @0.9.7_0 (active) | |||
XviD @1.3.2_2 (active) | |||
xz @5.0.4_0 (active) | |||
zip @3.00_0 (active) | |||
zlib @1.2.7_0 (active) | |||
If your checkout completes OK, then start compiling: | If your checkout completes OK, then start compiling: |
Latest revision as of 20:45, 5 January 2015
Introduction
The process described here is one of many ways to set up a KDE development environment on Mac OS X. It sets up a MacPorts installation to provide the required dependencies and uses this to then build a KDE kf5 development environment. This approach has the big advantage of using MacPorts to build, install and keep updated the base system and libraries required with minimal effort and without touching the base OSX system install.
It also gives you the choice of installing and running the latest stable KDE SC for everyday use while still developing on the unstable trunk.
The main disadvantage is compiling all the MacPort dependencies takes longer than binary installs, but the ease of maintenance is worth it.
OS X for Linux developers
One point to remember is that OS X is a customised version of BSD, so while it feels fairly familiar to a Linux developer, there are the occasional banana skins to slip you up.
The OS X filesystem, despite appearances, is by default not case sensitive, so KDE == kde == kDe.
It would appear all bash customisations need to go in ~/.profile rather than ~/.bashrc.
My pet hate is how useless Finder is for file management, particularly with hidden .files. You will be glad when you get Dolphin and Krusader installed :-)
Install XCode and X11.
Install Apple's XCode developer tools either from your OS X install disks or download from http://developer.apple.com/technologies/xcode.html or install from the OSX App Store.
If you are running Tiger you will also need to install Apple's X11 from your OS X Install disks. Snow Leopard and Leopard come with it installed by default.
Once installed, perform an OS X Software Update to ensure your system is fully up-to-date and reboot if required.
MacPorts.
"The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system."
MacPorts installs everything into /opt/local and so doesn't interfere with the base OS X install or any other local installs you have. This enables you to control the environment search hierarchy for different purposes.
Applications installed via MacPorts can be run from the command line or from the /Applications/MacPorts folder in the finder.
Install MacPorts.
It is recommended to initially install MacPorts using the package installer as this will automatically set-up your required $PATH.
Using MacPorts.
MacPorts should be very easy to use for anyone used to Linux-style package management.
Update MacPorts and the list of available ports, you should do this first whenever you work with the port command:
sudo port selfupdate
List all available packages, this will be very long:
port list
List all installed packages:
port installed
Search for a package:
port search <package>
Show information about a package:
port info <package>
Install a package, the -v is needed to see the build output:
sudo port -v install <package>
To enable a parallel build, which is encouraged, define the number `N` of processes
sudo port -v install <package> build.jobs=N
List the contents of an installed package
port contents <package>
List all installed packages with available updates:
port outdated
Upgrade a package and uninstall the old version (omit the -u to just disable the old version, useful when the new version may break things, note however that keeping the old version around may confuse the KDE build):
sudo port -u -v upgrade <package>
Switch to a different installed version of a package:
sudo port -v activate <package> <version>
Upgrade all outdated packages with new versions and uninstall the old versions:
sudo port -u -v upgrade outdated
Upgrade all installed packages and uninstall the old versions:
sudo port -u -v upgrade installed
Uninstall a package:
sudo port uninstall <package>
See the MacPorts documentation for more advanced options.
GUI frontends are available if you prefer.
Installing the base requirements for KDE Frameworks
NOTE: This section is WIP for now.
To install the requirements to build kde frameworks only a few items are needed (and their dependencies). These are:
- Qt (installer from qt.io will work, qt5-mac needs fixes: https://trac.macports.org/ticket/46129)
- cmake
- git
- p5.XX-libwww-perl and p5.XX-xml-parser XX should be the same or higher version than what's installed already by Apple to avoid issues. This is only required if you're going to build with kdesrc-build though, which is recommended.
Dependencies include:
- wget
- automake
- autoconf
- cppcheck
- lcov
- docbook-xml
- docbook-xsl
- giflib
- boost
- bzr
- shared-mime-info
- libgcrypt
Installing these with sudo port install should give you the dependencies you'll need to build the frameworks and applications, though some applications may have more dependencies of course.
On my machine I've used the following .kdesrc-buildrc file to build the frameworks and a handful of kdeedu applications:
global qtdir /Users/jeremywhiting/Qt/5.4/clang_64/ source-dir /Users/jeremywhiting/devel/kde/src build-dir /Users/jeremywhiting/devel/kde/build kdedir /usr/local git-repository-base kde-projects kde: cxxflags -pipe -DQT_STRICT_ITERATORS -DQURL_NO_CAST_FROM_STRING -DQT_NO_HTTP -DQT_NO_FTP -Wformat -Werror=format-security -Werror=return-type -Wno-variadic-macros cmake-options -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_DISABLE_FIND_PACKAGE_X11=ON make-options -j8 branch-group kf5-qt5 end global include devel/kde/src/extragear/utils/kdesrc-build/kf5-qt5-build-include
Installing the base requirements for KDE4
You can choose to find and install each requirement on your own, or if you have less time and plenty of disk space you can just install the stable KDE SC and let it pull all the dependencies in for you.
If you have plenty of time, just choose to install one of the major KDE packages and leave it running for 24-48 hours (if parallel build is not enabled; it can come down to 12 hours), kdesdk4 seems the obvious choice:
sudo port -v install kdesdk4 sudo port -v install dialog sudo perl -MCPAN -e 'install Bundle::LWP'
This will resolve all the dependencies and compile and install everything you need including development tools like subversion and cmake.
You may prefer to break it up into smaller chunks, although the Qt build will still take a long time.
sudo port -v install cmake sudo port -v install qt4-mac sudo port -v install kdelibs4 etc...
Feel free to install all the modules you later intend to build trunk for to ensure you have all your requirements.
At time of writing (10 Aug 2010) the following KDE SC 4.4.5 packages were available:
kdebase4 kdebase4-runtime kdeedu4 kdegames4 kdegraphics4 kdelibs4 kdemultimedia4 kdenetwork4 kdepim4 kdepimlibs4 kdesdk4 kdetoys4 kdeutils4 amarok digikam kipi-plugins kdesvn kdenlive kile konversation krusader ktorrent
Before running any KDE apps you need to perform a couple of steps once only (replace $USER with your our username):
sudo chown -R $USER ~/Library/Preferences/KDE sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
The 2nd and 3rd lines start DBUS and configure it to auto-run on every boot. Ignore what the KDE packages say, these are the correct commands needed now as described by the dbus package itself.
Once this is done you should be able to run the stable apps from /Applications/MacPorts/KDE4 or just search for them using Spotlight.
You may want to install the following extra packages to enable more features:
ffmpeg polkit-qt
Configure your KDE development environment
From this point on, the process is very similar to a standard KDE development build using dfaure's scripts. An alternative option might be the kdesrc-build script.
Configure bash scripts
Fire up a Terminal and perform the following steps.
Create a home bin directory and create a new script in it called findup:
cd ~ mkdir bin vim bin/findup
Copy the following into findup:
#!/bin/sh
arg="$1"
if test -z "$arg"; then exit 1; fi
while ! test -e "$arg"; do
cd ..
if test "$PWD" = "/"; then
exit 1
fi
done
echo $PWD/$arg
Make findup executable:
chmod 777 bin/findup
Modify your bash profile with some handy utilities:
vim ~/.profile
Copy the following into .profile:
export PATH=~/bin:$PATH
alias ls='ls -AFG'
###
## A script to setup some needed variables and functions for KDE 4 development.
prepend() { [ -d "$2" ] && eval $1=\"$2\$\{$1:+':'\$$1\}\" && export $1 ; }
# This will make the debug output prettier
export KDE_COLOR_DEBUG=1
export QTEST_COLORED=1
# Make
# Tell many scripts how to switch from source dir to build dir:
export OBJ_REPLACEMENT="s#$KDE_SRC#$KDE_BUILD#"
# Use makeobj instead of make, to automatically switch to the build dir.
# If you don't have makeobj, install the package named kdesdk-scripts or
# kdesdk, or check out kdesdk/scripts from svn, or just don't set the alias
# yet.
alias make=makeobj
##
# A function to easily build the current directory of KDE.
#
# This builds only the sources in the current ~/{src,build}/KDE subdirectory.
# Usage: cs KDE/kdebase && cmakekde
# will build/rebuild the sources in ~/src/KDE/kdebase
#
function cmakekde {
if test -n "$1"; then
# srcFolder is defined via command line argument
srcFolder="$1"
else
# get srcFolder for current dir
srcFolder=`pwd | sed -e s,$KDE_BUILD,$KDE_SRC,`
fi
# we are in the src folder, change to build directory
# Alternatively, we could just use makeobj in the commands below...
current=`pwd`
if [ "$srcFolder" = "$current" ]; then
cb
fi
# to enable tests, add -DKDE4_BUILD_TESTS=TRUE to the next line.
# you can also change "debugfull" to "debug" to save disk space.
# added "nice make..." to allow the user to work on the box while
# compiling
cmake "$srcFolder" -GKDevelop3 -DCMAKE_INSTALL_PREFIX=$KDEDIR \
-DKDE4_BUILD_TESTS=TRUE \
-DCMAKE_BUILD_TYPE=debugfull
# uncomment the following two lines to make builds wait after
# configuration step, so that the user can check configure output
echo "Press <ENTER> to continue..."
read userinput
# Note: To speed up compiling, change 'make -j2' to 'make -jx',
# where x is your number of processors +1
nice make -j3 && make install
RETURN=$?
cs
return ${RETURN}
}
##
# for the lazy ones, add/comment other directories
function cmakekdeall {
cs trunk/kdesupport && svn up && cmakekde
cs trunk/KDE/kdelibs && svn up && cmakekde
cs trunk/KDE/kdepimlibs && svn up && cmakekde
cs trunk/KDE/kdebase && svn up && cmakekde
cs trunk/KDE/kdepim && svn up && cmakekde
cs trunk/KDE/kdegraphics && svn up && cmakekde
cs trunk/KDE/kdemultimedia && svn up && cmakekde
cs trunk/KDE/kdenetwork && svn up && cmakekde
cs trunk/KDE/kdeutils && svn up && cmakekde
}
function cd() {
if test -z "$1"; then
builtin cd
elif test -z "$2"; then
builtin cd "$1"
else
builtin cd "$1" "$2"
fi
_f=`findup .my-setup`
if test -n "$_f" -a "$_lastf" != "$_f"; then
echo "Loading $_f"
_lastf="$_f"
source "$_f"
fi
}
##
# A function to easily change to the build directory.
# Usage: cb KDE/kdebase
# will change to $KDE_BUILD/KDE/kdebase
# Usage: cb
# will simply go to the build folder if you are currently in a src folder
# Example:
# $ pwd
# /home/user/src/KDE/kdebase
# $ cb && pwd
# /home/user/build/KDE/kdebase
#
function cb {
local dest
# Make sure build directory exists.
mkdir -p "$KDE_BUILD"
# command line argument
if test -n "$1"; then
cd "$KDE_BUILD/$1"
return
fi
# substitute src dir with build dir
dest=`pwd | sed -e s,$KDE_SRC,$KDE_BUILD,`
if test ! -d "$dest"; then
# build directory does not exist, create
mkdir -p "$dest"
fi
cd "$dest"
}
##
# Change to the source directory. Same as cb, except this
# switches to $KDE_SRC instead of $KDE_BUILD.
# Usage: cs KDE/kdebase
# will change to $KDE_SRC/KDE/kdebase
# Usage: cs
# will simply go to the source folder if you are currently in a build folder
# Example:
# $ pwd
# /home/user/build/KDE/kdebase
# $ cs && pwd
# /home/user/src/KDE/kdebase
#
function cs {
local dest current
# Make sure source directory exists.
mkdir -p "$KDE_SRC"
# command line argument
if test -n "$1"; then
cd "$KDE_SRC/$1"
else
# substitute build dir with src dir
dest=`pwd | sed -e s,$KDE_BUILD,$KDE_SRC,`
current=`pwd`
if [ "$dest" = "$current" ]; then
cd "$KDE_SRC"
else
cd "$dest"
fi
fi
}
##
# Add autocompletion to cs function
#
function _cs_scandir
{
local base ext
base=$1
ext=$2
if [ -d $base ]; then
for d in `ls $base`; do
if [ -d $base/$d ]; then
dirs="$dirs $ext$d/"
fi
done
fi
}
function _cs()
{
local cur dirs
_cs_scandir "$KDE_SRC"
_cs_scandir "$KDE_SRC/KDE" "KDE/"
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${dirs}" -- ${cur}) )
}
# Remove comment on next line to enable cs autocompletion
complete -F _cs cs
svndiff()
{
svn diff "$*" | colordiff | less;
}
Close your Terminal and open a new Terminal to have the .profile changes take effect, you should hopefully not see any error messages.
Configure svn+ssh
If using svn+ssh for subversion access, copy your key into ~/.ssh and set its permissions to 400.
Create KDE directories
Choose you KDE development base directory where the KDE source, build and installation will be kept. In this example the base directory is ~/kde but it could be anywhere with sufficient space and permissions. Create the following set of directories:
cd ~ mkdir kde mkdir kde/build mkdir kde/home mkdir kde/inst mkdir kde/src mkdir kde/src/branches mkdir kde/src/trunk
Configure your KDE environment
Now install the script that will set up the KDE environment for trunk development:
vim ~/kde/src/trunk/.my-setup
Copy the following into .my-setup and set BASEDIR as required:
#Set up base directory to your chosen location
export BASEDIR=/Users/your-user/kde
#Set up Qt environment
#Use Qt from MacPorts, change QTDIR if using own version of Qt
export QTDIR=/opt/local/libexec/qt4-mac
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$QTDIR/lib:$PKG_CONFIG_PATH
#Set up KDE environment
export KDE_BUILD=$BASEDIR/build
export KDEHOME=$BASEDIR/home/.kde4trunk
export KDEDIR=$BASEDIR/inst/kde4trunk
export KDE_SRC=$BASEDIR/src
export KDETMP=/tmp/kde4trunk-$USER
export KDEVARTMP=/var/tmp/kde4trunk-$USER
mkdir -p $KDETMP
mkdir -p $KDEVARTMP
export PATH=$KDEDIR/bin:$PATH
export LD_LIBRARY_PATH=$KDEDIR/lib:$LD_LIBRARY_PATH
prepend PKG_CONFIG_PATH $KDEDIR/lib/pkgconfig
export QT_PLUGIN_PATH=$KDEDIR/lib/kde4/plugins
export KDEDIRS=$KDEDIR
export PYTHON_SITE_PACKAGES_DIR=$KDEDIR/lib/python2.6/site-packages/PyKDE4
export PATH
export LD_LIBRARY_PATH
export PKG_CONFIG_PATH
export QT_PLUGIN_PATH
# CMake
# Make sure CMake searches the right places.
# Add the MacPorts paths so they take priority over any system versions
prepend CMAKE_PREFIX_PATH /opt/local
prepend CMAKE_LIBRARY_PATH /opt/local/lib
prepend CMAKE_INCLUDE_PATH /opt/local/include
# Add the KDE paths so they always take priority
prepend CMAKE_PREFIX_PATH $KDEDIR
prepend CMAKE_LIBRARY_PATH $KDEDIR/lib
prepend CMAKE_INCLUDE_PATH $KDEDIR/include
export CMAKE_PREFIX_PATH
export CMAKE_LIBRARY_PATH
export CMAKE_INCLUDE_PATH
# DBus
# only set DBUS related variables if you compiled dbus on your own
# (which is really discouraged). if you use the distro provided dbus,
# skip this variable. Uncomment it if necessary.
#export DBUSDIR=$KDEDIR
#prepend PKG_CONFIG_PATH $DBUSDIR/lib/pkgconfig
# only needed on some strange systems for compiling Qt. do not set
# it unless you have to.
#export YACC='byacc -d'
# XDG
#unset XDG_DATA_DIRS # to avoid seeing kde3 files from /usr
#unset XDG_CONFIG_DIRS
Finally, change into the trunk directory to activate the environment:
cd ~/kde/src/trunk
You should see the message:
Loading /Users/odysseus/kde/src/trunk/.my-setup
Try typing env to see settings similar to:
BASEDIR=/Users/odysseus/kde
QTDIR=/opt/local/libexec/qt4-mac
QT_PLUGIN_PATH=/Users/odysseus/kde/inst/kde4trunk/lib/kde4/plugins
KDE_BUILD=/Users/odysseus/kde/build
KDE_SRC=/Users/odysseus/kde/src
KDEDIR=/Users/odysseus/kde/inst/kde4trunk
KDEDIRS=/Users/odysseus/kde/inst/kde4trunk
KDEHOME=/Users/odysseus/kde/home/.kde4trunk
KDETMP=/tmp/kde4trunk-odysseus
KDEVARTMP=/var/tmp/kde4trunk-odysseus
LD_LIBRARY_PATH=/Users/odysseus/kde/inst/kde4trunk/lib:/opt/local/libexec/qt4-mac/lib
PATH=/Users/odysseus/kde/inst/kde4trunk/bin:/opt/local/libexec/qt4-mac/bin:/opt/local/bin:/opt/local/sbin:/Users/odysseus/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
PKG_CONFIG_PATH=/opt/local/libexec/qt4-mac/lib
PYTHON_SITE_PACKAGES_DIR=/Users/odysseus/kde/inst/kde4trunk/lib/python2.6/site-packages/PyKDE4
Checkout and Build KDE
Next cd into the source directory and checkout kdesupport:
cd ~/kde/src/trunk svn co svn+ssh://[email protected]/home/kde/trunk/kdesupport
Edit 07/2012
I haven't luck with this method on lion I have had best luck by downloading the KDEsrc from their homepage kdesrc-build 1.15.1 http://kdesrc-build.kde.org/releases/kdesrc-build-1.15.1.php once downloaded i placed the kdesrc-build folder in ~/src when running the . ~/src/kdesrc-build-setup use the default variables you can then run ./kdesrc-build these are the ports packages that i have installed thus far.. if you get a error about libtoolize you need to use the glibtoolize in the /opt/local/bin/ folder
you would achieve this with these commands
sudo mv /usr/local/bin/libtoolize /usr/local/bin/xlibtoolize sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/libtoolize
once that piece compiles you will need to use the native libtoolize so
sudo rm -r /usr/local/bin/libtoolize sudo mv /usr/local/bin/xlibtoolize /usr/local/bin/libtoolize
and continue compiling.. these are my installed ports packages:
a52dec @0.7.4_0 (active) akonadi @1.7.2_0 (active) antlr @2.7.7_1 (active) aspell @0.60.6_4+nonls (active) aspell-dict-en @7.1_0 (active) atk @2.2.0_1 (active) attica @0.4.0_0 (active) autoconf @2.69_0 (active) automake @1.12.1_0 (active) automoc @0.9.88_3 (active) avahi @0.6.31_2+gtk+python27 (active) BGHUDAppKit @0.7_1 (active) bison @2.5.1_0 (active) boost @1.49.0_0 (active) bzip2 @1.0.6_0 (active) cairo @1.12.2_0+x11 (active) clucene @0.9.21b_0 (active) cmake @2.8.8_1 (active) coreutils @8.17_0 (active) cppunit @1.12.1_0 (active) curl @7.26.0_0+ssl (active) curl-ca-bundle @7.26.0_1 (active) cyrus-sasl2 @2.1.25_1+kerberos (active) db46 @4.6.21_6 (active) dbus @1.4.20_1+startupitem (active) dbus-glib @0.100_0 (active) dbus-python27 @0.84.0_0 (active) dbusmenu-qt @0.9.0_0 (active) dialog @1.1-20120215_0 (active) dirac @1.0.2_1 (active) docbook-xml @5.0_0 (active) docbook-xml-4.1.2 @4.1.2_1 (active) docbook-xml-4.2 @4.2_0 (active) docbook-xml-4.3 @4.3_0 (active) docbook-xml-4.4 @4.4_0 (active) docbook-xml-4.5 @4.5_0 (active) docbook-xml-5.0 @5.0_0 (active) docbook-xsl @1.76.1_1 (active) docbook-xsl-ns @1.76.1_0 (active) eggdbus @0.6_1 (active) enchant @1.6.0_1 (active) exiv2 @0.22_0 (active) expat @2.1.0_0 (active) faad2 @2.7_0 (active) ffmpeg @0.7.11_1+mmx (active) fftw-3 @3.3.2_0 (active) flac @1.2.1_1 (active) flex @2.5.35_1 (active) fontconfig @2.9.0_1 (active) freetype @2.4.10_0 (active) gawk @4.0.0_0 (active) gdbm @1.10_1 (active) gdk-pixbuf2 @2.26.1_1 (active) getopt @1.1.4_1 (active) gettext @0.18.1.1_2 (active) ghostscript @9.05_2 (active) giflib @4.2.0_2+x11 (active) glib2 @2.32.3_1 (active) gmake @3.82_0 (active) gmp @5.0.4_1 (active) gnome-common @2.28.0_0 (active) gnome-doc-utils @0.20.6_0+python27 (active) gnupg @1.4.12_0 (active) gnutls @2.12.19_0 (active) gpgme @1.3.1_0 (active) grantlee @0.2.0_0 (active) gtk-doc @1.18_0+python27 (active) gtk2 @2.24.10_2+x11 (active) help2man @1.40.10_0 (active) hicolor-icon-theme @0.12_0 (active) hunspell @1.3.2_0 (active) icu @4.8.1_0 (active) ilmbase @1.0.2_0 (active) ImageMagick @6.7.8-0_0+q16 (active) intltool @0.50.2_0 (active) iso-codes @3.35_0 (active) jasper @1.900.1_9 (active) jbig2dec @0.11_1 (active) jbigkit @2.0_2 (active) jpeg @8d_0 (active) kate @4.8.3_0 (active) kde4-baseapps @4.8.3_0 (active) kde4-runtime @4.8.3_1 (active) kdelibs4 @4.8.3_2 (active) kdepimlibs4 @4.8.3_0 (active) kdesdk4 @4.8.3_0 (active) kerberos5 @1.7.2_0 (active) konsole @4.8.3_0 (active) lame @3.99_1 (active) lcms @1.19_2 (active) lcms2 @2.3_0 (active) libart_lgpl @2.3.21_0 (active) libassuan @2.0.2_0 (active) libcddb @1.3.2_1 (active) libcdio @0.83_0 (active) libdaemon @0.14_0 (active) libdca @0.0.5_0 (active) libdmtx @0.7.2_1 (active) libdvdcss @1.2.11_0 (active) libdvdnav @4.1.3_0 (active) libdvdread @4.2.0_0 (active) libedit @20120601-3.0_0 (active) libffi @3.0.11_0 (active) libgcrypt @1.5.0_0 (active) libglade2 @2.6.4_5 (active) libgpg-error @1.10_0 (active) libical @0.43_1 (active) libiconv @1.14_0 (active) libid3tag @0.15.1b_2 (active) libidn @1.25_0 (active) libiodbc @3.52.8_1 (active) libmad @0.15.1b_3 (active) libmatroska @1.3.0_0 (active) libmng @1.0.10_2 (active) libmodplug @0.8.8.4_0 (active) libmpcdec @1.2.6_0 (active) libogg @1.3.0_1 (active) libpaper @1.1.24_0 (active) libpixman @0.26.2_0 (active) libpng @1.4.11_0 (active) libsdl @1.2.15_0+x11 (active) libsigsegv @2.9_0 (active) libsndfile @1.0.25_0 (active) libssh @0.5.2_0 (active) libtasn1 @2.11_0 (active) libtheora @1.1.1_1 (active) libtool @2.4.2_2 (active) libusb @1.0.9_0 (active) libusb-compat @0.1.4_0 (active) libvorbis @1.3.3_0 (active) libvpx @1.1.0_0 (active) libxml2 @2.7.8_0 (active) libxslt @1.1.26_0 (active) lua @5.1.4_4 (active) lzo2 @2.05_1 (active) m4 @1.4.16_0 (active) mhash @0.9.9.9_0 (active) mpfr @3.1.0-p3_1 (active) mysql5 @5.1.63_0 (active) mysql5-server @5.1.63_0 (active) mysql55 @5.5.25_0 (active) mysql55-server @5.5.25_0 (active) mysql_select @0.1.2_0 (active) ncurses @5.9_1 (active) nosetests_select @0.1_0 (active) openexr @1.7.0_0 (active) openjpeg @1.5.0_2 (active) openldap @2.4.21_5 (active) openslp @1.2.1_2 (active) openssl @1.0.1c_0 (active) orc @0.4.16_0 (active) ossp-uuid @1.6.2_0 (active) oxygen-icons @4.8.3_0 (active) p5-xml-parser @2.400.0_4 (active) p5.12-getopt-long @2.380.0_3 (active) p5.12-locale-gettext @1.50.0_7 (active) p5.12-pathtools @3.330.0_3 (active) p5.12-scalar-list-utils @1.230.0_3 (active) p5.12-xml-parser @2.400.0_4 (active) pango @1.30.1_0+x11 (active) pcre @8.30_1 (active) perl5 @5.12.4_0+perl5_12 (active) perl5.12 @5.12.4_1 (active) phonon @4.6.0_0 (active) pkgconfig @0.26_1 (active) policykit @0.103_1 (active) polkit-qt @0.103.0_0 (active) popt @1.16_0 (active) postgresql92 @9.2beta2_0 (active) postgresql_select @0.1_0 (active) prison @1.0_0 (active) pth @2.0.7_0 (active) py-xattr @0.6.1_0 py24-distribute @0.6.27_0 (active) py27-cairo @1.8.10_1 (active) py27-distribute @0.6.27_0 (active) py27-gdbm @2.7.3_0 (active) py27-gobject @2.26.0_3 (active) py27-gtk @2.22.0_1+x11 (active) py27-libxml2 @2.7.8_0 (active) py27-nose @1.1.2_2 (active) py27-numpy @1.6.2_0 (active) py27-py @1.1.1_0 (active) python24 @2.4.6_10 (active) python27 @2.7.3_0 (active) python_select @0.3_1 (active) qca @2.0.3_0 (active) qimageblitz @0.0.6_0 (active) qjson @0.7.1_1 (active) qrencode @3.1.1_1 (active) qt4-mac @4.8.2_0+quartz (active) raptor2 @2.0.7_0 (active) rarian @0.8.1_0 (active) rasqal @0.9.28_0 (active) readline @6.2.000_0 (active) redland @1.0.15_0+db46 (active) samba3 @3.6.6_0 (active) schroedinger @1.0.11_0 (active) shared-desktop-ontologies @0.9.0_0 (active) shared-mime-info @1.0_0 (active) soprano @2.7.4_0 (active) speex @1.2rc1_0 (active) sqlite3 @3.7.13_0 (active) strigi @0.7.5_2 (active) taglib @1.7.2_0 (active) tcl @8.5.11_0 (active) tcp_wrappers @20_2 (active) texinfo @4.13_2 (active) tiff @3.9.5_0 (active) tk @8.5.11_0 (active) twolame @0.3.13_1 (active) urw-fonts @1.0.7pre44_0 (active) virtuoso @6.1.5_0 (active) VLC-devel @2.0.99_0+ffmpeg+mod+mpc+osd+qtkit+quartz (active) webp @0.1.3_0 (active) x264 @20111210_0 (active) xattr @0.1_2 (active) Xft2 @2.3.0_0 (active) xmlcatmgr @2.2_1 (active) xorg-compositeproto @0.4.2_0 (active) xorg-damageproto @1.2.1_0 (active) xorg-fixesproto @5.0_0 (active) xorg-inputproto @2.2_0 (active) xorg-kbproto @1.0.6_0 (active) xorg-libice @1.0.8_0 (active) xorg-libpthread-stubs @0.3_0 (active) xorg-libsm @1.2.1_0 (active) xorg-libX11 @1.5.0_0 (active) xorg-libXau @1.0.7_0 (active) xorg-libxcb @1.8.1_2+python27 (active) xorg-libXcomposite @0.4.3_0 (active) xorg-libXcursor @1.1.13_0 (active) xorg-libXdamage @1.1.3_0 (active) xorg-libXdmcp @1.1.1_0 (active) xorg-libXext @1.3.1_0 (active) xorg-libXfixes @5.0_0 (active) xorg-libXi @1.6.1_0 (active) xorg-libXinerama @1.1.2_0 (active) xorg-libXrandr @1.3.2_0 (active) xorg-libXScrnSaver @1.2.2_0 (active) xorg-libXt @1.1.3_0 (active) xorg-randrproto @1.3.2_0 (active) xorg-renderproto @0.11.1_0 (active) xorg-scrnsaverproto @1.2.2_0 (active) xorg-xcb-proto @1.7.1_0+python27 (active) xorg-xcb-util @0.3.9_0 (active) xorg-xextproto @7.2.1_0 (active) xorg-xineramaproto @1.2.1_0 (active) xorg-xproto @7.0.23_0 (active) xrender @0.9.7_0 (active) XviD @1.3.2_2 (active) xz @5.0.4_0 (active) zip @3.00_0 (active) zlib @1.2.7_0 (active)
If your checkout completes OK, then start compiling:
cd kdesupport cmakekde
This will pause after running the configure step for you to confirm everything is OK. Press enter if you are happy to continue, or ctrl-c to cancel. Later, you can remove this pause/enter by editing the cmakekde command in your .profile.