3eacf301d9350c2dbb6bacec2272a9635ffd2069
[openwrt/svn-archive/archive.git] / utils / lvm2 / Makefile
1 #
2 # Copyright (C) 2009, 2010 Stefan Monnier
3 #
4 # This is free software, licensed under the GNU General Public License v3+.
5 # See /LICENSE for more information.
6
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=LVM2
10 PKG_VERSION:=2.02.60
11 PKG_RELEASE:=1
12
13 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
14 PKG_SOURCE_URL:=ftp://sources.redhat.com/pub/lvm2/ \
15 http://netbsd.mirrors.tds.net/pub/sourceware.org/lvm2/
16 PKG_MD5SUM:=33e0e0f4b4582d495ff619696c634b2a
17 # 2.02.43 = fc34655706a2aa116b92328b24fad619
18 # 2.02.44 = 4ed7b99903a6fc5165b7b0b8def42486
19 # 2.02.53 = f9ae3579bf15467b7f1d7aea8b9ed9b3
20 # 2.02.60 = 33e0e0f4b4582d495ff619696c634b2a
21
22 # OpenWRT normally expects the tarball to expand into
23 # $(PKG_NAME)-$(PKG_VERSION), and this magic incantation seems to make it
24 # understand that LVM2's tarball expands into $(PKG_NAME).$(PKG_VERSION).
25 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/libdevmapper
30 SECTION:=libs
31 CATEGORY:=Libraries
32 SUBMENU:=disc
33 DEPENDS:=+kmod-dm
34 TITLE:=The Linux Kernel Device Mapper userspace library
35 URL:=http://sourceware.org/dm/
36 endef
37
38 define Package/libdevmapper/description
39 The Linux Kernel Device Mapper is the LVM (Linux Logical Volume Management)
40 Team\'s implementation of a minimalistic kernel-space driver that handles
41 volume management, while keeping knowledge of the underlying device layout
42 in user-space. This makes it useful for not only LVM, but EVMS, software
43 raid, and other drivers that create "virtual" block devices.
44 .
45 This package contains the (user-space) shared library for accessing the
46 device-mapper; it allows usage of the device-mapper through a clean,
47 consistent interface (as opposed to through kernel ioctls).
48 endef
49
50 define Package/lvm2
51 SECTION:=utils
52 CATEGORY:=Utilities
53 SUBMENU:=disc
54 TITLE:=The Linux Logical Volume Manager
55 DEPENDS:=+libdevmapper +libreadline
56 URL:=http://sourceware.org/lvm2/
57 endef
58
59 define Package/lvm2/description
60 This is LVM2, the rewrite of The Linux Logical Volume Manager. LVM
61 supports enterprise level volume management of disk and disk subsystems
62 by grouping arbitrary disks into volume groups. The total capacity of
63 volume groups can be allocated to logical volumes, which are accessed as
64 regular block devices.
65 endef
66
67 # I got problems building with readline, so I originally just disabled it.
68 # I've since added patch 100-readline-link which fixes the problem instead.
69 # CONFIGURE_ARGS += --disable-readline
70
71 # Apparently we have problems when "read"ing using O_DIRECT, maybe because
72 # of uClibc. More specifically, with O_DIRECT lvm becomes erratic, showing
73 # non-deterministic behavior: `lvs', `pvs' and friends can return anything
74 # from empty lists, to completely correct result, as well as checksum errors,
75 # complaints about missing volume groups, ... each run of the command can
76 # return something different. The "root" of the problem is (maybe among
77 # other places) in the "_io" function in dev-io.c, where calls to the "read"
78 # function often return garbage, although not always. There's nothing
79 # obviously wrong with the dev-io.c code, so the bug may just as well be in
80 # uClibc or in the kernel (it appeared on the MIPS platform and could be
81 # related to cache coherency issues).
82 # Debian Lenny's lvm2 also disables O_DIRECT on "arm armeb hppa mips mipsel".
83 CONFIGURE_ARGS += --disable-o_direct
84
85 define Build/Compile
86 $(MAKE) -C $(PKG_BUILD_DIR) \
87 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
88 DESTDIR="$(PKG_INSTALL_DIR)" \
89 install
90 endef
91
92 define Build/InstallDev
93 mkdir -p $(1)/usr/include
94 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/libdevmapper.h $(1)/usr/include/
95 mkdir -p $(1)/usr/lib
96 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdevmapper.so* $(1)/usr/lib/
97 mkdir -p $(1)/usr/lib/pkgconfig
98 $(CP) $(PKG_BUILD_DIR)/libdm/libdevmapper.pc $(1)/usr/lib/pkgconfig/
99 endef
100
101 define Package/libdevmapper/install
102 $(INSTALL_DIR) $(1)/usr/lib
103 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libdevmapper.so.* $(1)/usr/lib/
104 endef
105
106 # This rule only installs the `lvm' executable. Debian also installs
107 # a whole bunch of symlinks so that instead of `lvm <foo>' you can directly
108 # run `<foo>'.
109 define Package/lvm2/install
110 $(INSTALL_DIR) $(1)/sbin
111 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/lvm $(1)/sbin/
112 $(INSTALL_DIR) $(1)/etc/lvm
113 $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/example.conf $(1)/etc/lvm/lvm.conf
114 $(INSTALL_DIR) $(1)/etc/init.d
115 $(INSTALL_BIN) ./files/lvm2.init $(1)/etc/init.d/lvm2
116 endef
117
118 define Package/lvm2/conffiles
119 /etc/lvm/lvm.conf
120 endef
121
122 $(eval $(call BuildPackage,libdevmapper))
123 $(eval $(call BuildPackage,lvm2))