aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-21 12:39:28 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-21 12:39:28 +0100
commitb63e39ade1e376ad8f433a0d751eddf4826a5230 (patch)
treecb24f5327860d5eaa8363690df159c98f71ac500
parent69c0f7749aad857f6f9f6628a7e8d1d3e0dcb541 (diff)
Cleanup: move utilities back out of libsquashfs
This commit removes the allocation helpers and string table functions out of libsquashfs back into a "libutil.a". The problem of libsquashfs exporting stuff that it shouldn't is resolved by retaining the internal attributes and directly adding the source to libsquashfs instead of trying to somehow link against libutil.la. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--Makefile.am1
-rw-r--r--include/str_table.h (renamed from lib/sqfs/str_table.h)0
-rw-r--r--include/util.h (renamed from lib/sqfs/util.h)0
-rw-r--r--lib/sqfs/Makemodule.am5
-rw-r--r--lib/sqfs/block_processor/internal.h2
-rw-r--r--lib/sqfs/comp/internal.h2
-rw-r--r--lib/util/Makemodule.am6
-rw-r--r--lib/util/alloc.c (renamed from lib/sqfs/alloc.c)0
-rw-r--r--lib/util/str_table.c (renamed from lib/sqfs/str_table.c)0
-rw-r--r--tests/Makemodule.am6
10 files changed, 14 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index c958de6..7d4f9ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,6 +28,7 @@ include lib/fstree/Makemodule.am
include lib/common/Makemodule.am
include lib/tar/Makemodule.am
include lib/compat/Makemodule.am
+include lib/util/Makemodule.am
include tar/Makemodule.am
include mkfs/Makemodule.am
include unpack/Makemodule.am
diff --git a/lib/sqfs/str_table.h b/include/str_table.h
index 61f8aa5..61f8aa5 100644
--- a/lib/sqfs/str_table.h
+++ b/include/str_table.h
diff --git a/lib/sqfs/util.h b/include/util.h
index a379c0d..a379c0d 100644
--- a/lib/sqfs/util.h
+++ b/include/util.h
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index aada6c6..591eda2 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -24,8 +24,6 @@ libsquashfs_la_SOURCES += lib/sqfs/write_super.c lib/sqfs/data_reader.c
libsquashfs_la_SOURCES += lib/sqfs/block_processor/internal.h
libsquashfs_la_SOURCES += lib/sqfs/block_processor/common.c
libsquashfs_la_SOURCES += lib/sqfs/block_processor/xxhash.c
-libsquashfs_la_SOURCES += lib/sqfs/str_table.c lib/sqfs/str_table.h
-libsquashfs_la_SOURCES += lib/sqfs/alloc.c lib/sqfs/util.h
libsquashfs_la_SOURCES += lib/sqfs/frag_table.c include/sqfs/frag_table.h
libsquashfs_la_SOURCES += lib/sqfs/block_writer.c include/sqfs/block_writer.h
libsquashfs_la_CPPFLAGS = $(AM_CPPFLAGS)
@@ -36,6 +34,9 @@ libsquashfs_la_CFLAGS += $(ZSTD_CFLAGS) $(PTHREAD_CFLAGS)
libsquashfs_la_LIBADD = $(XZ_LIBS) $(ZLIB_LIBS) $(LZ4_LIBS)
libsquashfs_la_LIBADD += $(ZSTD_LIBS) $(PTHREAD_LIBS)
+# directly "import" stuff from libutil
+libsquashfs_la_SOURCES += lib/util/str_table.c lib/util/alloc.c
+
if WINDOWS
libsquashfs_la_SOURCES += lib/sqfs/win32/io_file.c
libsquashfs_la_CFLAGS += -DWINVER=0x0600 -D_WIN32_WINNT=0x0600
diff --git a/lib/sqfs/block_processor/internal.h b/lib/sqfs/block_processor/internal.h
index fb9c4a0..03a8296 100644
--- a/lib/sqfs/block_processor/internal.h
+++ b/lib/sqfs/block_processor/internal.h
@@ -18,7 +18,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "../util.h"
+#include "util.h"
#include <string.h>
#include <stdlib.h>
diff --git a/lib/sqfs/comp/internal.h b/lib/sqfs/comp/internal.h
index c687d41..7518f56 100644
--- a/lib/sqfs/comp/internal.h
+++ b/lib/sqfs/comp/internal.h
@@ -14,7 +14,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "../util.h"
+#include "util.h"
SQFS_INTERNAL
int sqfs_generic_write_options(sqfs_file_t *file, const void *data,
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
new file mode 100644
index 0000000..f5a5680
--- /dev/null
+++ b/lib/util/Makemodule.am
@@ -0,0 +1,6 @@
+libutil_a_SOURCES = include/util.h include/str_table.h
+libutil_a_SOURCES += lib/util/str_table.c lib/util/alloc.c
+libutil_a_CFLAGS = $(AM_CFLAGS)
+libutil_a_CPPFLAGS = $(AM_CPPFLAGS)
+
+noinst_LIBRARIES += libutil.a
diff --git a/lib/sqfs/alloc.c b/lib/util/alloc.c
index e8305d8..e8305d8 100644
--- a/lib/sqfs/alloc.c
+++ b/lib/util/alloc.c
diff --git a/lib/sqfs/str_table.c b/lib/util/str_table.c
index c0a364f..c0a364f 100644
--- a/lib/sqfs/str_table.c
+++ b/lib/util/str_table.c
diff --git a/tests/Makemodule.am b/tests/Makemodule.am
index 0c3f6e5..83f8666 100644
--- a/tests/Makemodule.am
+++ b/tests/Makemodule.am
@@ -1,10 +1,8 @@
test_canonicalize_name_SOURCES = tests/canonicalize_name.c
test_canonicalize_name_LDADD = libfstree.a
-test_str_table_SOURCES = tests/str_table.c lib/sqfs/str_table.c
-test_str_table_SOURCES += lib/sqfs/alloc.c lib/sqfs/util.h
-test_str_table_SOURCES += lib/sqfs/str_table.h
-test_str_table_LDADD = libcompat.a
+test_str_table_SOURCES = tests/str_table.c
+test_str_table_LDADD = libutil.a libcompat.a
test_str_table_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests
test_str_table_CPPFLAGS += -I$(top_srcdir)/lib/sqfs