Differences between revisions 1 and 11 (spanning 10 versions)
Revision 1 as of 2004-07-30 11:50:26
Size: 892
Editor: DavidTuch
Comment: Added CVS Checkout
Revision 11 as of 2005-03-30 16:57:10
Size: 4857
Editor: KevinTeich
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= CVS Checkout = #pragma section-numbers on
Line 3: Line 3:
There are several ways to do: pserver, ext, kserver, gserver. See, e.g. Chapter 2 of [http://cvsbook.red-bean.com/cvsbook.html Open Source Development with CVS] by K. Fogel and M. Bar (2nd Edition, Coriolis Group, 2001). [[Navigation(children)]]
Line 5: Line 5:
'''pserver''' '''Index'''
Line 7: Line 7:
`cvs -d :pserver:tosa@cvs.foobar.com:/space/repo/1/dev login` [[TableOfContents]]
Line 9: Line 9:
where username is "`tosa`" on the server "`cvs.foobar.com`". The cvs depository is `/space/repo/1/dev`. You get asked about the password. Once you stored your authentication in `.cvspass` file, you can run other CVS commands using a similar way. === Medical Image Format FAQ ===
[http://www.dclunie.com/medical-image-faq/html Medical Image Format FAQ]
Line 11: Line 12:
`cvs -d :pserver:tosa@cvs.foobar.com:/space/repo/1/dev co dev` === CVS Checkout ===
Line 13: Line 14:
which checkout the entire directory `dev` into the current directory. You can checkout the FreeSurfer source code from the NMR center using local CVS access or remotely by using SSH as the CVS remote connection method.
Line 15: Line 16:
'''ext''' ==== Local CVS Access ====
Line 17: Line 18:
`export CVS_RSH=ssh` [[BR]]
`cvs -d :ext:tosa@cvs.foobar.com:/space/repo/1/dev co dev`
The CVS repository is /space/repo/1/dev. Use this as your CVSROOT. You can either set it as an environment variable:
Line 20: Line 20:
Note that even though CVS_RSH, we use `ssh`, which is a secure shell {{{setenv CVSROOT /space/repo/1/dev}}}

or specify it in the checkout command with the -d option. Note that the CVS root is cached in a CVS checkout directory, so if you choose to use the -d method, you will only have to do it once during your first checkout.

Check out the code with the CVS checkout command. The archive name is dev.

{{{cvs checkout dev}}}

or

{{{cvs -d /space/repo/1/dev checkout dev}}}

This will copy the entire archive to your directory, creating a
directory called dev/. Now set up your environment to use this dev
directory by running the script in dev/:

{{{cd dev
source set_dev_env_to_here.csh}}}

==== Remote CVS Access ====

Tell CVS to use SSH to access the archive by setting the following environment variable:

{{{setenv CVS_RSH ssh}}}

Use the following string as your CVS root:

{{{:ext:USER@MACHINE.nmr.mgh.harvard.edu:/space/repo/1/dev}}}

Where USER is your username and MACHINE is one of the NMR machines visible to the outside, i.e. gate, entry, or door. Then use the CVS commands normally.

Note that using this method makes an SSH connection for every CVS command, and you will be required to enter your password every time. You may want to look into a utility to automatically authenticate SSH connections, such as SSH agent.

=== Building ===

==== Adding a new binary to the tree ====

Assuming that you have a source file {{{MYPROG.c}}} that compiles into MYPROG and want to add it to the FreeSurfer tree:

1) Make the directory in dev and copy the source file there. Name the directory MYPROG and the source file {{{MYPROG.c}}}.

{{{
mkdir dev/MYPROG
cp MYPROG.c dev/MYPROG
}}}

2) Tell the autotools to build your program when you type {{{make}}} from the top dir.

a) Modify {{{dev/configure.in}}} to add {{{MYPROG/Makefile}}} to the list at the end of the file in the definition of {{{AC_OUTPUT}}}. Be sure to add a backslash at the end of line:

{{{
AC_OUTPUT( \
... other files ...
MYPROG/Makefile \
)
}}}

b) Modify {{{dev/Makefile.am}}} to add {{{MYPROG}}} to the {{{SUBDIRS}}} definition. (You can also alternatively it to the end of {{{MRISUBDIRS}}} or {{{MRISSUBDIRS}}} if more appropriate.)

{{{
SUBDIRS= ... other directories ... MYPROG
}}}

c) Copy {{{dev/dummy/Makefile.am}}} into {{{MYPROG/}}} and customize it, replacing 'dummy' with 'MYPROG'. Be sure to change:

{{{
bin_PROGRAMS = MYPROG
}}}

d) Copy in the additional testing file {{{dev/dummy/myown.c}}}. You can customize it for your test program later.

3) Run {{{automake}}} from {{{dev/}}}. You should get no errors. If you do, make sure you followed the above instructions properly. Also try the AutoconfTroubleshooting page. Verify that this stepped work by checking if {{{MYPROG/Makefile.in}}} was created.

4) Run {{{autoconf}}} to generate a new {{{configure}}} script that now includes your new MYPROG directory.

5) Run {{{./configure}}} with the parameters you previously used. To check these out, run {{{head config.log}}} from {{{dev/}}}. The output should include the {{{./configure}}} line you used. Copy it, but leave out the {{{--no-create --no-recursion}}} options if present.

{{{
[dev/]$ head config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by Freesurfer configure 0.1, which was
generated by GNU Autoconf 2.57. Invocation command line was

  $ ./configure --with-mni-dir=/usr/pubsw/packages/mni/current --prefix=/home/kteich/freesurfer/dev --no-create --no-recursion

## --------- ##
## Platform. ##
[dev/]$ ./configure --with-mni-dir=/usr/pubsw/packages/mni/current --prefix=/home/kteich/freesurfer/dev
}}}

Note: Do not just copy this example, use what's in your own {{{config.log}}} file!

6) Run {{{make}}} and verify that your binary program {{{MYPROG/MYPROG}}} was created.

7) Check in your changes.

{{{
[dev/] cvs ci -m "Added MYPROG" configure configure.in Makefile.am Makefile.in
[dev/] cvs add MYPROG
[dev/] cd MYPROG
[MYPROG/] cvs add Makefile.am Makefile.in MYPROG.c myown.c
[MYPROG/] cvs commit -m "First checkin." Makefile.am Makefile.in MYPROG.c myown.c
}}}

==== autoconf Troubleshooting ====

[AutoconfTroubleshooting]


=== RPM ===

[RpmInfo]

Navigation(children)

Index

TableOfContents

1. Medical Image Format FAQ

[http://www.dclunie.com/medical-image-faq/html Medical Image Format FAQ]

2. CVS Checkout

You can checkout the FreeSurfer source code from the NMR center using local CVS access or remotely by using SSH as the CVS remote connection method.

2.1. Local CVS Access

The CVS repository is /space/repo/1/dev. Use this as your CVSROOT. You can either set it as an environment variable:

setenv CVSROOT /space/repo/1/dev

or specify it in the checkout command with the -d option. Note that the CVS root is cached in a CVS checkout directory, so if you choose to use the -d method, you will only have to do it once during your first checkout.

Check out the code with the CVS checkout command. The archive name is dev.

cvs checkout dev

or

cvs -d /space/repo/1/dev checkout dev

This will copy the entire archive to your directory, creating a directory called dev/. Now set up your environment to use this dev directory by running the script in dev/:

{{{cd dev source set_dev_env_to_here.csh}}}

2.2. Remote CVS Access

Tell CVS to use SSH to access the archive by setting the following environment variable:

setenv CVS_RSH ssh

Use the following string as your CVS root:

:ext:USER@MACHINE.nmr.mgh.harvard.edu:/space/repo/1/dev

Where USER is your username and MACHINE is one of the NMR machines visible to the outside, i.e. gate, entry, or door. Then use the CVS commands normally.

Note that using this method makes an SSH connection for every CVS command, and you will be required to enter your password every time. You may want to look into a utility to automatically authenticate SSH connections, such as SSH agent.

3. Building

3.1. Adding a new binary to the tree

Assuming that you have a source file MYPROG.c that compiles into MYPROG and want to add it to the FreeSurfer tree:

1) Make the directory in dev and copy the source file there. Name the directory MYPROG and the source file MYPROG.c.

mkdir dev/MYPROG
cp MYPROG.c dev/MYPROG

2) Tell the autotools to build your program when you type make from the top dir.

a) Modify dev/configure.in to add MYPROG/Makefile to the list at the end of the file in the definition of AC_OUTPUT. Be sure to add a backslash at the end of line:

AC_OUTPUT( \
... other files ...
MYPROG/Makefile \
)

b) Modify dev/Makefile.am to add MYPROG to the SUBDIRS definition. (You can also alternatively it to the end of MRISUBDIRS or MRISSUBDIRS if more appropriate.)

SUBDIRS= ... other directories ... MYPROG

c) Copy dev/dummy/Makefile.am into MYPROG/ and customize it, replacing 'dummy' with 'MYPROG'. Be sure to change:

bin_PROGRAMS = MYPROG

d) Copy in the additional testing file dev/dummy/myown.c. You can customize it for your test program later.

3) Run automake from dev/. You should get no errors. If you do, make sure you followed the above instructions properly. Also try the AutoconfTroubleshooting page. Verify that this stepped work by checking if MYPROG/Makefile.in was created.

4) Run autoconf to generate a new configure script that now includes your new MYPROG directory.

5) Run ./configure with the parameters you previously used. To check these out, run head config.log from dev/. The output should include the ./configure line you used. Copy it, but leave out the --no-create --no-recursion options if present.

[dev/]$ head config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by Freesurfer configure 0.1, which was
generated by GNU Autoconf 2.57.  Invocation command line was

  $ ./configure --with-mni-dir=/usr/pubsw/packages/mni/current --prefix=/home/kteich/freesurfer/dev --no-create --no-recursion

## --------- ##
## Platform. ##
[dev/]$ ./configure --with-mni-dir=/usr/pubsw/packages/mni/current --prefix=/home/kteich/freesurfer/dev

Note: Do not just copy this example, use what's in your own config.log file!

6) Run make and verify that your binary program MYPROG/MYPROG was created.

7) Check in your changes.

[dev/] cvs ci -m "Added MYPROG" configure configure.in Makefile.am Makefile.in
[dev/] cvs add MYPROG
[dev/] cd MYPROG
[MYPROG/] cvs add Makefile.am Makefile.in MYPROG.c myown.c
[MYPROG/] cvs commit -m "First checkin." Makefile.am Makefile.in MYPROG.c myown.c

3.2. autoconf Troubleshooting

[AutoconfTroubleshooting]

4. RPM

[RpmInfo]

DevelopersGuide (last edited 2023-09-13 15:46:41 by JacksonNolan)