From 3b43f166629efbb34e1b0ceeaa2f06452d0fed2f Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 31 Aug 2019 17:46:19 +0200 Subject: Turn libsquashfs.a into a shared library This of course entails turning the entire project over to libtool magic. Signed-off-by: David Oberhollenzer --- .gitignore | 7 ++++ Makefile.am | 2 + configure.ac | 2 +- difftool/Makemodule.am | 3 +- lib/Makemodule.am | 103 +++++++++++++++++++++++-------------------------- mkfs/Makemodule.am | 8 ++-- tar/Makemodule.am | 8 +--- tests/Makemodule.am | 41 ++++++++++---------- unpack/Makemodule.am | 3 +- 9 files changed, 85 insertions(+), 92 deletions(-) diff --git a/.gitignore b/.gitignore index f214ad1..ce80dd9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .deps .dirstamp .gdb_history +.libs Makefile Makefile.in aclocal.m4 @@ -16,6 +17,8 @@ missing stamp-h1 config.* *.o +*.lo +*.la *.a *~ gensquashfs @@ -28,3 +31,7 @@ fstree_fuzz test_* test-* fscompare +libtool +ltmain.sh +m4/libtool.m4 +m4/lt*.m4 diff --git a/Makefile.am b/Makefile.am index 577c060..3c0aa18 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,9 +3,11 @@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -I$(top_srcdir)/include -D_GNU_SOURCE AM_CFLAGS = $(WARN_CFLAGS) +noinst_LTLIBRARIES = noinst_LIBRARIES = noinst_PROGRAMS = bin_PROGRAMS = +lib_LTLIBRARIES = dist_man1_MANS = check_PROGRAMS = diff --git a/configure.ac b/configure.ac index 88a1eb4..96c6962 100644 --- a/configure.ac +++ b/configure.ac @@ -3,9 +3,9 @@ AC_INIT([squashfs-tools-ng], [0.6.1], [goliath@infraroot.at], squashfs-tools-ng) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects]) AM_SILENT_RULES([yes]) +LT_INIT AC_PROG_CC AC_PROG_CC_C99 -AC_PROG_RANLIB AC_PROG_INSTALL AC_SYS_LARGEFILE diff --git a/difftool/Makemodule.am b/difftool/Makemodule.am index 69fcb33..e64d23b 100644 --- a/difftool/Makemodule.am +++ b/difftool/Makemodule.am @@ -2,7 +2,6 @@ sqfsdiff_SOURCES = difftool/sqfsdiff.c difftool/sqfsdiff.h difftool/util.c sqfsdiff_SOURCES += difftool/compare_dir.c difftool/node_compare.c sqfsdiff_SOURCES += difftool/compare_files.c difftool/super.c sqfsdiff_SOURCES += difftool/extract.c difftool/options.c -sqfsdiff_LDADD = libsqfshelper.a libsquashfs.a libfstree.a libutil.a -sqfsdiff_LDADD += $(XZ_LIBS) $(ZLIB_LIBS) $(LZO_LIBS) $(LZ4_LIBS) $(ZSTD_LIBS) +sqfsdiff_LDADD = libsqfshelper.a libsquashfs.la libfstree.a libutil.la bin_PROGRAMS += sqfsdiff diff --git a/lib/Makemodule.am b/lib/Makemodule.am index 5905b26..bc08cc9 100644 --- a/lib/Makemodule.am +++ b/lib/Makemodule.am @@ -6,7 +6,7 @@ libfstree_a_SOURCES += lib/fstree/add_by_path.c lib/fstree/xattr.c libfstree_a_SOURCES += lib/fstree/node_from_path.c include/fstree.h libfstree_a_SOURCES += lib/fstree/gen_file_list.c lib/fstree/deduplicate.c libfstree_a_SOURCES += lib/fstree/optimize_unpack_order.c -libfstree_a_CFLAGS = $(AM_CFLAGS) +libfstree_a_CFLAGS = $(AM_CFLAGS) $(LIBSELINUX_CFLAGS) libfstree_a_CPPFLAGS = $(AM_CPPFLAGS) libtar_a_SOURCES = lib/tar/read_header.c lib/tar/write_header.c lib/tar/skip.c @@ -17,23 +17,6 @@ libtar_a_SOURCES += include/tar.h libtar_a_CFLAGS = $(AM_CFLAGS) libtar_a_CPPFLAGS = $(AM_CPPFLAGS) -libsquashfs_a_SOURCES = include/meta_writer.h include/squashfs.h -libsquashfs_a_SOURCES += lib/sqfs/meta_writer.c lib/sqfs/super.c -libsquashfs_a_SOURCES += lib/sqfs/id_table.c include/id_table.h -libsquashfs_a_SOURCES += lib/sqfs/write_table.c include/highlevel.h -libsquashfs_a_SOURCES += lib/sqfs/read_super.c lib/sqfs/meta_reader.c -libsquashfs_a_SOURCES += include/meta_reader.h lib/sqfs/id_table_write.c -libsquashfs_a_SOURCES += lib/sqfs/id_table_read.c lib/sqfs/read_inode.c -libsquashfs_a_SOURCES += lib/sqfs/readdir.c -libsquashfs_a_SOURCES += lib/sqfs/xattr.c -libsquashfs_a_SOURCES += lib/sqfs/read_table.c -libsquashfs_a_SOURCES += lib/sqfs/comp/compressor.c lib/sqfs/comp/internal.h -libsquashfs_a_SOURCES += include/block_processor.h include/compress.h -libsquashfs_a_SOURCES += lib/sqfs/comp/create_block.c -libsquashfs_a_SOURCES += lib/sqfs/comp/process_block.c -libsquashfs_a_CFLAGS = $(AM_CFLAGS) -libsquashfs_a_CPPFLAGS = $(AM_CPPFLAGS) - libsqfshelper_a_SOURCES = lib/sqfshelper/deserialize_fstree.c libsqfshelper_a_SOURCES += lib/sqfshelper/serialize_fstree.c libsqfshelper_a_SOURCES += lib/sqfshelper/statistics.c @@ -47,66 +30,76 @@ libsqfshelper_a_SOURCES += include/data_reader.h lib/sqfshelper/data_reader.c libsqfshelper_a_SOURCES += include/data_writer.h lib/sqfshelper/data_writer.c libsqfshelper_a_SOURCES += include/xattr_reader.h lib/sqfshelper/write_xattr.c -libutil_a_SOURCES = lib/util/canonicalize_name.c lib/util/write_data.c -libutil_a_SOURCES += lib/util/read_data.c include/util.h -libutil_a_SOURCES += lib/util/print_version.c lib/util/mkdir_p.c -libutil_a_SOURCES += lib/util/str_table.c include/str_table.h -libutil_a_SOURCES += lib/util/dirstack.c lib/util/padd_file.c -libutil_a_SOURCES += lib/util/read_data_at.c lib/util/alloc.c -libutil_a_SOURCES += lib/util/source_date_epoch.c -libutil_a_CFLAGS = $(AM_CFLAGS) -libutil_a_CPPFLAGS = $(AM_CPPFLAGS) +libutil_la_SOURCES = lib/util/canonicalize_name.c lib/util/write_data.c +libutil_la_SOURCES += lib/util/read_data.c include/util.h +libutil_la_SOURCES += lib/util/print_version.c lib/util/mkdir_p.c +libutil_la_SOURCES += lib/util/str_table.c include/str_table.h +libutil_la_SOURCES += lib/util/dirstack.c lib/util/padd_file.c +libutil_la_SOURCES += lib/util/read_data_at.c lib/util/alloc.c +libutil_la_SOURCES += lib/util/source_date_epoch.c +libutil_la_CFLAGS = $(AM_CFLAGS) +libutil_la_CPPFLAGS = $(AM_CPPFLAGS) + +libsquashfs_la_SOURCES = include/meta_writer.h include/squashfs.h +libsquashfs_la_SOURCES += lib/sqfs/meta_writer.c lib/sqfs/super.c +libsquashfs_la_SOURCES += lib/sqfs/id_table.c include/id_table.h +libsquashfs_la_SOURCES += lib/sqfs/write_table.c include/highlevel.h +libsquashfs_la_SOURCES += lib/sqfs/read_super.c lib/sqfs/meta_reader.c +libsquashfs_la_SOURCES += include/meta_reader.h lib/sqfs/id_table_write.c +libsquashfs_la_SOURCES += lib/sqfs/id_table_read.c lib/sqfs/read_inode.c +libsquashfs_la_SOURCES += lib/sqfs/readdir.c +libsquashfs_la_SOURCES += lib/sqfs/xattr.c +libsquashfs_la_SOURCES += lib/sqfs/read_table.c +libsquashfs_la_SOURCES += lib/sqfs/comp/compressor.c lib/sqfs/comp/internal.h +libsquashfs_la_SOURCES += include/block_processor.h include/compress.h +libsquashfs_la_SOURCES += lib/sqfs/comp/create_block.c +libsquashfs_la_SOURCES += lib/sqfs/comp/process_block.c +libsquashfs_la_CPPFLAGS = $(AM_CPPFLAGS) +libsquashfs_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS) +libsquashfs_la_CFLAGS += $(XZ_CFLAGS) $(LZO_CFLAGS) $(LZ4_CFLAGS) +libsquashfs_la_CFLAGS += $(ZSTD_CFLAGS) $(PTHREAD_CFLAGS) +libsquashfs_la_LIBADD = $(XZ_LIBS) $(ZLIB_LIBS) $(LZO_LIBS) $(LZ4_LIBS) +libsquashfs_la_LIBADD += $(ZSTD_LIBS) $(PTHREAD_LIBS) libutil.la if HAVE_PTHREAD -libsquashfs_a_SOURCES += lib/sqfs/comp/block_processor_parallel.c -libsquashfs_a_CFLAGS += $(PTHREAD_CFLAGS) +libsquashfs_la_SOURCES += lib/sqfs/comp/block_processor_parallel.c else -libsquashfs_a_SOURCES += lib/sqfs/comp/block_processor.c +libsquashfs_la_SOURCES += lib/sqfs/comp/block_processor.c endif if WITH_GZIP -libsquashfs_a_SOURCES += lib/sqfs/comp/gzip.c - -libsquashfs_a_CFLAGS += $(ZLIB_CFLAGS) -libsquashfs_a_CPPFLAGS += -DWITH_GZIP +libsquashfs_la_SOURCES += lib/sqfs/comp/gzip.c +libsquashfs_la_CPPFLAGS += -DWITH_GZIP -libutil_a_CFLAGS += $(ZLIB_CFLAGS) -libutil_a_CPPFLAGS += -DWITH_GZIP +libutil_la_CFLAGS += $(ZLIB_CFLAGS) +libutil_la_CPPFLAGS += -DWITH_GZIP endif if WITH_XZ -libsquashfs_a_SOURCES += lib/sqfs/comp/xz.c - -libsquashfs_a_CFLAGS += $(XZ_CFLAGS) -libsquashfs_a_CPPFLAGS += -DWITH_XZ +libsquashfs_la_SOURCES += lib/sqfs/comp/xz.c +libsquashfs_la_CPPFLAGS += -DWITH_XZ endif if WITH_LZO -libsquashfs_a_SOURCES += lib/sqfs/comp/lzo.c - -libsquashfs_a_CFLAGS += $(LZO_CFLAGS) -libsquashfs_a_CPPFLAGS += -DWITH_LZO +libsquashfs_la_SOURCES += lib/sqfs/comp/lzo.c +libsquashfs_la_CPPFLAGS += -DWITH_LZO endif if WITH_LZ4 -libsquashfs_a_SOURCES += lib/sqfs/comp/lz4.c - -libsquashfs_a_CFLAGS += $(LZ4_CFLAGS) -libsquashfs_a_CPPFLAGS += -DWITH_LZ4 +libsquashfs_la_SOURCES += lib/sqfs/comp/lz4.c +libsquashfs_la_CPPFLAGS += -DWITH_LZ4 endif if WITH_ZSTD -libsquashfs_a_SOURCES += lib/sqfs/comp/zstd.c - -libsquashfs_a_CFLAGS += $(ZSTD_CFLAGS) -libsquashfs_a_CPPFLAGS += -DWITH_ZSTD +libsquashfs_la_SOURCES += lib/sqfs/comp/zstd.c +libsquashfs_la_CPPFLAGS += -DWITH_ZSTD endif if WITH_SELINUX libfstree_a_SOURCES += lib/fstree/selinux.c - -libfstree_a_CFLAGS += $(LIBSELINUX_CFLAGS) libfstree_a_CPPFLAGS += -DWITH_SELINUX endif -noinst_LIBRARIES += libfstree.a libutil.a libsquashfs.a libtar.a libsqfshelper.a +noinst_LIBRARIES += libfstree.a libtar.a libsqfshelper.a +noinst_LTLIBRARIES += libutil.la +lib_LTLIBRARIES += libsquashfs.la diff --git a/mkfs/Makemodule.am b/mkfs/Makemodule.am index e3331ca..1955852 100644 --- a/mkfs/Makemodule.am +++ b/mkfs/Makemodule.am @@ -1,12 +1,10 @@ gensquashfs_SOURCES = mkfs/mkfs.c mkfs/mkfs.h mkfs/options.c -gensquashfs_LDADD = libsqfshelper.a libsquashfs.a libfstree.a libutil.a +gensquashfs_LDADD = libsqfshelper.a libsquashfs.la libfstree.a libutil.la +gensquashfs_LDADD += $(LIBSELINUX_LIBS) gensquashfs_CPPFLAGS = $(AM_CPPFLAGS) -gensquashfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -gensquashfs_LDADD += $(XZ_LIBS) $(ZLIB_LIBS) $(LZO_LIBS) $(LZ4_LIBS) -gensquashfs_LDADD += $(ZSTD_LIBS) $(PTHREAD_LIBS) +gensquashfs_CFLAGS = $(AM_CFLAGS) if WITH_SELINUX gensquashfs_CPPFLAGS += -DWITH_SELINUX -gensquashfs_LDADD += $(LIBSELINUX_LIBS) endif bin_PROGRAMS += gensquashfs diff --git a/tar/Makemodule.am b/tar/Makemodule.am index c4a4a6c..11e4f67 100644 --- a/tar/Makemodule.am +++ b/tar/Makemodule.am @@ -1,11 +1,7 @@ sqfs2tar_SOURCES = tar/sqfs2tar.c -sqfs2tar_LDADD = libsqfshelper.a libsquashfs.a libtar.a libfstree.a libutil.a -sqfs2tar_LDADD += $(XZ_LIBS) $(ZLIB_LIBS) $(LZO_LIBS) $(LZ4_LIBS) $(ZSTD_LIBS) +sqfs2tar_LDADD = libsqfshelper.a libsquashfs.la libtar.a libfstree.a libutil.la tar2sqfs_SOURCES = tar/tar2sqfs.c -tar2sqfs_LDADD = libsqfshelper.a libsquashfs.a libtar.a libfstree.a libutil.a -tar2sqfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -tar2sqfs_LDADD += $(XZ_LIBS) $(ZLIB_LIBS) $(LZO_LIBS) $(LZ4_LIBS) $(ZSTD_LIBS) -tar2sqfs_LDADD += $(PTHREAD_LIBS) +tar2sqfs_LDADD = libsqfshelper.a libsquashfs.la libtar.a libfstree.a libutil.la bin_PROGRAMS += sqfs2tar tar2sqfs diff --git a/tests/Makemodule.am b/tests/Makemodule.am index 4e12ff6..b242bd2 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -1,5 +1,5 @@ test_canonicalize_name_SOURCES = tests/canonicalize_name.c -test_canonicalize_name_LDADD = libutil.a +test_canonicalize_name_LDADD = libutil.la test_mknode_simple_SOURCES = tests/mknode_simple.c test_mknode_simple_LDADD = libfstree.a @@ -14,79 +14,78 @@ test_mknode_dir_SOURCES = tests/mknode_dir.c test_mknode_dir_LDADD = libfstree.a test_gen_inode_table_SOURCES = tests/gen_inode_table.c -test_gen_inode_table_LDADD = libfstree.a libutil.a +test_gen_inode_table_LDADD = libfstree.a libutil.la test_add_by_path_SOURCES = tests/add_by_path.c -test_add_by_path_LDADD = libfstree.a libutil.a +test_add_by_path_LDADD = libfstree.a libutil.la test_get_path_SOURCES = tests/get_path.c -test_get_path_LDADD = libfstree.a libutil.a +test_get_path_LDADD = libfstree.a libutil.la test_fstree_sort_SOURCES = tests/fstree_sort.c -test_fstree_sort_LDADD = libfstree.a libutil.a +test_fstree_sort_LDADD = libfstree.a libutil.la test_fstree_from_file_SOURCES = tests/fstree_from_file.c -test_fstree_from_file_LDADD = libfstree.a libutil.a +test_fstree_from_file_LDADD = libfstree.a libutil.la test_fstree_init_SOURCES = tests/fstree_init.c -test_fstree_init_LDADD = libfstree.a libutil.a +test_fstree_init_LDADD = libfstree.a libutil.la test_fstree_xattr_SOURCES = tests/fstree_xattr.c -test_fstree_xattr_LDADD = libfstree.a libutil.a +test_fstree_xattr_LDADD = libfstree.a libutil.la test_tar_gnu_SOURCES = tests/tar_gnu.c -test_tar_gnu_LDADD = libtar.a libutil.a +test_tar_gnu_LDADD = libtar.a libutil.la test_tar_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_pax_SOURCES = tests/tar_pax.c -test_tar_pax_LDADD = libtar.a libutil.a +test_tar_pax_LDADD = libtar.a libutil.la test_tar_pax_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar_SOURCES = tests/tar_ustar.c -test_tar_ustar_LDADD = libtar.a libutil.a +test_tar_ustar_LDADD = libtar.a libutil.la test_tar_ustar_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu_SOURCES = tests/tar_sparse_gnu.c -test_tar_sparse_gnu_LDADD = libtar.a libutil.a +test_tar_sparse_gnu_LDADD = libtar.a libutil.la test_tar_sparse_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu1_SOURCES = tests/tar_sparse_gnu1.c -test_tar_sparse_gnu1_LDADD = libtar.a libutil.a +test_tar_sparse_gnu1_LDADD = libtar.a libutil.la test_tar_sparse_gnu1_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu1_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu2_SOURCES = tests/tar_sparse_gnu1.c -test_tar_sparse_gnu2_LDADD = libtar.a libutil.a +test_tar_sparse_gnu2_LDADD = libtar.a libutil.la test_tar_sparse_gnu2_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu2_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_xattr_bsd_SOURCES = tests/tar_xattr_bsd.c -test_tar_xattr_bsd_LDADD = libtar.a libutil.a +test_tar_xattr_bsd_LDADD = libtar.a libutil.la test_tar_xattr_bsd_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_xattr_schily_SOURCES = tests/tar_xattr_schily.c -test_tar_xattr_schily_LDADD = libtar.a libutil.a +test_tar_xattr_schily_LDADD = libtar.a libutil.la test_tar_xattr_schily_CPPFLAGS = $(AM_CPPFLAGS) test_tar_xattr_schily_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_str_table_SOURCES = tests/str_table.c -test_str_table_LDADD = libutil.a +test_str_table_LDADD = libutil.la test_str_table_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests test_blk_proc_order_SOURCES = tests/blk_proc_order.c test_blk_proc_order_CPPFLAGS = $(AM_CPPFLAGS) -test_blk_proc_order_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -test_blk_proc_order_LDADD = libsquashfs.a libutil.a $(ZLIB_LIBS) $(PTHREAD_LIBS) +test_blk_proc_order_LDADD = libsquashfs.la libutil.la if HAVE_PTHREAD test_blk_proc_order_CPPFLAGS += -DHAVE_PTHREAD endif fstree_fuzz_SOURCES = tests/fstree_fuzz.c -fstree_fuzz_LDADD = libfstree.a libutil.a +fstree_fuzz_LDADD = libfstree.a libutil.la tar_fuzz_SOURCES = tests/tar_fuzz.c -tar_fuzz_LDADD = libtar.a libutil.a +tar_fuzz_LDADD = libtar.a libutil.la check_PROGRAMS += test_canonicalize_name test_mknode_simple test_mknode_slink check_PROGRAMS += test_mknode_reg test_mknode_dir test_gen_inode_table diff --git a/unpack/Makemodule.am b/unpack/Makemodule.am index 0fd20f4..b60292d 100644 --- a/unpack/Makemodule.am +++ b/unpack/Makemodule.am @@ -2,7 +2,6 @@ rdsquashfs_SOURCES = unpack/rdsquashfs.c unpack/rdsquashfs.h rdsquashfs_SOURCES += unpack/list_files.c unpack/options.c rdsquashfs_SOURCES += unpack/restore_fstree.c unpack/describe.c rdsquashfs_SOURCES += unpack/fill_files.c -rdsquashfs_LDADD = libsqfshelper.a libsquashfs.a libfstree.a libutil.a -rdsquashfs_LDADD += $(XZ_LIBS) $(ZLIB_LIBS) $(LZO_LIBS) $(LZ4_LIBS) $(ZSTD_LIBS) +rdsquashfs_LDADD = libsqfshelper.a libsquashfs.la libfstree.a libutil.la bin_PROGRAMS += rdsquashfs -- cgit v1.2.3