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