[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
- [Qemu-devel] [PATCH V18 00/10] libqblock qemu block layer library, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 03/10] libqblock: build: add configure support, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 04/10] libqblock: build: add rule for libqblock.la, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 01/10] build: add command check-clean, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 02/10] build: hide symbols in *.lo, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 05/10] libqblock: build: add packaging support,
Wenchao Xia <=
- [Qemu-devel] [PATCH V18 06/10] block: export function path_has_protocol(), Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 07/10] libqblock: libqblock API design and type defines, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 08/10] libqblock: libqblock API implement, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 09/10] libqblock: build: add rules for test case, Wenchao Xia, 2013/02/09
- [Qemu-devel] [PATCH V18 10/10] libqblock: test: libqblock test example, Wenchao Xia, 2013/02/09