Skip to content

Building from latest Git source code

artmg edited this page May 4, 2015 · 5 revisions

work in progress

These instructions are to help users create a working build of NixNote2 from the current head of the source on GitHub. They were originally based on the instructions in the User Documentation: https://github.com/baumgarr/Nixnote2/blob/master/help/UserDocumentation.pdf

Although that User Documentation gives details of how to build a development environment, the instructions on this page are aimed at users who simply wish to benefit from the latest updates to the code, without having to wait for a formal build to be released.

Needless to say, by following these instructions you will create an unsupported version of the software, that has not been fully regression tested, and you should therefore treat your data with caution when using the compiled program.

Table of Contents

Build Instructions

These commands are for Ubuntu and derivatives

(they have been tested on Lubuntu 14.04 and Lubuntu 14.10)


### Install Dependencies ###

# disk space requirements - free space that may be consumed by this process 
# home: up to 450 MB for source, intermediate files, and compiled objects 
# root: up to 700 MB for build & runtime dependencies (varies according to how many already installed)

# install git and build commands
# This uses qt4 in the assumtion that there is already more of that version installed
sudo apt-get install -y git-core qt4-default build-essential 

# install build dependency packages
sudo apt-get install -y libpoppler-qt4-dev libopencv-dev libhunspell-dev libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev      # perhaps ... ?   libqtwebkit-dev

# install runtime dependencies - NB this is a WORK IN PROGRESS list 
sudo apt-get install -y libpoppler-qt4-4 libopencv-core2.4 libopencv-highgui2.4 libopencv-imgproc2.4 libqt4-sql-sqlite tidy    # what about ... mimetex libhunspell 
# NB: if you have previously installed NixNote2 from vincentc PPA, runtime dependencies may already be installed 


### Obtain latest Source ###

# create and enter the working folder
mkdir -p ~/bin
cd ~/bin

git clone https://github.com/baumgarr/Nixnote2 Nixnote2
cd Nixnote2

# display the short hash for the lastest commit
GITHASH=`git log --pretty=format:%h -1`



### Modify source ###

# This will allow you to run a test copy of NixNote2 separately from the main copy from the repos, 
# with different settings and databases. In each file search and replace the first string with the second

sed -i -e 's|"/.nixnote/"|"/.nixnote-test/"|' \
./settings/startupconfig.cpp ;

sed -i -e 's|"NixNote - "|"NixNote TEST - "|' \
./nixnote.cpp ;

sed -i -e 's|TARGET = nixnote2|TARGET = nixnote2-test|' \
./NixNote2.pro ;

# In this last case, we double quote the strings to expand variable containing the Commit's Short Hash
sed -i -e "s|\"Built with Qt\"|\"Self built from Commit $GITHASH with Qt\"|" \
./main.cpp ;

Compile

qmake
make
# first time you compile from scratch this _could_ take up to an hour 

Prepare for execution

# The build process leaves over 200 MB of files that are NOT required for execution
# you could remove these if you like (by deleting all but the files mentioned below). 
# If however you consider that you might ever recompile a later version, you may prefer
# to leave the files there to speed the process up next time.
# So simply create a new folder (e.g. ~/bin/nixnote2-test/ ) for execution

### Prepare for execution ###

# create new folder for executables 
mkdir -p ~/bin/nixnote2-test/

# copy folders ...
cp -r \
 certs \
 help \
 images \
 java \
 qss \
 translations \
~/bin/nixnote2-test/

# ... and files required for execution
cp \
 changelog.txt \
 license.html \
 nixnote2-test \
 shortcuts.txt \
~/bin/nixnote2-test/

Shortcut

This creates the shortcut to run the test version of application. Note that the command is wrapped with bash and shell to keep the terminal window open ... if you have gone to all the trouble of compiling this then we guess you want to see any error messages that might appear when execution finishes :)

mkdir -p ~/.local/share/applications
cat > ~/.local/share/applications/nixnote2.TEST.desktop<<EOF!
[Desktop Entry]
Name=NixNote2 TEST
Comment=NixNote test from GitHub Head
Exec=bash -c '$HOME/bin/nixnote2-test/nixnote2-test ;$SHELL'
Icon=$HOME/bin/nixnote2-test/images/windowIcon2.png
StartupNotify=true
Terminal=true
Type=Application
Categories=Network;
EOF!