Kdesrc-build ilti napravi svoj KDE

Teme vezane za KDE grafičko okruženje.

Moderator/ica: Moderatori/ce

Odgovori
Avatar
sumski
Moderator
Postovi: 1779
Pridružen/a: 10 ruj 2010, 11:20
Spol: M
OS: openSUSE Factory KDE

Kdesrc-build ilti napravi svoj KDE

Post Postao/la sumski »

Kdesrc-build je perl skripta sa kojom buildate KDE direktno iz gita/svn-a. Sama skripta čita naredbe iz CLI-a i/li jedne konfiguracijske datoteke ~/.kdesrc-buildrc.

Prednosti spram korištenja paketa vaše distribucije odnosno samostalnog kompajliranja svakog pojedinog modula:
* Moguće je podesiti opcije i pakete po vašoj želji, umjesto onih koje imate isporučene od strane distribucije (primjer CXX/CMake flagovi, buildanje KDE-a bez nepomuka sopak , itd.)

* automatski update source-a (moguće je i preskakanje tog koraka)

* pruža mogućnost instalacije KDE-a uz stabilnu, već instaliranu verziju (potrebno posesiti .xsession i/li .bash_profile). Korisnikove postavke 'stabilnog' KDE-a se ne mijenjaju.


Sama skritpa odrađuje 2 faze za svaki specificirani modul:
a) update
b) build/install

Evo moje ~/.kdesrc-buildrc datoteke pa najbolje da se demostrira na mom primjeru (rascjepkana je radi lakšeg objašnjenja):

Kod: Označi sve

# Global settings go in this section.  They apply to every module unless
# overridden later.
global

# This is the directory that your KDE sources are downloaded to.  This
# directory also holds the build and log directories by default.
	source-dir ~/kdesrc

# This is the directory that KDE will end up installed at.  The default is
# appropriate for a single-user installation of KDE, which requires no root
# permissions.  If you'd like, you can install and use the sudo program to
# install KDE anywhere on your system, in conjunction with the
# make-install-prefix option.
	kdedir ~/kdelocal
#
# This is the Qt installation to use for building/using KDE. The default is
# to build Qt (see the qt module below). If you wish to use your system's
# installed Qt (assuming it is recent enough!) then you can set this to the
# path to your Qt installation. To find the path to your system's Qt, run
# "qmake -v". Qt will be installed to the path reported (do not include /lib)
#	qtdir ~/qt4  # Default to installing Qt

# By default (if the above is commented out), you are getting svn trunk / git master.
# If instead you want to check out another branch, like 4.7, use
#	branch KDE/4.7
#
# With KDE/4.7, use "branch 2.6" for soprano, or distribution-provided soprano.
#
# but also see the qt and kdesupport modules below, which have special
# requirements

# This is the Subversion server to download the rest of the KDE sources from.
# Developers: Don't forget to add your username to the URL if necessary!
#	svn-server svn://anonsvn.kde.org/home/kde

# cmake-options controls the compilation options for building KDE 4 modules.
# These options apply to all KDE modules unless otherwise specified.
#
# Also see http://techbase.kde.org/Development/Tutorials/CMake#Command_Line_Variables
#	cmake-options -DKDE4_BUILD_TESTS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release
	cmake-options -DCMAKE_BUILD_TYPE=Release

# These are the default options passed to the make command.  The default tries
# to build with 2 parallel compiles.  If you are using distcc or have SMP, you
# should experiment with setting this value higher for best performance.
	make-options -j3
	set-env LDFLAGS -Wl,-Bsymbolic-functions
	set-env CXXFLAGS -pipe -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -march=native
	set-env CFLAGS -pipe -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -march=native

# KDE has one of the most extensive translation packages in the world.  They
# are stored in the l10n module.  kdesrc-build can automatically try to build
# and install languages for you, using this parameter.  It should be a list
# of languages to build and install.  This option requires the language code
# as present in l10n.  You can look these codes up at
# http://i18n.kde.org/teams/
#	kde-languages de        # German
#	kde-languages fr        # French
#	kde-languages en_GB cs  # British English and Czech

# If you would like install KDE to the system (DO NOT INSTALL *over* a prior
# installation!), then you'll probably need to use sudo to install everything.
#
# The -S parameter causes sudo to read from standard input (which is redirected
# by kdesrc-build).  This means that if sudo has to ask for your password, it
# will fail, you need to configure sudo to be able to run "make install"
# without requesting a password.
#
# In addition, you can run kdesrc-build --no-install, and then
# sudo kdesrc-build --install if you are unable to configure sudo to allow
# make install with no password.
#	 make-install-prefix sudo -S

# purge-old-logs controls whether old log files should be removed after the
# latest build finishes. Set to false to disable it.
#	 purge-old-logs false
end global
Ovo su sve globalne postavke koje važe sa sve module.
source-dir definira direktorij u koji se sprema i builda source
kdedir definira prefix u koji instaliramo KDE
qtdir isto samo za qt4
cmake-options definira CMake opcije za module. U gornjem primjeru '-DCMAKE_BUILD_TYPE=Release' znači da se radi instalacija bez debug simbola (ako ne planirate prijavljivati crasheve ostavite ovako). Ja sam donjim exportom CXX flagova ustvari napravil release mode + dbg
make-options definira broj jobova (u praksi bude broj CPU-a +1)
set-env definirate enviroment parametre po želji (naravno može i bez toga)

Kod: Označi sve

# qt is the default name of the module used to build Nokia's Qt toolkit, which is
# required for KDE. It is sometimes required to use the latest Qt available
# to build KDE. 2 versions are supported by kdesrc-build:
# 1. Nokia's Qt with no modifications.
# 2. A KDE copy with no modifications (but on a better git server).
#
# The Qt buildsystem is different from that used by KDE modules, and so
# settings from the global section will not apply to Qt.
#module qt
# Configure flags. See README.kde-qt for the official recommended ones, which
# may become inconsistent with these sample flags.
# Do not specify -prefix, kdesrc-build will handle that.
#
# Phonon note:
# - If you compile phonon separately, make sure to pass -no-phonon.
# - Alternatively, if you use Qt's phonon, remove "phonon" from the use-modules
#   option in the module-set below.
# - As of KDE 4.6/Qt 4.7 the "right answer" is the first option: separate phonon.
#	configure-flags -fast -debug \
#	                -system-zlib -system-libpng -system-libjpeg \
#	                -dbus -webkit -plugin-sql-mysql \
#	                -nomake examples -nomake demos \
#	                -no-phonon # See module-set below

#	make-options -j2

# The kde: prefix here will be expanded by kdesrc-build to the correct URL
#	repository kde:qt

# If you use the branch option up in the "global" section to set a
# default KDE version, you should manually choose a branch here for Qt.
# You can see the available branches by looking first on gitorious.org,
# or by using "git branch -r" from the qt source directory.
#
# Note that Nokia's own Qt repository does not recommend using the master
# branch anymore. The Qt repository may be splitting in the future as well.
#	branch 4.8
#end module
Ja ovo imam zakomentirano jer imam dovoljnu verziju Qt-a, pa ga ne treba buildat (dovoljna bi bila bila koja >= 4.8 verzija)

Kod: Označi sve

module shared-desktop-ontologies
    repository git://oscaf.git.sourceforge.net/gitroot/oscaf/shared-desktop-ontologies
    branch master
end module

module-set
    # Special handling occurs with this option when used in module-set so you
    # don't have to re-type repository names.
    repository kde-projects

    # automoc is essential for building KDE's CMake-based modules, and so should be first
    # in this module set (but after Qt, if you're building that too)
    use-modules automoc cagibi attica soprano polkit-qt-1

    # Other options are simply passed to each defined module. For example if
    # you uncomment the next line, then the "Debug" build type will be used for
    # every module in this set, which makes modules optimized but still
    # debuggable.
    # cmake-options -DCMAKE_BUILD_TYPE=Debug
end module-set

module soprano
#    branch 2.8
    cmake-options -DSOPRANO_DISABLE_CLUCENE_INDEX=1 -DBUILD_VIRTUOSO_BACKEND=ON -DCMAKE_SKIP_RPATH=OFF
end module

# Phonon is the KDE multimedia layer, which is occasionally synced to Qt.
# It is required for the KDE libraries, and a specific backend for your system
# is also required. For Linux users, this means either phonon-gstreamer or
# phonon-vlc
module-set phonon
    repository kde-projects

    # We avoid using just "phonon" as kdesrc-build will include all submodules
    # that have phonon as part of their path. (i.e. it means phonon/*), but we
    # don't want all the phonon backends.
    use-modules phonon/phonon phonon-gstreamer # or you can try phonon-vlc
end module-set

# This set includes the modules required for the "strigi" file analyzer, used
# to extract information contained in various file types for Dolphin previews,
# Nepomuk tagging, etc.
module-set strigi
    repository kde-projects

    # Not all modules in strigi are built, and there is a certain order required.
    # See kde-build-metadata.git/{dependency-data,build-script-ignore}, which
    # are used automatically by kdesrc-build.
    use-modules kdesupport/strigi
end module-set

# kdesupport contains QCA, oxygen icons, and a few other small things.
module kdesupport
end module

# Support for notification area menus via the DBusMenu protocol
# This is needed by kdelibs.
#
# This is commented out as this is the only module that requires the 'bzr'
# source control software, and a recent libdbusmenu-qt development package from
# your distribution should meet the kdelibs dependency. If you wish to install
# this module, ensure you have the 'bzr' tool available and then uncomment this
# module.
#module libdbusmenu-qt
    # The lp: prefix refers to Canonical's Launchpad repository
#    repository bzr://lp:libdbusmenu-qt
#end module

# TagLib used to be in kdesupport and is used by JuK and Amarok for parsing
# audio metadata. It is required for JuK, amarok (though typically the
# system-provided taglib will suffice).
module taglib
    repository git://github.com/taglib/taglib.git

    # Note: -DWITH_ASF=TRUE and -DWITH_MP4=TRUE (for taglib) is required to
    # allow Amarok (defined below, near the end of this file) to build.
    cmake-options -DWITH_ASF=TRUE -DWITH_MP4=TRUE
end module
Ovo gore su definirani libovi nužni za daljnju kompilaciju. Možete i njih slobodno zakomentirati i koristiti devel pakete iz
vaše distribucije. Ipak preporučam koristit barem phonon(-gstreamer), soprano i shared-desktop-ontologies it git-a.

Kod: Označi sve

# kdelibs are the base KDE libraries needed by all KDE applications.
# kactivities is required for kde-runtime (supports Plasma Activity management)
# kde-runtime contains applications that are required for the operation of
# some base KDE libraries.
# nepomuk-core contains some split-out Nepomuk libraries.
module-set
    repository kde-projects
    use-modules kdelibs kactivities kde-runtime nepomuk-core

# KDE 4 uses CMake, if you need to pass options to the cmake command, use this
# option:
	cmake-options -DKDE4_ENABLE_FPIE=1
end module-set

# kdelibs was actually defined earlier, in the module set above. This module is
# only used to set the "branch" option.
module kdelibs
    branch KDE/4.10
    cmake-options -DKDE_DEFAULT_HOME=.kdelocal -DKDE4_ENABLE_FINAL=1
end module

#module nepomuk-core
#    branch feature/newIndexer
#end module
Najosnovniji KDE libovi. Za module kdelibs preporučam staviti branch KDE/4.10, i odma u cmake opcijama
definirati defaultni home direktorij. ENABLE_Final po želji

Kod: Označi sve

# The next module-set completes a base workspace. kdepimlibs should be compiled
# before the workspace and Plasma addons are compiled, and kdepimlibs itself
# requires akonadi.
# From there kde-workspace contains programs like Plasma Desktop and the KWin
# window manager, kde-baseapps contains core applications,
# and I also add konsole and kate since they are also very useful in general.
module-set
    repository kde-projects

    use-modules akonadi kdepimlibs nepomuk-widgets kde-workspace \
                kde-baseapps kate konsole
    cmake-options -DKDE4_ENABLE_FPIE=1
end module-set

# On OpenSUSE, for unlocking to work, you need to do this:
module kde-workspace
  cmake-options -DKDE4_COMMON_PAM_SERVICE=xdm -DKDE4_KCHECKPASS_PAM_SERVICE=xdm -DKDE4_KSCREENSAVER_PAM_SERVICE=kscreensaver -DKWORKSPACE_USE_SYSTEMD:BOOL=ON -DPOWERDEVIL_USE_SYSTEMD:BOOL=ON
end module

# KDE/kde-wallpapers contains all wallpapers for your desktop
module kde-wallpapers
end module

# KDE/kde-base-artwork contains the default splash screen
module kde-base-artwork
end module
Moduli za osnovni desktop - znači kde-workspace, dolphin, kate, konsole, itd
Bez toga nema puno smisla uopće kretat ovo sve radit :D
SUSE korisnici trebaju prve dvije opcije za CMake, ostatak ja dodal.

Dolje navedeni su poželjni, ali ne nužni.

Kod: Označi sve

# kdemultimedia contains JuK, Dragon Player and other KDE multimedia
# applications.  It does not include amarok, which is in git.kde.org
module-set kdemultimedia
    repository kde-projects
    use-modules kde/kdemultimedia
end module-set

#module kdemultimedia/kmix
#    branch KDE/4.9
#end module

# ... Well, they're games. ;)
#module-set kdegames
#    repository kde-projects
#    use-modules kde/kdegames
#end module-set

# kdesdk is a useful module for software developers. Programmers *need* this
# module for kcachegrind, but in addition there are several useful
# documentation kioslave formatters for use in konqueror.
#module kdesdk
#end module

# kdenetwork has Kopete and other useful applications for the Internet and
# other networks.
#module kdenetwork
#end module

# kdepim contains KMail, Kontact, KOrganizer, and other insanely useful
# programs that help you keep track of things. It consists of two core
# components, kdepim-runtime, and kdepim itself, which both depend on
# kdepimlibs.
module-set
    repository kde-projects

    use-modules kdepim-runtime kdepim
end module-set

module kdepim
    cmake-options -DKDEPIM_BUILD_MOBILE=OFF
end module

# kdeadmin has system administration tools for your computer.
#module kdeadmin
#end module

# kdeaccessibility accessibility tools
#module-set accessibility
#   repository kde-projects
#   use-modules kde/kdeaccessibility
#end module-set

# kdeartwork has themes and screensaver
module kdeartwork
end module

# kdeutils has miscellaneous programs which can be useful.  You probably won't
# die if you remove this from the config file though.
#module-set kdeutils
#    repository kde-projects
#
#    use-modules kdeutils
#end module-set

# kdegraphics contains various programs useful for graphics editing.  It
# doesn't include Krita, which is part of Calligra, but it is worth it just for
# KolourPaint and Gwenview.
#
# Note that this just references the KDE Projects database, so this will expand
# into many more modules.
module-set kdegraphics
    repository kde-projects

    # Until kdesrc-build supports dependency handling, you should specify
    # submodules that should be built in order specifically, and then the
    # parent module, which will build any remaining submodules.
    # kde/kdegraphics/* is a special syntax to include all children of
    # kde/kdegraphics, but not kde/kdegraphics itself (only one or the other
    # should be built)
    use-modules kde/kdegraphics/libs kde/kdegraphics/*
end module-set

# Contains nifty diversions of time, which generally aren't games.
#module kdetoys
	# Let's explain a new kdesrc-build feature here, as an example:
	# Say you don't want "./kdesrc-build" to always update and build kdetoys,
	# but you want to specify options here (branch, cmake-options etc.) so that
	# you can invoke "./kdesrc-build kdetoys" explicitly, now and then.
	# The option manual-update does exactly this.
#	manual-update true
#end module

# Educational programs.  Some are actually quite fun even if you're not trying
# to learn anything.
#module-set kdeedu
#    repository kde-projects

    # Until kdesrc-build supports dependency handling, you should specify
    # submodules that should be built in order specifically, and then the
    # parent module, which will build any remaining submodules.
#    use-modules kde/kdeedu/libkdeedu kde/kdeedu
#end module-set

# Extra collection of useful plasma applets, runners, data engines, etc.
module-set
    repository kde-projects

    use-modules kdeplasma-addons
end module-set

# The KDE Office Suite.  Includes a pretty expansive collection of programs.
# It is rather large, so you can cut download and build times by removing it
# from this file.
#module koffice
#end module

module kdesdk
    repository svn://anonsvn.kde.org/home/kde/trunk/KDE/kdesdk
end module

module clementine
    repository https://code.google.com/p/clementine-player/
    cmake-options -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE__BUILD_TYPE=release -DENABLE_BREAKPAD=OFF -DENABLE_GIO=OFF -DENABLE_LIBGPOD=OFF -DENABLE_SPOTIFY_BLOB=OFF
end module


## A prerequisite for kdevelop other modules using the kdevelop platform, like
# kdewebdev
#module-set
#    use-modules kdevplatform
#    repository kde-projects
#end module-set

## The KDevelop IDE, useful for developing all kinds of programs.  If you don't
# plan on being a software developer you can save time by removing this from
# your configuration.
#module-set
#    use-modules kdevelop
#    repository kde-projects
#end module-set

# Modules in extragear and playground can also be added.
#
# To see what you can find in the various modules, browse
# http://websvn.kde.org/trunk/extragear and
# http://websvn.kde.org/trunk/playground,
# and https://projects.kde.org/projects/kde/extragear (for git modules)

# Amarok is a KDE multimedia application extraordinaire.
# If you want to build and install amarok, simply uncomment this module
#   NOTE: Ensure you've enabled ASF and MP4 support above in taglib. (If you
#   build the taglib module by itself instead of using your distro's taglib,
#   then make sure you've enabled this support for taglib).
#module amarok
#   repository kde-projects
#
#   use-modules amarok
#end module

# --- The K3B cd/dvd/etc. burner.
#module-set
#    repository kde-projects
#
#    use-modules k3b
#end module-set

# Calligra Office Suite
module-set
    repository kde-projects

    use-modules calligra
end module-set

module calligra
    cmake-options -DTINY=1
end module

# Add more modules as needed.
Za calligru korisim _DTINY opciju, jer builda samo words i sheets, a ostalo ni ne trebam. Za KDEPIM obavezno staviti DKDEPIM_BUILD_MOBILE=OFF da ne buildate i verzije za plasmu-active.

U skriptu možete dodati bilo koji KDE projekt hostan preko kde git/snv servera, ili čak i iz neki drugi project (ja gore imam clementine):

Kod: Označi sve

module-set
    repository kde-projects
    use-modules $imemodula
end module-set
ili samo specificirati modul pri pokretanju skripte:

Kod: Označi sve

kdesrc-build $imemodula
Rezultat

Kod: Označi sve

kdesrc-build --debug kid3
slika

Korisne opcije: --debug:
slika
i --reconfigure (ako vam fali dep, te ga naknadno instalirate, potrebno je pokrenuti skriptu sa tom opcijom)

Kako nabaviti skriptu?

Kod: Označi sve

git clone git://anongit.kde.org/kdesrc-build.git
cd kdesrc-build
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix`
make
sudo make install
Za cijelu avanturu vam treba perl, a za sam KDE pogledati 1 i 2
Također, za samo skriptu postoji odlična dokumentacija

Preporučam build i pokretanje KDE-a sa drugim userom, ali to nije nužno, samo onda ne zaboraviti podesiti enviroment opcije da vam se postavke ne pokolju sa KDE-om instaliranim preko paketnog managera.

Evo mog .xsession filea;

Kod: Označi sve

#!/bin/sh

# Change these to the install prefix for each (if you modified that)
#export QTDIR="$HOME/qt4"
export KDEDIRS="$HOME/kdelocal"

# Execute custom-installed KDE programs by default
export PATH="$KDEDIRS/bin:$PATH"

export KDEVARTMP="/var/tmp/kdecache-local-hrvoje"

# Link to custom-installed KDE libraries by default
export LD_LIBRARY_PATH="$KDEDIRS/lib:$LD_LIBRARY_PATH"

# Tell Qt where to find KDE-installed plugins
export QT_PLUGIN_PATH="$KDEDIRS/lib/kde4/plugins:$QT_PLUGIN_PATH"

# Might be needed if you try to run 'make' from a kdesrc-build build directory
export PKG_CONFIG_PATH="$KDEDIRS/lib/pkgconfig:$PKG_CONFIG_PATH"

# Act appropriately if LD_LIBRARY_PATH is not already set.
#if [ -z $LD_LIBRARY_PATH ]; then
#  export LD_LIBRARY_PATH="$KDEDIRS/lib"
#else
#  export LD_LIBRARY_PATH="$KDEDIRS/lib:$LD_LIBRARY_PATH"
#fi

export KDEHOME="${HOME}/.kdelocal"

# Create it if needed
[ ! -e ~/.kdelocal ] && mkdir ~/.kdelocal

# Add XDG-compliant paths, for the K Menu, installed programs, etc.
# See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
export XDG_DATA_DIRS="$KDEDIRS/share/:$XDG_DATA_DIRS"
#export XDG_DATA_HOME="$HOME/.kdelocal/local/share"
#export XDG_CONFIG_HOME="$HOME/.kdelocal/config/"

# Startup the rest of KDE
exec "$KDEDIRS/bin/startkde"
Bar za kdm znam da se može preko njega ući u custom session.


Za ostala pitanja se slobodno javite :)
I ako sam nešt važno zaboravil szbunjen
Zadnja izmjena: sumski, dana/u 28 ruj 2012, 00:32, ukupno mijenjano 1 put.
Listen, I gotta fight the lion. That's what that guy Scott's all about. I know. I've studied him already.
Avatar
drone
Moderator
Postovi: 3293
Pridružen/a: 01 pro 2010, 23:50
OS: Arch/KDE, Debian/Armbian
Lokacija: Nova Gradiška

Re: Kdesrc-build ilti napravi svoj KDE

Post Postao/la drone »

Čini mi se izvrsno za LFS :excited
1986-1990: Commodore64 / 1990-1994: Amiga 500 / 1995-1996: Amiga 1200 / 1997-2001: N/A@home /
2002-2004: Windows98, XP /
2004-2005: Knoppix, Mandrake / 2005: Mandriva, Ubuntu / 2005-2009: LFS / 2009-2010: Mint /
2010-... Arch
Avatar
sumski
Moderator
Postovi: 1779
Pridružen/a: 10 ruj 2010, 11:20
Spol: M
OS: openSUSE Factory KDE

Re: Kdesrc-build ilti napravi svoj KDE

Post Postao/la sumski »

Pa da. Složiš si instalaciju u /usr i staviš sudo/su i rokaš
Listen, I gotta fight the lion. That's what that guy Scott's all about. I know. I've studied him already.
Avatar
blacx
Postovi: 1245
Pridružen/a: 22 vel 2012, 12:24
Spol: M
OS: Arch bspwm/KDE
Lokacija: Split

Re: Kdesrc-build ilti napravi svoj KDE

Post Postao/la blacx »

Odlična stvar :dobra_tema
Odgovori