add mc
[buildroot.git] / package / dm / dm.mk
blob217d944fdc249abc9e2690c642719862fa2f62bb
1 #############################################################
3 # device-mapper
5 #############################################################
6 # Copyright (C) 2005 by Richard Downer <rdowner@gmail.com>
7 # Derived from work
8 # Copyright (C) 2001-2005 by Erik Andersen <andersen@codepoet.org>
9 # Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU Library General Public License as
13 # published by the Free Software Foundation; either version 2 of the
14 # License, or (at your option) any later version.
16 # This program is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # Library General Public License for more details.
21 # You should have received a copy of the GNU Library General Public
22 # License along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 # USA
26 DM_BASEVER=1.02
27 DM_PATCH=22
28 DM_VERSION=$(DM_BASEVER).$(DM_PATCH)
29 DM_SOURCE:=device-mapper.$(DM_VERSION).tgz
30 DM_SITE:=ftp://sources.redhat.com/pub/dm
31 DM_SITE_OLD:=ftp://sources.redhat.com/pub/dm/old
32 DM_CAT:=$(ZCAT)
33 DM_DIR:=$(BUILD_DIR)/device-mapper.$(DM_VERSION)
34 DM_STAGING_BINARY:=$(STAGING_DIR)/usr/sbin/dmsetup
35 DM_TARGET_BINARY:=$(TARGET_DIR)/usr/sbin/dmsetup
36 DM_STAGING_LIBRARY:=$(STAGING_DIR)/lib/libdevmapper.so
37 DM_TARGET_LIBRARY:=$(TARGET_DIR)/usr/lib/libdevmapper.so
38 DM_TARGET_HEADER:=$(TARGET_DIR)/usr/include/libdevmapper.h
40 $(DL_DIR)/$(DM_SOURCE):
41 $(WGET) -P $(DL_DIR) $(DM_SITE)/$(DM_SOURCE) || \
42 $(WGET) -P $(DL_DIR) $(DM_SITE_OLD)/$(DM_SOURCE)
44 $(DM_DIR)/.unpacked: $(DL_DIR)/$(DM_SOURCE)
45 $(DM_CAT) $(DL_DIR)/$(DM_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
46 toolchain/patch-kernel.sh $(DM_DIR) package/dm/ \*.patch
47 touch $@
49 $(DM_DIR)/.configured: $(DM_DIR)/.unpacked
50 (cd $(DM_DIR); rm -rf config.cache; \
51 $(TARGET_CONFIGURE_OPTS) \
52 $(TARGET_CONFIGURE_ARGS) \
53 ac_cv_have_decl_malloc=yes \
54 gl_cv_func_malloc_0_nonnull=yes \
55 ac_cv_func_malloc_0_nonnull=yes \
56 ac_cv_func_calloc_0_nonnull=yes \
57 ac_cv_func_realloc_0_nonnull=yes \
58 ac_cv_func_lstat_dereferences_slashed_symlink=yes \
59 ./configure \
60 --target=$(GNU_TARGET_NAME) \
61 --host=$(GNU_TARGET_NAME) \
62 --build=$(GNU_HOST_NAME) \
63 --prefix=/usr \
64 --exec-prefix=/usr \
65 --bindir=/usr/bin \
66 --sbindir=/usr/sbin \
67 --libdir=/lib \
68 --libexecdir=/usr/lib \
69 --sysconfdir=/etc \
70 --datadir=/usr/share \
71 --localstatedir=/var \
72 --includedir=/usr/include \
73 --mandir=/usr/share/man \
74 --infodir=/usr/share/info \
75 $(DISABLE_NLS) \
76 $(DISABLE_LARGEFILE) \
77 --with-user=$(shell id -un) --with-group=$(shell id -gn) \
79 touch $@
81 $(DM_DIR)/$(DM_BINARY): dm-build
82 $(DM_DIR)/$(DM_LIBRARY): dm-build
84 $(DM_STAGING_BINARY) $(DM_STAGING_LIBRARY): $(DM_DIR)/.configured
85 $(MAKE) CC=$(TARGET_CC) -C $(DM_DIR)
86 $(MAKE) DESTDIR=$(STAGING_DIR) -C $(DM_DIR) install
88 # Install dmsetup from staging to target
89 $(DM_TARGET_BINARY): $(DM_STAGING_BINARY)
90 $(INSTALL) -m 0755 $? $@
91 -$(STRIPCMD) $(DM_TARGET_BINARY)
92 touch -c $@
94 # Install libdevmapper.so.1.00 from staging to target
95 $(DM_TARGET_LIBRARY).$(DM_BASEVER): $(DM_STAGING_LIBRARY)
96 $(INSTALL) -m 0644 $? $@
97 -$(STRIPCMD) $@
98 touch -c $@
100 # Makes libdevmapper.so a symlink to libdevmapper.so.1.00
101 $(DM_TARGET_LIBRARY): $(DM_TARGET_LIBRARY).$(DM_BASEVER)
102 rm -f $@
103 ln -s $(<F) $@
104 touch -c $@
106 # Install header file
107 $(DM_TARGET_HEADER): $(DM_TARGET_LIBRARY)
108 rm -f $@
109 mkdir -p $(STAGING_DIR)/usr/include
110 $(INSTALL) -m 0644 $(STAGING_DIR)/usr/include/libdevmapper.h $@
112 dm: uclibc $(DM_TARGET_BINARY) $(DM_TARGET_LIBRARY) #$(DM_TARGET_HEADER)
114 dm-source: $(DL_DIR)/$(DM_SOURCE)
116 dm-clean:
117 rm $(DM_TARGET_BINARY) $(DM_TARGET_LIBRARY) \
118 $(DM_TARGET_LIBRARY).$(DM_BASEVER) $(DM_TARGET_HEADER)
119 -$(MAKE) -C $(DM_DIR) clean
121 dm-dirclean:
122 rm -rf $(DM_DIR)
124 #############################################################
126 # Toplevel Makefile options
128 #############################################################
129 ifeq ($(BR2_PACKAGE_DM),y)
130 TARGETS+=dm
131 endif