modernize backfire 10.03 so it can be operational again
[openwrt-10.03/.git] / package / fuse / Makefile
1
2 # Copyright (C) 2006-2010 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 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=fuse
12 PKG_VERSION:=2.8.3
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@SF/$(PKG_NAME)
17 PKG_MD5SUM:=517c8384f915e40647bda9f71579fd97
18
19 PKG_INSTALL:=1
20
21 # Kernel 2.4 Module
22 FUSE24_VERSION=2.5.3
23 FUSE24_SOURCE:=$(PKG_NAME)-$(FUSE24_VERSION).tar.gz
24 FUSE24_MD5SUM:=9c7e8b6606b9f158ae20b8521ba2867c
25 FUSE24_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(FUSE24_VERSION)
26 FUSE24_INSTALL_DIR:=$(FUSE24_BUILD_DIR)/ipkg-install
27 FUSE24_PATCH_DIR:=./patches-kernel24
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define Package/fuse/Default
32   TITLE:=FUSE
33   URL:=http://fuse.sourceforge.net/
34 endef
35
36 define Package/fuse/Default/description
37  FUSE (Filesystem in UserSpacE)
38 endef
39
40 define Package/fuse-utils
41 $(call Package/fuse/Default)
42   SECTION:=utils
43   CATEGORY:=Utilities
44   DEPENDS:=+libfuse
45   TITLE+= (utilities)
46   SUBMENU:=Filesystem
47 endef
48
49 define Package/fuse-utils/description
50 $(call Package/fuse/Default/description)
51  This package contains the FUSE utilities.
52  - fusermount
53  - ulockmgr_server
54 endef
55
56 define KernelPackage/fuse
57         $(call Package/fuse/Default)
58         SUBMENU:=Filesystems
59         TITLE+= (kernel module)
60         ifeq ($(KERNEL),2.4)
61                 FILES:=$(FUSE24_INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/kernel/fs/fuse/fuse.$(LINUX_KMOD_SUFFIX)
62                 VERSION:=$(LINUX_VERSION)+$(FUSE24_VERSION)-$(PKG_RELEASE)
63         else
64                 KCONFIG:= CONFIG_FUSE_FS
65                 FILES:=$(LINUX_DIR)/fs/fuse/fuse.$(LINUX_KMOD_SUFFIX)
66                 VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)
67         endif
68         AUTOLOAD:=$(call AutoLoad,80,fuse)
69 endef
70
71 define KernelPackage/fuse/description
72 $(call Package/fuse/Default/description)
73  This package contains the FUSE kernel module.
74 endef
75
76 define Package/libfuse
77 $(call Package/fuse/Default)
78   SECTION:=libs
79   CATEGORY:=Libraries
80   TITLE+= (library)
81   DEPENDS:=kmod-fuse
82   SUBMENU:=Filesystem
83 endef
84
85 define Package/libfuse/description
86 $(call Package/fuse/Default/description)
87  This package contains the FUSE shared libraries, needed by other programs.
88  - libfuse
89  - libulockmgr
90 endef
91
92 # generic args
93 CONFIGURE_ARGS += \
94         --enable-shared \
95         --enable-static \
96         --disable-rpath \
97         --disable-example \
98         --disable-mtab 
99
100 # kmod 2.4 args
101 FUSE24_CONFIGURE_ARGS := $(CONFIGURE_ARGS) \
102         --disable-lib --disable-util \
103         --enable-kernel-module --disable-auto-modprobe \
104         --with-kernel="$(LINUX_DIR)"
105
106 # generic package uses lib & utils
107 CONFIGURE_ARGS += --enable-lib --enable-util
108
109 ####### FUSE24 - START ######
110 ### if we're on kernel 2.4 build a kernel 2.4 compatible fuse module from older version, see also
111 ### http://sourceforge.net/apps/mediawiki/fuse/index.php?title=FAQ#What_version_of_FUSE_do_I_need_to_use_FUSE_with_Linux_2.4.3F
112 ifeq ($(KERNEL),2.4)
113
114 define Download/fuse24
115         FILE:=$(FUSE24_SOURCE)
116         URL:=$(PKG_SOURCE_URL)
117         MD5SUM:=$(FUSE24_MD5SUM)
118 endef
119 $(eval $(call Download,fuse24))
120
121 define Build/Prepare/fuse24
122         rm -rf $(FUSE24_BUILD_DIR)/
123         mkdir -p $(FUSE24_BUILD_DIR)/
124         $(TAR) -xzf $(DL_DIR)/$(FUSE24_SOURCE) -C $(FUSE24_BUILD_DIR)/..
125 endef
126
127 define Build/Patch/fuse24
128         $(call PatchDir,$(FUSE24_BUILD_DIR),$(FUSE24_PATCH_DIR),)
129 endef
130
131 define Build/Configure/fuse24
132         (cd $(FUSE24_BUILD_DIR); \
133                 rm -rf config.{cache,status} ; \
134                 $(CONFIGURE_VARS) \
135                 ./configure \
136                         $(FUSE24_CONFIGURE_ARGS) \
137         );
138 endef
139
140 define Build/Compile/fuse24
141         $(MAKE) -C $(FUSE24_BUILD_DIR)/$(MAKE_PATH) \
142                 ARCH="$(LINUX_KARCH)" \
143                 CROSS_COMPILE="$(TARGET_CROSS)" \
144                 all;
145 endef
146
147 define Build/Install/fuse24
148         rm -rf $(FUSE24_INSTALL_DIR)
149         mkdir -p $(FUSE24_INSTALL_DIR)
150         $(MAKE) -C $(FUSE24_BUILD_DIR) \
151                 ARCH="$(LINUX_KARCH)" \
152                 CROSS_COMPILE="$(TARGET_CROSS)" \
153                 DESTDIR="$(FUSE24_INSTALL_DIR)" \
154                 install
155 endef
156
157 define Build/Prepare
158         @echo "--> Build/Prepare enter"
159         $(call Build/Prepare/fuse24)
160         $(call Build/Patch/fuse24)
161         $(call Build/Prepare/Default)
162         @echo "--> Build/Prepare leave"
163 endef
164
165 define Build/Configure
166         @echo "--> Build/Configure enter"
167         $(call Build/Configure/fuse24)
168         $(call Build/Configure/Default)
169         @echo "--> Build/Configure leave"
170 endef
171
172 define Build/Compile
173         @echo "--> Build/Compile enter"
174         $(call Build/Compile/fuse24)
175         $(call Build/Compile/Default)
176         @echo "--> Build/Compile leave"
177 endef
178
179 define Build/Install
180         @echo "--> Build/Install enter"
181         $(call Build/Install/fuse24)
182         $(call Build/Install/Default)
183         @echo "--> Build/Install leave"
184 endef
185
186 endif
187 ####### FUSE24 - END ######
188
189 define Build/InstallDev
190         @echo "--> Build/InstallDev enter"
191         mkdir -p $(1)/usr/include
192         $(CP)   $(PKG_INSTALL_DIR)/usr/include/{fuse,*.h} $(1)/usr/include/
193         mkdir -p $(1)/usr/lib
194         $(CP)   $(PKG_INSTALL_DIR)/usr/lib/*.{a,so*} $(1)/usr/lib/
195         mkdir -p $(1)/usr/lib/pkgconfig
196         $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/fuse.pc $(1)/usr/lib/pkgconfig/
197         $(SED) 's,-I$$$${includedir}/fuse,,g' $(1)/usr/lib/pkgconfig/fuse.pc
198         $(SED) 's,-L$$$${libdir},,g' $(1)/usr/lib/pkgconfig/fuse.pc
199         @echo "--> Build/InstallDev leave"
200 endef
201
202 define Package/fuse-utils/install
203         @echo "--> Package/fuse-utils/install enter"
204         $(INSTALL_DIR) $(1)/usr/bin
205         # use cp and keep fusermount sticky bit
206         $(FIND) $(PKG_INSTALL_DIR)/usr/bin/ -type f -exec $(CP) -a {} $(1)/usr/bin/ \;
207         @echo "--> Package/fuse-utils/install leave"
208 endef
209
210 define Package/libfuse/install
211         @echo "--> Package/libfuse/install enter"
212         $(INSTALL_DIR) $(1)/usr/lib
213         $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so.* $(1)/usr/lib/
214         @echo "--> Package/libfuse/install leave"
215 endef
216
217 define Package/kmod-fuse/install
218         @echo "--> Package/kmod-fuse/install enter/leave"
219 endef
220
221 $(eval $(call BuildPackage,fuse-utils))
222 $(eval $(call BuildPackage,libfuse))
223 $(eval $(call KernelPackage,fuse))