summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts/local/scripts/README.txt
blob: e960652327b926f0be96d90ca64b6e20794f2253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
 Index
-------
A) Environment preparation
B) Notes about scripts
C) How to use the scripts


 A) Environment preparation
----------------------------
0) * NOTE *: you can change folder names, as long as you update the "build_config.sh" file accordingly after the first run.
1) Install pbuilder and configure it (see https://wiki.ubuntu.com/PbuilderHowto for a detailed tutorial)
   * You can use the file ".pbuilderrc" from following point 2) - it is recommended to update the mirror to use 
     with one near you.
   * Create the folder "/var/cache/pbuilder/repo"  
2) copy files from "additional files" folder to respectivily named folder.
   "user_home_folder" is the user home folder path.
3) Create base package with the command:
   DIST=<your distro> pbuilder --create
4) create a base folder for TDE, hereafter referred to as TDE_SRC (for example ~/tde_src)
5) create the following folders [ see NOTE at point 0) about folder names ]
- in TDE_SRC: 0_logs : contains log files for repo update and global builds (more on this later)
							1_git  : contains the git repo clones and build hook scripts
              2_build: folder used for build preparation and for local builds
              3_repo : local repo for package installation (to be configured in /etc/apt/sources.list)
              buildscripts: contains a local copy of the build scripts, which can be modified as required
- in TDE_SRC/1_git: 
== SKIP TEMPORARILY ==  
              edeps  : contains extra dependency modules necessary to build TDE
== SKIP END ==
              hooks  : contains build hook scripts to execute ad-hoc code before and after the building process.
                       Mainly used to apply patches automatically during the building process
6) clone TDE git repositories:
  - cd "TDE_SRC/1_git"
  - clone tde repo          : git clone http://scm.trinitydesktop.org/scm/git/tde
  - clone tde packaging repo: git clone http://scm.trinitydesktop.org/scm/git/tde-packaging
== SKIP TEMPORARILY ==
  - download dependency modules from the official PPA:
      https://quickbuild.pearsoncomputing.net/~trinity/+archive/trinity-nightly-build-dependencies/+packages
    or from Slavek PPA (usually more recently updated):
      https://quickbuild.pearsoncomputing.net/~slavek-banko/+archive/deps-r14/+packages
    Make sure you select the correct modules for your distribution and copy them to TDE_SRC/1_git/extra-dependencies/<MODULE NAME>
    Examples: TDE_SRC/1_git/extra-dependencies/libr, TDE_SRC/1_git/extra-dependencies/imlib, ...
== SKIP END ==
== TEMPORARILY ONLY ==
 >>> @Slavek: if you have a better path for download, please let me know <<<
  - download extra dependency .deb modules from the official PPA:
      https://quickbuild.pearsoncomputing.net/~trinity/+archive/trinity-nightly-build-dependencies/+packages
    or from Slavek PPA (usually more recently updated):
      https://quickbuild.pearsoncomputing.net/~slavek-banko/+archive/deps-r14/+packages
    and save them inside the folders
      TDE_SRC/2_build/debs/edeps/<MODULE NAME>/
== TEMPORARILY ONLY END ==

7) - copy build scripts from "TDE_SRC/1_git/tde-packaging/debian/_buildscripts/local/scripts" to
     "TDE_SRC/buildscripts"
   - cd "TDE_SRC/buildscripts"
   - ./update_git_repository.sh  
           -> the very first time this will create the TDE_SRC/buildscripts/build_config.sh file.
              Edit the file to match your preferences and make sure to set TDE_DIR to your TDE_SRC folder.


 B) Notes about scripts
------------------------
1) * Notes *
Modules are built using the build_module.sh script. After the build is completed, the installation .deb files are located in TDE_SRC/2_build/debs/<MODULE NAME>/ and the source code in TDE_SRC/2_build/debs/<MODULE NAME>/src/

The source can be either the git repo or a local copy in TDE_SRC/2_build/build/<MODULE NAME>.
A module can be built in a clean chroot environment using pbuilder (default option) or locally using dpkg-buildpackage (useful for debugging/developing).
When using pbuilder, a hook can be used to invoke a shell when the build fails (see also "known issues").

Build logs are automatically stored to files, but can also be displayed during the build process.
The location of a module build log is TDE_SRC/2_build/debs/<MODULE NAME>/src/__build__.log

When building sets of modules or the whole TDE, a global build summary is automatically stored to TDE_SRC/0_logs/build_result.log to quickly check what built and what failed. It is recommended to delete that file before starting a new TDE build (if not, build results will be appended at the end of the file).

2) * Scripts description *
- build_module.sh: build a single module
  Usage:
    build_module.sh [options] module_name
  Options:
    -g  (Git)         : build from git repo sources. If missing, build from the local copy in build folder.
    -l  (Local)       : build the module locally. If missing, build in a clean chroot environment
    -sl (Show Log)    : output the building logs to terminal
    -lr (Log Result)  : log (append) build result (OK, FAILED) to TDE_SRC/0_logs/build_result.log file
    -sh (Shell Hook)  : use a shell hook for failing builds, only valid if building using pbuilder (clean chroot environment)
    -po (Prepare Only): only prepare the source folder but do not build the module. Useful to prepare the source code before
                        doing local changes/development. The module can then be built from the modified local folder
    -d  (Debug)       : enable debug symbols if possible (debian/rules file must contain "RelWithDebInfo" for this to work)
    -ip (Internal Pbuilder): build using internal pbuilder mode 
	
- _build_config_template.sh
Template file for building configuration. Will be copied into TDE_SRC/build_config.sh upon first execution

- _build_common.sh
Utility script containing common code. No need for invoking it directly.

- _build_set_common.sh
Utility script used to build sets of modules. No need for invoking it directly.

- <dd>_<set_name>.sh
A number of scripts used to build sets of modules. Each script builds an individual set.
Modules are built from the git sources and the build result is automatically appended to 
TDE_SRC/0_logs/build_result.log.
  Usage:
    <dd>_<set_name>.sh [options] set_name
  Options:
    -s N: if specified, skip first N modules from the set of modules

The sets are logically grouped as "base system", "applications" and "others"
== SKIP TEMPORARILY ==  
  00_extradeps.sh                             : dependencies modules
== SKIP END ==
  01_base_01.sh        - 03_base_03.sh        : TDE base system
  04_application_01.sh - 08_application_05.sh : application modules
  09_others_01.sh      - 10_others_02.sh      : other modules that either fail to build/install or that are somehow less used
  91_build_base.sh                            : whole TDE base system
  92_build_applications.sh                    : all TDE applications in 04_application_01.sh - 08_application_05.sh
  93_build_base.sh                            : all modules in 09_others_01.sh - 10_others_02.sh

- build_TDE.sh
Script used to build the whole TDE at once. Calls the dd_setname.sh set scripts in order.
  Usage:
    build_TDE.sh [options]
  Options:
    -s N: if specified, skip first N sets from the list of sets
    
== SKIP TEMPORARILY: not yet provided == 
- create_repo.sh
Creates a local repository from the .deb files currently stored in TDE_SRC/2_build/debs. This repo can be used as installation repository, just add the following lines to /etc/apt/sources.list
  # --- LOCAL TDE REPOSITORY ---
  deb [arch=##your arch here (ex. amd64)## trusted=yes] file:TDE_SRC(full path, ex:/home/tde_src)/3_repo/dists/testing/main/binary-##your arch here (ex. amd64)## ./
== SKIP END ==
  
- update_git_repository.sh:
Scripts used to update the local clone of the git repositories.
  Usage:
    update_git_repository.sh

3) * Building hooks *
Hooks are available to execute ad-hoc code before and after the build process. For example this is very useful to automatically apply patches.
Currently there are two type of hooks: 
- pre_build : applied just before switching the module to quilt format and build
- post_build: applied just after the build (dpkg-buildpackage or pbuilder) has terminated 
To use a hook, just create an executable pre_build.sh and/or post_build.sh script in the TDE_SRC/1_git/hooks/<MODULE NAME> folder. The scripts are executed in the build_module.sh environment, so have access to all the variable defined in that file. See the files in the "hook examples" folder for real usage samples.


 C) How to use the scripts
---------------------------
1) Follow the steps in section "A) Environment preparation" (only required the first time)
2) cd "TDE_SRC/buildscripts"
3) ./update_git_repository.sh  -> update git repository, wait until "Update completed" is printed out.
   Check log in TDE_SRC/0_logs/ if you wish
4) Run "pbuilder update" at the beginning of the day to update the base package to the latest version. This will speed up
   the process when building several modules in sequence.

Examples of real usage:

4.1) build a single module
* ./build_module.sh -g "tdelibs"  -> build "tdelibs" from git sources in a clean chroot environment
* ./build_module.sh -g -l -sl "applications/amarok"  -> build "amarok" locally from git sources and 
                                                        display building logs during building
* ./build_module.sh -sh -lr "tdebase"  -> build "tdebase" from the local sources (in TDE_SRC/2_build/build/tdebase)
                                          in a clean chroot environment and launch a shell in case of building failure.
                                          Append the build result (OK, FAILED) to TDE_SRC/scripts/logs/build_result.log
* ./build_module.sh -g -po "tdelibs"   -> prepare "tdelibs" for building from git sources. Source code will be available
                                          in TDE_SRC/2_build/build/tdelibs. After you have made changes to the source and
                                          want to build the modified package, run './build_module.sh "tdelibs"'
                                          
4.2) build a single set
  (optional) delete the TDE_SRC/0_logs/build_result.log file
  ./01_base_01.sh      : build this set. 
  ./03_base_03.sh -s 3 : build this set but skip the first 3 modules (tdeartwork, tdegames, tdetoys)

4.3) build all TDE
  ./build_TDE.sh      : build all TDE
  ./build_TDE.sh -s 4 : build all TDE, but skip the first 4 sets