vim.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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 0052
  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: 20161029
  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. Patch137: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0037
  90. Patch138: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0038
  91. Patch139: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0039
  92. Patch140: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0040
  93. Patch141: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0041
  94. Patch142: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0042
  95. Patch143: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0043
  96. Patch144: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0044
  97. Patch145: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0045
  98. Patch146: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0046
  99. Patch147: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0047
  100. Patch148: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0048
  101. Patch149: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0049
  102. Patch150: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0050
  103. Patch151: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0051
  104. Patch152: ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/%{V_vl}.0052
  105. # build information
  106. BuildPreReq: OpenPKG, openpkg >= 20160101, ncurses
  107. PreReq: OpenPKG, openpkg >= 20160101, ncurses
  108. %if "%{with_perl}" == "yes"
  109. BuildPreReq: perl
  110. PreReq: perl
  111. %endif
  112. %if "%{with_python}" == "yes"
  113. BuildPreReq: python
  114. PreReq: python
  115. %endif
  116. %if "%{with_tcl}" == "yes"
  117. BuildPreReq: tcl
  118. PreReq: tcl
  119. %endif
  120. %if "%{with_ruby}" == "yes"
  121. BuildPreReq: ruby
  122. PreReq: ruby
  123. %endif
  124. %if "%{with_shell}" == "yes"
  125. BuildPreReq: autoconf
  126. %endif
  127. %description
  128. Vim (Vi Improved) is a text editor that is upwards compatible
  129. with the classical Unix Vi. It can be used to edit any ASCII
  130. text. It is especially useful for editing programs. Vim offers
  131. a lot of enhancements not available in the traditional Vi. For
  132. example, Vim has multi level undo, multi windows and buffers, syntax
  133. highlighting, command line editing, filename completion, on-line
  134. help, and visual selection.
  135. %track
  136. prog vim = {
  137. version = %{V_vl}
  138. url = ftp://ftp.vim.org/pub/vim/unix/
  139. regex = vim-(\d+.\d+)\.tar\.(gz|bz2)
  140. }
  141. prog vim:patchlevel = {
  142. version = %{V_vl}.%{V_pl}
  143. url = ftp://ftp.vim.org/pub/vim/patches/%{V_vl}/
  144. regex = (%{V_vl}\.\d+)
  145. }
  146. %prep
  147. # unpack base distribution parts
  148. %setup -q -c
  149. %patch -p0
  150. %if "%{with_shell}" == "yes"
  151. %patch -p0 -d vim%{V_vs} -P 1
  152. %endif
  153. # apply bundle patchsets
  154. # for patchset in 0001-1000; do
  155. # %{l_gzip} -d -c $RPM_SOURCE_DIR/%{V_vl}.$patchset.gz |\
  156. # %{l_patch} -p0 -E -t -s >/dev/null 2>&1 || true
  157. # done
  158. # apply remaining single patches
  159. i=1
  160. while [ $i -le %{V_pl} ]; do
  161. cat $RPM_SOURCE_DIR/%{V_vl}.`echo $i | awk '{ printf("%04d", $0); }'` |\
  162. %{l_patch} -p0 -E -t -s >/dev/null 2>&1 || true
  163. i=`expr $i + 1`
  164. done
  165. # adjust introduction text for OpenPKG branding
  166. %{l_shtool} subst \
  167. -e 's;Modified by;Packaged by;' \
  168. vim%{V_vs}/src/version.c
  169. # adjust paths to global configuration files
  170. %{l_shtool} subst \
  171. -e 's;^/\* \(#define SYS_VIMRC_FILE\).*$;\1 "%{l_prefix}/etc/vim/vimrc";' \
  172. -e 's;^/\* \(#define SYS_GVIMRC_FILE\).*$;\1 "%{l_prefix}/etc/vim/gvimrc";' \
  173. vim%{V_vs}/src/feature.h
  174. %if "%{with_python}" == "yes"
  175. # fix Python includes
  176. %{l_shtool} subst \
  177. -e 's;PYTHON_CFLAGS=.*$;PYTHON_CFLAGS="`python-config --includes`";' \
  178. vim%{V_vs}/src/auto/configure
  179. %endif
  180. %build
  181. # configure package
  182. cd vim%{V_vs}/src
  183. %if "%{with_shell}" == "yes"
  184. %{l_make} %{l_mflags} autoconf
  185. %endif
  186. CC="%{l_cc}" \
  187. CFLAGS="%{l_cflags -O}" \
  188. CPPFLAGS="%{l_cppflags}" \
  189. LDFLAGS="%{l_ldflags}" \
  190. GREP="grep" \
  191. ./configure \
  192. --prefix=%{l_prefix} \
  193. --mandir=%{l_prefix}/man \
  194. --with-local-dir=%{l_prefix} \
  195. --with-global-runtime=%{l_prefix}/lib/vim \
  196. --with-modified-by='%{l_openpkg_release}' \
  197. --with-tlib=ncurses \
  198. --without-x \
  199. --disable-gui \
  200. %if "%{with_features}" == "huge"
  201. --with-features=huge \
  202. %else
  203. %if "%{with_features}" == "big"
  204. --with-features=big \
  205. %else
  206. %if "%{with_features}" == "small"
  207. --with-features=small \
  208. %else
  209. --with-features=normal \
  210. %endif
  211. %endif
  212. %endif
  213. %if "%{with_multibyte}" == "yes"
  214. --enable-multibyte \
  215. %endif
  216. %if "%{with_perl}" == "yes"
  217. --enable-perlinterp \
  218. %else
  219. --disable-perlinterp \
  220. %endif
  221. %if "%{with_python}" == "yes"
  222. --enable-pythoninterp \
  223. --with-python-config-dir=%{l_prefix}/lib/python/config \
  224. %else
  225. --disable-pythoninterp \
  226. %endif
  227. %if "%{with_tcl}" == "yes"
  228. --enable-tclinterp \
  229. %else
  230. --disable-tclinterp \
  231. %endif
  232. %if "%{with_ruby}" == "yes"
  233. --enable-rubyinterp \
  234. %else
  235. --disable-rubyinterp \
  236. %endif
  237. --disable-nls
  238. %{l_shtool} subst \
  239. -e 's;^\(VIMRTDIR[^=]*=\).*;\1;' \
  240. Makefile
  241. # build package
  242. %{l_make} %{l_mflags -O}
  243. %install
  244. # perform package installation procedure
  245. ( cd vim%{V_vs}/src
  246. %{l_make} %{l_mflags} install \
  247. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  248. MANDIR=$RPM_BUILD_ROOT%{l_prefix}/man
  249. ) || exit $?
  250. # strip down installation hierarchy
  251. strip $RPM_BUILD_ROOT%{l_prefix}/bin/vim >/dev/null 2>&1 || true
  252. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/xxd
  253. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/xxd.1
  254. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/vim/tools
  255. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/vim/macros
  256. # add links for program runtime variants
  257. for link in vi ex rview rvim view vimdiff; do
  258. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$link
  259. ln $RPM_BUILD_ROOT%{l_prefix}/bin/vim \
  260. $RPM_BUILD_ROOT%{l_prefix}/bin/$link
  261. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/$link.1
  262. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/vim.1 \
  263. $RPM_BUILD_ROOT%{l_prefix}/man/man1/$link.1
  264. done
  265. # create installation area for addon packages
  266. %{l_shtool} mkdir -f -p -m 755 \
  267. $RPM_BUILD_ROOT%{l_prefix}/lib/vim
  268. # install run-command script
  269. %{l_shtool} mkdir -f -p -m 755 \
  270. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  271. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  272. %{SOURCE rc.vim} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  273. # install default configuration
  274. %{l_shtool} mkdir -f -p -m 755 \
  275. $RPM_BUILD_ROOT%{l_prefix}/etc/vim
  276. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  277. %{SOURCE vimrc} $RPM_BUILD_ROOT%{l_prefix}/etc/vim/
  278. # determine installation files
  279. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  280. %{l_files_std} \
  281. '%config %{l_prefix}/etc/vim/vimrc'
  282. %files -f files
  283. %clean
  284. %preun
  285. if [ $1 -eq 0 ]; then
  286. # remove a (usually empty) "helptags" file of addon packages
  287. rm -f $RPM_INSTALL_PREFIX/lib/vim/doc/tags >/dev/null 2>&1 || true
  288. fi