packages: fix parallel build by adding + for every make command that passes the jobserver
[packages.git] / utils / vim / Makefile
1 #
2 # Copyright (C) 2006-2012 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:=vim
11 PKG_VERSION:=7.3
12 PKG_RELEASE:=1
13 VIMVER:=73
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=ftp://ftp.vim.org/pub/vim/unix/
17 PKG_MD5SUM:=5b9510a17074e2b37d8bb38ae09edbf2
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)$(VIMVER)
20 PKG_BUILD_PARALLEL:=1
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/vim/Default
25   SECTION:=utils
26   CATEGORY:=Utilities
27   DEPENDS:=+libncurses
28   TITLE:=Vi IMproved - enhanced vi editor
29   URL:=http://www.vim.org/
30   SUBMENU:=Editors
31 endef
32
33 define Package/vim
34   $(call Package/vim/Default)
35   TITLE+= (Tiny)
36 endef
37
38 define Package/vim-full
39   $(call Package/vim/Default)
40   TITLE+= (Normal)
41 endef
42
43 define Package/vim-runtime
44   $(call Package/vim/Default)
45   TITLE+= (runtime files)
46 endef
47
48 define Package/vim-help
49   $(call Package/vim/Default)
50   TITLE+= (help files)
51 endef
52
53 define Package/xxd
54   SECTION:=utils
55   CATEGORY:=Utilities
56   TITLE:=make a hexdump or do the reverse
57   URL:=http://www.vim.org/
58 endef
59
60 define Package/vim-full/conffiles
61 /usr/share/vim/vimrc
62 endef
63
64 define Package/vim/conffiles
65 /usr/share/vim/vimrc
66 endef
67
68 define Package/vim/description
69  Vim is an almost compatible version of the UNIX editor Vi.
70  (Tiny build)
71 endef
72
73 define Package/vim-full/description
74  Vim is an almost compatible version of the UNIX editor Vi.
75  (Normal build)
76 endef
77
78 define Package/vim-runtime/description
79  Vim is an almost compatible version of the UNIX editor Vi.
80  (Runtime files)
81 endef
82
83 define Package/vim-help/description
84  Vim is an almost compatible version of the UNIX editor Vi.
85  (Help files)
86 endef
87
88 define Package/xxd/description
89  xxd creates a hex dump of a given file or standard input, it can also convert
90  a hex dump back to its original binary form.
91 endef
92
93 CONFIGURE_ARGS += \
94         --disable-gui \
95         --disable-gtktest \
96         --disable-xim \
97         --without-x \
98         --disable-netbeans \
99         --disable-cscope \
100         --disable-gpm \
101         --with-tlib=ncurses
102
103 CONFIGURE_VARS += \
104         vim_cv_getcwd_broken=no \
105         vim_cv_memmove_handles_overlap=yes \
106         vim_cv_stat_ignores_slash=yes \
107         vim_cv_tgetent=zero \
108         vim_cv_terminfo=yes \
109         vim_cv_toupper_broken=no \
110         vim_cv_tty_group=root \
111         vim_cv_tty_mode=0620
112
113 ifneq ($(CONFIG_PACKAGE_vim),)
114 define Build/Compile/vim
115         $(call Build/Configure/Default, \
116                 --with-features=tiny \
117                 --disable-multibyte \
118         )
119         $(MAKE) -C $(PKG_BUILD_DIR) clean
120         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
121                 DESTDIR="$(PKG_INSTALL_DIR)" all
122         $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_tiny
123 endef
124 endif
125
126 ifneq ($(CONFIG_PACKAGE_vim-full),)
127 define Build/Compile/vim-full
128         $(call Build/Configure/Default, \
129                 --with-features=normal \
130                 --enable-multibyte \
131         )
132         $(MAKE) -C $(PKG_BUILD_DIR) clean
133         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
134                 DESTDIR="$(PKG_INSTALL_DIR)" all
135         $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_normal
136 endef
137 endif
138
139 ifneq ($(CONFIG_PACKAGE_xxd),)
140 define Build/Compile/xxd
141         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
142                 DESTDIR="$(PKG_INSTALL_DIR)" all
143 endef
144 endif
145
146 define Build/Compile/vim-runtime
147         $(MAKE) -C $(PKG_BUILD_DIR)/src DESTDIR="$(PKG_INSTALL_DIR)" installrtbase
148         (cd $(PKG_INSTALL_DIR) && tar -cf $(PKG_BUILD_DIR)/docs.tar ./usr/share/vim/vim$(VIMVER)/doc)
149         rm -rf $(PKG_INSTALL_DIR)/usr/share/vim/vim$(VIMVER)/doc
150         rm -rf $(PKG_INSTALL_DIR)/usr/man
151 endef
152
153 define Build/Compile
154 $(call Build/Compile/vim)
155 $(call Build/Compile/vim-full)
156 $(call Build/Compile/vim-runtime)
157 $(call Build/Compile/xxd)
158 endef
159
160 define Package/vim/install
161         $(INSTALL_DIR) $(1)/usr/bin
162         $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_tiny $(1)/usr/bin/vim
163         $(INSTALL_DIR) $(1)/usr/share/vim
164         $(INSTALL_CONF) ./files/vimrc $(1)/usr/share/vim/
165 endef
166
167 define Package/vim-full/install
168         $(INSTALL_DIR) $(1)/usr/bin
169         $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_normal $(1)/usr/bin/vim
170         $(INSTALL_DIR) $(1)/usr/share/vim
171         $(INSTALL_CONF) ./files/vimrc.full $(1)/usr/share/vim/vimrc
172 endef
173
174 define Package/vim-runtime/install
175         $(CP) $(PKG_INSTALL_DIR)/* $(1)
176         rm -rf $(1)/usr/share/vim/vim$(VIMVER)/doc
177 endef
178
179 define Package/vim-help/install
180         tar -C $(1) -xf $(PKG_BUILD_DIR)/docs.tar
181 endef
182
183 define Package/xxd/install
184         $(INSTALL_DIR) $(1)/usr/bin
185         $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/xxd/xxd $(1)/usr/bin
186 endef
187
188 $(eval $(call BuildPackage,vim))
189 $(eval $(call BuildPackage,vim-full))
190 $(eval $(call BuildPackage,vim-runtime))
191 $(eval $(call BuildPackage,vim-help))
192 $(eval $(call BuildPackage,xxd))