Re: [PATCH] [RFC] Add static compile target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 26, 2013 at 01:09:47AM +0100, Ian Kumlien wrote:
> Sometimes, when you least expect it, a static binary is what you need to
> rescue your data... Or just get a good enough handle on things to make
> it work again ;)
> 
> "make static" is a gift to you, dear user with filesystem problems!

Adding the build target does not cost us anything. The result depends on the
distro and set of the needed libraries provided for a static build. Even
the basic 'btrfs' too needs uuid (due to cmds-receive) and I don't have
it in my distro. The other utilities may need static zlib or lzo
(restore) or libblkid (mkfs.btrfs).

I tried to build 'btrfs' only and moved the static libs definition to
the beginning (still needs the uuid static library though):

--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@ prefix ?= /usr/local
 bindir = $(prefix)/bin
 LIBS=-luuid -lm
 RESTORE_LIBS=-lz
+STATIC_LIBS= -lpthread

 progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
        btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
@@ -117,4 +118,9 @@ install: $(progs) install-man
        $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
        $(INSTALL) $(progs) $(DESTDIR)$(bindir)

+static: CFLAGS += -static
+static: LIBS = $(STATIC_LIBS)
+static: version btrfs
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux