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
1=== modified file 'doc/zorba/indexpage.dox.in'
2--- doc/zorba/indexpage.dox.in 2013-09-17 16:29:09 +0000
3+++ doc/zorba/indexpage.dox.in 2013-10-14 22:35:48 +0000
4@@ -15,6 +15,7 @@
5 - \ref build
6
7 \section install_section Install
8+ - \ref install_osx_tutorial
9 - \ref php_ubuntu_tutorial
10 - \ref php_windows_tutorial
11 - \ref python_windows_tutorial
12
13=== added file 'doc/zorba/install_osx.dox'
14--- doc/zorba/install_osx.dox 1970-01-01 00:00:00 +0000
15+++ doc/zorba/install_osx.dox 2013-10-14 22:35:48 +0000
16@@ -0,0 +1,237 @@
17+/** \page install_osx_tutorial Zorba - Mac OSX Installation
18+
19+\section zosx_title Guide to Zorba installation on Mac OSX
20+
21+This 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.
22+
23+There are 3 ways to get Zorba running on your Mac:
24+ - \ref zosx_pkg (Requires macports dependencies, recommended)
25+ - \ref zosx_mpkg (.mpkg file contains all it's .pkg dependencies, easiest)
26+ - \ref zosx_src (the most complete)
27+
28+\section zosx_prereq Prerequisites
29+
30+ - Apple Mac OSX 10.8.5 Mountain Lion
31+ - Apple Xcode Developer Tools version 5.0 (might work with 4.4 or later too)
32+ - For a) and c) MacPorts 2.2.0 (see below).
33+
34+\section zosx_install_macports Install MacPorts
35+
36+Install 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.
37+
38+Update MacPorts
39+\code
40+$ sudo port -v selfupdate
41+\endcode
42+
43+Upgrade outdated packages (this might take a while depending on the outdated packages).
44+
45+\code
46+$ sudo port upgrade outdated
47+\endcode
48+
49+
50+\section zosx_pkg a) Install Zorba binary from .pkg file
51+
52+The 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.
53+
54+Make sure you have MacPorts installed and up to date. Since .pkg contains only Zorba installation files, it's dependecies need to be installed too.
55+
56+Install dependecies:
57+\code
58+sudo port install boost curl icu libiconv libxml2 libxslt xerces3 tidy fop geos libarchive sqlite3 swig swig-python swig-php swig-java swig-ruby
59+\endcode
60+
61+\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.
62+
63+Download the zorba .pkg file (aproximately 12MB) : <a href="http://launchpad.net/zorba/+download">zorba-x.pkg</a>.
64+
65+Install it by running it, a MacPorts gui installer will guide you.
66+
67+after installation Zorba binary should be available in: /opt/local/bin/zorba.
68+
69+To 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>.
70+
71+
72+
73+\section zosx_mpkg b) Install Zorba binary from .mpkg file
74+
75+This is the easies way to install Zorba since it doesn't require installation of MacPorts and requires download and installation of only one file.
76+- 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.
77+- 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.
78+
79+Download the zorba .mpkg file (aproximately 175MB) : <a href="http://launchpad.net/zorba/+download">zorba-x.mpkg</a>.
80+
81+Install it by running it, a MacPorts gui installer will guide you.
82+
83+Zorba binary should be available in: /opt/local/bin/zorba
84+
85+To 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.
86+
87+
88+
89+
90+\section zosx_src c) Install Zorba from sources
91+This 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.
92+
93+This requires instalation of < href="http://www.macports.org/install.php">MacPorts 2.2.0</a> and installation of Zorba dependecy ports:
94+
95+\code
96+sudo port install boost curl icu libiconv libxml2 libxslt xerces3 tidy fop geos libarchive sqlite3 swig swig-python swig-php swig-java swig-ruby
97+\endcode
98+
99+For more details on configuring and building Zorba from sources see:
100+ - \ref build
101+ - or <a href="https://docs.google.com/document/d/14KD51yoT27sK-g4dn0YVSAnCbX8nPsDaF_Gsdi2oWdo/edit">Zachary Graceffa's guide</a>.
102+
103+\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.
104+
105+
106+
107+\section zosx_python Working with Python
108+
109+The installer puts the Zorba python library in: /opt/local/share/python/, so this path needs to be added to system path.
110+
111+The contents of test.py:
112+
113+\code
114+import sys
115+sys.path.insert(0, '/opt/local/share/python/')
116+import zorba_api
117+
118+print "Running: Get zorba instance and shutdown"
119+
120+store = zorba_api.InMemoryStore_getInstance()
121+zorba = zorba_api.Zorba_getInstance(store)
122+zorba.shutdown()
123+zorba_api.InMemoryStore_shutdown(store)
124+
125+print "Success"
126+\endcode
127+
128+Since the installer is done by MacPorts, the MacPorts python needs to be used. To run the test python script use:
129+
130+\code
131+/opt/local/bin/python2.7 test.py
132+\endcode
133+
134+A 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>.
135+
136+
137+
138+\section zosx_php Working with PHP
139+
140+The Zorba library for PHP is installed under: /opt/local/share/php5/. PHP needs a \b php.ini configuration file that has to contain:
141+
142+\code
143+extension_dir=/opt/local/share/php5/
144+include_path=/opt/local/share/php5/
145+\endcode
146+
147+The test.php file should look like:
148+\code
149+<?
150+require 'zorba_api_wrapper.php';
151+
152+print "Running: Get zorba instance and shutdown\n";
153+
154+$store = InMemoryStore::getInstance();
155+$zorba = Zorba::getInstance($store);
156+
157+$zorba->shutdown();
158+InMemoryStore::shutdown($store);
159+
160+print "Success";
161+?>
162+\endcode
163+
164+To run the script use:
165+\code
166+php -c path/to/php.ini/ test.php
167+\endcode
168+
169+A 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>.
170+
171+
172+
173+\section zosx_ruby Working with Ruby
174+
175+The Zorba library for Ruby is installed under /opt/local/share/ruby/zorba_api.bundle.
176+
177+The test.rb file contains:
178+
179+\code
180+require '/opt/local/share/ruby/zorba_api'
181+
182+print "Running: Get zorba instance and shutdown"
183+
184+store = Zorba_api::InMemoryStore.getInstance()
185+zorba = Zorba_api::Zorba.getInstance(store)
186+zorba.shutdown()
187+Zorba_api::InMemoryStore.shutdown(store)
188+
189+print "Success"
190+\endcode
191+
192+To run the script execute:
193+
194+\code
195+ruby test.rb
196+\endcode
197+
198+A 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>.
199+
200+
201+
202+\section zosx_java Working with Java
203+
204+To 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.
205+
206+\code
207+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/share/java
208+export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/share/java
209+export CLASSPATH=$CLASSPATH:/opt/local/share/java/zorba_api.jar:/opt/local/share/java/zorba_xqj.jar:/opt/local/share/java/xqjapi.jar
210+\endcode
211+
212+Compile and run your files as usual:
213+
214+\code
215+javac -cp $CLASSPATH Test.java
216+java -cp $CLASSPATH:. Test
217+\endcode
218+
219+A simple source on how to use it in code:
220+
221+\code
222+import javax.xml.xquery.*;
223+import org.zorbaxquery.api.xqj.*;
224+
225+class Test
226+{
227+ static
228+ {
229+ System.loadLibrary ( "zorba_api" );
230+ }
231+
232+ public static void main(String[] args) throws XQException
233+ {
234+ System.out.println("Test Zorba");
235+
236+ ZorbaXQDataSource xqds = new ZorbaXQDataSource();
237+ XQConnection xqc = xqds.getConnection();
238+ XQExpression xqe = xqc.createExpression();
239+ XQResultSequence result = xqe.executeQuery("1+2");
240+
241+ while (result.next()) {
242+ // Print the current item in the sequence
243+ System.out.println("> " + result.getItemAsString(null));
244+ }
245+
246+ xqc.close();
247+ }
248+}
249+\endcode
250+
251+A 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>.
252+
253+*/
254
255=== modified file 'swig/ruby/CMakeLists.txt'
256--- swig/ruby/CMakeLists.txt 2013-09-21 00:39:52 +0000
257+++ swig/ruby/CMakeLists.txt 2013-10-14 22:35:48 +0000
258@@ -12,7 +12,7 @@
259 # See the License for the specific language governing permissions and
260 # limitations under the License.
261 IF(APPLE)
262-CMAKE_FIND_FRAMEWORKS ( Ruby )
263+ CMAKE_FIND_FRAMEWORKS ( Ruby )
264 ENDIF(APPLE)
265 FIND_PACKAGE(Ruby)
266
267@@ -33,10 +33,17 @@
268 # apparently doesn't allow CMake's RPATH-rewriting magic to work.
269 GET_TARGET_PROPERTY(_rpath zorba_simplestore LOCATION)
270 GET_FILENAME_COMPONENT(_rpath "${_rpath}" PATH)
271- SET_TARGET_PROPERTIES(zorba_api PROPERTIES
272- INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath}"
273- BUILD_WITH_INSTALL_RPATH ON
274- OUTPUT_NAME "${ZORBA_SWIG_LIB_PREFIX}zorba_api")
275+ IF (APPLE)
276+ SET_TARGET_PROPERTIES(zorba_api PROPERTIES
277+ INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath}"
278+ BUILD_WITH_INSTALL_RPATH ON
279+ OUTPUT_NAME "zorba_api")
280+ ELSE (APPLE)
281+ SET_TARGET_PROPERTIES(zorba_api PROPERTIES
282+ INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath}"
283+ BUILD_WITH_INSTALL_RPATH ON
284+ OUTPUT_NAME "${ZORBA_SWIG_LIB_PREFIX}zorba_api")
285+ ENDIF (APPLE)
286 ENDIF (WIN32)
287
288 IF ( APPLE )
289@@ -60,7 +67,7 @@
290 SET (RUBY_SITEARCH_DIR "${CMAKE_INSTALL_PREFIX}/share/ruby")
291
292 IF ( APPLE )
293- INSTALL ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}zorba_api_ruby.bundle
294+ INSTALL ( FILES ${CMAKE_CURRENT_BINARY_DIR}/zorba_api_ruby.bundle
295 DESTINATION ${RUBY_SITEARCH_DIR} )
296 ELSE ( APPLE )
297 IF ( LINUX )

Subscribers

People subscribed via source and target branches