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