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