fork for IVI
[profile/ivi/vim.git] / packaging / vim.spec
1 %define vimdir vim73
2
3 Summary: The VIM editor
4 URL:     http://www.vim.org/
5 Name: vim
6 Version: 7.3.382
7 Release: 1
8 License: Vim
9 Group: Applications/Editors
10 Source0: vim-%{version}.tar.bz2
11 Source4: vimrc
12 Source5: virc
13 #Source5: ftp://ftp.vim.org/pub/vim/patches/README.patches
14 Source11: Changelog.rpm
15 Source12: vi_help.txt
16 Source14: spec-template
17
18 Patch2002: vim-7.0-fixkeys.patch
19 Patch2003: vim-6.2-specsyntax.patch
20 Patch2004: vim-7.0-crv.patch
21
22 Patch3004: vim-7.0-rclocation.patch
23 Patch3006: vim-6.4-checkhl.patch
24 Patch3009: vim-7.0-syncolor.patch
25 Patch3010: vim-7.0-specedit.patch
26
27 BuildRequires: pkgconfig(ncurses)
28 BuildRequires: libacl-devel autoconf
29
30 %description
31 VIM (VIsual editor iMproved) is an updated and improved version of the
32 vi editor.  Vi was the first real screen-based editor for UNIX, and is
33 still very popular.  VIM improves on vi by adding new features:
34 multiple windows, multi-level undo, block highlighting and more.
35
36 %package common
37 Summary: The common files needed by any version of the VIM editor
38 Group: Applications/Editors
39 Requires: %{name}-filesystem
40
41 %description common
42 VIM (VIsual editor iMproved) is an updated and improved version of the
43 vi editor.  Vi was the first real screen-based editor for UNIX, and is
44 still very popular.  VIM improves on vi by adding new features:
45 multiple windows, multi-level undo, block highlighting and more.  The
46 vim-common package contains files which every VIM binary will need in
47 order to run.
48
49 If you are installing vim-enhanced or vim-X11, you'll also need
50 to install the vim-common package.
51
52 %package minimal
53 Summary: A minimal version of the VIM editor
54 Group: Applications/Editors
55 Provides: vi = %{version}-%{release}
56
57 %description minimal
58 VIM (VIsual editor iMproved) is an updated and improved version of the
59 vi editor.  Vi was the first real screen-based editor for UNIX, and is
60 still very popular.  VIM improves on vi by adding new features:
61 multiple windows, multi-level undo, block highlighting and more. The
62 vim-minimal package includes a minimal version of VIM, which is
63 installed into /bin/vi for use when only the root partition is
64 present. NOTE: The online help is only available when the vim-common
65 package is installed.
66
67 %package enhanced
68 Summary: A version of the VIM editor which includes recent enhancements
69 Group: Applications/Editors
70 Requires: vim-common = %{version}-%{release} which
71 Provides: vim = %{version}-%{release}
72
73 %description enhanced
74 VIM (VIsual editor iMproved) is an updated and improved version of the
75 vi editor.  Vi was the first real screen-based editor for UNIX, and is
76 still very popular.  VIM improves on vi by adding new features:
77 multiple windows, multi-level undo, block highlighting and more.  The
78 vim-enhanced package contains a version of VIM with extra, recently
79 introduced features like Python and Perl interpreters.
80
81 Install the vim-enhanced package if you'd like to use a version of the
82 VIM editor which includes recently added enhancements like
83 interpreters for the Python and Perl scripting languages.  You'll also
84 need to install the vim-common package.
85
86 %package filesystem
87 Summary: VIM filesystem layout
88 Group: Applications/Editors
89
90 %Description filesystem
91 This package provides some directories which are required by other
92 packages that add vim files, p.e.  additional syntax files or filetypes.
93
94
95 %prep
96 %setup
97 # fix rogue dependencies from sample code
98 chmod -x runtime/tools/mve.awk
99 %patch2002 -p1
100 %patch2003 -p1
101 %patch2004 -p1
102 perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk
103
104 %patch3004 -p1
105 %patch3006 -p1
106 %patch3009 -p1
107 %patch3010 -p1
108
109 %build
110 cd src
111 autoconf
112
113 sed -e "s+VIMRCLOC      = \$(VIMLOC)+VIMRCLOC   = /etc+" Makefile > Makefile.tmp
114 mv -f Makefile.tmp Makefile
115
116 export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2"
117 export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2"
118
119 sed -i 's/-l\$with_tlib/-ltinfo -l\$with_tlib/g' configure
120 sed -i 's/-l\$with_tlib/-ltinfo -l\$with_tlib/g' auto/configure
121
122 %configure --prefix=%{_prefix} --with-features=huge --enable-pythoninterp \
123  --enable-perlinterp --disable-tclinterp --with-x=no \
124  --enable-gui=no --exec-prefix=%{_prefix} --enable-multibyte \
125  --enable-cscope --with-modified-by="<bugzilla@meego.com>" \
126  --with-compiledby="<bugzilla@meego.com>" \
127   --disable-netbeans \
128   --disable-selinux \
129   --disable-nls \
130   --disable-rubyinterp \
131   --disable-perlinterp  \
132   --disable-pythoninterp 
133
134 make VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim/%{vimdir} %{?_smp_mflags}
135 cp vim enhanced-vim
136 make clean
137
138 perl -pi -e "s/help.txt/vi_help.txt/"  os_unix.h ex_cmds.c
139 perl -pi -e "s/\/etc\/vimrc/\/etc\/virc/"  os_unix.h
140 %configure --prefix=%{_prefix} --with-features=small --with-x=no \
141   --enable-multibyte \
142   --disable-netbeans \
143   --disable-nls \
144   --disable-selinux \
145   --disable-pythoninterp --disable-perlinterp --disable-tclinterp \
146   --enable-gui=no --disable-gpm --exec-prefix=/ \
147   --with-compiledby="<bugzilla@meego.com>" \
148   --with-modified-by="<bugzilla@meego.com>"
149
150 make VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim/%{vimdir} %{?_smp_mflags}
151
152 %install
153 rm -rf $RPM_BUILD_ROOT
154 mkdir -p $RPM_BUILD_ROOT/bin
155 mkdir -p $RPM_BUILD_ROOT/%{_bindir}
156 mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}/vimfiles/{after,autoload,colors,compiler,doc,ftdetect,ftplugin,indent,keymap,lang,plugin,print,spell,syntax,tutor}
157 mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}/vimfiles/after/{autoload,colors,compiler,doc,ftdetect,ftplugin,indent,keymap,lang,plugin,print,spell,syntax,tutor}
158 cp -f %{SOURCE11} .
159 cp -f %{SOURCE14} $RPM_BUILD_ROOT/%{_datadir}/%{name}/vimfiles/template.spec
160 cp runtime/doc/uganda.txt LICENSE
161 # Those aren't Linux info files but some binary files for Amiga:
162 rm -f README*.info
163
164
165 cd src
166 make install DESTDIR=$RPM_BUILD_ROOT BINDIR=/bin VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim/%{vimdir}
167 make installgtutorbin  DESTDIR=$RPM_BUILD_ROOT BINDIR=/bin VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim/%{vimdir}
168 mv $RPM_BUILD_ROOT/bin/xxd $RPM_BUILD_ROOT/%{_bindir}/xxd
169 mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32,48x48,64x64}/apps
170 install -m755 enhanced-vim $RPM_BUILD_ROOT/%{_bindir}/vim
171
172 ( cd $RPM_BUILD_ROOT
173   mv ./bin/vimtutor ./%{_bindir}/vimtutor
174   mv ./bin/vim ./bin/vi
175   rm -f ./bin/rvim
176   ln -sf vi ./bin/ex
177   ln -sf vi ./bin/rvi
178   ln -sf vi ./bin/rview
179   ln -sf vi ./bin/view
180   ln -sf vim ./%{_bindir}/ex
181   ln -sf vim ./%{_bindir}/rvim
182   ln -sf vim ./%{_bindir}/vimdiff
183 )
184
185 # Dependency cleanups
186 chmod 644 $RPM_BUILD_ROOT/%{_datadir}/%{name}/%{vimdir}/doc/vim2html.pl \
187  $RPM_BUILD_ROOT/%{_datadir}/%{name}/%{vimdir}/tools/*.pl \
188  $RPM_BUILD_ROOT/%{_datadir}/%{name}/%{vimdir}/tools/vim132
189 chmod 644 ../runtime/doc/vim2html.pl
190
191 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/profile.d
192 cat >$RPM_BUILD_ROOT/%{_sysconfdir}/profile.d/vim.sh <<EOF
193 if [ -n "\$BASH_VERSION" -o -n "\$KSH_VERSION" -o -n "\$ZSH_VERSION" ]; then
194   [ -x /%{_bindir}/id ] || return
195   [ \`/%{_bindir}/id -u\` -le 200 ] && return
196   # for bash and zsh, only if no alias is already set
197   alias vi >/dev/null 2>&1 || alias vi=vim
198 fi
199 EOF
200 cat >$RPM_BUILD_ROOT/%{_sysconfdir}/profile.d/vim.csh <<EOF
201 [ -x /%{_bindir}/id ] || exit
202 [ \`/%{_bindir}/id -u\` -gt 200 ] && alias vi vim
203 EOF
204 chmod 0644 $RPM_BUILD_ROOT/%{_sysconfdir}/profile.d/*
205 install -p -m644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/vimrc
206 install -p -m644 %{SOURCE5} $RPM_BUILD_ROOT/%{_sysconfdir}/virc
207 (cd $RPM_BUILD_ROOT/%{_datadir}/%{name}/%{vimdir}/doc;
208  gzip -9 *.txt
209  gzip -d help.txt.gz version7.txt.gz sponsor.txt.gz
210  cp %{SOURCE12} .
211  cat tags | sed -e 's/\t\(.*.txt\)\t/\t\1.gz\t/;s/\thelp.txt.gz\t/\thelp.txt\t/;s/\tversion7.txt.gz\t/\tversion7.txt\t/;s/\tsponsor.txt.gz\t/\tsponsor.txt\t/' > tags.new; mv -f tags.new tags
212 cat >> tags << EOF
213 vi_help.txt     vi_help.txt     /*vi_help.txt*
214 vi-author.txt   vi_help.txt     /*vi-author*
215 vi-Bram.txt     vi_help.txt     /*vi-Bram*
216 vi-Moolenaar.txt        vi_help.txt     /*vi-Moolenaar*
217 vi-credits.txt  vi_help.txt     /*vi-credits*
218 EOF
219 LANG=C sort tags > tags.tmp; mv tags.tmp tags
220  )
221 (cd ../runtime; rm -rf doc; ln -svf ../../vim/%{vimdir}/doc docs;) 
222 rm -f $RPM_BUILD_ROOT/%{_datadir}/vim/%{vimdir}/macros/maze/maze*.c
223 rm -rf $RPM_BUILD_ROOT/%{_datadir}/vim/%{vimdir}/tools
224 rm -rf $RPM_BUILD_ROOT/%{_datadir}/vim/%{vimdir}/doc/vim2html.pl
225 rm -f $RPM_BUILD_ROOT/%{_datadir}/vim/%{vimdir}/tutor/tutor.gr.utf-8~
226
227 rm -rf %{buildroot}/bin/gvimtutor
228 rm -rf %{buildroot}%{_bindir}/vimtutor
229
230 %remove_docs
231
232
233 %files common
234 %defattr(-,root,root)
235 %config(noreplace) %{_sysconfdir}/vimrc
236 %doc README* LICENSE
237 %dir %{_datadir}/%{name}
238 %{_datadir}/%{name}/vimfiles/template.spec
239 %{_datadir}/%{name}/%{vimdir}/autoload
240 %{_datadir}/%{name}/%{vimdir}/colors
241 %{_datadir}/%{name}/%{vimdir}/compiler
242 %{_datadir}/%{name}/%{vimdir}/doc
243 %{_datadir}/%{name}/%{vimdir}/*.vim
244 %{_datadir}/%{name}/%{vimdir}/ftplugin
245 %{_datadir}/%{name}/%{vimdir}/indent
246 #%{_datadir}/%{name}/%{vimdir}/keymap
247 %{_datadir}/%{name}/%{vimdir}/macros
248 %{_datadir}/%{name}/%{vimdir}/plugin
249 %{_datadir}/%{name}/%{vimdir}/print
250 %{_datadir}/%{name}/%{vimdir}/syntax
251 %{_datadir}/%{name}/%{vimdir}/tutor
252 %{_datadir}/%{name}/%{vimdir}/spell
253 /%{_bindir}/xxd
254
255
256 %files minimal
257 %defattr(-,root,root)
258 %config(noreplace) %{_sysconfdir}/virc
259 /bin/ex
260 /bin/vi
261 /bin/view
262 /bin/rvi
263 /bin/rview
264
265 %files enhanced
266 %defattr(-,root,root)
267 %{_bindir}/vim
268 %{_bindir}/rvim
269 %{_bindir}/vimdiff
270 %{_bindir}/ex
271 %config(noreplace) %{_sysconfdir}/profile.d/vim.*
272
273 %files filesystem
274 %defattr(-,root,root)
275 %dir %{_datadir}/%{name}/vimfiles
276 %dir %{_datadir}/%{name}/vimfiles/after
277 %dir %{_datadir}/%{name}/vimfiles/after/*
278 %dir %{_datadir}/%{name}/vimfiles/autoload
279 %dir %{_datadir}/%{name}/vimfiles/colors
280 %dir %{_datadir}/%{name}/vimfiles/compiler
281 %dir %{_datadir}/%{name}/vimfiles/doc
282 %dir %{_datadir}/%{name}/vimfiles/ftdetect
283 %dir %{_datadir}/%{name}/vimfiles/ftplugin
284 %dir %{_datadir}/%{name}/vimfiles/indent
285 #%dir %{_datadir}/%{name}/vimfiles/keymap
286 %dir %{_datadir}/%{name}/vimfiles/lang
287 %dir %{_datadir}/%{name}/vimfiles/plugin
288 %dir %{_datadir}/%{name}/vimfiles/print
289 %dir %{_datadir}/%{name}/vimfiles/spell
290 %dir %{_datadir}/%{name}/vimfiles/syntax
291 %dir %{_datadir}/%{name}/vimfiles/tutor
292