vim.spec 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. ##
  2. ## vim.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2016 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package versions
  24. %define V_vl 8.0
  25. %define V_vs 80
  26. %define V_pl 0036
  27. # package information
  28. Name: vim
  29. Summary: The Vi (Improved) Text Editor
  30. URL: http://www.vim.org/
  31. Vendor: Bram Moolenaar et al.
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: CORE
  35. Group: Editor
  36. License: Charityware
  37. Version: %{V_vl}.%{V_pl}
  38. Release: 20161015
  39. # package options
  40. %option with_features normal
  41. %option with_multibyte yes
  42. %option with_perl no
  43. %option with_python no
  44. %option with_tcl no
  45. %option with_ruby no
  46. %option with_shell no
  47. # list of sources
  48. Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{V_vl}.tar.bz2
  49. Source2: rc.vim
  50. Source3: vimrc
  51. Patch0: vim.patch
  52. Patch1: vim.patch.shell
  53. Patch101: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0001
  54. Patch102: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0002
  55. Patch103: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0003
  56. Patch104: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0004
  57. Patch105: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0005
  58. Patch106: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0006
  59. Patch107: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0007
  60. Patch108: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0008
  61. Patch109: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0009
  62. Patch110: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0010
  63. Patch111: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0011
  64. Patch112: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0012
  65. Patch113: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0013
  66. Patch114: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0014
  67. Patch115: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0015
  68. Patch116: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0016
  69. Patch117: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0017
  70. Patch118: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0018
  71. Patch119: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0019
  72. Patch120: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0020
  73. Patch121: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0021
  74. Patch122: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0022
  75. Patch123: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0023
  76. Patch124: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0024
  77. Patch125: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0025
  78. Patch126: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0026
  79. Patch127: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0027
  80. Patch128: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0028
  81. Patch129: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0029
  82. Patch130: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0030
  83. Patch131: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0031
  84. Patch132: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0032
  85. Patch133: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0033
  86. Patch134: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0034
  87. Patch135: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0035
  88. Patch136: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0036
  89. # build information
  90. BuildPreReq: OpenPKG, openpkg >= 20160101, ncurses
  91. PreReq: OpenPKG, openpkg >= 20160101, ncurses
  92. %if "%{with_perl}" == "yes"
  93. BuildPreReq: perl
  94. PreReq: perl
  95. %endif
  96. %if "%{with_python}" == "yes"
  97. BuildPreReq: python
  98. PreReq: python
  99. %endif
  100. %if "%{with_tcl}" == "yes"
  101. BuildPreReq: tcl
  102. PreReq: tcl
  103. %endif
  104. %if "%{with_ruby}" == "yes"
  105. BuildPreReq: ruby
  106. PreReq: ruby
  107. %endif
  108. %if "%{with_shell}" == "yes"
  109. BuildPreReq: autoconf
  110. %endif
  111. %description
  112. Vim (Vi Improved) is a text editor that is upwards compatible
  113. with the classical Unix Vi. It can be used to edit any ASCII
  114. text. It is especially useful for editing programs. Vim offers
  115. a lot of enhancements not available in the traditional Vi. For
  116. example, Vim has multi level undo, multi windows and buffers, syntax
  117. highlighting, command line editing, filename completion, on-line
  118. help, and visual selection.
  119. %track
  120. prog vim = {
  121. version = %{V_vl}
  122. url = ftp://ftp.vim.org/pub/vim/unix/
  123. regex = vim-(\d+.\d+)\.tar\.(gz|bz2)
  124. }
  125. prog vim:patchlevel = {
  126. version = %{V_vl}.%{V_pl}
  127. url = ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/
  128. regex = (%{V_vl}\.\d+)
  129. }
  130. %prep
  131. # unpack base distribution parts
  132. %setup -q -c
  133. %patch -p0
  134. %if "%{with_shell}" == "yes"
  135. %patch -p0 -d vim%{V_vs} -P 1
  136. %endif
  137. # apply bundle patchsets
  138. # for patchset in 0001-1000; do
  139. # %{l_gzip} -d -c $RPM_SOURCE_DIR/%{V_vl}.$patchset.gz |\
  140. # %{l_patch} -p0 -E -t -s >/dev/null 2>&1 || true
  141. # done
  142. # apply remaining single patches
  143. i=1
  144. while [ $i -le %{V_pl} ]; do
  145. cat $RPM_SOURCE_DIR/%{V_vl}.`echo $i | awk '{ printf("%04d", $0); }'` |\
  146. %{l_patch} -p0 -E -t -s >/dev/null 2>&1 || true
  147. i=`expr $i + 1`
  148. done
  149. # adjust introduction text for OpenPKG branding
  150. %{l_shtool} subst \
  151. -e 's;Modified by;Packaged by;' \
  152. vim%{V_vs}/src/version.c
  153. # adjust paths to global configuration files
  154. %{l_shtool} subst \
  155. -e 's;^/\* \(#define SYS_VIMRC_FILE\).*$;\1 "%{l_prefix}/etc/vim/vimrc";' \
  156. -e 's;^/\* \(#define SYS_GVIMRC_FILE\).*$;\1 "%{l_prefix}/etc/vim/gvimrc";' \
  157. vim%{V_vs}/src/feature.h
  158. %if "%{with_python}" == "yes"
  159. # fix Python includes
  160. %{l_shtool} subst \
  161. -e 's;PYTHON_CFLAGS=.*$;PYTHON_CFLAGS="`python-config --includes`";' \
  162. vim%{V_vs}/src/auto/configure
  163. %endif
  164. %build
  165. # configure package
  166. cd vim%{V_vs}/src
  167. %if "%{with_shell}" == "yes"
  168. %{l_make} %{l_mflags} autoconf
  169. %endif
  170. CC="%{l_cc}" \
  171. CFLAGS="%{l_cflags -O}" \
  172. CPPFLAGS="%{l_cppflags}" \
  173. LDFLAGS="%{l_ldflags}" \
  174. GREP="grep" \
  175. ./configure \
  176. --prefix=%{l_prefix} \
  177. --mandir=%{l_prefix}/man \
  178. --with-local-dir=%{l_prefix} \
  179. --with-global-runtime=%{l_prefix}/lib/vim \
  180. --with-modified-by='%{l_openpkg_release}' \
  181. --with-tlib=ncurses \
  182. --without-x \
  183. --disable-gui \
  184. %if "%{with_features}" == "huge"
  185. --with-features=huge \
  186. %else
  187. %if "%{with_features}" == "big"
  188. --with-features=big \
  189. %else
  190. %if "%{with_features}" == "small"
  191. --with-features=small \
  192. %else
  193. --with-features=normal \
  194. %endif
  195. %endif
  196. %endif
  197. %if "%{with_multibyte}" == "yes"
  198. --enable-multibyte \
  199. %endif
  200. %if "%{with_perl}" == "yes"
  201. --enable-perlinterp \
  202. %else
  203. --disable-perlinterp \
  204. %endif
  205. %if "%{with_python}" == "yes"
  206. --enable-pythoninterp \
  207. --with-python-config-dir=%{l_prefix}/lib/python/config \
  208. %else
  209. --disable-pythoninterp \
  210. %endif
  211. %if "%{with_tcl}" == "yes"
  212. --enable-tclinterp \
  213. %else
  214. --disable-tclinterp \
  215. %endif
  216. %if "%{with_ruby}" == "yes"
  217. --enable-rubyinterp \
  218. %else
  219. --disable-rubyinterp \
  220. %endif
  221. --disable-nls
  222. %{l_shtool} subst \
  223. -e 's;^\(VIMRTDIR[^=]*=\).*;\1;' \
  224. Makefile
  225. # build package
  226. %{l_make} %{l_mflags -O}
  227. %install
  228. # perform package installation procedure
  229. ( cd vim%{V_vs}/src
  230. %{l_make} %{l_mflags} install \
  231. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  232. MANDIR=$RPM_BUILD_ROOT%{l_prefix}/man
  233. ) || exit $?
  234. # strip down installation hierarchy
  235. strip $RPM_BUILD_ROOT%{l_prefix}/bin/vim >/dev/null 2>&1 || true
  236. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/xxd
  237. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/xxd.1
  238. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/vim/tools
  239. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/vim/macros
  240. # add links for program runtime variants
  241. for link in vi ex rview rvim view vimdiff; do
  242. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$link
  243. ln $RPM_BUILD_ROOT%{l_prefix}/bin/vim \
  244. $RPM_BUILD_ROOT%{l_prefix}/bin/$link
  245. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/$link.1
  246. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/vim.1 \
  247. $RPM_BUILD_ROOT%{l_prefix}/man/man1/$link.1
  248. done
  249. # create installation area for addon packages
  250. %{l_shtool} mkdir -f -p -m 755 \
  251. $RPM_BUILD_ROOT%{l_prefix}/lib/vim
  252. # install run-command script
  253. %{l_shtool} mkdir -f -p -m 755 \
  254. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  255. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  256. %{SOURCE rc.vim} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  257. # install default configuration
  258. %{l_shtool} mkdir -f -p -m 755 \
  259. $RPM_BUILD_ROOT%{l_prefix}/etc/vim
  260. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  261. %{SOURCE vimrc} $RPM_BUILD_ROOT%{l_prefix}/etc/vim/
  262. # determine installation files
  263. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  264. %{l_files_std} \
  265. '%config %{l_prefix}/etc/vim/vimrc'
  266. %files -f files
  267. %clean
  268. %preun
  269. if [ $1 -eq 0 ]; then
  270. # remove a (usually empty) "helptags" file of addon packages
  271. rm -f $RPM_INSTALL_PREFIX/lib/vim/doc/tags >/dev/null 2>&1 || true
  272. fi