pass the CFLAGS through the environment on compile and fix a few packages
[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: Makefile 3822 2006-05-24 07:01:52Z nico $
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 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
24 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/util-linux/Default
29   SECTION:=utils
30   CATEGORY:=Utilities
31   URL:=http://www.kernel.org/pub/linux/utils/util-linux/
32 endef
33
34 define Package/fdisk
35   $(call Package/util-linux/Default)
36   TITLE:=Partition table manipulation utility
37   DESCRIPTION:=\
38         This package contains an utility for managing disk partition tables.
39   URL:=http://www.kernel.org/pub/linux/utils/util-linux/
40 endef
41
42 define Package/losetup
43   $(call Package/util-linux/Default)
44   TITLE:=Loopback devices setup and control utility
45   DESCRIPTION:=\
46         This package contains an utility for managing loopback devices.
47 endef
48
49 define Package/swap-utils
50   $(call Package/util-linux/Default)
51   TITLE:=Swap space management utilities
52   DESCRIPTION:=\
53         This package contains a collection of tools for managing swap space: \\\
54         - mkswap\\\
55         - swapon\\\
56         - swapoff
57 endef
58
59 TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib
60 define Build/Compile
61         $(call Build/Compile/Default, \
62                 OPT="$(TARGET_CFLAGS)" \
63                 INSTALLSUID="install -m 4755" \
64                 DESTDIR="$(PKG_INSTALL_DIR)" \
65                 all install \
66         )
67 endef
68
69 define Package/Template
70         @if [ \! -f "$(PKG_INSTALL_DIR)/$(1)" ]; then \
71                 rm -f $(PKG_BUILD_DIR)/.built; \
72                 $(MAKE) $(PKG_BUILD_DIR)/.built; \
73         fi
74         $(INSTALL_DIR) $(2)
75         $(CP) $(PKG_INSTALL_DIR)/$(1) $(2)/
76 endef
77
78 define Package/fdisk/install
79         $(call Package/Template,sbin/fdisk,$(1)/usr/sbin)
80 endef
81
82 define Package/losetup/install
83         $(call Package/Template,sbin/losetup,$(1)/usr/sbin)
84 endef
85
86 define Package/swap-utils/install
87         $(call Package/Template,sbin/mkswap,$(1)/usr/sbin)
88         $(call Package/Template,sbin/swapon,$(1)/usr/sbin)
89         $(call Package/Template,sbin/swapoff,$(1)/usr/sbin)
90 endef
91
92 $(eval $(call BuildPackage,fdisk))
93 $(eval $(call BuildPackage,losetup))
94 $(eval $(call BuildPackage,swap-utils))