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 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001
|
<?xml version='1.0' encoding='iso-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY llversion '3.0.61'>]>
<!--
Outline for developer's guide to lifelines code.
This is only an outline, not a parseable XML file.
2005-02-12, Perry Rapp
* stdlib directory
The stdlib directory contains various utility functions not specifically
related to LifeLines, GEDCOM, or even genealogy.
* string functions
There has built up, over time, quite an assortment of string functions,
split currently between mystring.c and stdstrng.c (and a few macros in
standard.h).
* llstrncpy, llstrncat
These are simple wrappers around the C RTL (run time library) functions.
The ANSI versions do not zero-terminate on overflow, which is greatly
inconvenient, os the wrapper versions do so. Also, the wrapper versions
are UTF-8 aware (they backtrack on overflow, to avoid leaving part of
a UTF-8 multibyte sequence at the end).
* llstrapp (string append)
This family of functions is one (thin) layer higher than llstrncpy,
providing an interface wherein the caller specified the buffer's start
and entire size. That is,
llstrncat(buffer, " more stuff", sizeof(buffer)-strlen(buffer));
may be replaced by
llstrapp(buffer, sizeof(buffer), " more stuff");
There are also varargs versions, so that
snprintf(buffer+strlen(buffer), sizeof(buffer)-strlen(buffer), ...
may be replaced by
llstrappf(buffer, sizeof(buffer), ...
* appendstr
This is a family of functions similar in purpose to the strapp
family, but which uses an additional level of indirection, advancing
pointers and decrementing counts.
* NOTE: FUTURE DIRECTIONS
I put these in, and I would like to take them out, as I find them
less intuitive than the strapp family, and more bug-prone. They are
slightly faster, but I don't think it is worth it. -Perry.
* char functions
There are character classification functions, which have handling
particular to Latin-1 and to Finnish (if the Finnish compilation option
was set).
* NOTE: FUTURE DIRECTIONS
It would be very nice to see wchar-based functions, which handle
unicode, replace these, and then we might be able to jettison the
Latin-1 & Finnish specific character code.
* string allocation functions
TODO: (strsave, strfree, strupdate, strconcat, free_array_strings)
* string conversion functions
TODO: (isnumeric, lower, upper, capitalize, titlecase)
* string equality functions
TODO: (eqstr, eqstr_ex, nestr, cmpstr)
* string comparison function
TODO: (cmpstrloc)
* string whitespace functions
TODO: (trim, striptrail, striplead, allwhite, chomp)
* string UTF-8 functions
TODO: (utf8len, find_prev_char)
* printpic functions
TODO: (sprintpic0,1,2,3)
* gedlib directory
This directory is a collection of routines for GEDCOM and for its use in
a LifeLines btree database.
* keytonod.c
This module implements the cache of node trees. This cache
operates on top of the back-end database, and nztop() uses
this cache to access the node tree of a RECORD.
* names
This module implements indexing names.
TODO: Explain soundex indexing.
* refns
This module implements indexing references (REFNs).
TOD: Explain two character index.
* xreffile
This module stores lists of deleted record numbers for each type.
When a record is deleted, its number is added to the appropriate
deleted list in xreffile. When a record is added, first the
appropriate deleted list in xreffile is checked for a free record
number.
* messages
Traditionally all translatable strings have been stored in this file.
This is not necessary with the current gettext scheme, but it would
perhaps be helpful if a resource based scheme were adapted in the
future.
* FUTURE DIRECTIONS
When/If GUI versions are incorporated into the same codebase, how to
handle translate strings shared and not shared between versions needs
to be worked out.
* translation tables (charmaps.c & translat.c)
The implementation of codeset translation is stored here (not to be
confused with language translation for the user interface, called
localization, and not associated with these files). Both custom
translation tables and delegation to the iconv codeset conversion
library are done here.
* TRANTABLE
A TRANTABLE is a single, custom-translation table in memory.
It may have been loaded from the tt subdirectory (which holds
custom tables for standard conversions, for systems lacking iconv)
or it may have been loaded from a resident-in-database legacy
table.
* XLAT
An XLAT is a full translation chain, which may use TRANTABLES and
iconv steps in series. For example, an XLAT might convert from
UTF-8 to ISO-8859-1 but also html'ize the text, using two steps,
firstly a TRANTABLE loaded from UTF-8__html.tt, and secondly
using iconv.
* XLSTEP
An XLSTEP represents one step in an XLAT chain.
* DYNTT
A DYNTT is a wrapper for a TRANTABLE loaded from the tt subdir.
* indiseq
The indiseq type is implemented here, a list of records (which no longer
need all be persons).
* brwslist
Named browse lists are implemented here (temporary record lists named by
user during this session).
* interp directory
The lifelines reporting language parser and interpreter are stored here.
A custom lexical analyzer is in lex.c, and a yacc parser generator is
in yacc.y.
The main interpreter is called with a list of files to parse, and some
options. In actuality, I don't think more than one file is ever passed
to the main entry point. If no file is passed, the routine will prompt
(and here is where the user may choose a report from a list). But a
report may be passed in, if one was specified with commandline argument
to llines or llexec.
The report file is parsed, and as it is parsed, any included reports
are added to the list to be parsed (unless already on the list,
so circular references are not a problem).
require statements are handled at parse time. The handler puts the
requested version into the file property table (stored inside the
pointer in the filetab entry for the file; filetab entries are
indexed by full path of report). Later, just after parse completes
for that file (in the main parsing loop in the main interpreter
function), require conditions are tested in check_rpt_requires(...).
* pvalues
All variable values in report language interpretation are stored in a
union type called pvalue.
* symtab
Symbol tables are a thin wrapper around the table type provided by
stdlib, specialized to hold pvalues.
* date
A fairly complete GEDCOM date parser is also located here. It actually
includes both a date parser, and a date formatter (which generates the
thousands of possible lifelines date formats).
* FUTURE DIRECTIONS
If a date type were added to the report language, it would be possible
to distinguish fully-parsed dates in the report language (so invalid or
illegal dates could be flagged & handled separately in a report). The
date module already implements a date type internally, and it is
exposed to the rest of the program (gdate & gdate_val, which correspond
to GEDCOM date types), but not to the report language.
* liflines directory
TODO:
* screen
The screen module contains most of the curses drawing code.
* DYNMENU
Each menu that is resizable and pageable, such as the menu at the bottom
of the person browse screen, has a DYNMENU structure, which contains all of
its menuitem strings and hotkeys (both English and localized to current
language), and also information about it size, and cursor point.
* UIWINDOW
Each actual curses window is inside a UIWINDOW, which is a structure that
holds our supplementary information for the window, such as its cursor point,
its parent and child in the (ui)window stack.
* cursor point
Note that both DYNMEMU and UIWINDOW structures have a cursor point. This is
because the cursor point is within the dynamic menu when it exists, but on
popup screens with no dynamic menu (such as full scan menu, or the partial
scan menu) the cursor point is held in the UIWINDOW itself. Further, the
full screen main menu is a special case, having neither DYNMENU nor UIWINDOW
of its own (it shares its UIWINDOW and its cursor window with all the
full screen browse screens), so its cursor point is hardcoded in
place_cursor_main.
-->
<book id="docbook">
<bookinfo>
<!--
this is ll-devguide.xml
To use this file with SGML software, replace the text above
this comments section with the following:
_________________________________________________________
<!DOCTYPE BOOK PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
<!entity llversion "3.0.52">
]>
<book id="docbook">
<?dbhtml filename="ll-doc.htm">
<bookinfo>
_________________________________________________________
-->
<!-- ================================================= -->
<title>
<application>LifeLines</application> Developer Documentation
</title>
<authorgroup>
<author>
<firstname>Perry</firstname><surname>Rapp </surname>
</author>
</authorgroup>
<subtitle><application>LifeLines</application> Version &llversion;</subtitle>
</bookinfo>
<chapter><title>
Introduction to Lifelines Developers Manual
</title>
<para>
<application>LifeLines</application> source code is divided into
several functional subdirectories, which will be discussed
individually below. They are chained together by an autotools
build system, which creates executables in both the liflines
and tools subdirectories.
</para>
</chapter>
<chapter>
<title>btree module</title>
<para>
The btree subdirectory contains the implementation for a btree
database, using fixed length 8 letter keys (RKEY).
</para>
<formalpara>
<title>nodes</title>
<para>
Each node in the btree is a separate file on disk (named, eg, "aa"),
and the first 4096 (BUFLEN macro) bytes are the node header.
</para></formalpara>
<formalpara><title>
index nodes
</title><para>
These are the interior index nodes of the btree; they contain pointers
to subordinate index or block nodes. The program performs binary
searches through index nodes to find a particular key.
</para></formalpara><formalpara><title>
block nodes
</title><para>
These contain the actual data (keys and their associated records).
</para></formalpara><formalpara><title>
keyfile
</title><para>
One special file on the disk, the keyfile, contains some meta information
and a pointer to the root of the btree (the master key). When the root
changes (splits), the master key in the keyfile is updated accordingly.
</para></formalpara><formalpara><title>
traverse
</title><para>
There is a traversal function implemented at the btree level, which uses
a callback.
</para></formalpara><formalpara><title>
bterrno
</title><para>
There is a global integer error variable, bterrno, which is set by this
module upon most failure conditions.
</para></formalpara><formalpara><title>
FUTURE DIRECTIONS
</title><para>
bterrno must be removed for multi-threading. Traversal is more elegantly
done via iterator style repeated calls in, instead of callback.
</para></formalpara>
</chapter>
<chapter>
<title>stdlib module</title>
<para>
The stdlib directory contains various utility functions not specifically
related to <application>LifeLines</application>, GEDCOM, or even genealogy.
</para>
<sect1>
<title>String Functions</title>
<para>
There has built up, over time, quite an assortment of string functions,
split currently between mystring.c and stdstrng.c (and a few macros in
standard.h).
</para>
<sect2>
<title>String copy and concatenation</title>
<funcsynopsis><funcprototype>
<funcdef>char *<function>llstrncpy</function></funcdef>
<paramdef><parameter>char *dest</parameter>,
<parameter>size_t n</parameter>,
<parameter>int utf8</parameter>,
<parameter>const char * fmt</parameter>,
<parameter>va_list args</parameter></paramdef>
</funcprototype></funcsynopsis>
<funcsynopsis><funcprototype>
<funcdef>char *<function>llstrncat</function></funcdef>
<paramdef><parameter>char *dest</parameter>,
<parameter>size_t n</parameter>,
<parameter>int utf8</parameter>,
<parameter>const char * fmt</parameter>,
<parameter>va_list args</parameter></paramdef>
</funcprototype></funcsynopsis>
<para>
These are simple wrappers around the C RTL (run time library) functions.
The ANSI versions do not zero-terminate on overflow, which is greatly
inconvenient, os the wrapper versions do so. Also, the wrapper versions
are UTF-8 aware (they backtrack on overflow, to avoid leaving part of
a UTF-8 multibyte sequence at the end).
</para>
</sect2>
<sect2>
<title>String append (llstrapp)</title>
<para>
<funcsynopsis><funcprototype>
<funcdef>char *<function>llstrapps</function></funcdef>
<paramdef><parameter>char *dest</parameter>,
<parameter>size_t limit</parameter>,
<parameter>int utf8</parameter>,
<parameter>const char * src</parameter></paramdef>
</funcprototype></funcsynopsis>
<funcsynopsis><funcprototype>
<funcdef>char *<function>llstrappc</function></funcdef>
<paramdef><parameter>char *dest</parameter>,
<parameter>size_t limit</parameter>,
<parameter>char ch</parameter></paramdef>
</funcprototype></funcsynopsis>
<funcsynopsis><funcprototype>
<funcdef>char *<function>llstrappc</function></funcdef>
<paramdef><parameter>char *dest</parameter>,
<parameter>int limit</parameter>,
<parameter>int utf8</parameter>,
<parameter>const char * fmt</parameter></paramdef>
</funcprototype></funcsynopsis>
<funcsynopsis><funcprototype>
<funcdef>char *<function>llstrappv</function></funcdef>
<paramdef><parameter>char *dest</parameter>,
<parameter>int limit</parameter>,
<parameter>int utf8</parameter>,
<parameter>const char * fmt</parameter>,
<parameter>va_list args</parameter></paramdef>
</funcprototype></funcsynopsis>
</para>
<para>
This family of functions is one (thin) layer higher than llstrncpy,
providing an interface wherein the caller specified the buffer's start
and entire size. That is,
<programlisting>
llstrncat(buffer, " more stuff", sizeof(buffer)-strlen(buffer));
</programlisting>
may be replaced by
<programlisting>
llstrapp(buffer, sizeof(buffer), " more stuff");
</programlisting>
There are also varargs versions, so that
<programlisting>
snprintf(buffer+strlen(buffer), sizeof(buffer)-strlen(buffer), ...
</programlisting>
may be replaced by
<programlisting>
llstrappf(buffer, sizeof(buffer), ...
</programlisting>
</para>
</sect2>
<sect2>
<title>String append (appendstr)</title>
<para>
This is a family of functions similar in purpose to the strapp
family, but which uses an additional level of indirection, advancing
pointers and decrementing counts.
</para>
<para>
* NOTE: FUTURE DIRECTIONS
I put these in, and I would like to take them out, as I find them
less intuitive than the strapp family, and more bug-prone. They are
slightly faster, but I don't think it is worth it. -Perry.
</para>
</sect2>
<sect2>
<title>char functions</title>
<para>
There are character classification functions, which have handling
particular to Latin-1 and to Finnish (if the Finnish compilation option
was set).
</para>
<para>
* NOTE: FUTURE DIRECTIONS
It would be very nice to see wchar-based functions, which handle
unicode, replace these, and then we might be able to jettison the
Latin-1 and Finnish specific character code.
</para>
</sect2>
<sect2>
<title>string allocation functions</title>
<para>
TODO: (strsave, strfree, strupdate, strconcat, free_array_strings)
</para>
</sect2>
<sect2>
<title>string conversion functions</title>
<para>
TODO: (isnumeric, lower, upper, capitalize, titlecase)
</para>
</sect2>
<sect2>
<title>string equality functions</title>
<para>
TODO: (eqstr, eqstr_ex, nestr, cmpstr)
</para>
</sect2>
<sect2>
<title>string comparison functions</title>
<para>
TODO: (cmpstrloc)
</para>
</sect2>
<sect2>
<title>string whitespace functions</title>
<para>
TODO: (trim, striptrail, striplead, allwhite, chomp)
</para>
</sect2>
<sect2>
<title>string UTF-8 functions</title>
<para>
These are the low-level functions used to do UTF-8 mechanics.
These should only be called when in a database with internal
codeset of UTF-8.
</para>
</sect2>
<sect2>
<title>printpic functions</title>
<para>
These are simple printf style functions, except they only handle
string format, and they do handle reordering the inputs. These
are used for strings that are internationalized, so that words
or numbers (passed in string format) may be reordered in other
languages. Instead of %s escapes, these handle %1, %2, and %3
escapes.
</para>
</sect2>
</sect1>
<sect1>
<title>List Module</title>
<para>
list.c and list.h implement a simple, doubly-linked list type, which
takes void pointers (VPTR) as elements. The list manages its own nodes
and memory (struct tag_list and struct tag_lnode), but the for the
elements, it only frees them if the caller so instructs it (using
list type LISTDOFREE), and of course this only works if they are
stdalloc/stdfree heap blocks.
</para>
</sect1>
<sect1>
<title>Table Module</title>
<para>
table.c and table.h implement a fixed size hash tree (with linear buckets).
As of 2005-01, Perry has been changing the implementation of the table
type, so it is currently in flux.
</para>
</sect1>
<sect1>
<title>Balanced Binary Tree (rbtree) Module</title>
<para>
rbtree.c and rbtree.h implement a generic red/black balanced binary tree.
These are not currently used by lifelines, but are planned as a replacement
for the current fixed-size hash table in table.c.
</para>
</sect1>
</chapter>
<chapter>
<title>gedlib module</title>
<para>
This directory is a collection of routines for GEDCOM and for its use in
a <application>LifeLines</application> btree database.
</para>
<sect1>
<title>names</title>
<para>
This module implements indexing names.
TODO: Explain soundex indexing.
</para>
</sect1>
<sect1>
<title>refns</title>
<para>
This module implements indexing references (REFNs).
TOD: Explain two character index.
</para>
</sect1>
<sect1>
<title>xreffile</title>
<para>
This module stores lists of deleted record numbers for each type.
When a record is deleted, its number is added to the appropriate
deleted list in xreffile. When a record is added, first the
appropriate deleted list in xreffile is checked for a free record
number.
</para>
</sect1>
<sect1>
<title>messages</title>
<para>
Traditionally all translatable strings have been stored in this file.
This is not necessary with the current gettext scheme, but it would
perhaps be helpful if a resource based scheme were adapted in the
future.
</para>
<para>
* FUTURE DIRECTIONS
When/If GUI versions are incorporated into the same codebase, how to
handle translate strings shared and not shared between versions needs
to be worked out.
</para>
</sect1>
<sect1>
<title>translation tables (charmaps.c and translat.c)</title>
<para>
The implementation of codeset translation is stored here (not to be
confused with language translation for the user interface, called
localization, and not associated with these files). Both custom
translation tables and delegation to the iconv codeset conversion
library are done here.
</para>
</sect1>
<sect1>
<title>indiseq</title>
<para>
The indiseq type is implemented here, a list of records (which no longer
need all be persons).
</para>
</sect1>
<sect1>
<title>brwslist</title>
<para>
Named browse lists are implemented here (temporary record lists named by
user during this session).
</para>
</sect1>
</chapter>
<chapter>
<title>interp module</title>
<para>
The <application>LifeLines</application> reporting language parser and interpreter are stored here.
A custom lexical analyzer is in lex.c, and a yacc parser generator is
in yacc.y.
</para>
<para>
The main interpreter is called with a list of files to parse, and some
options. In actuality, I don't think more than one file is ever passed
to the main entry point. If no file is passed, the routine will prompt
(and here is where the user may choose a report from a list). But a
report may be passed in, if one was specified with commandline argument
to llines or llexec.
</para>
<para>
The report file is parsed, and as it is parsed, any included reports
are added to the list to be parsed (unless already on the list,
so circular references are not a problem).
</para>
<para>
require statements are handled at parse time. The handler puts the
requested version into the file property table (stored inside the
pointer in the filetab entry for the file; filetab entries are
indexed by full path of report). Later, just after parse completes
for that file (in the main parsing loop in the main interpreter
function), require conditions are tested in check_rpt_requires(...).
</para>
<sect1>
<title>pvalues</title>
<para>
All variable values in report language interpretation are stored in a
union type called pvalue.
</para>
</sect1>
<sect1>
<title>symtab</title>
<para>
Symbol tables are a thin wrapper around the table type provided by
stdlib, specialized to hold pvalues.
</para>
</sect1>
<sect1>
<title>date</title>
<para>
A fairly complete GEDCOM date parser is also located here. It actually
includes both a date parser, and a date formatter (which generates the
thousands of possible <application>LifeLines</application> date formats).
</para>
<para>
* FUTURE DIRECTIONS
If a date type were added to the report language, it would be possible
to distinguish fully-parsed dates in the report language (so invalid or
illegal dates could be flagged and handled separately in a report). The
date module already implements a date type internally, and it is
exposed to the rest of the program (gdate and gdate_val, which correspond
to GEDCOM date types), but not to the report language.
</para>
</sect1>
</chapter>
<chapter>
<title>liflines module</title>
<para>
TODO:
</para>
</chapter>
<chapter>
<title>autotools build system</title>
<para>
todo
</para>
</chapter>
<chapter>
<title>Building <application>LifeLines</application></title>
<para>
This chapter gives an overview of one way you can build
<application>LifeLines</application>. It is not intended to be
a comprehensive list of all techniques, but rather enough to get you started.
This section does not assume you are downloading the source tarball
and building it, Those instructions are in the file INSTALL.
We are assuming you are checking out the sources from CVS.
</para>
<sect1>
<title>Checking the CVS source out</title>
<para>
If you are not a member of the
<application>LifeLines</application>
development project, you can check out sources anonymously.
In the following assume that CVS stands for
<programlisting>
cvs -d:pserver:anonymous@cvs.lifelines.sourceforge.net:/cvsroot/lifelines
</programlisting>
If you are a project developer, you will be checking the files out under your
user_id. so CVS will stand for
<programlisting>
cvs -d:ext:user_id@cvs.lifelines.sourceforge.net:/cvsroot/lifelines
</programlisting>
You will also need to export CVS_RSH
<programlisting>
CVS_RSH=ssh
export CVS_RSH
</programlisting>
The first time you check out sources into a build area:
<programlisting>
CVS login anonymous
CVS checkout lifelines
</programlisting>
When prompted for a password for anonymous, simply press the Enter key.
</para>
<para>
Once you have checked out the sources, cvs hides information in the CVS
sub directories about how you accessed sourceforge so the -d option
isn't needed to be typed in. After the first checkout, if you want to
update your sources, you can just type:
<programlisting>
cvs update lifelines
</programlisting>
</para>
<para>
The cvs login command stashes information in .cvspass for remote repository
access. If this is the only remote cvs archive you access, you may be able
to skip the cvs login command on future access attempts. If you work on
multiple projects you can logout when you are finished with
<programlisting>
cvs logout
</programlisting>
</para>
</sect1>
<sect1>
<title>automake and autoconf</title>
<para>
Many of the files you're used to editing by hand are automatically
generated by automake and/or autoconf. These include any file named
Makefile, Makefile.in, config.h, config.h.in, or configure.
</para>
<para>
The proper files to modify by hand are configure.ac (if there's something
new you need to determine about the host system at configuration time)
and Makefile.am (if source files are added or removed, targets added,
or dependencies changed).
</para>
<para>
As long as you have autoconf and automake installed on your system, the
Makefiles generated will be able to regenerate any file dependent on a
Makefile.am or configure.ac. To regenerate the build system explicitly
run the script autogen.sh:
<programlisting>
sh autogen.sh
</programlisting>
</para>
<para>
autogen *must* be run after freshly checking a copy of the
project out of CVS -- the files generated automatically are no longer
included in the CVS repository.
</para>
<sect2>
<title>Which does what:</title>
<para>
At development (or package creation) time:
</para>
<para>
aclocal: This generates aclocal.m4 from acinclude.m4.
</para>
<para>
Please run 'aclocal -I build/autotools -I build/autotools' in order to get all
the autoconf, automake and gettext macros into aclocal.m4.
[ The autogen.sh script has been updated to do this. ]
</para>
<para>
autoheader: This generates acconfig.h.
</para>
<para>
automake: This generates Makefile.in files from Makefile.am files.
</para>
<para>
autoconf: This generates configure from configure.ac.
</para>
<para>
On remote machine compiling a source distribution package:
</para>
<para>
configure will generate config.h and Makefile files from Makefile.in files.
</para>
</sect2>
</sect1>
<sect1>
<title>Building the code on Unix/Linux</title>
<para>
There are lots of dependencies required to build
<application>LifeLines</application>.
Of course you need a C Compiler and make, but also a number of other tools
like autoconf, automake, byacc and flex.
One way to build the code is to make a subdirectory, lets say called bld
in your lifelines directory, (where the toplevel Makefile.am is located)
and then build all the code there. This keeps the objects and executables
out of the source directories. This is the process shown here.
<programlisting>
sh autogen.sh
mkdir bld
cd bld
../configure
make
</programlisting>
</para>
<para>
This should build
<application>LifeLines</application>
and leave the results in subdirectories of the the directory bld.
</para>
</sect1>
<sect1>
<title>Generating the source tarball</title>
<para>
If you have build the code as described above, you can generate the
source tarball as follows;
<programlisting>
cd bld
make dist
</programlisting>
</para>
<para>
While this is a source tarball it does contain a number of generated
files that make it easier to generate
<application>LifeLines</application>
from the source tarball.
</para>
</sect1>
<sect1>
<title>Generating the rpm package</title>
<para>
The specification file to build a rpm for redhat linux is included in the
cvs repository. These notes show how you can use this to build the
source and binary rpm for redhat linux.
</para>
<para>
These instructions use techniques described by Mike Harris in a note
entitled "Building RPM packages as a non-root user." These were found
at http://www.rpm.org/hintskinks/buildtree. At that url was also a
tarball that included the files README( the note), .rpmrc and .rpmmacros.
The later two files are installed in your home directory. These do alter
the default behavior of rpm for you and are not required to build the rpm,
however, these instructions will fail.
</para>
<para>
Make sure there is a line of the form
<programlisting>
%packager Joe Blow <joe@blow.com>
</programlisting>
In your ~/.rpmmacros file. It is used to put the name and email address
of the individual generating the rpm package into the file. Be sure to
use your name and email address. If there is a "Packager:" entry in the
lifelines.spec file, make sure it is correct, as it overrides the value
in your .rpmmacros file.
</para>
<para>
From the lifelines directory (where the toplevel Makefile.am and the bld
directory are, execute the following commands (with appropriate version
numbers of course)
<programlisting>
mkdir ~/rpmbuild
mkdir ~/rpmbuild/SRPMS
mkdir ~/rpmbuild/RPMS
mkdir ~/rpmbuild/BUILD
mkdir ~/rpmbuild/tmp
mkdir ~/rpmbuild/lifelines-3.0.22
cp bld/lifelines-3.0.22.tar.gz ~/rpmbuild/lifelines-3.0.22.
cp build/rpm/lifelines.spec ~/rpmbuild/lifelines-3.0.22
cd ~/rpmbuild/lifeines-3.0.22
rpmbuild -ba lifelines.spec
</programlisting>
The mkdir commands only need to be executed if needed.
If everything goes ok, this will generate a source and binary rpm.
</para>
</sect1>
<sect1>
<title>Making a release</title>
<para>
To release a new version, run the build/setversions.sh script
to set the version in the many necessary files.
Add an entry mentioning the new version in the
<programlisting>
ChangeLog
</programlisting>
Tag the cvs source via (for example, for version 3.0.25)
<programlisting>
cvs tag v3_0_25
</programlisting>
Finally, Send an announcement to the LINES-L mailing list
</para>
</sect1>
<sect1>
<title>Putting a release on sourceforge</title>
<para>
(Not all developers have the power to create or edit a file release
on sourceforge, only Project Administrators and File Release Technicians.)
</para>
<para>
The instructions at
http://sourceforge.net/docman/display_doc.php?docid=6445&group_id=1
are the ones that Perry followed to make many of the releases.
</para>
</sect1>
</chapter>
</book>
|