0f73dd27d3522c6114e3a34f6e16fa67a43e27a3
[openwrt/openwrt.git] / package / system / fstools / Makefile
1 #
2 # Copyright (C) 2014-2015 OpenWrt.org
3 #
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:=fstools
11 PKG_RELEASE:=1
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL=$(LEDE_GIT)/project/fstools.git
15 PKG_SOURCE_DATE:=2017-02-11
16 PKG_SOURCE_VERSION:=7d78836dac9e0ece57c51ab06589efa524276b9d
17 PKG_MIRROR_HASH:=261d8e6d0faa18b3c87cd6089b9110d655da133e478033e454c749ac43d3bc15
18 CMAKE_INSTALL:=1
19
20 PKG_LICENSE:=GPL-2.0
21 PKG_LICENSE_FILES:=
22
23 PKG_USE_MIPS16:=0
24 PKG_FLAGS:=nonshared
25
26 PKG_BUILD_DEPENDS := util-linux
27 PKG_CONFIG_DEPENDS := CONFIG_NAND_SUPPORT CONFIG_FSTOOLS_UBIFS_EXTROOT
28
29 PKG_MAINTAINER:=John Crispin <john@phrozen.org>
30
31 include $(INCLUDE_DIR)/package.mk
32 include $(INCLUDE_DIR)/cmake.mk
33
34 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
35 CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_UBIFS_EXTROOT),-DCMAKE_UBIFS_EXTROOT=y)
36
37 define Package/fstools
38 SECTION:=base
39 CATEGORY:=Base system
40 DEPENDS:=+ubox +USE_GLIBC:librt +NAND_SUPPORT:ubi-utils
41 TITLE:=OpenWrt filesystem tools
42 MENU:=1
43 endef
44
45 define Package/fstools/config
46 config FSTOOLS_UBIFS_EXTROOT
47 depends on PACKAGE_fstools
48 depends on NAND_SUPPORT
49 bool "Support extroot functionality with UBIFS"
50 default y
51 help
52 This option makes it possible to use extroot functionality if the root filesystem resides on an UBIFS partition
53 endef
54
55 define Package/snapshot-tool
56 SECTION:=base
57 CATEGORY:=Base system
58 TITLE:=rootfs snapshoting tool
59 DEPENDS:=+libubox +fstools
60 endef
61
62 define Package/block-mount
63 SECTION:=base
64 CATEGORY:=Base system
65 TITLE:=Block device mounting and checking
66 DEPENDS:=+ubox +libubox +libuci
67 endef
68
69 define Package/fstools/install
70 $(INSTALL_DIR) $(1)/sbin $(1)/lib
71
72 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{mount_root,jffs2reset} $(1)/sbin/
73 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libfstools.so $(1)/lib/
74 $(LN) jffs2reset $(1)/sbin/jffs2mark
75 endef
76
77 define Package/snapshot-tool/install
78 $(INSTALL_DIR) $(1)/sbin
79
80 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snapshot_tool $(1)/sbin/
81 $(INSTALL_BIN) ./files/snapshot $(1)/sbin/
82 endef
83
84 define Package/block-mount/install
85 $(INSTALL_DIR) $(1)/sbin $(1)/lib $(1)/usr/sbin $(1)/etc/hotplug.d/block $(1)/etc/init.d/ $(1)/etc/uci-defaults/
86
87 $(INSTALL_BIN) ./files/fstab.init $(1)/etc/init.d/fstab
88 $(INSTALL_DATA) ./files/fstab.default $(1)/etc/uci-defaults/10-fstab
89 $(INSTALL_DATA) ./files/mount.hotplug $(1)/etc/hotplug.d/block/10-mount
90
91 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/block $(1)/sbin/
92 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblkid-tiny.so $(1)/lib/
93 $(LN) ../../sbin/block $(1)/usr/sbin/swapon
94 $(LN) ../../sbin/block $(1)/usr/sbin/swapoff
95
96 endef
97
98 define Build/InstallDev
99 $(INSTALL_DIR) $(1)/usr/include
100 $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
101 $(INSTALL_DIR) $(1)/usr/lib/
102 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libubi-utils.a $(1)/usr/lib/
103 endef
104
105 $(eval $(call BuildPackage,fstools))
106 $(eval $(call BuildPackage,snapshot-tool))
107 $(eval $(call BuildPackage,block-mount))