How to setup a test/development environment

Jack ostroffjh at users.sourceforge.net
Tue Aug 15 20:59:15 UTC 2017


On 2017.08.13 22:47, Jonatan Cloutier wrote:
> Hello,
> 
> I'm trying to test the kf5 version and maybe develop a bit on it, but  
> as explain in the build instruction, KMyMoney need to be installed in  
> the usual path to find all its resources. The thing is I don't want  
> to use the development version with my current accounting.
> 
> So the question is what is the best way to test and develop on  
> KMyMoney while style using the stable version?
> 
> Regards,
> 
>-- 
> Jonatan Cloutier

Replying to the original to keep it shorter, but as Thomas said, backup  
early and often :-)

The difficulty with having multiple versions of KDE softare installed  
at the same time is that a great deal of the libraries and  
configuration info that KDE uses is cached and based on environment  
variables, not just the location of the application itself.  (Tha't  
just motivation or explanation or excuse in case it seems a bit  
convoluted.)

I keep all my KMM source related stuff in one area, so for example
- mkdir KMM
- cd KMM
- git clone magic-git-incantation kmymoney-git
- mkdir install48 (for installing a local 4.8 version - you can have as  
many as you want to keep different versions around but it's easy to get  
confused)
- mkdir installframe (for installing a local frameworks version)
- mkdir build48 (I keep a separate build directory for each branch, but  
some people  just create a new build directory every time to be sure  
it's a clean start.)
- mkdir buildframe
- cd kmymoney-git
- checkout master (or 4.8 or whatever branch you want to build)
- cd ../buildframe (move to the build directory)
- cmake --DCMAKE_INSTALL_PREFIX=/path/to/KMM/installframe  
../kmymoney-git   (with any other parameters you want - I keep this in  
a script file so I don't forget anything.)
- make
- make install
- ./runlocal.sh where this is a script

My script keeps getting fancier, with a section that uses parameters to  
determine if I want to copy my existing .kmy file or start without a  
file or use the last file that was open in this version.  I also have  
lots of echo for debugging values of environment variables.  What is  
critical however, is:

#!/bin/bash  (there are bashisms here, so it probably won't work in  
other shells without modification)
export KDEDIRS=/path/to/KMM/installframe (this is where KDE will look  
for all sorts of stuff)
prepend() { [ -d "$2" ] && eval $1=\"$2\$\{$1:+':'\$$1\}\" && export $1  
; }
  # the above (forgot where I got it) helps put directories at the  
front of lists, without duplicating.
prepend LD_LIBRARY_PATH $(KDE_DIRS)/lib
prepend XDG_DATA_DIRS $(KDE_DIRS)/share
export KDESYCOCA=/path/to/KMM/installframe/var/cache/ksycoca
export KDEHOME=/path/to/KMM/installframe/.kde5  (.kde4 for 4.8)
export KDEVARTMP=/path/to/KMM/installframe/var/tmp
prepend QT_PLUGIN_PATH /path/to/KMM/installframeworks/lib64/plugins   
(your system might use lib instead of lib64)
kbuildsycoca5  (kbuildsycoca4 for 4.8)
/path/to/KMM/installframe/bin/kmymoney path/to/copy/of/kmydatafile.kmy

and remember, after you exit KMM, you are still in the shell with all  
those variables set, so you can just run the program again.  Exit that  
shell if you want to reinvoke the entire script, otherwise you'll end  
up with lot of nested shells.

Ask if anything doesn't work or doesn't make sense.

Jack


More information about the KMyMoney-devel mailing list