]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: add basic files
authorOndrej Oprala <ooprala@redhat.com>
Mon, 17 Mar 2014 09:51:56 +0000 (10:51 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Apr 2014 10:29:15 +0000 (12:29 +0200)
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Makefile.am
configure.ac
libsmartcols/Makemodule.am [new file with mode: 0644]
libsmartcols/smartcols.pc.in [new file with mode: 0644]
libsmartcols/src/.gitignore [new file with mode: 0644]
libsmartcols/src/Makemodule.am [new file with mode: 0644]
libsmartcols/src/libsmartcols.h.in [new file with mode: 0644]
libsmartcols/src/libsmartcols.sym [new file with mode: 0644]
libsmartcols/src/smartcolsP.h [new file with mode: 0644]

index 151d483bf68d3bbbe914570c64f1cd1a415565fc..2c19283d7dd29f4550235f974fbd783f722cfcb8 100644 (file)
@@ -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
index f87d7fb5a2caa822bd5505b1facfd17a39bd4875..5e43dc145964c80a61920c1c47b211b4265ba195 100644 (file)
@@ -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 (file)
index 0000000..ee96786
--- /dev/null
@@ -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 (file)
index 0000000..0b16739
--- /dev/null
@@ -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 (file)
index 0000000..b2a0c5e
--- /dev/null
@@ -0,0 +1 @@
+libsmartcols.h
diff --git a/libsmartcols/src/Makemodule.am b/libsmartcols/src/Makemodule.am
new file mode 100644 (file)
index 0000000..f942b67
--- /dev/null
@@ -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 (file)
index 0000000..84bbb82
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Prints table or tree.
+ *
+ * Copyright (C) 2014 Ondrej Oprala <ooprala@redhat.com>
+ * Copyright (C) 2014 Karel Zak <kzak@redhat.com>
+ *
+ * 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 <stdlib.h>
+#include <sys/types.h>
+
+#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 (file)
index 0000000..99e517c
--- /dev/null
@@ -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 (file)
index 0000000..fecf9e8
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * smartcolsP.h - private library header file
+ *
+ * Copyright (C) 2014 Ondrej Oprala <ooprala@redhat.com>
+ * Copyright (C) 2014 Karel Zak <kzak@redhat.com>
+ *
+ * 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 <assert.h>
+#else
+# define assert(x)
+#endif
+
+#endif /* _LIBSMARTCOLS_PRIVATE_H */