b1e49228c4c271ba9859c7809aae390641f1b9b5
[openwrt/openwrt.git] / package / utils / e2fsprogs / Makefile
1 #
2 # Copyright (C) 2006-2014 OpenWrt.org
3 # Copyright 2010 Vertical Communications
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=e2fsprogs
11 PKG_VERSION:=1.44.2
12 PKG_HASH:=8324cf0b6e81805a741d94087b00e99f7e16144f1ee5a413709a1fa6948b126c
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
16 PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/
17 PKG_LICENSE:=GPL-2.0
18 PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs
19
20 PKG_BUILD_DEPENDS:=util-linux e2fsprogs/host
21 PKG_INSTALL:=1
22
23 PKG_BUILD_PARALLEL:=1
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/host-build.mk
27
28 define Package/e2fsprogs
29 SECTION:=utils
30 CATEGORY:=Utilities
31 SUBMENU:=Filesystem
32 TITLE:=Ext2/3/4 filesystem utilities
33 URL:=http://e2fsprogs.sourceforge.net/
34 DEPENDS:=+libuuid +libext2fs
35 endef
36
37 define Package/e2fsprogs/description
38 This package contains essential ext2 filesystem utilities which consists of
39 e2fsck, mke2fs and most of the other core ext2 filesystem utilities.
40 endef
41
42 define Package/libext2fs
43 SECTION:=libs
44 CATEGORY:=Libraries
45 TITLE:=ext2/3/4 filesystem library
46 URL:=http://e2fsprogs.sourceforge.net/
47 DEPENDS:=+libuuid +libblkid +libss +libcomerr
48 endef
49
50 define Package/libext2fs/description
51 libext2fs is a library which can access ext2, ext3 and ext4 filesystems.
52 endef
53
54 define Package/libss
55 SECTION:=libs
56 CATEGORY:=Libraries
57 TITLE:=command-line interface parsing library
58 URL:=http://e2fsprogs.sourceforge.net/
59 DEPENDS:=+libcomerr
60 endef
61
62 define Package/libss/description
63 This pacakge contains libss, a command-line interface parsing library
64 bundled with e2fsprogs.
65 endef
66
67 define Package/libcomerr
68 SECTION:=libs
69 CATEGORY:=Libraries
70 TITLE:=common error description library
71 URL:=http://e2fsprogs.sourceforge.net/
72 DEPENDS:=+libuuid
73 endef
74
75 define Package/libcomerr/description
76 This package contains libcom_err, the common error description library
77 bundled with e2fsprogs.
78 endef
79
80 define Package/tune2fs
81 $(call Package/e2fsprogs)
82 TITLE:=Ext2 Filesystem tune utility
83 DEPENDS:= +e2fsprogs
84 endef
85
86 define Package/resize2fs
87 $(call Package/e2fsprogs)
88 TITLE:=Ext2 Filesystem resize utility
89 DEPENDS:= +e2fsprogs
90 endef
91
92 define Package/badblocks
93 $(call Package/e2fsprogs)
94 TITLE:=Ext2 Filesystem badblocks utility
95 DEPENDS:= +e2fsprogs
96 endef
97
98 define Package/dumpe2fs
99 $(call Package/e2fsprogs)
100 TITLE:=Ext2 Filesystem information dumping utility
101 DEPENDS:= +e2fsprogs
102 endef
103
104 define Package/e2freefrag
105 $(call Package/e2fsprogs)
106 TITLE:=Ext2 Filesystem free space fragmentation information utility
107 DEPENDS:= +e2fsprogs
108 endef
109
110 define Package/filefrag
111 $(call Package/e2fsprogs)
112 TITLE:=Ext2 Filesystem file fragmentation report utility
113 DEPENDS:= +e2fsprogs
114 endef
115
116 define Package/debugfs
117 $(call Package/e2fsprogs)
118 TITLE:=Ext2 Filesystem debugger
119 DEPENDS:= +e2fsprogs
120 endef
121
122 define Package/chattr
123 $(call Package/e2fsprogs)
124 TITLE:=Ext2 Filesystem chattr utility
125 DEPENDS:= +e2fsprogs
126 endef
127
128 define Package/lsattr
129 $(call Package/e2fsprogs)
130 TITLE:=Ext2 Filesystem lsattr utility
131 DEPENDS:= +e2fsprogs
132 endef
133
134 TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections
135
136 CONFIGURE_ARGS += \
137 --disable-testio-debug \
138 --enable-elf-shlibs \
139 --disable-libuuid \
140 --disable-libblkid \
141 --disable-uuidd \
142 --disable-tls \
143 --disable-nls \
144 --disable-rpath \
145 --disable-threads \
146 --disable-fuse2fs
147
148 define Build/Prepare
149 $(call Build/Prepare/Default)
150 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/config/
151 endef
152
153 define Build/Compile
154 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/util \
155 BUILDCC="$(HOSTCC)" \
156 CFLAGS="" \
157 CPPFLAGS="" \
158 LDFLAGS="" \
159 V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1,) \
160 subst
161 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
162 LDFLAGS=-Wl,--gc-sections \
163 BUILDCC="$(HOSTCC)" \
164 DESTDIR="$(PKG_INSTALL_DIR)" \
165 ELF_OTHER_LIBS="$(TARGET_LDFLAGS) -luuid" \
166 SYSLIBS="$(TARGET_LDFLAGS) -ldl -L$(PKG_BUILD_DIR)/lib/ -l:libcom_err.so.0.0" \
167 V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1,) \
168 all
169 endef
170
171 define Build/InstallDev
172 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
173 $(CP) $(PKG_BUILD_DIR)/lib/ext2fs/ext2fs.pc $(1)/usr/lib/pkgconfig
174 $(CP) $(PKG_BUILD_DIR)/lib/et/com_err.pc $(1)/usr/lib/pkgconfig
175
176 $(INSTALL_DIR) $(1)/usr/lib
177 $(CP) $(PKG_BUILD_DIR)/lib/libext2fs.{so,a}* $(1)/usr/lib
178 $(CP) $(PKG_BUILD_DIR)/lib/libcom_err.{so,a}* $(1)/usr/lib
179 $(CP) $(PKG_BUILD_DIR)/lib/libss.{so,a}* $(1)/usr/lib
180
181 $(INSTALL_DIR) $(1)/usr/include/ext2fs
182 $(CP) $(PKG_BUILD_DIR)/lib/ext2fs/*.h $(1)/usr/include/ext2fs
183 $(INSTALL_DIR) $(1)/usr/include/et
184 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/et/*.h $(1)/usr/include/et
185 # Apparently there is some confusion
186 echo "#include <et/com_err.h>" > $(1)/usr/include/com_err.h
187 $(INSTALL_DIR) $(1)/usr/include/ss
188 $(CP) \
189 $(PKG_BUILD_DIR)/lib/ss/ss.h \
190 $(PKG_BUILD_DIR)/lib/ss/ss_err.h \
191 $(1)/usr/include/ss/
192 endef
193
194 define Host/Compile
195 $(MAKE) $(PKG_JOBS) -C $(HOST_BUILD_DIR)/lib/ss mk_cmds
196 $(MAKE) $(PKG_JOBS) -C $(HOST_BUILD_DIR)/lib/et compile_et
197 endef
198
199 define Host/Install
200 $(INSTALL_DIR) $(1)/share/et
201 $(CP) $(HOST_BUILD_DIR)/lib/et/et_[ch].awk $(1)/share/et/
202 $(INSTALL_DIR) $(1)/share/ss
203 $(CP) $(HOST_BUILD_DIR)/lib/ss/ct_c.{sed,awk} $(1)/share/ss/
204 $(INSTALL_DIR) $(1)/bin
205 $(CP) \
206 $(HOST_BUILD_DIR)/lib/et/compile_et \
207 $(HOST_BUILD_DIR)/lib/ss/mk_cmds \
208 $(1)/bin/
209 endef
210
211 define Package/e2fsprogs/conffiles
212 /etc/e2fsck.conf
213 endef
214
215 define Package/e2fsprogs/install
216 $(INSTALL_DIR) $(1)/usr/sbin
217 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/e2fsck $(1)/usr/sbin/
218 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mke2fs $(1)/usr/sbin/
219 $(LN) mke2fs $(1)/usr/sbin/mkfs.ext2
220 $(LN) mke2fs $(1)/usr/sbin/mkfs.ext3
221 $(LN) mke2fs $(1)/usr/sbin/mkfs.ext4
222 $(LN) e2fsck $(1)/usr/sbin/fsck.ext2
223 $(LN) e2fsck $(1)/usr/sbin/fsck.ext3
224 $(LN) e2fsck $(1)/usr/sbin/fsck.ext4
225 $(INSTALL_DIR) $(1)/usr/lib
226 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libe2p.so.* $(1)/usr/lib/
227 $(INSTALL_DIR) $(1)/etc/init.d
228 $(INSTALL_DIR) $(1)/lib/functions/fsck
229 $(INSTALL_DATA) ./files/e2fsck.sh $(1)/lib/functions/fsck/
230 $(INSTALL_DATA) ./files/e2fsck.conf $(1)/etc/e2fsck.conf
231 endef
232
233 define Package/libcomerr/install
234 $(INSTALL_DIR) $(1)/usr/lib
235 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcom_err.so* $(1)/usr/lib/
236 endef
237
238 define Package/libss/install
239 $(INSTALL_DIR) $(1)/usr/lib
240 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libss.so* $(1)/usr/lib/
241 endef
242
243 define Package/libext2fs/install
244 $(INSTALL_DIR) $(1)/usr/lib
245 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libext2fs.so.* $(1)/usr/lib/
246 endef
247
248 define Package/libext2fs/install_lib
249 $(INSTALL_DIR) $(1)/usr/lib
250 $(CP) $(PKG_BUILD_DIR)/lib/ext2fs/libext2fs.a $(1)/usr/lib/libext2fs_pic.a
251 endef
252
253 define Package/tune2fs/install
254 $(INSTALL_DIR) $(1)/usr/sbin
255 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tune2fs $(1)/usr/sbin/
256 $(LN) tune2fs $(1)/usr/sbin/findfs
257 endef
258
259 define Package/resize2fs/install
260 $(INSTALL_DIR) $(1)/usr/sbin
261 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/resize2fs $(1)/usr/sbin/
262 endef
263
264 define Package/badblocks/install
265 $(INSTALL_DIR) $(1)/usr/sbin
266 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/badblocks $(1)/usr/sbin/
267 endef
268
269 define Package/dumpe2fs/install
270 $(INSTALL_DIR) $(1)/usr/sbin
271 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dumpe2fs $(1)/usr/sbin/
272 endef
273
274 define Package/e2freefrag/install
275 $(INSTALL_DIR) $(1)/usr/sbin
276 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/e2freefrag $(1)/usr/sbin/
277 endef
278
279 define Package/filefrag/install
280 $(INSTALL_DIR) $(1)/usr/sbin
281 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/filefrag $(1)/usr/sbin/
282 endef
283
284 define Package/debugfs/install
285 $(INSTALL_DIR) $(1)/usr/sbin
286 $(INSTALL_DIR) $(1)/usr/lib
287 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/debugfs $(1)/usr/sbin/
288 endef
289
290 define Package/chattr/install
291 $(INSTALL_DIR) $(1)/usr/bin
292 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/chattr $(1)/usr/bin/
293 endef
294
295 define Package/lsattr/install
296 $(INSTALL_DIR) $(1)/usr/bin
297 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lsattr $(1)/usr/bin/
298 endef
299
300 $(eval $(call BuildPackage,e2fsprogs))
301 $(eval $(call BuildPackage,libcomerr))
302 $(eval $(call BuildPackage,libss))
303 $(eval $(call BuildPackage,libext2fs))
304 $(eval $(call BuildPackage,tune2fs))
305 $(eval $(call BuildPackage,resize2fs))
306 $(eval $(call BuildPackage,badblocks))
307 $(eval $(call BuildPackage,dumpe2fs))
308 $(eval $(call BuildPackage,e2freefrag))
309 $(eval $(call BuildPackage,filefrag))
310 $(eval $(call BuildPackage,debugfs))
311 $(eval $(call BuildPackage,chattr))
312 $(eval $(call BuildPackage,lsattr))
313 $(eval $(call HostBuild))