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