Skip to content

Commit

Permalink
ARROW-631: [GLib] Import
Browse files Browse the repository at this point in the history
See also https://issues.apache.org/jira/browse/ARROW-631 and `glib/README.md` in this change.

Author: Kouhei Sutou <[email protected]>

Closes apache#382 from kou/glib-import and squashes the following commits:

67a5d24 [Kouhei Sutou] [GLib] Rename directory to c_glib/ from glib/
24cd605 [Kouhei Sutou] [GLib] Import
  • Loading branch information
kou authored and wesm committed Mar 17, 2017
1 parent c13d671 commit 39c7274
Show file tree
Hide file tree
Showing 246 changed files with 18,251 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ addons:
- libboost-filesystem-dev
- libboost-system-dev
- libjemalloc-dev
- gtk-doc-tools
- autoconf-archive
- libgirepository1.0-dev

matrix:
fast_finish: true
Expand All @@ -30,9 +33,11 @@ matrix:
- export CC="gcc-4.9"
- export CXX="g++-4.9"
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
- $TRAVIS_BUILD_DIR/ci/travis_before_script_c_glib.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
- $TRAVIS_BUILD_DIR/ci/travis_script_python.sh
- $TRAVIS_BUILD_DIR/ci/travis_script_c_glib.sh
- compiler: clang
osx_image: xcode6.4
os: osx
Expand Down
44 changes: 44 additions & 0 deletions c_glib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Makefile
Makefile.in
.deps/
.libs/
*.gir
*.typelib
*.o
*.lo
*.la
*~
/*.tar.gz
/aclocal.m4
/autom4te.cache/
/config.h
/config.h.in
/config.log
/config.status
/config/
/configure
/doc/reference/*.txt
/doc/reference/*.txt.bak
/doc/reference/*.args
/doc/reference/*.hierarchy
/doc/reference/*.interfaces
/doc/reference/*.prerequisites
/doc/reference/*.signals
/doc/reference/*.types
/doc/reference/gtk-doc.make
/doc/reference/*.stamp
/doc/reference/html/
/doc/reference/xml/
/libtool
/m4/
/stamp-h1
/version
/arrow-glib/enums.c
/arrow-glib/enums.h
/arrow-glib/io-enums.c
/arrow-glib/io-enums.h
/arrow-glib/ipc-enums.c
/arrow-glib/ipc-enums.h
/arrow-glib/stamp-*
/arrow-glib/*.pc
/example/build
26 changes: 26 additions & 0 deletions c_glib/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}

SUBDIRS = \
arrow-glib \
doc \
example

EXTRA_DIST = \
version
114 changes: 114 additions & 0 deletions c_glib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!---
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->

# Arrow GLib

Arrow GLib is a wrapper library for Arrow C++. Arrow GLib provides C
API.

Arrow GLib supports
[GObject Introspection](https://wiki.gnome.org/action/show/Projects/GObjectIntrospection).
It means that you can create language bindings at runtime or compile time.

For example, you can use Apache Arrow from Ruby by Arrow GLib and
[gobject-introspection gem](https://rubygems.org/gems/gobject-introspection)
with the following code:

```ruby
# Generate bindings at runtime
require "gi"
Arrow = GI.load("Arrow")

# Now, you can access arrow::BooleanArray in Arrow C++ by
# Arrow::BooleanArray
p Arrow::BooleanArray
```

In Ruby case, you should use
[red-arrow gem](https://rubygems.org/gems/red-arrow). It's based on
gobject-introspection gem. It adds many convenient features to raw
gobject-introspection gem based bindings.

## Install

### Package

TODO

### Build

You need to install Arrow C++ before you install Arrow GLib. See Arrow
C++ document about how to install Arrow C++.

You need [GTK-Doc](https://www.gtk.org/gtk-doc/) and
[GObject Introspection](https://wiki.gnome.org/action/show/Projects/GObjectIntrospection)
to build Arrow GLib. You can install them by the followings:

On Debian GNU/Linux or Ubuntu:

```text
% sudo apt install -y -V gtk-doc-tools libgirepository1.0-dev
```

On CentOS 7 or later:

```text
% sudo yum install -y gtk-doc gobject-introspection-devel
```

On macOS with [Homebrew](https://brew.sh/):

```text
% brew install -y gtk-doc gobject-introspection
```

Now, you can build Arrow GLib:

```text
% cd glib
% ./configure --enable-gtk-doc
% make
% sudo make install
```

## Usage

You can use Arrow GLib with C or other languages. If you use Arrow
GLib with C, you use C API. If you use Arrow GLib with other
languages, you use GObject Introspection based bindings.

### C

You can find API reference in the
`/usr/local/share/gtk-doc/html/arrow-glib/` directory. If you specify
`--prefix` to `configure`, the directory will be different.

You can find example codes in the `example/` directory.

### Language bindings

You can use Arrow GLib with non C languages with GObject Introspection
based bindings. Here are languages that support GObject Introspection:

* Ruby: [red-arrow gem](https://rubygems.org/gems/red-arrow) should be used.

* Python: [PyGObject](https://wiki.gnome.org/Projects/PyGObject) should be used. (Note that you should use PyArrow than Arrow GLib.)

* Lua: [LGI](https://github.com/pavouk/lgi) should be used.

* Go: [Go-gir-generator](https://github.com/linuxdeepin/go-gir-generator) should be used.

See also
[Projects/GObjectIntrospection/Users - GNOME Wiki!](https://wiki.gnome.org/Projects/GObjectIntrospection/Users)
for other languages.
Loading

0 comments on commit 39c7274

Please sign in to comment.