Skip to content

SIPfoundry

Narrow screen resolution Wide screen resolution Increase font size Decrease font size Default font size
Home arrow Developers arrow sipXecs Filesystem Conventions
sipXecs Filesystem Conventions PDF Print E-mail
Written by Administrator   
Friday, 15 October 2004

This is a set of guidelines for how sipXecs projects should choose filesystem names and layouts in the installed files and within the development tree. Deviating from these guidelines is not automatically a bug - there may be good reasons for doing so, but if possible they should be followed, and when not followed the reasons should be clear and the differences well documented..

These recommendations are based, at least roughly, on the Filesystem Hierarchy Standard. The intent is that the evolution of these conventions be toward closer conformance to that standard (and for the actual layout of files in the sipXecs project to evolve toward these conventions).

Installation Tree

This section describes the layout conventions used for sipXecs projects at installation time on a user system. This does not include everything used by a system being used for development (see Development Tree).

${prefix}

The sipXecs build system uses the GNU autotools; as such, many of the conventions here can be modified at build time by the various options available in that framework. The most commonly used of these is the variable prefix, normally passed to the 'configure' script. Depending on how the configure script is invoked, the paths given here may be relative to the value of ${prefix}. When building from source (from tar files or subversion), the default ${prefix} value is '/usr/local/sipx'. In RPM releases there is no common prefix.

Install Directories

The following is a list of directories where sipXecs components are installed. These can be controlled in a variety of ways; see the table of directory controls below.

bin/
Executables intended for use directly by users or as system daemons; may include both scripts and binaries.
bin/ssl-cert/
Utility scripts to generate and install SSL/TLS certificates and keys.
etc/init.d/
Startup scripts intended to be run under a sysV-style system (such as the 'chkconfig/service' system used by Red Hat).
etc/sipxpbx/
Configuration files that may be modified by the user, but will not be modified by the system itself at run time.

Some of these files are installed as templates (with a '.in' suffix). These files are processed at startup time to produce the functional file to incorporate configuration information from the config.defs file. The processing is done by the bin/configpp utility, which is invoked at startup time.
include/
(included only in developer installs)
Interface definition files.
lib/
Shared and static libraries.
lib/sipviewer/
Java .jar files for the sipviewer utility (used by the wrapper script 'bin/sipviewer').
share/sipxpbx/
Architecture-independent data files that should not be modified by the user.
Note: no files are to be installed in 'share/' other than under 'share/sipxpbx' or another appropriate subdirectory.
var/
Files that are modified by the system at run time. They should not include files that the user modifies.
Note: no files are to be installed in 'var/' other than under the appropriate subdirectory (see below).
var/log/sipxpbx
Log files - written only, never read by the system. The 'logrotate' mechanism or other safeguards should be applied to ensure that these do not grow without bound.
var/run/sipxpbx
Marker files used to detect that a process is running (typically '.pid' files containing a process id). These should be created by the process when it starts, and destroyed when it stops (either by the process itself or by the means used to stop it).
var/sipxdata/
Persistent data used (and potentially modified) by the system.
Note: it could be argued that everything we have put here actually belongs elsewhere.
var/spool/
Spool data - variable size objects created and destroyed by the system (examples would include such things as voice mail messages, but right now they are under var/sipxdata - see note above).
var/tmp/
Purely temporary files - created by the system when running that can be safely deleted whenever it is not running.
www/
Modifications to the apache web server for the benefit of sipXecs. Note: it could be argued that everything we have put here actually belongs elsewhere.

Directory Variables

In makefiles or RPM spec files, the autoconf variable names for directories should be used. The machinery to make these names available is in sipXportLib/config/sipXcommon.mak.in. In code, these names can be made available as strings through C macros, but each such substitution has to be added to the appropriate lib*_la_CXXFLAGS variable.  The default values are listed below and are set by the sipXlib.m4 macro SFAC_INIT_FLAGS. When building from source, each of the ${...} variables listed below has the default value shown in the table. These default values can be overridden by the corresponding argument to ./configure. ${prefix} defaults to /usr/local/sipx and can be overridden by the --prefix argument to ./configure.

sipX Macroconfigure variableRPM DefaultInstalled from source default
SIPX_BINDIR ${bindir} /usr/bin ${prefix}/bin
SIPX_INCDIR ${includedir} /usr/include ${prefix}/include
SIPX_LIBDIR ${libdir} /usr/lib ${prefix}/lib
SIPX_CONFDIR ${sysconfdir}/sipxpbx /etc/sipxpbx ${prefix}/etc/sipxpbx
SIPX_DATADIR ${datadir}/sipxpbx /usr/share/sipxpbx ${prefix}/share/sipxpbx
SIPX_LOGDIR ${localstatedir}/log/sipxpbx /var/log/sipxpbx ${prefix}/var/log/sipxpbx
SIPX_RUNDIR ${localstatedir}/run/sipxpbx /var/run/sipxpbx ${prefix}/var/run/sipxpbx
SIPX_TMPDIR ${localstatedir}/tmp /var/tmp ${prefix}/var/tmp
SIPX_DBDIR ${localstatedir}/sipxdata/sipdb /var/sipxdata/sipdb ${prefix}/var/sipxdata/sipdb
SIPX_VXMLDATADIR ${localstatedir}/sipxdata/mediaserver/data /var/sipxdata/mediaserver/data ${prefix}/var/sipxdata/mediaserver/data

Development Tree

Each of the headings below represents a directory that may be found in a sipXecs project; each is followed by a description of the contents to be found in that directory (and in some cases, specific files that may be present). Not all projects will need all of the subdirectories (for example, a project with no metadata would not need a meta/ subdirectory), but if the project has the content described as being found in one of these directories, then it should have the directory and use it in this way.

(top level)/
This is the project directory - its name is the project name.
README
A plain text file describing at least: what this project is (including the version information or where to find it), a pointer to what file has instructions on how to build it, and the URL of the project home page.
Makefile
A makefile compatible with GNU make. All projects that include any C/C++ components use make as the primary supported build mechanism - any other mechanisms used (ant, shell scripts) are invoked by commands in some Makefile so that the project can be built, tested, installed, and binary distributions created through invoking make with the appropriate target(s). (We need a list of standard targets? to be supported by all Makefiles) ;build.xml:In pure Java projects, the top level build mechanism is the ant script build.xml; to the extent possible and consistent with conventional Java usage, it should use the same target names as Makefiles use.
<project-name>.dsp
For projects that support building on Visual Studio, the dsp file should be at the top level. The Makefile is the authoritative file.
TODO
a plain text file describing how to find work that needs to be done, and who to contact if you want to volunteer to do it. This should be primarily a pointer to a relevant section of the project web site.
BUGS
a plain text file describing known problems with the project and a pointer to the live tracking system for it.
CONTRIBUTORS
a plain text file of the names and contact information for contributors (and a pointer...)
INSTALL
a plain text file describing how to build and install the project
configure
a /bin/sh script with which to configure the project for a given platform; all distributed snapshots should have this (it is usually actually a generated file, so the project as checked out from the source control system will not have it - a standard makefile target will create it)
DEPENDENCIES
this is a plain text file that documents what packages/projects this one depends on, including any known version requirements, and pointers to where these projects can be found.
LICENSE
a plain text file specifying the license terms for the project.
doc/
Documentation about the project. Most will actually belong in one of the following subdirectories:
doc/<project-name>/
End user documentation; everything a user would need if they were never going to look at any of the source code. Using the project name as a subdirectory here allows multiple projects to be overlaid in end-user distributions without name changes.
doc/developer/
Developer documentation; design documents.
doc/code/
Documents generated automatically from code (javadoc & doxygen output).
doc/license/
Contains the licenses of any packages that we include that are covered by any license other than that described by LICENSE.
src/
Source code. For C/C++ this should be as flat as possible, except for the src/test/ directory (below); Java source will have its top level directory as a child of this one (src/org/sipfoundry/...). Subsystems that are moved to subdirectories of src MUST use the same structure under include.
src/test/ (and src/<subsystem>/test/)
Source for unit tests of the components in the src/ directory.
include/
Public API definition files. These should be only files that define interface usable from outside the project; files containing definitions (such as internal constants or unsupported internal interfaces) should be in the src/ directory.
meta/
Metadata that is not meant to be edited by end users (database schema files, for example)
config.<platform>
Platform-specific configuration information. This is one of the ways to use the GNU autoconf framework - if the configure script is run in a directory named this way (by creating the directory under the top level, changing into it, and then invoking ".configure"), then it will generate platform-specific configuration in the subdirectory. The Makefile it generates will then generated output into ../obj.<platform< and ../bin.<platform>
obj/ or obj.<platform>
Any generated object (not a final executable) for the platform (see config.<platform>)
lib/ or lib.<platform>
Libraries or other binary objects (such as images) distributed with the project (as opposed to generated from sources included in the project). This does not contain generated library output.
bin/ or bin.<platform>
Generated executables for the platform (see config.<platform>)
bin/ or bin.<platform>
Generated executables for the current platform (see config.<platform>)
shared/
Platform-independent executables (scripts)
log/
Run time log files (in a distribution this will be empty, except for a placeholder file)
etc/
Run time configuration files and configuration file templates
Last Updated ( Sunday, 24 February 2008 )
 
Tag it:
Delicious
Furl it!
digg
blogmarks
De.lirio.us
YahooMyWeb
< Prev   Next >