qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH V18 05/10] libqblock: build: add packaging support


From: Wenchao Xia
Subject: [Qemu-devel] [PATCH V18 05/10] libqblock: build: add packaging support
Date: Sat, 9 Feb 2013 15:42:34 +0800

  Now libqblock can be packaged and installed by
"sudo make install-libqblock'.

Signed-off-by: Wenchao Xia <address@hidden>
---
 libqblock/Makefile          |   34 +++++++++++++++++++++++++++++-----
 libqblock/libqblock.pc.in   |   13 +++++++++++++
 2 files changed, 42 insertions(+), 5 deletions(-)
 create mode 100644 libqblock/libqblock-error.h
 create mode 100644 libqblock/libqblock-types.h
 create mode 100644 libqblock/libqblock.h
 create mode 100644 libqblock/libqblock.pc.in

diff --git a/libqblock/Makefile b/libqblock/Makefile
index 4965dd6..75d9d18 100644
--- a/libqblock/Makefile
+++ b/libqblock/Makefile
@@ -1,4 +1,4 @@
-all: libqblock.la
+libqblock_includedir= $(includedir)/qblock
 
 # objects linked into a shared library, built with libtool with -fPIC if 
required
 libqblock-obj-y = libqblock/libqblock.o libqblock/libqblock-error.o
@@ -8,10 +8,18 @@ libqblock-obj-y += $(util-obj-y) $(block-obj-y)
 
 libqblock-lobj-y=$(patsubst %.o, %.lo, $(libqblock-obj-y))
 
+libqblock-pub-headers= $(SRC_PATH)/libqblock/libqblock.h \
+                       $(SRC_PATH)/libqblock/libqblock-types.h \
+                       $(SRC_PATH)/libqblock/libqblock-error.h
+
+libqblock-requires-$(CONFIG_CURL) += curl
+libqblock-requires-$(CONFIG_LIBCAP) += cap-ng
+libqblock-requires-$(CONFIG_UUID) += uuid
+
 # libtool will build the .o files, too
 $(libqblock-obj-y): | $(libqblock-lobj-y)
 
-all: libqblock.la
+all: libqblock.la libqblock.pc
 
 #########################################################################
 # Rules for building libqblock standalone library
@@ -21,10 +29,26 @@ libqblock.la: LDFLAGS += -rpath $(libdir) -no-undefined \
 libqblock.la: $(libqblock-lobj-y)
        $(call LINK,$^)
 
-
-.PHONY: libqblock-clean
+libqblock.pc: $(SRC_PATH)/libqblock/libqblock.pc.in
+       $(call quiet-command,sed -e 's|@LIBDIR@|$(libdir)|' \
+               -e 's|@INCLUDEDIR@|$(libqblock_includedir)|' \
+           -e 's|@VERSION@|$(shell cat $(SRC_PATH)/VERSION)|' \
+               -e 's|@PREFIX@|$(prefix)|' \
+               -e 's|@REQUIRES@|$(libqblock-requires-y)|' \
+               $< > libqblock.pc,\
+       "  GEN   $@")
+
+.PHONY: libqblock-clean install-libqblock
+
+install-libqblock: libqblock.la libqblock.pc
+       $(INSTALL_DIR) "$(DESTDIR)$(libdir)"
+       $(INSTALL_DIR) "$(DESTDIR)$(libdir)/pkgconfig"
+       $(INSTALL_DIR) "$(DESTDIR)$(libqblock_includedir)"
+       $(INSTALL_LIB) libqblock.la "$(DESTDIR)$(libdir)"
+       $(INSTALL_DATA) libqblock.pc "$(DESTDIR)$(libdir)/pkgconfig"
+       $(INSTALL_DATA) $(libqblock-pub-headers) 
"$(DESTDIR)$(libqblock_includedir)"
 
 libqblock-clean:
-       rm -rf $(libqblock-lobj-y) libqblock.la libqblock/.libs
+       rm -rf $(libqblock-lobj-y) libqblock.la libqblock.pc libqblock/.libs
 
 clean: libqblock-clean
diff --git a/libqblock/libqblock-error.h b/libqblock/libqblock-error.h
new file mode 100644
index 0000000..e69de29
diff --git a/libqblock/libqblock-types.h b/libqblock/libqblock-types.h
new file mode 100644
index 0000000..e69de29
diff --git a/libqblock/libqblock.h b/libqblock/libqblock.h
new file mode 100644
index 0000000..e69de29
diff --git a/libqblock/libqblock.pc.in b/libqblock/libqblock.pc.in
new file mode 100644
index 0000000..0901672
--- /dev/null
+++ b/libqblock/libqblock.pc.in
@@ -0,0 +1,13 @@
address@hidden@
+exec_prefix=${prefix}
address@hidden@
address@hidden@
+
+Name: qblock
+Description: Qemu block layer library
+Version: @VERSION@
+
+Requires: @REQUIRES@
+Libs: -L${libdir} -lqblock
+Libs.private:
+Cflags: -I${includedir}
-- 
1.7.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]