aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-04-15 06:19:10 -0800
committerDavid M. Syzdek <david@syzdek.net>2022-04-15 06:19:10 -0800
commit2b7cbd06dc90c741a2a007e2dbe8398d994df18e (patch)
treed4aaad9b3e5de816fd67be13ddddcf62e498cba8
parent4d1657c495490d7790221e4e1f8af9bd364b5528 (diff)
downloadbindletools-2b7cbd06dc90c741a2a007e2dbe8398d994df18e.tar.gz
bindletools-2b7cbd06dc90c741a2a007e2dbe8398d994df18e.tar.bz2
bindletools-2b7cbd06dc90c741a2a007e2dbe8398d994df18e.tar.xz
bindletools-2b7cbd06dc90c741a2a007e2dbe8398d994df18e.zip
libbindle: adding ability to add symbol prefix
-rw-r--r--Makefile.am27
-rw-r--r--build-aux/makefile-libbindle.am78
-rw-r--r--configure.ac1
-rw-r--r--include/bindle.h14
-rw-r--r--lib/libbindle/ldebug.c2
-rw-r--r--lib/libbindle/libbindle.h12
-rw-r--r--m4/bindle-libbindle.m446
7 files changed, 150 insertions, 30 deletions
diff --git a/Makefile.am b/Makefile.am
index 0f12d19..e563a7f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,34 +136,23 @@ endif
136# Makefile includes 136# Makefile includes
137GIT_PACKAGE_VERSION_DIR=include 137GIT_PACKAGE_VERSION_DIR=include
138SUBST_EXPRESSIONS = 138SUBST_EXPRESSIONS =
139include $(srcdir)/build-aux/makefile-autotools.am 139include build-aux/makefile-subst.am
140include $(srcdir)/build-aux/makefile-subst.am 140include build-aux/makefile-version.am
141include $(srcdir)/build-aux/makefile-version.am 141include build-aux/makefile-libbindle.am
142 142
143 143
144# macros for lib/libbindle.a 144# macros for lib/libbindle.a
145lib_libbindle_a_DEPENDENCIES = Makefile \ 145lib_libbindle_a_DEPENDENCIES = Makefile \
146 config.h 146 config.h \
147 include/bindle_prefix.h
147lib_libbindle_a_CPPFLAGS = $(AM_CPPFLAGS) \ 148lib_libbindle_a_CPPFLAGS = $(AM_CPPFLAGS) \
148 -I$(srcdir)/lib/libbindle 149 -I$(srcdir)/lib/libbindle
149lib_libbindle_a_CFLAGS = $(AM_CFLAGS) 150lib_libbindle_a_CFLAGS = $(AM_CFLAGS)
150lib_libbindle_a_SOURCES = include/bindle.h \ 151lib_libbindle_a_SOURCES = $(libbindle_sources)
151 lib/libbindle/libbindle.h \
152 lib/libbindle/ldebug.c \
153 lib/libbindle/ldebug.h \
154 lib/libbindle/lobj.c \
155 lib/libbindle/lobj.h \
156 lib/libbindle/lstring.c \
157 lib/libbindle/lstring.h \
158 lib/libbindle/lstrings.c \
159 lib/libbindle/lstrings.h \
160 lib/libbindle/lutf8.c \
161 lib/libbindle/lutf8.h
162 152
163 153
164# macros for lib/libbindle.la 154# macros for lib/libbindle.la
165lib_libbindle_la_DEPENDENCIES = Makefile \ 155lib_libbindle_la_DEPENDENCIES = $(lib_libbindle_a_DEPENDENCIES) \
166 config.h \
167 lib/libbindle/libbindle.sym 156 lib/libbindle/libbindle.sym
168lib_libbindle_la_CPPFLAGS = $(AM_CPPFLAGS) \ 157lib_libbindle_la_CPPFLAGS = $(AM_CPPFLAGS) \
169 -I$(srcdir)/lib/libbindle 158 -I$(srcdir)/lib/libbindle
@@ -172,7 +161,7 @@ lib_libbindle_la_LDFLAGS = -rpath'$(libdir)' \
172 -version-info $(LIB_VERSION_INFO) \ 161 -version-info $(LIB_VERSION_INFO) \
173 $(AM_LDFLAGS) \ 162 $(AM_LDFLAGS) \
174 -export-symbols $(srcdir)/lib/libbindle/libbindle.sym 163 -export-symbols $(srcdir)/lib/libbindle/libbindle.sym
175lib_libbindle_la_SOURCES = $(lib_libbindle_a_SOURCES) 164lib_libbindle_la_SOURCES = $(libbindle_sources)
176 165
177 166
178# custom targets 167# custom targets
diff --git a/build-aux/makefile-libbindle.am b/build-aux/makefile-libbindle.am
new file mode 100644
index 0000000..c668bed
--- /dev/null
+++ b/build-aux/makefile-libbindle.am
@@ -0,0 +1,78 @@
1#
2# Bindle Binaries Tools
3# Copyright (C) 2022 David M. Syzdek <david@syzdek.net>.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met:
8#
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# * Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# * Neither the name of Bindle Binaries nor the
15# names of its contributors may be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BINDLE BINARIES BE LIABLE FOR
22# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28# SUCH DAMAGE.
29#
30
31EXTRA_DIST += $(bindletools_srcdir)/build-aux/makefile-libbindle.am
32EXTRA_DIST += $(bindletools_srcdir)/include/bindle.h
33BUILT_SOURCES += include/bindle_prefix.h
34EXTRA_DIST += include/bindle_prefix.h
35
36LIBBINDLE_PREFIX ?=
37
38libbindle_sources = $(srcdir)/$(bindletools_srcdir)/include/bindle.h \
39 include/bindle_prefix.h \
40 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/libbindle.h \
41 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/ldebug.c \
42 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/ldebug.h \
43 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lobj.c \
44 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lobj.h \
45 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lstring.c \
46 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lstring.h \
47 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lstrings.c \
48 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lstrings.h \
49 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lutf8.c \
50 $(srcdir)/$(bindletools_srcdir)/lib/libbindle/lutf8.h
51
52
53libbindle_symbol_list = $(EGREP) \
54 '^[[:space:]]{0,1}bindle_[_[:alnum:]]{1,}[\(\;][[:space:]]{0,}$$' \
55 $(libbindle_sources) \
56 |cut -d: -f2 \
57 |$(SED) -e 's/[[:space:]]//g' -e 's/[(;]$$//g' \
58 |sort \
59 |uniq
60
61
62include/bindle_prefix.h: $(libbindle_sources)
63 @if test "x$(V)" == "x0";then \
64 echo " GEN $(@)"; \
65 else \
66 echo "$(libbindle_symbol_list)"; \
67 fi; \
68 $(MKDIR_P) "`dirname "$(@)"`" || exit 1; \
69 rm -f $(@) || exit 1; \
70 touch $(@) || exit 1; \
71 for FUNC in `$(libbindle_symbol_list)`;do \
72 echo "#undef $$FUNC"; \
73 echo "#define $$FUNC $(LIBBINDLE_PREFIX)$$FUNC"; \
74 done > $(@); \
75 cat $(srcdir)/$(bindletools_srcdir)/include/bindle.h >> $(@); \
76 touch $(@);
77
78# end of automake file
diff --git a/configure.ac b/configure.ac
index d17ca5e..0e8fe79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,7 @@ AC_BINDLE_GIT_PACKAGE_VERSION([build-aux/git-package-version.sh])
166 166
167# custom configure options 167# custom configure options
168AC_BINDLE_ENABLE_WARNINGS([-Wno-unknown-pragmas -Wno-missing-format-attribute -Wno-poison-system-directories], [], [c11]) 168AC_BINDLE_ENABLE_WARNINGS([-Wno-unknown-pragmas -Wno-missing-format-attribute -Wno-poison-system-directories], [], [c11])
169AC_BINDLE_LIBBINDLE([])
169AC_BINDLETOOLS_LIBBINDLE 170AC_BINDLETOOLS_LIBBINDLE
170 171
171# Creates outputs 172# Creates outputs
diff --git a/include/bindle.h b/include/bindle.h
index a4378aa..28d8c2f 100644
--- a/include/bindle.h
+++ b/include/bindle.h
@@ -42,6 +42,7 @@
42#include <stddef.h> 42#include <stddef.h>
43#include <inttypes.h> 43#include <inttypes.h>
44#include <sys/types.h> 44#include <sys/types.h>
45#include <stdatomic.h>
45 46
46 47
47////////////// 48//////////////
@@ -135,9 +136,16 @@ typedef struct _bindle_obj
135///////////////// 136/////////////////
136#pragma mark - Variables 137#pragma mark - Variables
137 138
138extern const char * bindle_debug_ident; 139_BINDLE_V const char *
139extern int bindle_debug_level; 140bindle_debug_ident;
140extern int bindle_debug_syslog; 141
142
143_BINDLE_V int
144bindle_debug_level;
145
146
147_BINDLE_V int
148bindle_debug_syslog;
141 149
142 150
143////////////////// 151//////////////////
diff --git a/lib/libbindle/ldebug.c b/lib/libbindle/ldebug.c
index 7566af0..bbfceb0 100644
--- a/lib/libbindle/ldebug.c
+++ b/lib/libbindle/ldebug.c
@@ -46,7 +46,7 @@
46#include <strings.h> 46#include <strings.h>
47#include <unistd.h> 47#include <unistd.h>
48#include <syslog.h> 48#include <syslog.h>
49#include <stdatomic.h> 49#include <stdarg.h>
50#include <assert.h> 50#include <assert.h>
51 51
52 52
diff --git a/lib/libbindle/libbindle.h b/lib/libbindle/libbindle.h
index f74f59f..d6bb1ea 100644
--- a/lib/libbindle/libbindle.h
+++ b/lib/libbindle/libbindle.h
@@ -45,13 +45,11 @@
45#include <config.h> 45#include <config.h>
46#endif 46#endif
47 47
48#include <stddef.h> 48#ifdef LIBBINDLE_PREFIX
49#include <stdint.h> 49# include <bindle_prefix.h>
50#include <stdatomic.h> 50#else
51#include <stdio.h> 51# include <bindle.h>
52#include <stdarg.h> 52#endif
53
54#include <bindle.h>
55 53
56 54
57////////////// 55//////////////
diff --git a/m4/bindle-libbindle.m4 b/m4/bindle-libbindle.m4
new file mode 100644
index 0000000..e9f3e72
--- /dev/null
+++ b/m4/bindle-libbindle.m4
@@ -0,0 +1,46 @@
1#
2# Bindle Binaries Tools
3# Copyright (C) 2022 David M. Syzdek <david@syzdek.net>.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met:
8#
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# * Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# * Neither the name of Bindle Binaries nor the
15# names of its contributors may be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BINDLE BINARIES BE LIABLE FOR
22# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28# SUCH DAMAGE.
29#
30
31
32# AC_BINDLE_LIBBINDLE()
33# ______________________________________________________________________________
34AC_DEFUN([AC_BINDLE_LIBBINDLE],[dnl
35
36 AC_REQUIRE([AC_PROG_CC])
37 AC_REQUIRE([AC_BINDLE])
38
39 LIBBINDLE_PREFIX="$1"
40
41 AC_SUBST([LIBBINDLE_PREFIX], [${LIBBINDLE_PREFIX}])
42 AC_DEFINE_UNQUOTED([LIBBINDLE_PREFIX], ["$LIBBINDLE_PREFIX"], [libbindle.la function prefix])
43])dnl
44
45
46# end of m4 file