Education ClassRoom/Practice
Draft
Since we use subversion, some parts are obsolete, and need to be updated
Objective : create exercices, to practice OpenOffice.org tools used for development
TODO : define a list of items
Contents
Join the Project
Login and accounts
- Create your login on the OpenOffice.org wiki
- Become member of Education Project, using the Education Project wiki page : http://wiki.services.openoffice.org/wiki/Education_Project
Find a page or a document
- Find the web page for your own locale in OpenOffice.org project ( e.g. nl.openoffice.org )
- Find the OpenOffice.org Coding Guidelines on the Wiki ( and read it ... )
- Find the page about cws ( Child Workspace )
- Find dev@gsl.openoffice.org mailing list archive
- Subscribe to dev@education.openoffice.org mailing list if you didn't yet
- Extract mails 10 to 14 from any mailing list
Bonsai use
- Discover Bonsai
- Visualize changes in a cws
1) Go to http://bonsai.go-oo.org/cvsqueryform.cgi
We'll try to do a request :)
2) Don't modify Module (must be All files in the repository ) Remark : note the name "repository "
3) In the Field "Branch" replace HEAD with cws_dev300_aquavcl07
4) in the field "Date" check "Since the beginning of time "
5) do not modify the other fields
6) Click "Run Query"
=> all the changes in the code, based on DEV300_m9 ( we'll explain later) are on the page !!
7) To see the diff for any commit, click in the Rev. columns. Back to retrieve the current page.
Strongly advised : 8) Look carefully at other changes, what information you can obtain here.
Remark: Bonsai helps when you are searching for changes in the code, author date .. precise information about CODE
SVN use
Ericb 16:53, 17 February 2009 (UTC)
Outline of the ClassRoom
1) Create patches using svn
2) apply a patch
3) rebuild a module
4) rebuild a module including symbols
5) run OOo with gdb (introduction of gdb use)
Introduction : in this part, we will create, apply patches using svn tool. To simplify, we'll suppose the patches are in unified mode. Means:
- 3 lines of context before the change - a line who starts with " - " means the line before the old version (if the old version was existing) - a line starting with " + " means after the change(s), if a new version does exist - 3 lines of context after the change
For example :
ordinateur-de-eric-b-2:~/Desktop/ecntablet01 ericb$ svn diff sd/source/ui/slideshow/slideshow.hrc
Index: sd/source/ui/slideshow/slideshow.hrc =================================================================== --- sd/source/ui/slideshow/slideshow.hrc (revision 267130) +++ sd/source/ui/slideshow/slideshow.hrc (working copy) @@ -38,8 +38,10 @@ #define CM_SCREEN_BLACK 5 #define CM_SCREEN_WHITE 6 #define CM_ENDSHOW 7 -#define CM_FIRST_SLIDE 8 -#define CM_LAST_SLIDE 9 -#define CM_SLIDES 10 +#define CM_ERASE_ALLINK 8 +#define CM_ERASE_INK 9 +#define CM_FIRST_SLIDE 10 +#define CM_LAST_SLIDE 11 +#define CM_SLIDES 12 #endif
Create patches using svn
Lot of possibilities. Below some of them. Probably better solutions do exist. This is just a little inventory of the possibilities.
- you got a tree, did some modifications, and you want to send the patch to a friend
The idea is to compare your current tree with the one *before* the changes.
To visualize the changes :
ordinateur-de-eric-b-2:~/Desktop/moz2seamonkey01 ericb$ svn diff slideshow/source/inc/userpainteventhandler.hxx
The command (without the prompt) is :
svn diff slideshow/source/inc/userpainteventhandler.hxx
The result is :
Index: slideshow/source/inc/userpainteventhandler.hxx =================================================================== --- slideshow/source/inc/userpainteventhandler.hxx (revision 267652) +++ slideshow/source/inc/userpainteventhandler.hxx (working copy) @@ -53,6 +53,9 @@ virtual ~UserPaintEventHandler() {} virtual bool colorChanged( RGBColor const& rUserColor ) = 0; + + virtual bool eraseAllInkChanged(bool const& rEraseAllInk) =0; + virtual bool eraseInkChanged(bool const& rEraseInk) =0; virtual bool disable() = 0; };
To create the patch for true, the command is : svn diff slideshow/source/inc/userpainteventhandler.hxx > my pretty patch.diff
And " my_pretty_patch.diff " will contain the same.
- you want to create a patch between a cws and a milestone (the one the cws is based on )
For example, to extract the changes in helpcontent2, ab65 introduced
svn diff http://svn.services.openoffice.org/ooo/tags/DEV300_m35/helpcontent2 http://svn.services.openoffice.org/ooo/cws/ab65/helpcontent2 > mydiff.diff
- you want to create a patch between two svn revisions for a given cws
IMPORTANT: you can follow the recent commits there : http://cia.vc/stats/project/OOo
Example of change (in one line) :
svn diff http://svn.services.openoffice.org/ooo/cws/ooo31gsl2/vcl@268180 http://svn.services.openoffice.org/ooo/cws/ooo31gsl2/vcl@268182
- using svn log, you want to create the diff between two revisions of the same file
For example :
ordinateur-de-eric-b-2:~/Desktop/moz2seamonkey01 ericb$ svn log configure.in Enter passphrase for key '/Users/ericb/.ssh/id_dsa_ooo_svn':
r267684 | ericb | 2009-02-12 18:13:52 +0100 (Thu, 12 Feb 2009) | 1 line
- i94628# fix a path issue for finding seamonkey01
r267656 | ericb | 2009-02-12 14:13:21 +0100 (Thu, 12 Feb 2009) | 1 line
- i94628# other missing changes for Windows
Apply a patch
Essential options :
--dry-run : fakes the patch application *extremely usefull* if you want to check whether a patch will apply, without create garbage in your tree
-R : reverse it -> we suppose you already applied the patch, did no change and want to reverse the patch, to retrieve the same code as before
-p0 : apply a patch using the exact path the files have. Important: your tree does match with the path of the file the patch will be applied, *AND* you apply it form the right location
-p1 : you remove the first subdir of the path for every to be patched file listed in th patch
Correct way of application :
Fake the application :
patch --dry-run -p0 < my_patch.diff
If nothing wrong occurs :
patch -p0 < my_patch.diff
Other possibility, not recommended because of the UUOC (useless use of cat) :
cat my_patch.diff | patch -p0
Depth of the application:
e.g. let's suppose a patch has to modify :
vcl/source/aqua/source/window/salframeview.mm vcl/source/aqua/source/gdi/salprn.cxx vcl/source/aqua/inc/salframeview.h
You can :
apply the patch from
- the root of the sources :
patch -p0 < my_patch.diff
- inside vcl :
patch -p1 < my_patch.diff
- inside vcl/aqua
patch -p2 < my_patch.diff
You cannot apply patch from elsewhere, because the paths will no longer match with the one every of the file contained in it.
- mix of applying patches + svn use
e.g. you did a wrong change in a module, and you want to reverse it directly :
cd module
svn diff apath/afile.cxx | patch -R -p0
for the entire local tree :
svn diff . | patch -R -p0
Rebuild a module where a patch has been applied
- Introduction
We suppose we modified some files, and we need to rebuild a lib. The scheme is always the same, in every module concerned by the build.
- the first prj/build.lst does contain the modules dependencies, means all the listed modules are prerequisites - everything built inside a module is put in type_os_proc.pro
e.g. on Mac OS X, type == unx , os == macx , I for Intel -> output dir is unxmacxi.pro
Note: have a look in solenv/inc -> all the possible arch/os have their own makefile, containing the essential for the build.
The last modification date is used to check the dependencies.
Rule : If a .o is older than it's depenencies, it is rebuild -> once you modified a file ( touch file is enough) , build in a module will create a new lib
- rebuild libvclmxi.dylib on Mac ( .so on Linux, .dll on Windows )
Hypothesis : we suppose the build is completed, and successfull.
cd vcl touch aqua/source/gdi/sallayout.cxx build
If you are in aqua/source/gdi , and you want to rebuild *only* the files listed in the makefile in the current dir, do :
dmake killobj build
Once done, and if you want to see the changes packaged, :
deliver cd ../instsetoo_native build # will rebuild a new installset
Else, if you just want to test your lib, put it in the right subdir (probably in <Install_dir>/OpenOffice.org.app/Contents/basis-link/program on Mac OS X )
Build including symbols
Example
-> in vcl
cd vcl mv unxmacxi.pro unxmacxi.pro_back # keep the normal build build debug="a_non_empty_sting" # means " build debug=t " is ok
The final lib, including symbols for debugging, will be in unxmacxi.pro/lib (on Mac OS X )
Replace the one already in <Install_dir>/OpenOffice.org.app/Contents/basis-link/program on Mac OS X
To debug using gdb,do :
cd <Install_dir>/OpenOffice.org.app/Contents/program
gdb --args soffice apath/afile
"r" (to start) .. and so on;
Happy debugging !
LXR use
[Complete me]
Checkout the code
Preliminary:
- we suppose you have some bash knowledge, and some programming skills
- your .cvsrc file is ok (else ask on #education.openoffice.org )
Now, open a terminal, use bash, and do :
0 ) create the environment
export CVSROOT=":pserver:anoncvs@anoncvs.services.openoffice.org:/cvs"
Let the proxy be 100.101.102.103 ( name proxy.machine.education.org ) , and the open port 1234, then just do :
export CVSROOT=":pserver;proxy=100.101.102.103;proxyport=1234:anoncvs@anoncvs.services.openoffice.org:/cvs"
export CVSROOT=":pserver;proxy=proxy.machine.education.org;proxyport=1234:anoncvs@anoncvs.services.openoffice.org:/cvs"
IMPORTANT : proxy.machine.education.org is just a fake name, as example. Please replace it with the one in your network :)
... it should work now (else, contact your sys admin).
For the next step, create TMP dir (command: mkdir TMP )
cd TMP
1) checkout vcl module from DEV300_m31
cvs co -r DEV300_m31 dtrans
Question: what happens ?
Download all OpenOffice.org tree :
mkdir DEV300_m31
cd DEV300_m31
cvs -4 co -r DEV300_m31 OpenOffice2
( -z4 is optional )
-> once done ( can be very long), and if no error occurs, you got all OpenOffice.org source code from DEV300_m31 Milestone !!
Create a patch
2) Modify one file, do "cvs up" , and comment on the result
3) using grep , retrieve the name of the milestone in the sources
4) checkout vcl from a cws under development
cvs -z4 co -r cws_dev300_aquavcl07 vcl
5) retrieve the cwsname in the sources
6) analyse the list of the subdirectories vcl contains
7) modify the code in vcl/source/gdi/sallayout.cxx
(write whatever you want, respecting C++ syntax prefered ;)
8) create a diff with the OpenOffice.org repository
change directory outside of vcl
in the current dir ( TMP ) , do :
cvs diff -u vcl > my_pretty_patch.diff
9) What does contain the patch ?
Apply and Reverse a patch
- Simulate a patch application
- Apply it for true
10) How reverse your changes ?
11) Be sure you have enough place on your hard disk ( count 2GB )
Fix a build breaker (most common breakages )
A) Building OpenOffice.org
Note: add your own experience here !
Building on Ubunutu 7.10
Ubuntu version : 7.10 - Gutsy Gibbon
Estimated time for the cnofiguration: 1h30
1) Download OpenOffice.org source code
install subversion : sudo apt-get install subversion
Command line for the download : svn checkout svn://svn.services.openoffice.org/ooo/tags/DEV300_m39
2) Java
Prefer the Sun JDK
Version of the installed Java (mini 1.5.0 ) Command line to check : java -version
In config_office tcsh was not found
Solution it to use the following option : --with-use-shell=bash
Archive::Zip is missing :
checking for required Perl modules... Can't locate Archive/Zip.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at -e line 1. BEGIN failed--compilation aborted at -e line 1. configure: error: Failed to find some modules
Solution :
apt-cache search archive | grep perl
Returns
libarchive-zip-perl - Module for manipulation of ZIP archives
Solution sudo apt-get install libarchive-zip-perl
Cups : checking for cups/cups.h... no configure: error: cups/cups.h could not be found. libcupsys2-dev or cups???-dev
Solution: sudo apt-get install libcupsys2-dev
pam :
checking for security/pam_appl.h... no configure: error: pam_appl.h could not be found. libpam-dev or pam-devel missing?
Solution: sudo apt-get install libpam0g-dev
javac: checking for javac... no configure: error: javac not found set with_jdk_home
Solution:
Install Sun Java 1.5.0 from the URL below:
http://java.sun.com/javase/downloads/index_jdk5.jsp
JDK2 installed in /usr/local, means the following option is mandatory :
--with-jdk-home=/usr/local/jdk1.5.0_17
Gperf: checking for gperf... no configure: error: gperf not found but needed. Install it.
Solution: sudo apt-get install gperf
unowinreg.dll:
checking whether to build the ODK... yes
checking for external/unowinreg/unowinreg.dll... configure: WARNING: not found, will be cross-built using mingw32
Looking at external/unowinreg, the readme invites to download unowinreg.dll at
http://tools.openoffice.org/unowinreg_prebuild/680
cd ../DEV300_m39/external/unowinreg/
Solution:
wget http://tools.openoffice.org/unowinreg_prebuild/680/unowinreg.dll
gtk+ stuff :
checking whether freetype is available... checking for pkg-config... /usr/bin/pkg-config checking for freetype2 >= 2.0 ... Package freetype2 was not found in the pkg-config search path
Solution : install all the gtk+ stuff (first is freetype )
sudo apt-get install libfreetype6-dev
Mozilla :
checking for mozilla-source-1.7.5.tar.gz... not found checking for mozilla-source-1.7.5.tar.bz2... not found configure: error: Mozilla source archive not found. Please copy mozilla-source-1.7.5.tar.bz2 or mozilla-source-1.7.5.tar.gz to moz/download/. The archives can be found here: http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.5/source/
use prebuilt-archives downloadable from http://tools.openoffice.org/source/browse/tools/www/moz_prebuild/680/
For Linux: LINUXGCCIinc.zip LINUXGCCIlib.zip LINUXGCCIruntime.zip
Xaw:
checking X11/Xaw/Label.h usability... no checking X11/Xaw/Label.h presence... no checking for X11/Xaw/Label.h... no configure: error: Xaw include headers not found
Solution :
sudo apt-get install libxaw6-dev
Fontconfig:
checking fontconfig/fontconfig.h usability... no checking fontconfig/fontconfig.h presence... no checking for fontconfig/fontconfig.h... no configure: error: fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?
Solution: sudo apt-get install libfontconfig1-dev
Xrandr:
checking for X11/extensions/Xrandr.h... no configure: error: X11/extensions/Xrandr.h could not be found. X11 dev missing?
Solution: sudo apt-get install libxrandr-dev
Bison:
checking for bison... no configure: error: no bison found in $PATH, install bison
Solution: sudo apt-get install bison
Flex: checking for flex... no configure: error: no flex found in $PATH, install flex
Solution: sudo apt-get install flex
Gconf-2.0:
checking whether to enable GConf support... yes checking for gconf-2.0 ... Package gconf-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gconf-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gconf-2.0' found configure: error: Library requirements (gconf-2.0 ) not met; consider adjusti
Solution: sudo apt-get install libgconf2-dev
Gnomevfs:
checking for gnome-vfs-2.0 >= 2.6.0 ... Package gnome-vfs-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gnome-vfs-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gnome-vfs-2.0' found configure: error: Library requirements (gnome-vfs-2.0 >= 2.6.0 ) not met; cons
Solution: sudo apt-get install libgnome-vfs-dev
WARNING: not available -> use the --disable-gnome-vfs option solved the issue
libgtk+-2.0 missing:
Solution: sudo apt-get install libgtk2.0-dev
Ant missing:
checking for ant.cmd... no configure: error: Ant not found - Make sure it's in the path or use --with-ant-home
Solution Download apache-ant from (e.g.) : http://archive.apache.org/dist/ant/binaries/
Install the decompressed archive in /usr/local
use : --with-ant-home=/usr/local/apache-ant-1.7.1
EXTRA INSTALLATION
Use as much as possible system libs:
libxml : --with-system-openssl
To avoid broken dependencies, libxml2 + matching libxslt (development archives) must be installed.
sudo apt-get install libxslt1-dev libxslt1.1
Finaly,use the foloowing option to successfully pass configure : --with-system-libxml
openssl : --with-system-openssl
checking for openssl ... Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable No package 'openssl' found
Solution:
sudo apt-get install libssl-dev
expat : --with-system-expat
berkeleydb : --with-system-db
checking for db.h... no checking for db4/db.h... no configure: error: no. install the db4 libraries
Solution : sudo apt-get install libdb4.4-dev
icu: --with-system-icu
checking for genbrk... no configure: error: \genbrk\ not found in $PATH, install the icu development tool \genbrk""
Solution : sudo apt-get install libicu36-dev
neon : --with-system-neon
checking which neon to use... external checking for neon >= 0.24.0... configure: error: you need neon >= 0.24.x for system-neon
Solution: sudo apt-get install libneon26-dev
Install ccache :
sudo apt-get install ccache
edit the ~/.bashrc and add the lines :
CC="ccache gcc" CXX="ccache g++" export CC CXX
save, close and open a new term => ccache will be detected at the next configure
Final configure command line ( experimental, might be modified) :
./configure \ --with-use-shell=bash \ --with-jdk-home=/usr/local/jdk1.5.0_17 \ --disable-build-mozilla \ --disable-gnome-vfs \ --with-ant-home=/usr/local/apache-ant-1.7.1 \ --with-lang=fr \ --with-system-libxml \ --with-system-libxslt \ --with-system-openssl \ --with-system-expat \ --with-system-db \ --with-system-icu \ --with-system-neon
And configure is successfull :-)
Bootstrap :
cd $ROOT_SOURCES
./bootstrap # builds dmake
either :
dmake
or :
cd instsetoo_native
build --all -P4
Starts the build
See you tomorrow :)
Missing modules
e.g. missing alias in DEV300_m13 : hyphen module is not checked, causing missing headers, never delivered and then, a breakage in lingucomponent because of undefined functions/methods and so on
Solution: check out hyphen
export CVSROOT=":pserver:anoncvs@anoncvs.services.openoffice.org:/cvs"
Note: there is another solution for experimented devs, using tunnel
cvs co -r DEV300_m13 hyphen