Skip to content

Commit 56a24f6

Browse files
authored
Split squashfuse_ll into a lib and executable (#59)
* Split squashfuse_ll into a lib and executable This makes it easier for people to statically link squashfuse_ll into their application, which can in turn be used to more easily ship self-exectracting binaries (e.g. facebook xar or appimage)
1 parent 204731a commit 56a24f6

File tree

10 files changed

+331
-175
lines changed

10 files changed

+331
-175
lines changed

.cirrus.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ task:
1717
build_script:
1818
- ./autogen.sh
1919
- CPPFLAGS="$CONFIGURE_CPPFLAGS -Werror" LDFLAGS="$CONFIGURE_LDFLAGS" ./configure
20-
- make
20+
- make V=1
2121
test_script:
2222
- make check
2323
- diff -u ci/expected-features/all ci/features

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: |
2020
./autogen.sh
2121
CPPFLAGS="-Werror" ./configure
22-
make -j3
22+
make -j3 V=1
2323
- name: test
2424
run: |
2525
make check

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ build-aux
2121
configure
2222
libtool
2323
stamp-h1
24-
squashfuse.pc
24+
*.pc
2525

2626
win/Debug
2727
win/Release

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
os: windows
3131
env:
3232
global:
33-
- MAKEFLAGS="-j3"
33+
- MAKEFLAGS="-j3 V=1"
3434
addons:
3535
apt:
3636
update: true

Makefile.am

+40-17
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,80 @@ EXTRA_DIST = gen_swap.sh autogen.sh LICENSE CONFIGURATION PLATFORMS NEWS win
1212

1313
bin_PROGRAMS =
1414
noinst_PROGRAMS =
15-
16-
lib_LTLIBRARIES = libsquashfuse.la
15+
lib_LTLIBRARIES =
1716
noinst_LTLIBRARIES =
1817

1918
pkgincludedir = @includedir@/squashfuse
2019
pkginclude_HEADERS = squashfuse.h squashfs_fs.h \
2120
cache.h common.h config.h decompress.h dir.h file.h fs.h stack.h table.h \
2221
traverse.h util.h xattr.h
23-
2422
pkgconfigdir = @pkgconfigdir@
2523
pkgconfig_DATA = squashfuse.pc
2624

27-
# Main library: libsquashfuse
28-
libsquashfuse_la_SOURCES = swap.c cache.c table.c dir.c file.c fs.c \
25+
# Convenience lib to we get static executables
26+
noinst_LTLIBRARIES += libsquashfuse_convenience.la
27+
libsquashfuse_convenience_la_SOURCES = swap.c cache.c table.c dir.c file.c fs.c \
2928
decompress.c xattr.c hash.c stack.c traverse.c util.c \
3029
nonstd-pread.c nonstd-stat.c \
3130
squashfs_fs.h common.h nonstd-internal.h nonstd.h swap.h cache.h table.h \
3231
dir.h file.h decompress.h xattr.h squashfuse.h hash.h stack.h traverse.h \
3332
util.h fs.h
33+
libsquashfuse_convenience_la_CPPFLAGS = $(ZLIB_CPPFLAGS) $(XZ_CPPFLAGS) $(LZO_CPPFLAGS) \
34+
$(LZ4_CPPFLAGS) $(ZSTD_CPPFLAGS) $(FUSE_CPPFLAGS)
35+
libsquashfuse_convenience_la_LIBADD = $(COMPRESSION_LIBS) $(FUSE_LIBS)
36+
37+
# Main library: libsquashfuse
38+
lib_LTLIBRARIES += libsquashfuse.la
39+
libsquashfuse_la_SOURCES =
3440
libsquashfuse_la_CPPFLAGS = $(ZLIB_CPPFLAGS) $(XZ_CPPFLAGS) $(LZO_CPPFLAGS) \
35-
$(LZ4_CPPFLAGS) $(ZSTD_CPPFLAGS)
36-
libsquashfuse_la_LIBADD =
41+
$(LZ4_CPPFLAGS) $(ZSTD_CPPFLAGS) $(FUSE_CPPFLAGS)
42+
libsquashfuse_la_LIBADD = libsquashfuse_convenience.la
3743

3844
if SQ_WANT_FUSE
3945
# Helper for FUSE clients: libfuseprivate
4046
libfuseprivate_la_SOURCES = fuseprivate.c nonstd-makedev.c nonstd-enoattr.c \
4147
fuseprivate.h stat.h stat.c
4248
libfuseprivate_la_CPPFLAGS = $(FUSE_CPPFLAGS)
43-
libfuseprivate_la_LIBADD =
49+
libfuseprivate_la_LIBADD = $(COMPRESSION_LIBS) $(FUSE_LIBS)
4450
noinst_LTLIBRARIES += libfuseprivate.la
4551
endif
4652

4753
# High-level squashfuse
4854
if SQ_WANT_HIGHLEVEL
4955
bin_PROGRAMS += squashfuse
5056
squashfuse_SOURCES = hl.c
51-
squashfuse_CPPFLAGS = $(FUSE_CPPFLAGS)
52-
squashfuse_LDADD = libsquashfuse.la libfuseprivate.la $(COMPRESSION_LIBS) \
53-
$(FUSE_LIBS)
54-
57+
squashfuse_CPPFLAGS = $(ZLIB_CPPFLAGS) $(XZ_CPPFLAGS) $(LZO_CPPFLAGS) \
58+
$(LZ4_CPPFLAGS) $(ZSTD_CPPFLAGS) $(FUSE_CPPFLAGS)
59+
squashfuse_LDADD = libsquashfuse_convenience.la libfuseprivate.la $(COMPRESSION_LIBS) $(FUSE_LIBS)
5560
dist_man_MANS += squashfuse.1
5661
endif
5762

5863
# Low-level squashfuse_ll, if supported
5964
if SQ_WANT_LOWLEVEL
65+
66+
# convenience lib so we can link squashfuse_ll statically
67+
noinst_LTLIBRARIES += libsquashfuse_ll_convenience.la
68+
libsquashfuse_ll_convenience_la_SOURCES = ll.c ll_inode.c nonstd-daemon.c
69+
libsquashfuse_ll_convenience_la_CPPFLAGS = $(ZLIB_CPPFLAGS) $(XZ_CPPFLAGS) $(LZO_CPPFLAGS) \
70+
$(LZ4_CPPFLAGS) $(ZSTD_CPPFLAGS) $(FUSE_CPPFLAGS)
71+
libsquashfuse_ll_convenience_la_LIBADD = libsquashfuse_convenience.la libfuseprivate.la
72+
73+
# squashfuse_ll library we will install
74+
lib_LTLIBRARIES += libsquashfuse_ll.la
75+
libsquashfuse_ll_la_SOURCES =
76+
libsquashfuse_ll_la_CPPFLAGS = $(ZLIB_CPPFLAGS) $(XZ_CPPFLAGS) $(LZO_CPPFLAGS) \
77+
$(LZ4_CPPFLAGS) $(ZSTD_CPPFLAGS) $(FUSE_CPPFLAGS)
78+
libsquashfuse_ll_la_LIBADD = libsquashfuse_ll_convenience.la $(COMPRESSION_LIBS) $(FUSE_LIBS)
79+
80+
# squashfuse_ll binary that's statically linked against internal libs
6081
bin_PROGRAMS += squashfuse_ll
61-
squashfuse_ll_SOURCES = ll.c ll_inode.c nonstd-daemon.c ll.h
62-
squashfuse_ll_CPPFLAGS = $(FUSE_CPPFLAGS)
63-
squashfuse_ll_LDADD = libsquashfuse.la libfuseprivate.la $(COMPRESSION_LIBS) \
64-
$(FUSE_LIBS)
82+
squashfuse_ll_SOURCES = ll_main.c
83+
squashfuse_ll_CPPFLAGS = $(ZLIB_CPPFLAGS) $(XZ_CPPFLAGS) $(LZO_CPPFLAGS) \
84+
$(LZ4_CPPFLAGS) $(ZSTD_CPPFLAGS) $(FUSE_CPPFLAGS)
85+
squashfuse_ll_LDADD = libsquashfuse_ll_convenience.la $(COMPRESSION_LIBS) $(FUSE_LIBS)
6586

87+
pkgconfig_DATA += squashfuse_ll.pc
88+
pkginclude_HEADERS += ll.h
6689
endif
6790

6891

@@ -95,6 +118,6 @@ tests/ll-smoke.sh tests/ls.sh: tests/lib.sh
95118
# Handle generation of swap include files
96119
CLEANFILES = swap.h.inc swap.c.inc
97120
EXTRA_DIST += swap.h.inc swap.c.inc
98-
$(libsquashfuse_la_OBJECTS): swap.h.inc
121+
$(libsquashfuse_convenience_la_OBJECTS): swap.h.inc
99122
swap.h.inc swap.c.inc: gen_swap.sh squashfs_fs.h Makefile
100123
SED="$(SED)" $(srcdir)/gen_swap.sh $(srcdir)/squashfs_fs.h

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ AC_SUBST([sq_high_level])
100100
AC_SUBST([sq_low_level])
101101
AC_SUBST([sq_demo])
102102
AC_SUBST([sq_tests])
103-
AC_CONFIG_FILES([Makefile squashfuse.pc tests/lib.sh ci/features])
103+
AC_CONFIG_FILES([Makefile squashfuse.pc squashfuse_ll.pc tests/lib.sh ci/features])
104104
AC_OUTPUT
105105

106106
AS_ECHO()

0 commit comments

Comments
 (0)