Merge lp:~zorba-coders/zorba/b1197577-macDocs into lp:zorba

Proposed by Cezar Andrei
Status: Merged
Merged at revision: 11660
Proposed branch: lp:~zorba-coders/zorba/b1197577-macDocs
Merge into: lp:zorba
Diff against target: 297 lines (+251/-6)
3 files modified
doc/zorba/indexpage.dox.in (+1/-0)
doc/zorba/install_osx.dox (+237/-0)
swig/ruby/CMakeLists.txt (+13/-6)
To merge this branch: bzr merge lp:~zorba-coders/zorba/b1197577-macDocs
Reviewer Review Type Date Requested Status
Chris Hillery Approve
Cezar Andrei Approve
Review via email: mp+188143@code.launchpad.net

Commit message

Add documentation on how to install Zorba and run examples in Python, PHP, Ruby and Java.

Description of the change

Add documentation on how to install Zorba and run examples in Python, PHP, Ruby and Java.

To post a comment you must log in.
Revision history for this message
Cezar Andrei (cezar-andrei) :
review: Approve
11642. By Chris Hillery

Merge from trunk.

Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/b1197577-macDocs/+merge/188143

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/zorba/indexpage.dox.in'
--- doc/zorba/indexpage.dox.in 2013-09-17 16:29:09 +0000
+++ doc/zorba/indexpage.dox.in 2013-10-14 22:35:48 +0000
@@ -15,6 +15,7 @@
15 - \ref build15 - \ref build
1616
17\section install_section Install17\section install_section Install
18 - \ref install_osx_tutorial
18 - \ref php_ubuntu_tutorial19 - \ref php_ubuntu_tutorial
19 - \ref php_windows_tutorial20 - \ref php_windows_tutorial
20 - \ref python_windows_tutorial21 - \ref python_windows_tutorial
2122
=== added file 'doc/zorba/install_osx.dox'
--- doc/zorba/install_osx.dox 1970-01-01 00:00:00 +0000
+++ doc/zorba/install_osx.dox 2013-10-14 22:35:48 +0000
@@ -0,0 +1,237 @@
1/** \page install_osx_tutorial Zorba - Mac OSX Installation
2
3\section zosx_title Guide to Zorba installation on Mac OSX
4
5This is a guide to install Zorba on Mac OSX, it was tested on OSX 10.8.5 Mountain Lion with Xcode 5.0 and Zorba 2.9.1. Send us email with the results you had on different versions or platforms.
6
7There are 3 ways to get Zorba running on your Mac:
8 - \ref zosx_pkg (Requires macports dependencies, recommended)
9 - \ref zosx_mpkg (.mpkg file contains all it's .pkg dependencies, easiest)
10 - \ref zosx_src (the most complete)
11
12\section zosx_prereq Prerequisites
13
14 - Apple Mac OSX 10.8.5 Mountain Lion
15 - Apple Xcode Developer Tools version 5.0 (might work with 4.4 or later too)
16 - For a) and c) MacPorts 2.2.0 (see below).
17
18\section zosx_install_macports Install MacPorts
19
20Install MacPorts 2.2.0: <a href="http://www.macports.org/install.php">http://www.macports.org/install.php</a> . The easiest way to install MacPorts on a Mac OS X system is by downloading and running the .dmg file.
21
22Update MacPorts
23\code
24$ sudo port -v selfupdate
25\endcode
26
27Upgrade outdated packages (this might take a while depending on the outdated packages).
28
29\code
30$ sudo port upgrade outdated
31\endcode
32
33
34\section zosx_pkg a) Install Zorba binary from .pkg file
35
36The zorba-2.9.1.pkg file contains only Zorba installation files but not it's dependecies. Unlike Linux and Windows distributions, it contains both Zorba runtime with core modules and most of the external modules. It does not contain the folowing external modules: image, schema-tools, read-pdf and email, due to lack of macports of these modules dependencies. If one of these modules is required, then Zorba must be installed from source.
37
38Make sure you have MacPorts installed and up to date. Since .pkg contains only Zorba installation files, it's dependecies need to be installed too.
39
40Install dependecies:
41\code
42sudo port install boost curl icu libiconv libxml2 libxslt xerces3 tidy fop geos libarchive sqlite3 swig swig-python swig-php swig-java swig-ruby
43\endcode
44
45\b Note: Use MacPorts installation of the libraries, do not modify the libraries that ships with OSX. Modifying OXS libraries usualy renders your OSX installation unusable.
46
47Download the zorba .pkg file (aproximately 12MB) : <a href="http://launchpad.net/zorba/+download">zorba-x.pkg</a>.
48
49Install it by running it, a MacPorts gui installer will guide you.
50
51after installation Zorba binary should be available in: /opt/local/bin/zorba.
52
53To uninstall Zorba files, use the folowing script: <a href="http://my.zorba-xquery.com/tmp/zorba-2.9.1-uninstall.sh">zorba-2.9.1-uninstall.sh</a>.
54
55
56
57\section zosx_mpkg b) Install Zorba binary from .mpkg file
58
59This is the easies way to install Zorba since it doesn't require installation of MacPorts and requires download and installation of only one file.
60- The Zorba .mpkg file contains both the Zorba installation files and also all it's MacPorts dependecies. This makes the zorba-2.9.1.mpkg a 175MB file.
61- Similar to .pkg file, the .mpkg file contains the Zorba runtime, core modules and most of the external modules. It does not contain the folowing external modules: image, schema-tools, read-pdf and email, due to lack of macports of these modules dependencies. If one of these modules is required, then Zorba must be installed from source.
62
63Download the zorba .mpkg file (aproximately 175MB) : <a href="http://launchpad.net/zorba/+download">zorba-x.mpkg</a>.
64
65Install it by running it, a MacPorts gui installer will guide you.
66
67Zorba binary should be available in: /opt/local/bin/zorba
68
69To uninstall only Zorba files, use the following script: <a href="http://my.zorba-xquery.com/tmp/zorba-2.9.1-uninstall.sh">zorba-2.9.1-uninstall.sh</a>. For the rest of the packages use their own recommendations.
70
71
72
73
74\section zosx_src c) Install Zorba from sources
75This is the most flexible way of installing Zorba, one has access to all it's build configuration and has the opportunity to select the required external modules including the image, schema-tools and read-pdf.
76
77This requires instalation of < href="http://www.macports.org/install.php">MacPorts 2.2.0</a> and installation of Zorba dependecy ports:
78
79\code
80sudo port install boost curl icu libiconv libxml2 libxslt xerces3 tidy fop geos libarchive sqlite3 swig swig-python swig-php swig-java swig-ruby
81\endcode
82
83For more details on configuring and building Zorba from sources see:
84 - \ref build
85 - or <a href="https://docs.google.com/document/d/14KD51yoT27sK-g4dn0YVSAnCbX8nPsDaF_Gsdi2oWdo/edit">Zachary Graceffa's guide</a>.
86
87\b Note: Make sure you don't have any binary Zorba versions instaled, if you do you need to uninstall them in order to have Zorba build correctly from your sources.
88
89
90
91\section zosx_python Working with Python
92
93The installer puts the Zorba python library in: /opt/local/share/python/, so this path needs to be added to system path.
94
95The contents of test.py:
96
97\code
98import sys
99sys.path.insert(0, '/opt/local/share/python/')
100import zorba_api
101
102print "Running: Get zorba instance and shutdown"
103
104store = zorba_api.InMemoryStore_getInstance()
105zorba = zorba_api.Zorba_getInstance(store)
106zorba.shutdown()
107zorba_api.InMemoryStore_shutdown(store)
108
109print "Success"
110\endcode
111
112Since the installer is done by MacPorts, the MacPorts python needs to be used. To run the test python script use:
113
114\code
115/opt/local/bin/python2.7 test.py
116\endcode
117
118A list of other python examples can be found in <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/doc/python/examples/">doc/python/examples</a> and <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/swig/python/tests/">swig/python/tests/</a>.
119
120
121
122\section zosx_php Working with PHP
123
124The Zorba library for PHP is installed under: /opt/local/share/php5/. PHP needs a \b php.ini configuration file that has to contain:
125
126\code
127extension_dir=/opt/local/share/php5/
128include_path=/opt/local/share/php5/
129\endcode
130
131The test.php file should look like:
132\code
133<?
134require 'zorba_api_wrapper.php';
135
136print "Running: Get zorba instance and shutdown\n";
137
138$store = InMemoryStore::getInstance();
139$zorba = Zorba::getInstance($store);
140
141$zorba->shutdown();
142InMemoryStore::shutdown($store);
143
144print "Success";
145?>
146\endcode
147
148To run the script use:
149\code
150php -c path/to/php.ini/ test.php
151\endcode
152
153A list of other PHP examples can be found in <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/doc/php/examples/">doc/php/examples</a> and <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/swig/php/tests/">swig/php/tests/</a>.
154
155
156
157\section zosx_ruby Working with Ruby
158
159The Zorba library for Ruby is installed under /opt/local/share/ruby/zorba_api.bundle.
160
161The test.rb file contains:
162
163\code
164require '/opt/local/share/ruby/zorba_api'
165
166print "Running: Get zorba instance and shutdown"
167
168store = Zorba_api::InMemoryStore.getInstance()
169zorba = Zorba_api::Zorba.getInstance(store)
170zorba.shutdown()
171Zorba_api::InMemoryStore.shutdown(store)
172
173print "Success"
174\endcode
175
176To run the script execute:
177
178\code
179ruby test.rb
180\endcode
181
182A list of other Ruby examples can be found in <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/doc/ruby/examples/">doc/ruby/examples</a> and <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/swig/ruby/tests/">swig/ruby/tests/</a>.
183
184
185
186\section zosx_java Working with Java
187
188To make Java work with Zorba, the Zorba library needs to be on the path and the Zorba jars need to be on the class path. Zorba library and jars are installed under /opt/local/share/java.
189
190\code
191export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/share/java
192export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/share/java
193export CLASSPATH=$CLASSPATH:/opt/local/share/java/zorba_api.jar:/opt/local/share/java/zorba_xqj.jar:/opt/local/share/java/xqjapi.jar
194\endcode
195
196Compile and run your files as usual:
197
198\code
199javac -cp $CLASSPATH Test.java
200java -cp $CLASSPATH:. Test
201\endcode
202
203A simple source on how to use it in code:
204
205\code
206import javax.xml.xquery.*;
207import org.zorbaxquery.api.xqj.*;
208
209class Test
210{
211 static
212 {
213 System.loadLibrary ( "zorba_api" );
214 }
215
216 public static void main(String[] args) throws XQException
217 {
218 System.out.println("Test Zorba");
219
220 ZorbaXQDataSource xqds = new ZorbaXQDataSource();
221 XQConnection xqc = xqds.getConnection();
222 XQExpression xqe = xqc.createExpression();
223 XQResultSequence result = xqe.executeQuery("1+2");
224
225 while (result.next()) {
226 // Print the current item in the sequence
227 System.out.println("> " + result.getItemAsString(null));
228 }
229
230 xqc.close();
231 }
232}
233\endcode
234
235A list of other Ruby examples can be found in <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/doc/xqj/examples/">doc/xqj/examples</a> and <a href="http://bazaar.launchpad.net/~zorba-coders/zorba/trunk/files/head:/swig/xqj/managers/">swig/xqj/managers/</a>.
236
237*/
0238
=== modified file 'swig/ruby/CMakeLists.txt'
--- swig/ruby/CMakeLists.txt 2013-09-21 00:39:52 +0000
+++ swig/ruby/CMakeLists.txt 2013-10-14 22:35:48 +0000
@@ -12,7 +12,7 @@
12# See the License for the specific language governing permissions and12# See the License for the specific language governing permissions and
13# limitations under the License.13# limitations under the License.
14IF(APPLE)14IF(APPLE)
15CMAKE_FIND_FRAMEWORKS ( Ruby )15 CMAKE_FIND_FRAMEWORKS ( Ruby )
16ENDIF(APPLE)16ENDIF(APPLE)
17FIND_PACKAGE(Ruby)17FIND_PACKAGE(Ruby)
1818
@@ -33,10 +33,17 @@
33 # apparently doesn't allow CMake's RPATH-rewriting magic to work.33 # apparently doesn't allow CMake's RPATH-rewriting magic to work.
34 GET_TARGET_PROPERTY(_rpath zorba_simplestore LOCATION)34 GET_TARGET_PROPERTY(_rpath zorba_simplestore LOCATION)
35 GET_FILENAME_COMPONENT(_rpath "${_rpath}" PATH)35 GET_FILENAME_COMPONENT(_rpath "${_rpath}" PATH)
36 SET_TARGET_PROPERTIES(zorba_api PROPERTIES36 IF (APPLE)
37 INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath}"37 SET_TARGET_PROPERTIES(zorba_api PROPERTIES
38 BUILD_WITH_INSTALL_RPATH ON38 INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath}"
39 OUTPUT_NAME "${ZORBA_SWIG_LIB_PREFIX}zorba_api")39 BUILD_WITH_INSTALL_RPATH ON
40 OUTPUT_NAME "zorba_api")
41 ELSE (APPLE)
42 SET_TARGET_PROPERTIES(zorba_api PROPERTIES
43 INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath}"
44 BUILD_WITH_INSTALL_RPATH ON
45 OUTPUT_NAME "${ZORBA_SWIG_LIB_PREFIX}zorba_api")
46 ENDIF (APPLE)
40 ENDIF (WIN32)47 ENDIF (WIN32)
4148
42 IF ( APPLE )49 IF ( APPLE )
@@ -60,7 +67,7 @@
60 SET (RUBY_SITEARCH_DIR "${CMAKE_INSTALL_PREFIX}/share/ruby")67 SET (RUBY_SITEARCH_DIR "${CMAKE_INSTALL_PREFIX}/share/ruby")
61 68
62 IF ( APPLE )69 IF ( APPLE )
63 INSTALL ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}zorba_api_ruby.bundle70 INSTALL ( FILES ${CMAKE_CURRENT_BINARY_DIR}/zorba_api_ruby.bundle
64 DESTINATION ${RUBY_SITEARCH_DIR} )71 DESTINATION ${RUBY_SITEARCH_DIR} )
65 ELSE ( APPLE )72 ELSE ( APPLE )
66 IF ( LINUX )73 IF ( LINUX )

Subscribers

People subscribed via source and target branches