[libgsystem] Rework to be an installed library
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsystem] Rework to be an installed library
- Date: Thu, 6 Feb 2014 09:13:44 +0000 (UTC)
commit 9363cfc28ede912e2f06d4ccb42a646bb8a4bd2e
Author: Colin Walters <walters verbum org>
Date: Wed Feb 5 06:58:51 2014 -0500
Rework to be an installed library
See https://mail.gnome.org/archives/desktop-devel-list/2014-February/msg00028.html
Makefile-decls.am | 50 +++++++++++++++
Makefile-libgsystem.am | 64 ++++++++++++-------
Makefile.am | 34 ++++++++++
Makefile.dist-packaging | 39 +++++++++++
autogen.sh | 34 ++++++++++
configure.ac | 67 ++++++++++++++++++++
packaging/libgsystem.spec.in | 62 ++++++++++++++++++
packaging/rpmbuild-cwd | 11 +++
gsystem-console.c => src/gsystem-console.c | 0
gsystem-console.h => src/gsystem-console.h | 0
gsystem-file-utils.c => src/gsystem-file-utils.c | 0
gsystem-file-utils.h => src/gsystem-file-utils.h | 1 +
gsystem-glib-compat.h => src/gsystem-glib-compat.h | 0
gsystem-local-alloc.c => src/gsystem-local-alloc.c | 0
gsystem-local-alloc.h => src/gsystem-local-alloc.h | 0
gsystem-log.c => src/gsystem-log.c | 0
gsystem-log.h => src/gsystem-log.h | 0
gsystem-shutil.c => src/gsystem-shutil.c | 0
gsystem-shutil.h => src/gsystem-shutil.h | 0
.../gsystem-subprocess-context-private.h | 0
.../gsystem-subprocess-context.c | 0
.../gsystem-subprocess-context.h | 0
gsystem-subprocess.c => src/gsystem-subprocess.c | 0
gsystem-subprocess.h => src/gsystem-subprocess.h | 0
libgsystem.h => src/libgsystem.h | 0
src/libgsystem.pc.in | 11 +++
26 files changed, 351 insertions(+), 22 deletions(-)
---
diff --git a/Makefile-decls.am b/Makefile-decls.am
new file mode 100644
index 0000000..a57466c
--- /dev/null
+++ b/Makefile-decls.am
@@ -0,0 +1,50 @@
+# Copyright (C) 2011,2014 Colin Walters <walters verbum org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Common variables
+AM_CPPFLAGS =
+AM_CFLAGS =
+DISTCHECK_CONFIGURE_FLAGS =
+SUBDIRS =
+NULL =
+BUILT_SOURCES =
+MANPAGES =
+CLEANFILES =
+EXTRA_DIST =
+bin_PROGRAMS =
+sbin_PROGRAMS =
+bin_SCRIPTS =
+lib_LTLIBRARIES =
+libexec_PROGRAMS =
+noinst_LTLIBRARIES =
+noinst_PROGRAMS =
+privlibdir = $(pkglibdir)
+privlib_LTLIBRARIES =
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA =
+INTROSPECTION_GIRS =
+girdir = $(datadir)/gir-1.0
+gir_DATA =
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA =
+gsettings_SCHEMAS =
+# git.mk
+GITIGNOREFILES =
+
+# This is a special facility to chain together hooks easily
+INSTALL_DATA_HOOKS =
+install-data-hook: $(INSTALL_DATA_HOOKS)
diff --git a/Makefile-libgsystem.am b/Makefile-libgsystem.am
index 092522c..b75d517 100644
--- a/Makefile-libgsystem.am
+++ b/Makefile-libgsystem.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Colin Walters <walters verbum org>
+# Copyright (C) 2012,2014 Colin Walters <walters verbum org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -15,28 +15,48 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-EXTRA_DIST += $(libgsystem_srcpath)/README $(libgsystem_srcpath)/COPYING
+lib_LTLIBRARIES += libgsystem.la
+
+libgsystemheaderdir = $(includedir)/libgsystem
+libgsystemheader_HEADERS = \
+ src/gsystem-local-alloc.h \
+ src/gsystem-console.h \
+ src/gsystem-file-utils.h \
+ src/gsystem-glib-compat.h \
+ src/gsystem-shutil.h \
+ src/gsystem-log.h \
+ src/gsystem-subprocess-context.h \
+ src/gsystem-subprocess.h \
+ src/libgsystem.h \
+ $(NULL)
libgsystem_la_SOURCES = \
- $(libgsystem_srcpath)/gsystem-local-alloc.h \
- $(libgsystem_srcpath)/gsystem-local-alloc.c \
- $(libgsystem_srcpath)/gsystem-console.h \
- $(libgsystem_srcpath)/gsystem-console.c \
- $(libgsystem_srcpath)/gsystem-file-utils.h \
- $(libgsystem_srcpath)/gsystem-file-utils.c \
- $(libgsystem_srcpath)/gsystem-glib-compat.h \
- $(libgsystem_srcpath)/gsystem-shutil.h \
- $(libgsystem_srcpath)/gsystem-shutil.c \
- $(libgsystem_srcpath)/gsystem-log.h \
- $(libgsystem_srcpath)/gsystem-log.c \
- $(libgsystem_srcpath)/gsystem-subprocess-context.h \
- $(libgsystem_srcpath)/gsystem-subprocess-context-private.h \
- $(libgsystem_srcpath)/gsystem-subprocess-context.c \
- $(libgsystem_srcpath)/gsystem-subprocess.h \
- $(libgsystem_srcpath)/gsystem-subprocess.c \
- $(libgsystem_srcpath)/libgsystem.h \
+ src/gsystem-local-alloc.c \
+ src/gsystem-console.c \
+ src/gsystem-file-utils.c \
+ src/gsystem-shutil.c \
+ src/gsystem-log.c \
+ src/gsystem-subprocess-context-private.h \
+ src/gsystem-subprocess-context.c \
+ src/gsystem-subprocess.c \
$(NULL)
-libgsystem_la_CFLAGS = $(AM_CFLAGS) $(libgsystem_cflags)
-libgsystem_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^gs_" -no-undefined
-export-dynamic
-libgsystem_la_LIBADD = $(libgsystem_libs)
+libgsystem_la_CFLAGS = $(AM_CFLAGS) $(BUILDDEP_GIO_UNIX_CFLAGS) $(BUILDDEP_SYSTEMD_JOURNAL_CFLAGS)
-I$(srcdir)/src -DGSYSTEM_CONFIG_XATTRS
+libgsystem_la_LDFLAGS = -version-info 0:0:0 -Bsymbolic-functions -export-symbols-regex "^gs_" -no-undefined
-export-dynamic
+libgsystem_la_LIBADD = $(BUILDDEP_GIO_UNIX_LIBS) $(BUILDDEP_SYSTEMD_JOURNAL_LIBS)
+
+pkgconfig_DATA += src/libgsystem.pc
+
+if BUILDOPT_INTROSPECTION
+GSystem-1.0.gir: libgsystem.la Makefile
+GSystem_1_0_gir_EXPORT_PACKAGES = libgsystem
+GSystem_1_0_gir_INCLUDES = Gio-2.0
+GSystem_1_0_gir_CFLAGS = $(libgsystem_la_CFLAGS)
+GSystem_1_0_gir_LIBS = libgsystem.la
+GSystem_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=GS --symbol-prefix=gs
+GSystem_1_0_gir_FILES = $(libgsystemheader_HEADERS) $(filter-out %-private.h,$(libgsystem_la_SOURCES))
+INTROSPECTION_GIRS += GSystem-1.0.gir
+gir_DATA += GSystem-1.0.gir
+typelib_DATA += GSystem-1.0.typelib
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..472fbc1
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,34 @@
+# Copyright (C) 2011,2014 Colin Walters <walters verbum org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+include Makefile-decls.am
+
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
+ -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_34 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_34
+AM_CFLAGS += $(WARN_CFLAGS)
+DISTCHECK_CONFIGURE_FLAGS += --enable-gtk-doc --disable-maintainer-mode
+
+SUBDIRS += .
+
+EXTRA_DIST += autogen.sh COPYING README
+
+if BUILDOPT_INTROSPECTION
+include $(INTROSPECTION_MAKEFILE)
+endif
+
+include Makefile-libgsystem.am
diff --git a/Makefile.dist-packaging b/Makefile.dist-packaging
new file mode 100644
index 0000000..75a52f6
--- /dev/null
+++ b/Makefile.dist-packaging
@@ -0,0 +1,39 @@
+# -*- mode: Makefile -*-
+
+GITREV = $$(git describe --always --tags)
+GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')
+
+srcdir=$(shell pwd)
+PACKAGE=$(shell basename $(srcdir))
+
+PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
+
+dist-snapshot:
+ set -x; \
+ echo "PACKAGE=$(PACKAGE)"; \
+ TARFILE_TMP=$(PKG_VER).tar.tmp; \
+ echo "Archiving $(PACKAGE) at $(GITREV)"; \
+ (cd $(srcdir); git archive --format=tar --prefix=$(PKG_VER)/ $(GITREV)) > $${TARFILE_TMP}; \
+ (cd $$(git rev-parse --show-toplevel); git submodule status) | while read line; do \
+ rev=$$(echo $$line | cut -f 1 -d ' '); path=$$(echo $$line | cut -f 2 -d ' '); \
+ echo "Archiving $${path} at $${rev}"; \
+ (cd $(srcdir)/$$path; git archive --format=tar --prefix=$(PKG_VER)/$$path/ $${rev}) >
submodule.tar; \
+ tar -A -f $${TARFILE_TMP} submodule.tar; \
+ rm submodule.tar; \
+ done; \
+ mv $(PKG_VER).tar{.tmp,}; \
+ rm -f $(PKG_VER).tar.xz; \
+ xz $(PKG_VER).tar
+
+srpm: dist-snapshot
+ (cd $(srcdir)/packaging; \
+ cp ../$(PKG_VER).tar.xz . ; \
+ sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > $(PACKAGE).spec; \
+ ./rpmbuild-cwd -bs $(PACKAGE).spec)
+
+rpm: srpm
+ $(srcdir)/packaging/rpmbuild-cwd --rebuild packaging/$(PKG_VER)*.src.rpm
+
+buildinstall: rpm
+ sudo yum localinstall $(PKG_VER)*.src.rpm
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..fe690e9
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+
+olddir=`pwd`
+cd $srcdir
+
+AUTORECONF=`which autoreconf`
+if test -z $AUTORECONF; then
+ echo "*** No autoreconf found, please intall it ***"
+ exit 1
+fi
+
+set -e
+
+mkdir -p m4
+
+GTKDOCIZE=$(which gtkdocize 2>/dev/null)
+if test -z $GTKDOCIZE; then
+ echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation."
+ rm -f gtk-doc.make
+ cat > gtk-doc.make <<EOF
+EXTRA_DIST =
+CLEANFILES =
+EOF
+else
+ gtkdocize || exit $?
+fi
+
+autoreconf --force --install --verbose
+
+cd $olddir
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..c2e435a
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,67 @@
+AC_PREREQ([2.63])
+AC_INIT([libgsystem], [2014.1], [walters verbum org])
+AC_CONFIG_HEADER([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([build-aux])
+
+AM_INIT_AUTOMAKE([1.11 -Wno-portability foreign no-define tar-ustar no-dist-gzip dist-xz])
+AM_MAINTAINER_MODE([enable])
+AM_SILENT_RULES([yes])
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+
+AC_PROG_CC
+AM_PROG_CC_C_O
+
+changequote(,)dnl
+if test "x$GCC" = "xyes"; then
+ WARN_CFLAGS="-Wall -Wstrict-prototypes -Werror=missing-prototypes \
+ -Werror=implicit-function-declaration \
+ -Werror=pointer-arith -Werror=init-self -Werror=format=2 \
+ -Werror=format-security \
+ -Werror=missing-include-dirs -Werror=aggregate-return \
+ -Werror=declaration-after-statement"
+fi
+changequote([,])dnl
+AC_SUBST(WARN_CFLAGS)
+
+# Initialize libtool
+LT_PREREQ([2.2.4])
+LT_INIT([disable-static])
+
+AC_CHECK_HEADER([attr/xattr.h],,[AC_MSG_ERROR([You must have attr/xattr.h from libattr])])
+
+PKG_PROG_PKG_CONFIG
+
+GIO_DEPENDENCY="gio-unix-2.0 >= 2.34.0"
+PKG_CHECK_MODULES(BUILDDEP_GIO_UNIX, $GIO_DEPENDENCY)
+
+GTK_DOC_CHECK([1.15], [--flavour no-tmpl])
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+
+m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
+ GOBJECT_INTROSPECTION_CHECK([1.34.0])
+])
+AM_CONDITIONAL(BUILDOPT_INTROSPECTION, test "x$found_introspection" = xyes)
+
+AC_ARG_WITH(systemd-journal,
+ AS_HELP_STRING([--without-systemd-journal], [Use systemd journal @<:@default=auto@:>@]),
+ [], [with_systemd_journal=auto])
+AS_IF([test x$with_systemd_journal != xno], [
+ PKG_CHECK_MODULES([SYSTEMD_JOURNAL], [libsystemd-journal >= 200], have_systemd_journal=yes,
have_systemd_journal=no)
+ ])
+AM_CONDITIONAL(ENABLE_SYSTEMD_JOURNAL, test x$have_systemd_journal = xyes)
+
+AC_CONFIG_FILES([
+Makefile
+src/libgsystem.pc
+])
+AC_OUTPUT
+
+echo "
+ libgsystem $VERSION
+ ====================
+
+ introspection: $found_introspection
+ systemd journal: $have_systemd_journal
+"
diff --git a/packaging/libgsystem.spec.in b/packaging/libgsystem.spec.in
new file mode 100644
index 0000000..3284784
--- /dev/null
+++ b/packaging/libgsystem.spec.in
@@ -0,0 +1,62 @@
+Summary: GIO-based library with Unix/Linux specific API
+Name: libgsystem
+Version: 2014.1
+Release: 1%{?dist}
+#VCS: git:git://git.gnome.org/libgsystem
+Source0: http://ftp.gnome.org/pub/GNOME/sources/libgsystem/%{version}/libgsystem-%{version}.tar.xz
+License: LGPLv2+
+URL: https://wiki.gnome.org/Projects/LibGSystem
+
+# We always run autogen.sh
+BuildRequires: autoconf automake libtool
+# For docs
+BuildRequires: gtk-doc
+# Core requirements
+BuildRequires: pkgconfig(gio-unix-2.0)
+BuildRequires: libattr-devel
+BuildRequires: /usr/bin/g-ir-scanner
+
+%description
+LibGSystem is a GIO-based library usable as a "git submodule",
+targeted primarily for use by operating system components.
+
+%package devel
+Summary: Development headers for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+The %{name}-devel package includes the header files for the %{name} library.
+
+%prep
+%autosetup
+
+%build
+env NOCONFIGURE=1 ./autogen.sh
+%configure --disable-silent-rules \
+ --enable-gtk-doc
+make %{?_smp_mflags}
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p -c"
+find $RPM_BUILD_ROOT -name '*.la' -delete
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%doc COPYING README
+%{_libdir}/*.so.*
+%{_libdir}/girepository-1.0/*.typelib
+
+%files devel
+%{_libdir}/lib*.so
+%{_includedir}/*
+%{_libdir}/pkgconfig/*
+%{_datadir}/gir-1.0/*.gir
diff --git a/packaging/rpmbuild-cwd b/packaging/rpmbuild-cwd
new file mode 100755
index 0000000..d0805bb
--- /dev/null
+++ b/packaging/rpmbuild-cwd
@@ -0,0 +1,11 @@
+#!/bin/sh
+# rpmbuild-cwd:
+# Run "rpmbuild", defining all RPM variables to use the current directory.
+# This matches Fedora's system.
+#
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+# Copyright (C) 2010 Red Hat, Inc.
+# Written by Colin Walters <walters verbum org>
+
+pwd=$(pwd)
+exec rpmbuild --define "_sourcedir ${pwd}" --define "_specdir ${pwd}" --define "_builddir ${pwd}" --define
"_srcrpmdir ${pwd}" --define "_rpmdir ${pwd}" --define "_buildrootdir ${pwd}/.build" "$@"
diff --git a/gsystem-console.c b/src/gsystem-console.c
similarity index 100%
rename from gsystem-console.c
rename to src/gsystem-console.c
diff --git a/gsystem-console.h b/src/gsystem-console.h
similarity index 100%
rename from gsystem-console.h
rename to src/gsystem-console.h
diff --git a/gsystem-file-utils.c b/src/gsystem-file-utils.c
similarity index 100%
rename from gsystem-file-utils.c
rename to src/gsystem-file-utils.c
diff --git a/gsystem-file-utils.h b/src/gsystem-file-utils.h
similarity index 99%
rename from gsystem-file-utils.h
rename to src/gsystem-file-utils.h
index 021aebb..deb0a48 100644
--- a/gsystem-file-utils.h
+++ b/src/gsystem-file-utils.h
@@ -167,6 +167,7 @@ gboolean gs_file_set_all_xattrs (GFile *file,
GCancellable *cancellable,
GError **error);
+
G_END_DECLS
#endif
diff --git a/gsystem-glib-compat.h b/src/gsystem-glib-compat.h
similarity index 100%
rename from gsystem-glib-compat.h
rename to src/gsystem-glib-compat.h
diff --git a/gsystem-local-alloc.c b/src/gsystem-local-alloc.c
similarity index 100%
rename from gsystem-local-alloc.c
rename to src/gsystem-local-alloc.c
diff --git a/gsystem-local-alloc.h b/src/gsystem-local-alloc.h
similarity index 100%
rename from gsystem-local-alloc.h
rename to src/gsystem-local-alloc.h
diff --git a/gsystem-log.c b/src/gsystem-log.c
similarity index 100%
rename from gsystem-log.c
rename to src/gsystem-log.c
diff --git a/gsystem-log.h b/src/gsystem-log.h
similarity index 100%
rename from gsystem-log.h
rename to src/gsystem-log.h
diff --git a/gsystem-shutil.c b/src/gsystem-shutil.c
similarity index 100%
rename from gsystem-shutil.c
rename to src/gsystem-shutil.c
diff --git a/gsystem-shutil.h b/src/gsystem-shutil.h
similarity index 100%
rename from gsystem-shutil.h
rename to src/gsystem-shutil.h
diff --git a/gsystem-subprocess-context-private.h b/src/gsystem-subprocess-context-private.h
similarity index 100%
rename from gsystem-subprocess-context-private.h
rename to src/gsystem-subprocess-context-private.h
diff --git a/gsystem-subprocess-context.c b/src/gsystem-subprocess-context.c
similarity index 100%
rename from gsystem-subprocess-context.c
rename to src/gsystem-subprocess-context.c
diff --git a/gsystem-subprocess-context.h b/src/gsystem-subprocess-context.h
similarity index 100%
rename from gsystem-subprocess-context.h
rename to src/gsystem-subprocess-context.h
diff --git a/gsystem-subprocess.c b/src/gsystem-subprocess.c
similarity index 100%
rename from gsystem-subprocess.c
rename to src/gsystem-subprocess.c
diff --git a/gsystem-subprocess.h b/src/gsystem-subprocess.h
similarity index 100%
rename from gsystem-subprocess.h
rename to src/gsystem-subprocess.h
diff --git a/libgsystem.h b/src/libgsystem.h
similarity index 100%
rename from libgsystem.h
rename to src/libgsystem.h
diff --git a/src/libgsystem.pc.in b/src/libgsystem.pc.in
new file mode 100644
index 0000000..abf8575
--- /dev/null
+++ b/src/libgsystem.pc.in
@@ -0,0 +1,11 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: libgsystem
+Description: https://live.gnome.org/Projects/libgsystem
+Version: @VERSION@
+Requires: gio-unix-2.0
+Libs: -L${libdir} -lgsystem
+Cflags: -I${includedir}/libgsystem
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]