diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-08-19 23:04:06 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-08-27 23:49:26 -0700 |
commit | b067004c92dcb5a11817c9bc4d3fe2acc9f8e5d7 (patch) | |
tree | b332850c5f5db634f917e552bb625568822134a4 | |
parent | 0ba902b37820296ec6921e246d6c2c9104fe07f4 (diff) | |
download | f2fs-tools-b067004c92dcb5a11817c9bc4d3fe2acc9f8e5d7.tar.gz |
add configure option --with-root-libdir
This allows the development link libraries to be installed in
/usr/lib, while the run-libraries are installed in /lib, which is
required by Debian policy. This can be done via:
configure --prefix=/ --libdir=/usr/lib --with-root-libdir=/lib
The technique of working around libtool's inflexibility is borrowed
from util-linux.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | lib/Makefile.am | 17 | ||||
-rw-r--r-- | mkfs/Makefile.am | 15 |
3 files changed, 43 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 75a0c7a..672cab9 100644 --- a/configure.ac +++ b/configure.ac @@ -190,6 +190,17 @@ AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"]) #AC_SUBST([sbindir], [/sbin]) #AC_SUBST([sysconfdir], [/etc]) #AC_SUBST([localstatedir], [/var]) + +AC_ARG_WITH([root-libdir], +[ --with-root-libdir=DIR override location for /lib/libf2fs.so], +root_libdir=$withval, +root_libdir=NONE)dnl + +if test "$root_libdir" = NONE ; then + root_libdir="$libdir" +fi +AC_SUBST(root_libdir) + AC_CONFIG_FILES([ Makefile man/Makefile diff --git a/lib/Makefile.am b/lib/Makefile.am index b26b404..c1875a0 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,3 +6,20 @@ libf2fs_la_SOURCES = libf2fs.c libf2fs_io.c libf2fs_zoned.c libf2fs_la_CFLAGS = -Wall libf2fs_la_CPPFLAGS = -I$(top_srcdir)/include libf2fs_la_LDFLAGS = -version-info $(LIBF2FS_CURRENT):$(LIBF2FS_REVISION):$(LIBF2FS_AGE) + +root_libdir=@root_libdir@ + +install-exec-hook: + if test -n "$(root_libdir)" -a "$(libdir)" != "$(root_libdir)" -a \ + -f "$(DESTDIR)$(libdir)/libf2fs.so"; then \ + $(MKDIR_P) $(DESTDIR)$(root_libdir); \ + mv $(DESTDIR)$(libdir)/libf2fs.so.* $(DESTDIR)$(root_libdir); \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libf2fs.so); \ + so_img_rel_target=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + (cd $(DESTDIR)$(libdir) && \ + rm -f libf2fs.so && \ + $(LN_S) $$so_img_rel_target$(root_libdir)/$$so_img_name libf2fs.so); \ + fi + +uninstall-hook: + rm -f $(DESTDIR)$(root_libdir)/libf2fs.so* diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am index bbb4917..32996ba 100644 --- a/mkfs/Makefile.am +++ b/mkfs/Makefile.am @@ -14,3 +14,18 @@ libf2fs_format_la_CFLAGS = -DWITH_BLKDISCARD libf2fs_format_la_CPPFLAGS = -I$(top_srcdir)/include libf2fs_format_la_LDFLAGS = -luuid -L$(top_builddir)/lib -lf2fs \ -version-info $(FMT_CURRENT):$(FMT_REVISION):$(FMT_AGE) + +install-exec-hook: + if test -n "$(root_libdir)" -a "$(libdir)" != "$(root_libdir)" -a \ + -f "$(DESTDIR)$(libdir)/libf2fs_format.so"; then \ + $(MKDIR_P) $(DESTDIR)$(root_libdir); \ + mv $(DESTDIR)$(libdir)/libf2fs_format.so.* $(DESTDIR)$(root_libdir); \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libf2fs_format.so); \ + so_img_rel_target=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + (cd $(DESTDIR)$(libdir) && \ + rm -f libf2fs_format.so && \ + $(LN_S) $$so_img_rel_target$(root_libdir)/$$so_img_name libf2fs_format.so); \ + fi + +uninstall-hook: + rm $(DESTDIR)$(root_libdir)/libf2fs_format.so* |