Skip to content

Commit

Permalink
Get rid of GObject and GLib
Browse files Browse the repository at this point in the history
  • Loading branch information
vpodzime committed Feb 26, 2016
1 parent ceaaa6a commit ed33718
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 432 deletions.
14 changes: 2 additions & 12 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,7 @@ AC_CONFIG_FILES([Makefile src/Makefile src/bytesize.pc \
docs/Makefile docs/libbytesize-docs.xml \
tests/Makefile])

LIBBYTESIZE_PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.42.2])
LIBBYTESIZE_PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.42.2])

m4_ifdef([GOBJECT_INTROSPECTION_CHECK],
[GOBJECT_INTROSPECTION_CHECK([1.3.0])],
[found_introspection=no
AM_CONDITIONAL(HAVE_INTROSPECTION, false)])

# Complain if introspection was not enabled
AS_IF([test "x$found_introspection" = xyes], [:],
[LIBBYTESIZE_SOFT_FAILURE([GObject introspection must be enabled])])
LIBBYTESIZE_PKG_CHECK_MODULES([PCRE], [libpcre >= 8.38])

AC_PATH_PROG([PYTHON3], [python3], [no])
AS_IF([test "x$PYTHON3" == "xno"], [LIBBYTESIZE_SOFT_FAILURE([\
Expand All @@ -49,7 +39,7 @@ AC_SUBST(py3execdir, $PYTHON3_EXECDIR)

AC_CHECK_LIB(gmp, __gmpz_init)

AC_CHECK_HEADERS([langinfo.h gmp.h mpfr.h],
AC_CHECK_HEADERS([langinfo.h gmp.h mpfr.h stdint.h stdbool.h stdarg.h string.h stdio.h ctype.h],
[],
[LIBBYTESIZE_SOFT_FAILURE([Header file $ac_header not found.])],
[])
Expand Down
10 changes: 1 addition & 9 deletions dist/libbytesize.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ Source0: https://github.com/rhinstaller/libbytesize/archive/%{name}-%{versio

%define realname bytesize

BuildRequires: glib2-devel
BuildRequires: gobject-introspection-devel
BuildRequires: gmp-devel
BuildRequires: mpfr-devel
BuildRequires: pcre-devel
BuildRequires: gettext-devel
BuildRequires: python-devel
BuildRequires: python3-devel
BuildRequires: gtk-doc
BuildRequires: glib2-doc

Requires: gobject-introspection

%description
The libbytesize is a C library with GObject introspection support that
Expand All @@ -30,8 +26,6 @@ MAXUINT64.
%package devel
Summary: Development files for libbytesize
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: glib2-devel
Requires: gobject-introspection-devel

%description devel
This package contains header files and pkg-config files needed for development
Expand Down Expand Up @@ -78,15 +72,13 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%{!?_licensedir:%global license %%doc}
%license LICENSE
%{_libdir}/libbytesize.so.*
%{_libdir}/girepository*/ByteSize*.typelib

%files devel
%{_libdir}/libbytesize.so
%dir %{_includedir}/bytesize
%{_includedir}/bytesize/bs_size.h
%{_libdir}/pkgconfig/bytesize.pc
%{_datadir}/gtk-doc/html/libbytesize
%{_datadir}/gir*/ByteSize*.gir

%files -n python-%{realname}
%{python2_sitearch}/gi/overrides/*
Expand Down
24 changes: 7 additions & 17 deletions docs/libbytesize-docs.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,16 @@

<chapter>
<title>libbytesize Reference Manual</title>
<xi:include href="xml/size.xml"/>
<xi:include href="xml/bs_size.xml"/>
</chapter>
<chapter>
<title>GI Overrides</title>
<title>Bindings</title>
<para>
The libbytesize library supports <emphasis>GObject
introspection</emphasis> and thus can be used from a variety of
languages. To make such use even easier and to make the code using
libbytesize from different languages than C feel more natural the library
also provides so-called <emphasis>overrides</emphasis> &mdash; pieces of
code that usually wrap the original libbytesize objects and functions with
language-native objects that provide language-specific features like
default values for parameters etc.
</para>
<para>
The overrides are not documented here (yet), but it should be easy to directly check
the sources for anybody who understands their language of choice. The overrides are
located in the <filename class="directory">src/LANG_NAME</filename> directory in the
source tree. The only language that libbytesize provides overrides for right now is
Python (under the <filename class="directory">src/python</filename> directory).
Currently there are only Python bindings (working with both Python 2 and
Python 3). The bindings are not documented here (yet), but it should be
easy to directly check the sources. The bindings are located in the
<filename class="directory">src/python</filename> directory in the source
tree.
</para>
</chapter>
<index id="api-index-full">
Expand Down
20 changes: 6 additions & 14 deletions docs/libbytesize-sections.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<SECTION>
<FILE>size</FILE>
BS_SIZE_ERROR
BSSizeError
<FILE>bs_size</FILE>
BSSize
BSErrorCode
BSError
BSBunit
BSDunit
BSRoundDir
Expand All @@ -11,6 +12,8 @@ bs_size_new
bs_size_new_from_bytes
bs_size_new_from_str
bs_size_new_from_size
bs_size_free
bs_clear_error
bs_size_get_bytes
bs_size_sgn
bs_size_get_bytes_str
Expand All @@ -37,15 +40,4 @@ bs_size_mod
bs_size_round_to_nearest
bs_size_cmp
bs_size_cmp_bytes
<SUBSECTION Standard>
BSSize
BSSizeClass
BSSizePrivate
BS_IS_SIZE
BS_IS_SIZE_CLASS
BS_SIZE
BS_SIZE_CLASS
BS_SIZE_GET_CLASS
BS_TYPE_SIZE
bs_size_get_type
</SECTION>
33 changes: 4 additions & 29 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,44 +1,19 @@
-include $(INTROSPECTION_MAKEFILE)

AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -DDEFAULT_TEXT_DOMAIN=\"libbytesize\"
LDADD = $(LIBINTL)

lib_LTLIBRARIES = libbytesize.la
libbytesize_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall -Wextra -Werror -Wno-overflow
libbytesize_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) -lgmp -lmpfr
libbytesize_la_LDFLAGS = -version-info 0:0:0
libbytesize_la_CFLAGS = -Wall -Wextra -Werror -Wno-overflow -D_GNU_SOURCE
libbytesize_la_LIBADD = -lgmp -lmpfr -lpcre
libbytesize_la_LDFLAGS = -version-info 1:0:0
libbytesize_la_SOURCES = bs_size.c bs_size.h gettext.h

noinst_dist_SOURCES = gettext.h

if HAVE_INTROSPECTION
GIHEADERS = ${srcdir}/bs_size.h
GISOURCES = ${srcdir}/bs_size.c
endif

ByteSize-1.0.gir: libbytesize.la

ByteSize_1_0_gir_FILES = $(GIHEADERS) $(GISOURCES)
ByteSize_1_0_gir_LIBS = libbytesize.la
ByteSize_1_0_gir_INCLUDES = GObject-2.0
ByteSize_1_0_gir_LDFLAGS = -lgmp
ByteSize_1_0_gir_SCANNERFLAGS = --warn-error --warn-all --identifier-prefix=BS --symbol-prefix=bs
ByteSize_1_0_gir_EXPORT_PACKAGES = bytesize

INTROSPECTION_GIRS = ByteSize-1.0.gir

typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)

girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)

libincludedir = $(includedir)/bytesize
libinclude_HEADERS = bs_size.h

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ${builddir}/bytesize.pc

SUBDIRS = python
CLEANFILES = $(INTROSPECTION_GIRS) $(typelib_DATA)
MAINTAINERCLEANFILES = Makefile.in
MAINTAINERCLEANFILES = Makefile.in bytesize.pc
Loading

0 comments on commit ed33718

Please sign in to comment.