| 1 | In this file are instructions for developers and those wishing to |
|---|
| 2 | contribute to Linbox. It is intended both for the uninitiated and for |
|---|
| 3 | the reference of existing developers. |
|---|
| 4 | |
|---|
| 5 | I. Compilation and installation |
|---|
| 6 | |
|---|
| 7 | If you are installing from a tarred distribution, please see the file |
|---|
| 8 | INSTALL for basic instructions on how to install Linbox. If you are |
|---|
| 9 | installing from CVS, please see the instructions in section (III) |
|---|
| 10 | below. |
|---|
| 11 | |
|---|
| 12 | II. Basic layout |
|---|
| 13 | |
|---|
| 14 | Linbox is a template library, so installation requires very little |
|---|
| 15 | actual compilation. Nearly all of the library is in header |
|---|
| 16 | files. Directories in the source distribution are as follows, relative |
|---|
| 17 | to the tree's root: |
|---|
| 18 | |
|---|
| 19 | doc/ - Documentation (see below) |
|---|
| 20 | examples/ - Simple examples to help new users get started with the |
|---|
| 21 | library |
|---|
| 22 | macros/ - Files to assist the build system |
|---|
| 23 | linbox/ - All library source (i.e. header files) goes here |
|---|
| 24 | algorithms/ - Specific algorithms |
|---|
| 25 | blackbox/ - Black box (i.e. matrix) objects |
|---|
| 26 | element/ - Objects representing field elements |
|---|
| 27 | field/ - Objects representing fields (e.g. rationals, |
|---|
| 28 | integers modulo p, etc.) |
|---|
| 29 | randiter/ - Random number generators |
|---|
| 30 | solutions/ - Easy-to-use interfaces for solutions to problems |
|---|
| 31 | vector/ - Vector implementations |
|---|
| 32 | util/ - Utility routines that don't belong anywhere else |
|---|
| 33 | integer/ - C++ source code for GMP integer wrapper |
|---|
| 34 | test/ - Tests for library performance and correctness |
|---|
| 35 | util/ - Scripts and other miscellaneous items, mostly for making |
|---|
| 36 | library maintenance easier |
|---|
| 37 | |
|---|
| 38 | N.B. Though the doc/ directory contains some top-level and tutorial |
|---|
| 39 | documentation, reference documentation is stored in parallel with the |
|---|
| 40 | source code, under the src/ tree. |
|---|
| 41 | |
|---|
| 42 | III. CVS |
|---|
| 43 | |
|---|
| 44 | Linbox is stored in a CVS repository at the University of Delaware. To |
|---|
| 45 | access the latest bleeding edge copy of Linbox from this source, you |
|---|
| 46 | will need a working copy of CVS and all of the GNU development tools |
|---|
| 47 | (e.g. autoconf, automake, GNU make, and so on). To access CVS: |
|---|
| 48 | |
|---|
| 49 | 0. Make sure you have the necessary tools installed |
|---|
| 50 | |
|---|
| 51 | You will need CVS installed. See http://www.cvshome.org/ |
|---|
| 52 | |
|---|
| 53 | You will need GNU Autoconf, GNU Automake, GNU Libtool, and the GNU |
|---|
| 54 | multiprecision library (GMP) to compile Linbox. Make sure the bin |
|---|
| 55 | directories of the first three of those are all in your PATH, e.g. if |
|---|
| 56 | you have Libtool installed in /usr/local/algebra/libtool, make sure |
|---|
| 57 | /usr/local/algebra/libtool/bin is in your PATH. |
|---|
| 58 | |
|---|
| 59 | Also, if Automake is installed in a place separate from Autoconf, you |
|---|
| 60 | will need to set the environment variable ACLOCAL_FLAGS to "-I |
|---|
| 61 | <automake prefix>/share/aclocal", where <prefix> is the install prefix |
|---|
| 62 | of Automake. Similarly, if Libtool is installed to a separate prefix, |
|---|
| 63 | you should add "-I <libtool prefix>/share/aclocal" to ACLOCAL_FLAGS, |
|---|
| 64 | where <libtool prefix> is the install prefix of Libtool. |
|---|
| 65 | |
|---|
| 66 | Of the four tools I have mentioned, only GMP is required if you are |
|---|
| 67 | installing from a tarball. GNU Autoconf, GNU Automake, and GNU Libtool |
|---|
| 68 | are only required for users of CVS and those individuals interested in |
|---|
| 69 | doing major development work on the library. |
|---|
| 70 | |
|---|
| 71 | See http://www.gnu.org/software/autoconf/ for GNU Autoconf, |
|---|
| 72 | http://www.gnu.org/software/automake/ for GNU Automake, and |
|---|
| 73 | http://www.gnu.org/software/libtool/ for GNU Libtool. |
|---|
| 74 | |
|---|
| 75 | 1. Set your CVSROOT environment variable (on Bourne shell): |
|---|
| 76 | |
|---|
| 77 | export CVSROOT=:pserver:<username>@linbox.pc.cis.udel.edu:/home/cvs |
|---|
| 78 | |
|---|
| 79 | (and on the C shell): |
|---|
| 80 | |
|---|
| 81 | setenv CVSROOT :pserver:<username>@linbox.pc.cis.udel.edu:/home/cvs |
|---|
| 82 | |
|---|
| 83 | 2. Log in to CVS; you only ever need to do this once for any given |
|---|
| 84 | Unix shell account: |
|---|
| 85 | |
|---|
| 86 | cvs login |
|---|
| 87 | |
|---|
| 88 | 3. Check out the linbox module |
|---|
| 89 | |
|---|
| 90 | cvs -z3 co linbox |
|---|
| 91 | |
|---|
| 92 | The -z3 option compresses the data in transit, making the operation |
|---|
| 93 | faster for remote users. |
|---|
| 94 | |
|---|
| 95 | 4. Switch to the newly-created linbox directory and run the script |
|---|
| 96 | autogen.sh, optionally specifying the installation prefix: |
|---|
| 97 | |
|---|
| 98 | cd linbox |
|---|
| 99 | ./autogen.sh [--prefix=<prefix>] [options] |
|---|
| 100 | |
|---|
| 101 | [options] include the following: |
|---|
| 102 | |
|---|
| 103 | --with-gmp<prefix> Prefix of your GMP installation |
|---|
| 104 | --with-ntl=<prefix> Prefix of your NTL installation |
|---|
| 105 | |
|---|
| 106 | GMP is *required* for the library to compile, so you must specify |
|---|
| 107 | --with-gmp=<prefix> if <prefix> is not a standard location such |
|---|
| 108 | as /usr or /usr/local otherwise you juste give the option --with-gmp. |
|---|
| 109 | |
|---|
| 110 | 5. Install the library: |
|---|
| 111 | |
|---|
| 112 | make install |
|---|
| 113 | |
|---|
| 114 | When you want to update your tree with the contents of the main CVS |
|---|
| 115 | repository, issue the following command from the linbox/ directory: |
|---|
| 116 | |
|---|
| 117 | cvs -z3 up -dP |
|---|
| 118 | |
|---|
| 119 | The -z3 option is as before and the -dP option tells CVS to update the |
|---|
| 120 | directory structure as well as the files. Note that the order of items |
|---|
| 121 | in that command *is* important. |
|---|
| 122 | |
|---|
| 123 | You should receive some information on what files have been updated. |
|---|
| 124 | If any files have a "U" or "P" before them, this means that there has |
|---|
| 125 | been a change. You are getting an updated version. |
|---|
| 126 | If any files have a "M" before them, this means that a change in the |
|---|
| 127 | repository has been merged with your version. The appropriate question |
|---|
| 128 | is "should I commit my version to the repository?" |
|---|
| 129 | If any files have a "?" before them, this means that this is a file |
|---|
| 130 | that CVS (and hence the rest of the team) knows nothing about. If it |
|---|
| 131 | is not a file created by build or install activity, the appropriate |
|---|
| 132 | question is "should I add this to the repository?" |
|---|
| 133 | If any files have a "C" before them, this means what you have |
|---|
| 134 | conflicts with what is in the repository. In other words, you made |
|---|
| 135 | changes while someone else made other changes and CVS does not know |
|---|
| 136 | how to reconcile the two. You will need to edit that file manually, |
|---|
| 137 | looking for and fixing lines like |
|---|
| 138 | |
|---|
| 139 | that show the sections that could not be reconciled. |
|---|
| 140 | |
|---|
| 141 | If you have made changes and would like to commit them to the global |
|---|
| 142 | repository, issue the command |
|---|
| 143 | |
|---|
| 144 | cvs -z3 ci [<filename(s)>] |
|---|
| 145 | |
|---|
| 146 | The optional filename(s) argument specifies what you would like to |
|---|
| 147 | commit; the default is to commit everything that has changed in the |
|---|
| 148 | current directory and its descendents. When you enter this command, a |
|---|
| 149 | text editor will come up prompting you for a log message. *ALWAYS |
|---|
| 150 | ENTER A LOG MESSAGE DESCRIBING WHAT YOU HAVE CHANGED*. Failure to do |
|---|
| 151 | so may result in your changes being backed out by the |
|---|
| 152 | administrator. When you are done entering your message, simply save |
|---|
| 153 | and exit the text editor. |
|---|
| 154 | |
|---|
| 155 | If you are not a main Linbox developer but would like to submit some |
|---|
| 156 | addition or modification, your code is welcome. Please email a patch |
|---|
| 157 | (use 'cvs -z3 diff -u' to form a patch) to us and we will consider |
|---|
| 158 | including it. |
|---|
| 159 | |
|---|
| 160 | IV. Coding standards |
|---|
| 161 | |
|---|
| 162 | 1. Indentation style |
|---|
| 163 | |
|---|
| 164 | We use the Linux indentation style, i.e. K&R with 1-tab = 8-space indents. |
|---|
| 165 | We would like to keep this standard, so please use it for any code |
|---|
| 166 | submitted to the project. The first line of code files should be |
|---|
| 167 | /* -*- mode: C++; style: linux -*- */ |
|---|
| 168 | This will ensure linux indentation for emacs users. |
|---|
| 169 | We make two exceptions to this indentation pattern, however. |
|---|
| 170 | 1. There is no need to indent within the "namespace LinBox" block. |
|---|
| 171 | 2. public, private, protected tags may be indented a half-tab. |
|---|
| 172 | Here is an example: |
|---|
| 173 | |
|---|
| 174 | namespace LinBox |
|---|
| 175 | { |
|---|
| 176 | void myFunction (int a, int b, int c) |
|---|
| 177 | { |
|---|
| 178 | int d; |
|---|
| 179 | |
|---|
| 180 | if (a == 0) { |
|---|
| 181 | d = 1; |
|---|
| 182 | } |
|---|
| 183 | else if (a == 1) { |
|---|
| 184 | d = 2; |
|---|
| 185 | myOtherFunction (b, c); |
|---|
| 186 | } else |
|---|
| 187 | d = 3; |
|---|
| 188 | } // myFunction |
|---|
| 189 | |
|---|
| 190 | template <class T> |
|---|
| 191 | class MyClass : public MyOtherClass |
|---|
| 192 | { |
|---|
| 193 | int _b; |
|---|
| 194 | |
|---|
| 195 | public: |
|---|
| 196 | MyClass (int a) |
|---|
| 197 | : MyOtherClass (a), _b (0) |
|---|
| 198 | { |
|---|
| 199 | } |
|---|
| 200 | }; // MyClass |
|---|
| 201 | } // LinBox |
|---|
| 202 | |
|---|
| 203 | 2. Naming conventions |
|---|
| 204 | |
|---|
| 205 | We use Java/Smalltalk conventions for naming classes, methods, and |
|---|
| 206 | variables. Classes whose names have several words have all the words |
|---|
| 207 | juxtaposed without underscores, and each word has its first letter |
|---|
| 208 | capitalized (e.g. MyClass, MyOtherClass). Methods are similar, except |
|---|
| 209 | that the first letter of the first word is lower case |
|---|
| 210 | (e.g. myMethod). Global constants should be all upper case with |
|---|
| 211 | underscores between the words (e.g. MY_CONSTANT). In addition, |
|---|
| 212 | variables that are members of classes should begin with an underscore |
|---|
| 213 | to differentiate them from methods and parameters (e.g. int _myMember; |
|---|
| 214 | int myMember () const;). |
|---|
| 215 | |
|---|
| 216 | Directory and file names should be in lower case, with words separated |
|---|
| 217 | by a hyphen ('-'), e.g. my-file.h |
|---|
| 218 | |
|---|
| 219 | We generally avoid abbreviations so as to avoid confusion among users |
|---|
| 220 | of the library. However, some very commonly used features are |
|---|
| 221 | abbreviated and some words commonly used together are treated as a |
|---|
| 222 | single word. For example, we use "minpoly" rather than |
|---|
| 223 | "MinimalPolynomial" and "Blackbox" rather than "BlackBox". |
|---|
| 224 | |
|---|
| 225 | 3. Licensing |
|---|
| 226 | |
|---|
| 227 | This code is licensed under the GNU Lesser General Public License (see |
|---|
| 228 | COPYING for details); all contributed code should be similarly |
|---|
| 229 | licensed. We cannot accept any code that is released under a license |
|---|
| 230 | legally incompatible with the LGPL, so please either license the code |
|---|
| 231 | under the LGPL or explicitly place it in the public domain if you are |
|---|
| 232 | unsure. Technically, code released without a license at all and not |
|---|
| 233 | explicitly placed in the public domain is incompatible with the LGPL, |
|---|
| 234 | so licensing it is important. |
|---|
| 235 | |
|---|
| 236 | 3B. Intellectual property |
|---|
| 237 | |
|---|
| 238 | The original author of a program holds the copyright to that program. |
|---|
| 239 | If another author changes the program, the changes are copyrighted to |
|---|
| 240 | that other author provided that in the preamble a change is announced |
|---|
| 241 | and that the places where the changes are made are annodated by the |
|---|
| 242 | initials of the author and a date. |
|---|
| 243 | |
|---|
| 244 | 4. Checklist for adding files |
|---|
| 245 | |
|---|
| 246 | The procedure for adding a file is based on the type of file being |
|---|
| 247 | added. |
|---|
| 248 | |
|---|
| 249 | 4.A. Adding header files |
|---|
| 250 | |
|---|
| 251 | In the text below <filename> refers to the file you are adding and |
|---|
| 252 | <dir> refers to the directory where the file you are adding is |
|---|
| 253 | located. |
|---|
| 254 | |
|---|
| 255 | 1. Make sure the file has the correct format, with the |
|---|
| 256 | author's name and a copyright and license notice at the |
|---|
| 257 | file's top. Also make sure it follows coding standards to |
|---|
| 258 | the best of your ability. |
|---|
| 259 | |
|---|
| 260 | 2. Open <dir>/Makefile.am and locate the list that starts with |
|---|
| 261 | include_HEADERS. Add your file to that list. If you add it |
|---|
| 262 | to the end of the list, make sure the preceding line ends |
|---|
| 263 | with a backslash '/'. |
|---|
| 264 | |
|---|
| 265 | 3. Add an entry to linbox-new/ChangeLog of the following form: |
|---|
| 266 | |
|---|
| 267 | 2002-02-03 Bradford Hovinen <hovinen@ximian.com> |
|---|
| 268 | |
|---|
| 269 | * <dir>/Makefile.am (include_HEADERS): Added <filename> |
|---|
| 270 | |
|---|
| 271 | Replace the date, name, and email I have given with the |
|---|
| 272 | current date and your own name and email. |
|---|
| 273 | |
|---|
| 274 | 4. Run the command "cvs add <filename>" from the directory |
|---|
| 275 | where the file is located. |
|---|
| 276 | |
|---|
| 277 | 5. Commit your changes with "cvs ci", issued from the |
|---|
| 278 | linbox-new directory. When the editor opens up to enter |
|---|
| 279 | your log entry, use the text that you just entered in the |
|---|
| 280 | ChangeLog. |
|---|
| 281 | |
|---|
| 282 | 4.B. Adding a test |
|---|
| 283 | |
|---|
| 284 | All tests should go in the directory tests. They should be in the form |
|---|
| 285 | of a standalone program that can run a sensable test with no command |
|---|
| 286 | line arguments, preferably with a name prefixed by "test-". In the |
|---|
| 287 | text below, <test> refers to the name of your test binary, |
|---|
| 288 | e.g. test-minpoly. <mod-test> refers to the result of replacing all |
|---|
| 289 | "-" and "." characters in <test> with an underscore "_". <test-source> |
|---|
| 290 | refers to the name of the source file; the procedure works just as |
|---|
| 291 | well if you have multiple source files. By convention, the name of the |
|---|
| 292 | source file should be <test>.C |
|---|
| 293 | |
|---|
| 294 | 1. As above, make sure the file has the correct format. |
|---|
| 295 | |
|---|
| 296 | 2. Open tests/Makefile.am. Add <test> to the line that starts |
|---|
| 297 | with "BASIC_TESTS = ". |
|---|
| 298 | |
|---|
| 299 | 3. You will see a list of blocks that look like: |
|---|
| 300 | |
|---|
| 301 | test_sparse_matrix_SOURCES = \ |
|---|
| 302 | test-0-matrix.C \ |
|---|
| 303 | test-common.C test-common.h |
|---|
| 304 | |
|---|
| 305 | Below the last such block, add a block of the following form: |
|---|
| 306 | |
|---|
| 307 | <mod-test>_SOURCES = \ |
|---|
| 308 | <test-source> \ |
|---|
| 309 | test-common.C test-common.h |
|---|
| 310 | |
|---|
| 311 | 4. Open tests/.cvsignore and add <test> on a line by itself |
|---|
| 312 | to that file. |
|---|
| 313 | |
|---|
| 314 | 5. Open linbox-new/ChangeLog and add a block of the following |
|---|
| 315 | format: |
|---|
| 316 | |
|---|
| 317 | 2002-02-03 Bradford Hovinen <hovinen@ximian.com> |
|---|
| 318 | |
|---|
| 319 | * tests/Makefile.am (BASIC_TESTS): Added <test> |
|---|
| 320 | |
|---|
| 321 | 6. Add the file to cvs with "cvs add <test-source>" |
|---|
| 322 | |
|---|
| 323 | 7. Commit your changes with "cvs ci tests", issued from the |
|---|
| 324 | linbox-new directory. Use the text you entered in ChangeLog |
|---|
| 325 | for your log entry. |
|---|
| 326 | |
|---|
| 327 | 5. Miscellanae |
|---|
| 328 | |
|---|
| 329 | We put all of our declarations in the namespace LinBox. Please put the |
|---|
| 330 | lines |
|---|
| 331 | |
|---|
| 332 | namespace LinBox |
|---|
| 333 | { |
|---|
| 334 | |
|---|
| 335 | ... // Your code here |
|---|
| 336 | |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | in all header files of contributed code. |
|---|
| 340 | |
|---|
| 341 | All header files should have a set of preprocessor directives to |
|---|
| 342 | prevent multiple inclusion. If your header file is named |
|---|
| 343 | my-header-file.h, use |
|---|
| 344 | |
|---|
| 345 | #ifndef __MY_HEADER_FILE_H |
|---|
| 346 | #define __MY_HEADER_FILE_H |
|---|
| 347 | |
|---|
| 348 | ... // Your code here |
|---|
| 349 | |
|---|
| 350 | #endif // __MY_HEADER_FILE_H |
|---|
| 351 | |
|---|
| 352 | surrounding the whole file, except possibly any comments you have at |
|---|
| 353 | the top. |
|---|
| 354 | |
|---|
| 355 | All files should contain a comment at the top indicating the file |
|---|
| 356 | name, copyright, authors, and licensing. Additional documentation |
|---|
| 357 | would be useful. You may use any of the files in this library as a |
|---|
| 358 | template. |
|---|
| 359 | |
|---|
| 360 | ================== |
|---|
| 361 | The Linbox Team |
|---|