From 1a4d989e220677124ba24617d38cda533ae1340f Mon Sep 17 00:00:00 2001 From: Ondrej Oprala Date: Mon, 17 Mar 2014 10:51:56 +0100 Subject: libsmartcols: add basic files Signed-off-by: Ondrej Oprala Signed-off-by: Karel Zak --- Makefile.am | 7 +++-- configure.ac | 25 ++++++++++++++++++ libsmartcols/Makemodule.am | 14 ++++++++++ libsmartcols/smartcols.pc.in | 10 +++++++ libsmartcols/src/.gitignore | 1 + libsmartcols/src/Makemodule.am | 53 ++++++++++++++++++++++++++++++++++++++ libsmartcols/src/libsmartcols.h.in | 27 +++++++++++++++++++ libsmartcols/src/libsmartcols.sym | 9 +++++++ libsmartcols/src/smartcolsP.h | 27 +++++++++++++++++++ 9 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 libsmartcols/Makemodule.am create mode 100644 libsmartcols/smartcols.pc.in create mode 100644 libsmartcols/src/.gitignore create mode 100644 libsmartcols/src/Makemodule.am create mode 100644 libsmartcols/src/libsmartcols.h.in create mode 100644 libsmartcols/src/libsmartcols.sym create mode 100644 libsmartcols/src/smartcolsP.h diff --git a/Makefile.am b/Makefile.am index 151d483bf..2c19283d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,11 +17,13 @@ LDADD = $(LTLIBINTL) # Work the bug around until it is fixed: dist_noinst_DATA = $(dist_man_MANS) -# Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) -# Note that blkid.h and libmount.h are generated and stored in build dirs. +# Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) Note +# that blkid.h, libmount.h and libsmartcols.h are generated and stored in build +# dirs. # ul_libblkid_incdir = $(top_builddir)/libblkid/src ul_libmount_incdir = $(top_builddir)/libmount/src +ul_libsmartcols_incdir = $(top_builddir)/libsmartcols/src ul_libuuid_incdir = $(top_srcdir)/libuuid/src ul_libfdisk_incdir = $(top_srcdir)/libfdisk/src @@ -78,6 +80,7 @@ include libuuid/Makemodule.am include libblkid/Makemodule.am include libmount/Makemodule.am include libfdisk/Makemodule.am +include libsmartcols/Makemodule.am include schedutils/Makemodule.am include text-utils/Makemodule.am diff --git a/configure.ac b/configure.ac index f87d7fb5a..5e43dc145 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,13 @@ LIBMOUNT_LT_MINOR=1 LIBMOUNT_LT_MICRO=0 LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR +dnl libsmartcols version +LIBSMARTCOLS_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE" +LIBSMARTCOLS_LT_MAJOR=1 +LIBSMARTCOLS_LT_MINOR=1 +LIBSMARTCOLS_LT_MICRO=0 +LIBSMARTCOLS_VERSION_INFO=`expr $LIBSMARTCOLS_LT_MAJOR + $LIBSMARTCOLS_LT_MINOR`:$LIBSMARTCOLS_LT_MICRO:$LIBSMARTCOLS_LT_MINOR + # Check whether exec_prefix=/usr: AS_CASE([$exec_prefix:$prefix], [NONE:NONE | NONE:/usr | /usr:*], @@ -791,6 +798,23 @@ AC_SUBST([LIBMOUNT_VERSION_INFO]) AC_DEFINE_UNQUOTED([LIBMOUNT_VERSION], ["$LIBMOUNT_VERSION"], [libmount version string]) +dnl +dnl libsmartcols +dnl +AC_ARG_ENABLE([libsmartcols], + AS_HELP_STRING([--disable-libsmartcols], [do not build libsmartcols]), + [], [enable_libsmartcols=check] +) +UL_BUILD_INIT([libsmartcols]) +UL_REQUIRES_LINUX([libsmartcols]) +AM_CONDITIONAL([BUILD_LIBSMARTCOLS], [test "x$build_libsmartcols" = xyes]) +AM_CONDITIONAL([BUILD_LIBSMARTCOLS_TESTS], [test "x$build_libsmartcols" = xyes -a "x$enable_static" = xyes]) + +AC_SUBST([LIBSMARTCOLS_VERSION]) +AC_SUBST([LIBSMARTCOLS_VERSION_INFO]) +AC_DEFINE_UNQUOTED([LIBSMARTCOLS_VERSION], ["$LIBSMARTCOLS_VERSION"], [libsmartcols version string]) + + dnl dnl libfdisk is enabled all time if possible dnl @@ -1593,6 +1617,7 @@ libblkid/src/blkid.h libmount/docs/Makefile libmount/docs/version.xml libmount/src/libmount.h +libsmartcols/src/libsmartcols.h po/Makefile.in ]) diff --git a/libsmartcols/Makemodule.am b/libsmartcols/Makemodule.am new file mode 100644 index 000000000..ee9678633 --- /dev/null +++ b/libsmartcols/Makemodule.am @@ -0,0 +1,14 @@ +if BUILD_LIBSMARTCOLS + +include libsmartcols/src/Makemodule.am + +#if ENABLE_GTK_DOC +# Docs uses separate Makefiles +#SUBDIRS += libsmartcols/docs +#endif + +pkgconfig_DATA += libsmartcols/smartcols.pc +PATHFILES += libsmartcols/smartcols.pc +EXTRA_DIST += libsmartcols/COPYING + +endif # BUILD_LIBSMARTCOLS diff --git a/libsmartcols/smartcols.pc.in b/libsmartcols/smartcols.pc.in new file mode 100644 index 000000000..0b1673998 --- /dev/null +++ b/libsmartcols/smartcols.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@usrlib_execdir@ +includedir=@includedir@ + +Name: smartcols +Description: table or tree library +Version: @LIBSMARTCOLS_VERSION@ +Cflags: -I${includedir}/libsmartcols +Libs: -L${libdir} -lsmartcols diff --git a/libsmartcols/src/.gitignore b/libsmartcols/src/.gitignore new file mode 100644 index 000000000..b2a0c5e5a --- /dev/null +++ b/libsmartcols/src/.gitignore @@ -0,0 +1 @@ +libsmartcols.h diff --git a/libsmartcols/src/Makemodule.am b/libsmartcols/src/Makemodule.am new file mode 100644 index 000000000..f942b6789 --- /dev/null +++ b/libsmartcols/src/Makemodule.am @@ -0,0 +1,53 @@ + + +# smartcols.h is generated, so it's stored in builddir! +smartcolsincdir = $(includedir)/libsmartcols +nodist_smartcolsinc_HEADERS = $(top_builddir)/libsmartcols/src/libsmartcols.h + +usrlib_exec_LTLIBRARIES += libsmartcols.la +libsmartcols_la_SOURCES= \ + include/list.h \ + \ + libsmartcols/src/smartcolsP.h \ + $(smartcolsinc_HEADERS) + +nodist_libsmartcols_la_SOURCES = libsmartcols/src/smartcolsP.h + +libsmartcols_la_LIBADD = libcommon.la + +libsmartcols_la_CFLAGS = \ + $(SOLIB_CFLAGS) \ + -I$(ul_libsmartcols_incdir) \ + -I$(top_srcdir)/libsmartcols/src + +libsmartcols_la_DEPENDENCIES = \ + libsmartcols/src/libsmartcols.sym \ + libsmartcols/src/libsmartcols.h.in + +libsmartcols_la_LDFLAGS = \ + $(SOLIB_LDFLAGS) \ + -Wl,--version-script=$(top_srcdir)/libsmartcols/src/libsmartcols.sym \ + -version-info $(LIBSMARTCOLS_VERSION_INFO) + +EXTRA_DIST += \ + libsmartcols/src/libsmartcols.sym \ + libsmartcols/src/libsmartcols.h.in + + +# move lib from $(usrlib_execdir) to $(libdir) if needed +install-exec-hook-libsmartcols: + if test "$(usrlib_execdir)" != "$(libdir)"; then \ + mkdir -p $(DESTDIR)$(libdir); \ + mv $(DESTDIR)$(usrlib_execdir)/libsmartcols.so.* $(DESTDIR)$(libdir); \ + so_img_name=$$(readlink $(DESTDIR)$(usrlib_execdir)/libsmartcols.so); \ + so_img_rel_target=$$(echo $(usrlib_execdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + (cd $(DESTDIR)$(usrlib_execdir) && \ + rm -f libsmartcols.so && \ + $(LN_S) $$so_img_rel_target$(libdir)/$$so_img_name libsmartcols.so); \ + fi + +uninstall-hook-libsmartcols: + rm -f $(DESTDIR)$(libdir)/libsmartcols.so* + +INSTALL_EXEC_HOOKS += install-exec-hook-libsmartcols +UNINSTALL_HOOKS += uninstall-hook-libsmartcols diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in new file mode 100644 index 000000000..84bbb825f --- /dev/null +++ b/libsmartcols/src/libsmartcols.h.in @@ -0,0 +1,27 @@ +/* + * Prints table or tree. + * + * Copyright (C) 2014 Ondrej Oprala + * Copyright (C) 2014 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#ifndef _LIBSMARTCOLS_H +#define _LIBSMARTCOLS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define LIBSMARTCOLS_VERSION "@LIBSMARTCOLS_VERSION@" + + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBSMARTCOLS_H */ diff --git a/libsmartcols/src/libsmartcols.sym b/libsmartcols/src/libsmartcols.sym new file mode 100644 index 000000000..99e517c1d --- /dev/null +++ b/libsmartcols/src/libsmartcols.sym @@ -0,0 +1,9 @@ +/* + * symbols since util-linux 2.25 + */ +SMARTCOLS_2.25 { +global: + *; +local: + *; +}; diff --git a/libsmartcols/src/smartcolsP.h b/libsmartcols/src/smartcolsP.h new file mode 100644 index 000000000..fecf9e8c0 --- /dev/null +++ b/libsmartcols/src/smartcolsP.h @@ -0,0 +1,27 @@ +/* + * smartcolsP.h - private library header file + * + * Copyright (C) 2014 Ondrej Oprala + * Copyright (C) 2014 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#ifndef _LIBSMARTCOLS_PRIVATE_H +#define _LIBSMARTCOLS_PRIVATE_H + +#include "c.h" +#include "list.h" +#include "colors.h" +#include "libsmartcols.h" + +#define CONFIG_LIBSMARTCOLS_ASSERT + +#ifdef CONFIG_LIBSMARTCOLS_ASSERT +# include +#else +# define assert(x) +#endif + +#endif /* _LIBSMARTCOLS_PRIVATE_H */ -- cgit v1.2.3-55-g7522