diff --git a/c_glib/arrow-glib/Makefile.am b/c_glib/arrow-glib/Makefile.am index cde62cde080..4c22d11c76c 100644 --- a/c_glib/arrow-glib/Makefile.am +++ b/c_glib/arrow-glib/Makefile.am @@ -52,6 +52,7 @@ libarrow_glib_la_headers = \ data-type.h \ error.h \ field.h \ + gobject-type.h \ record-batch.h \ schema.h \ table.h \ diff --git a/c_glib/arrow-glib/arrow-glib.h b/c_glib/arrow-glib/arrow-glib.h index f15f16db9a3..47f324dc046 100644 --- a/c_glib/arrow-glib/arrow-glib.h +++ b/c_glib/arrow-glib/arrow-glib.h @@ -19,6 +19,8 @@ #pragma once +#include + #include #include #include diff --git a/c_glib/arrow-glib/compute.h b/c_glib/arrow-glib/compute.h index 4b944ad30d3..cdae5790e83 100644 --- a/c_glib/arrow-glib/compute.h +++ b/c_glib/arrow-glib/compute.h @@ -19,20 +19,16 @@ #pragma once -#include +#include G_BEGIN_DECLS #define GARROW_TYPE_CAST_OPTIONS (garrow_cast_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCastOptions, - garrow_cast_options, - GARROW, - CAST_OPTIONS, - GObject) -struct _GArrowCastOptionsClass -{ - GObjectClass parent_class; -}; +GARROW_DECLARE_TYPE(GArrowCastOptions, + garrow_cast_options, + GARROW, + CAST_OPTIONS, + GObject) GArrowCastOptions *garrow_cast_options_new(void); diff --git a/c_glib/arrow-glib/gobject-type.h b/c_glib/arrow-glib/gobject-type.h new file mode 100644 index 00000000000..a2f8397b941 --- /dev/null +++ b/c_glib/arrow-glib/gobject-type.h @@ -0,0 +1,97 @@ +/* + * 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. + */ + +#pragma once + +#include + +#ifdef G_DECLARE_DERIVABLE_TYPE +# define GARROW_DECLARE_TYPE(ObjectName, \ + object_name, \ + MODULE_NAME, \ + OBJECT_NAME, \ + ParentName) \ + G_DECLARE_DERIVABLE_TYPE(ObjectName, \ + object_name, \ + MODULE_NAME, \ + OBJECT_NAME, \ + ParentName) \ + struct _ ## ObjectName ## Class \ + { \ + ParentName ## Class parent_class; \ + }; +#else +# define GARROW_DECLARE_TYPE(ObjectName, \ + object_name, \ + MODULE_NAME, \ + OBJECT_NAME, \ + ParentName) \ + typedef struct _ ## ObjectName ObjectName; \ + typedef struct _ ## ObjectName ## Class ObjectName ## Class; \ + \ + struct _ ## ObjectName \ + { \ + ParentName parent_instance; \ + }; \ + \ + struct _ ## ObjectName ## Class \ + { \ + ParentName ## Class parent_class; \ + }; \ + \ + GType object_name ## _get_type(void) G_GNUC_CONST; \ + \ + static inline ObjectName * \ + MODULE_NAME ## _ ## OBJECT_NAME(gpointer object) \ + { \ + return G_TYPE_CHECK_INSTANCE_CAST(object, \ + object_name ## _get_type(), \ + ObjectName); \ + } \ + \ + static inline ObjectName ## Class * \ + MODULE_NAME ## _ ## OBJECT_NAME ## _CLASS(gpointer klass) \ + { \ + return G_TYPE_CHECK_CLASS_CAST(klass, \ + object_name ## _get_type(), \ + ObjectName ## Class); \ + } \ + \ + static inline gboolean \ + MODULE_NAME ## _IS_ ## OBJECT_NAME(gpointer object) \ + { \ + return G_TYPE_CHECK_INSTANCE_TYPE(object, \ + object_name ## _get_type()); \ + } \ + \ + static inline gboolean \ + MODULE_NAME ## _IS_ ## OBJECT_NAME ## _CLASS(gpointer klass) \ + { \ + return G_TYPE_CHECK_CLASS_TYPE(klass, \ + object_name ## _get_type()); \ + } \ + \ + static inline ObjectName ## Class * \ + MODULE_NAME ## _ ## ObjectName ## _GET_CLASS(gpointer object) \ + { \ + return G_TYPE_INSTANCE_GET_CLASS(object, \ + object_name ## _get_type(), \ + ObjectName ## Class); \ + } +#endif diff --git a/ci/travis_before_script_c_glib.sh b/ci/travis_before_script_c_glib.sh index 52bfe87eba7..7100946d76a 100755 --- a/ci/travis_before_script_c_glib.sh +++ b/ci/travis_before_script_c_glib.sh @@ -28,10 +28,6 @@ if [ $TRAVIS_OS_NAME == "osx" ]; then brew outdated || brew upgrade libtool export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/libffi/lib/pkgconfig -else - sudo apt-add-repository -y ppa:jonathonf/gtk3.18 - sudo apt-get update - sudo apt-get install -V -y libglib2.0-dev fi gem install test-unit gobject-introspection diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index 38680f429ed..9ebffdb6401 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -151,20 +151,6 @@ test_python() { test_glib() { - # Build and test GLib, requires GLib >= 2.44 , so install that - # here - GLIB_VERSION=glib-2.53.7 - GLIB_URL=https://gensho.ftp.acc.umu.se/pub/gnome/sources/glib/2.53/$GLIB_VERSION.tar.xz - curl -f -O $GLIB_URL - tar xf $GLIB_VERSION.tar.xz - pushd $GLIB_VERSION - - ./configure --disable-libelf --enable-libmount=no --prefix=$ARROW_HOME - make -j$NPROC - make install - - popd - pushd c_glib ./configure --prefix=$ARROW_HOME