add a default for PKG_BUILD_DIR and PKG_INSTALL_DIR (will use KERNEL_BUILD_DIR if...
[openwrt.git] / package / util-linux / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=util-linux
12 PKG_VERSION:=2.12r
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=ftp://ftp.kernel.org/pub/linux/utils/$(PKG_NAME)/ \
17         http://ftp.kernel.org/pub/linux/utils/$(PKG_NAME)/ \
18         ftp://ftp.de.kernel.org/pub/linux/utils/$(PKG_NAME)/ \
19         http://ftp.de.kernel.org/pub/linux/utils/$(PKG_NAME)/
20 PKG_MD5SUM:=c261230b27fc0fbcc287c76884caf2d3
21 PKG_CAT:=zcat
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/util-linux/Default
26   SECTION:=utils
27   CATEGORY:=Utilities
28   URL:=http://www.kernel.org/pub/linux/utils/util-linux/
29 endef
30
31 define Package/fdisk
32   $(call Package/util-linux/Default)
33   TITLE:=Partition table manipulation utility
34   DESCRIPTION:=\
35         This package contains an utility for managing disk partition tables.
36   URL:=http://www.kernel.org/pub/linux/utils/util-linux/
37 endef
38
39 define Package/losetup
40   $(call Package/util-linux/Default)
41   TITLE:=Loopback devices setup and control utility
42   DESCRIPTION:=\
43         This package contains an utility for managing loopback devices.
44 endef
45
46 define Package/swap-utils
47   $(call Package/util-linux/Default)
48   TITLE:=Swap space management utilities
49   DESCRIPTION:=\
50         This package contains a collection of tools for managing swap space: \\\
51         - mkswap\\\
52         - swapon\\\
53         - swapoff
54 endef
55
56 TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib
57 define Build/Compile
58         $(call Build/Compile/Default, \
59                 OPT="$(TARGET_CFLAGS)" \
60                 INSTALLSUID="install -m 4755" \
61                 DESTDIR="$(PKG_INSTALL_DIR)" \
62                 all install \
63         )
64 endef
65
66 define Package/Template
67         @if [ \! -f "$(PKG_INSTALL_DIR)/$(1)" ]; then \
68                 rm -f $(PKG_BUILD_DIR)/.built; \
69                 $(MAKE) $(PKG_BUILD_DIR)/.built; \
70         fi
71         $(INSTALL_DIR) $(2)
72         $(CP) $(PKG_INSTALL_DIR)/$(1) $(2)/
73 endef
74
75 define Package/fdisk/install
76         $(call Package/Template,sbin/fdisk,$(1)/usr/sbin)
77 endef
78
79 define Package/losetup/install
80         $(call Package/Template,sbin/losetup,$(1)/usr/sbin)
81 endef
82
83 define Package/swap-utils/install
84         $(call Package/Template,sbin/mkswap,$(1)/usr/sbin)
85         $(call Package/Template,sbin/swapon,$(1)/usr/sbin)
86         $(call Package/Template,sbin/swapoff,$(1)/usr/sbin)
87 endef
88
89 $(eval $(call BuildPackage,fdisk))
90 $(eval $(call BuildPackage,losetup))
91 $(eval $(call BuildPackage,swap-utils))