xref: /f-stack/tools/libxo/doc/getting.rst (revision d4a07e70)
1*d4a07e70Sfengbojiang
2*d4a07e70Sfengbojiang.. index:: Getting libxo
3*d4a07e70Sfengbojiang
4*d4a07e70SfengbojiangGetting libxo
5*d4a07e70Sfengbojiang=============
6*d4a07e70Sfengbojiang
7*d4a07e70Sfengbojianglibxo now ships as part of the FreeBSD Operating System (as of Release
8*d4a07e70Sfengbojiang11).
9*d4a07e70Sfengbojiang
10*d4a07e70Sfengbojianglibxo source code lives on github:
11*d4a07e70Sfengbojiang
12*d4a07e70Sfengbojiang  https://github.com/Juniper/libxo
13*d4a07e70Sfengbojiang
14*d4a07e70SfengbojiangThe latest release of libxo is available at:
15*d4a07e70Sfengbojiang
16*d4a07e70Sfengbojiang  https://github.com/Juniper/libxo/releases
17*d4a07e70Sfengbojiang
18*d4a07e70SfengbojiangWe're using `Semantic Versioning`_ to number our releases.  libxo is
19*d4a07e70Sfengbojiangopen source, distributed under the BSD license.  We follow the
20*d4a07e70Sfengbojiangbranching scheme from `A Successful Git Branching Model`_:
21*d4a07e70Sfengbojiangwe do development under the "*develop*" branch, and release from
22*d4a07e70Sfengbojiangthe "*master*" branch.  To clone a developer tree, run the following
23*d4a07e70Sfengbojiangcommand::
24*d4a07e70Sfengbojiang
25*d4a07e70Sfengbojiang  git clone https://github.com/Juniper/libxo.git -b develop
26*d4a07e70Sfengbojiang
27*d4a07e70Sfengbojiang.. _Semantic Versioning: http://semver.org/spec/v2.0.0.html
28*d4a07e70Sfengbojiang.. _A Successful Git Branching Model:
29*d4a07e70Sfengbojiang    http://nvie.com/posts/a-successful-git-branching-model
30*d4a07e70Sfengbojiang
31*d4a07e70SfengbojiangIssues, problems, and bugs should be directly to the issues page on
32*d4a07e70Sfengbojiangour github site.
33*d4a07e70Sfengbojiang
34*d4a07e70SfengbojiangDownloading libxo Source Code
35*d4a07e70Sfengbojiang-----------------------------
36*d4a07e70Sfengbojiang
37*d4a07e70SfengbojiangYou can retrieve the source for libxo in two ways:
38*d4a07e70Sfengbojiang
39*d4a07e70SfengbojiangA. Use a "distfile" for a specific release.  We use github to maintain
40*d4a07e70Sfengbojiang   our releases.  Visit the `release page`_ to see the list of
41*d4a07e70Sfengbojiang   releases.  To download the latest, look for the release witeh the
42*d4a07e70Sfengbojiang   green "Latest release" button and the green "libxo-RELEASE.tar.gz"
43*d4a07e70Sfengbojiang   button under that section.
44*d4a07e70Sfengbojiang
45*d4a07e70Sfengbojiang.. _release page: https://github.com/Juniper/libxo/releases
46*d4a07e70Sfengbojiang
47*d4a07e70Sfengbojiang   After downloading that release's distfile, untar it as follows::
48*d4a07e70Sfengbojiang
49*d4a07e70Sfengbojiang       tar -zxf libxo-RELEASE.tar.gz
50*d4a07e70Sfengbojiang       cd libxo-RELEASE
51*d4a07e70Sfengbojiang
52*d4a07e70Sfengbojiang   .. admonition:: Solaris Users
53*d4a07e70Sfengbojiang
54*d4a07e70Sfengbojiang     Note: for Solaris users, your "`tar`" command lacks the "-z" flag,
55*d4a07e70Sfengbojiang     so you'll need to substitute "`gzip -dc $file | tar xf -`" instead
56*d4a07e70Sfengbojiang     of "`tar -zxf $file`".
57*d4a07e70Sfengbojiang
58*d4a07e70SfengbojiangB. Use the current build from github.  This gives you the most recent
59*d4a07e70Sfengbojiang   source code, which might be less stable than a specific release.  To
60*d4a07e70Sfengbojiang   build libxo from the git repo::
61*d4a07e70Sfengbojiang
62*d4a07e70Sfengbojiang       git clone https://github.com/Juniper/libxo.git
63*d4a07e70Sfengbojiang       cd libxo
64*d4a07e70Sfengbojiang
65*d4a07e70Sfengbojiang   .. admonition:: Be Aware
66*d4a07e70Sfengbojiang
67*d4a07e70Sfengbojiang     The github repository does **not** contain the files generated by
68*d4a07e70Sfengbojiang     "*autoreconf*", with the notable exception of the "*m4*" directory.
69*d4a07e70Sfengbojiang     Since these files (depcomp, configure, missing, install-sh, etc) are
70*d4a07e70Sfengbojiang     generated files, we keep them out of the source code repository.
71*d4a07e70Sfengbojiang
72*d4a07e70Sfengbojiang     This means that if you download the a release distfile, these files
73*d4a07e70Sfengbojiang     will be ready and you'll just need to run "configure", but if you
74*d4a07e70Sfengbojiang     download the source code from svn, then you'll need to run
75*d4a07e70Sfengbojiang     "*autoreconf*" by hand.  This step is done for you by the "*setup.sh*"
76*d4a07e70Sfengbojiang     script, described in the next section.
77*d4a07e70Sfengbojiang
78*d4a07e70Sfengbojiang.. _building:
79*d4a07e70Sfengbojiang
80*d4a07e70SfengbojiangBuilding libxo
81*d4a07e70Sfengbojiang--------------
82*d4a07e70Sfengbojiang
83*d4a07e70SfengbojiangTo build libxo, you'll need to set up the build, run the "*configure*"
84*d4a07e70Sfengbojiangscript, run the "*make*" command, and run the regression tests.
85*d4a07e70Sfengbojiang
86*d4a07e70SfengbojiangThe following is a summary of the commands needed.  These commands are
87*d4a07e70Sfengbojiangexplained in detail in the rest of this section::
88*d4a07e70Sfengbojiang
89*d4a07e70Sfengbojiang    sh bin/setup.sh
90*d4a07e70Sfengbojiang    cd build
91*d4a07e70Sfengbojiang    ../configure
92*d4a07e70Sfengbojiang    make
93*d4a07e70Sfengbojiang    make test
94*d4a07e70Sfengbojiang    sudo make install
95*d4a07e70Sfengbojiang
96*d4a07e70SfengbojiangThe following sections will walk through each of these steps with
97*d4a07e70Sfengbojiangadditional details and options, but the above directions should be all
98*d4a07e70Sfengbojiangthat's needed.
99*d4a07e70Sfengbojiang
100*d4a07e70SfengbojiangSetting up the build
101*d4a07e70Sfengbojiang~~~~~~~~~~~~~~~~~~~~
102*d4a07e70Sfengbojiang
103*d4a07e70Sfengbojiang.. admonition: Note
104*d4a07e70Sfengbojiang
105*d4a07e70Sfengbojiang   If you downloaded a distfile, you can skip this step.
106*d4a07e70Sfengbojiang
107*d4a07e70SfengbojiangRun the "*setup.sh*" script to set up the build.  This script runs the
108*d4a07e70Sfengbojiang"*autoreconf*" command to generate the "*configure*" script and other
109*d4a07e70Sfengbojianggenerated files::
110*d4a07e70Sfengbojiang
111*d4a07e70Sfengbojiang    sh bin/setup.sh
112*d4a07e70Sfengbojiang
113*d4a07e70SfengbojiangNote: We're are currently using autoreconf version 2.69.
114*d4a07e70Sfengbojiang
115*d4a07e70SfengbojiangRunning the "configure" Script
116*d4a07e70Sfengbojiang~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
117*d4a07e70Sfengbojiang
118*d4a07e70SfengbojiangConfigure (and autoconf in general) provides a means of building
119*d4a07e70Sfengbojiangsoftware in diverse environments.  Our configure script supports
120*d4a07e70Sfengbojianga set of options that can be used to adjust to your operating
121*d4a07e70Sfengbojiangenvironment. Use "`configure --help`" to view these options.
122*d4a07e70Sfengbojiang
123*d4a07e70SfengbojiangWe use the "*build*" directory to keep object files and generated files
124*d4a07e70Sfengbojiangaway from the source tree.
125*d4a07e70Sfengbojiang
126*d4a07e70SfengbojiangTo run the configure script, change into the "*build*" directory, and
127*d4a07e70Sfengbojiangrun the "*configure*" script.  Add any required options to the
128*d4a07e70Sfengbojiang"`../configure`" command line::
129*d4a07e70Sfengbojiang
130*d4a07e70Sfengbojiang    cd build
131*d4a07e70Sfengbojiang    ../configure
132*d4a07e70Sfengbojiang
133*d4a07e70SfengbojiangExpect to see the "*configure*" script generate the following error::
134*d4a07e70Sfengbojiang
135*d4a07e70Sfengbojiang    /usr/bin/rm: cannot remove `libtoolT': No such file or directory
136*d4a07e70Sfengbojiang
137*d4a07e70SfengbojiangThis error is harmless and can be safely ignored.
138*d4a07e70Sfengbojiang
139*d4a07e70SfengbojiangBy default, libxo installs architecture-independent files, including
140*d4a07e70Sfengbojiangextension library files, in the /usr/local directories. To specify an
141*d4a07e70Sfengbojianginstallation prefix other than /usr/local for all installation files,
142*d4a07e70Sfengbojianginclude the --prefix=prefix option and specify an alternate
143*d4a07e70Sfengbojianglocation. To install just the extension library files in a different,
144*d4a07e70Sfengbojianguser-defined location, include the "*--with-extensions-dir=dir*" option
145*d4a07e70Sfengbojiangand specify the location where the extension libraries will live::
146*d4a07e70Sfengbojiang
147*d4a07e70Sfengbojiang    cd build
148*d4a07e70Sfengbojiang    ../configure [OPTION]... [VAR=VALUE]...
149*d4a07e70Sfengbojiang
150*d4a07e70SfengbojiangRunning the "make" Command
151*d4a07e70Sfengbojiang++++++++++++++++++++++++++
152*d4a07e70Sfengbojiang
153*d4a07e70SfengbojiangOnce the "*configure*" script is run, build the images using the
154*d4a07e70Sfengbojiang"`make`" command::
155*d4a07e70Sfengbojiang
156*d4a07e70Sfengbojiang    make
157*d4a07e70Sfengbojiang
158*d4a07e70SfengbojiangRunning the Regression Tests
159*d4a07e70Sfengbojiang++++++++++++++++++++++++++++
160*d4a07e70Sfengbojiang
161*d4a07e70Sfengbojianglibxo includes a set of regression tests that can be run to ensure
162*d4a07e70Sfengbojiangthe software is working properly.  These test are optional, but will
163*d4a07e70Sfengbojianghelp determine if there are any issues running libxo on your
164*d4a07e70Sfengbojiangmachine.  To run the regression tests::
165*d4a07e70Sfengbojiang
166*d4a07e70Sfengbojiang    make test
167*d4a07e70Sfengbojiang
168*d4a07e70SfengbojiangInstalling libxo
169*d4a07e70Sfengbojiang~~~~~~~~~~~~~~~~
170*d4a07e70Sfengbojiang
171*d4a07e70SfengbojiangOnce the software is built, you'll need to install libxo using the
172*d4a07e70Sfengbojiang"`make install`" command.  If you are the root user, or the owner of
173*d4a07e70Sfengbojiangthe installation directory, simply issue the command::
174*d4a07e70Sfengbojiang
175*d4a07e70Sfengbojiang    make install
176*d4a07e70Sfengbojiang
177*d4a07e70SfengbojiangIf you are not the "*root*" user and are using the "*sudo*" package, use::
178*d4a07e70Sfengbojiang
179*d4a07e70Sfengbojiang    sudo make install
180*d4a07e70Sfengbojiang
181*d4a07e70SfengbojiangVerify the installation by viewing the output of "`xo --version`"::
182*d4a07e70Sfengbojiang
183*d4a07e70Sfengbojiang    % xo --version
184*d4a07e70Sfengbojiang    libxo version 0.3.5-git-develop
185*d4a07e70Sfengbojiang    xo version 0.3.5-git-develop
186